Skip to content

The operator no longer installs the CRDs on start-up #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,16 @@ jobs:

- name: E2E Remote Tests
shell: bash
run: make e2e-test
run: |
make undeploy
make uninstall-crds
make e2e-test

- name: Helm Chart Tests
shell: bash
run: |
make undeploy
make uninstall-crds
make e2e-helm-test

- name: Upload Manifests
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/istio-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ jobs:
sudo echo nameserver 8.8.8.8 > /run/systemd/resolve/stub-resolv.conf

- name: Start KinD Cluster
# Start a KinD K8s cluster with single worker node
shell: bash
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
Expand All @@ -119,7 +118,6 @@ jobs:
make all

- name: Load Images to KinD
# Load the images just built to the KinD cluster
shell: bash
run: |
make kind-load
Expand All @@ -130,8 +128,9 @@ jobs:
- name: Istio Tests
shell: bash
run: |
make deploy
make reset-namespace
ISTIO_VERSION=${{ matrix.istioVersion }} make install-istio
make deploy
make e2e-client-test
make e2e-test
make undeploy
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,25 @@ $(BUILD_TARGETS)/java: $(JAVA_FILES)
.PHONY: helm-chart
helm-chart: $(BUILD_PROPS) $(BUILD_HELM)/coherence-operator-$(VERSION).tgz ## Build the Coherence Operator Helm chart

CRD_TEMPLATE := $(BUILD_HELM)/coherence-operator/templates/crd.yaml
$(BUILD_HELM)/coherence-operator-$(VERSION).tgz: $(BUILD_PROPS) $(HELM_FILES) $(BUILD_TARGETS)/generate $(BUILD_TARGETS)/manifests $(TOOLS_BIN)/kustomize
# Copy the Helm chart from the source location to the distribution folder
-mkdir -p $(BUILD_HELM)
-mkdir -p $(BUILD_HELM)/temp
cp -R ./helm-charts/coherence-operator $(BUILD_HELM)
$(KUSTOMIZE) build $(BUILD_DEPLOY)/overlays/helm -o $(BUILD_HELM)/temp
rm $(CRD_TEMPLATE) || true
echo "{{- if (eq .Values.installCrd true) }}" > $(CRD_TEMPLATE)
cat $(BUILD_HELM)/temp/apiextensions.k8s.io_v1_customresourcedefinition_coherence.coherence.oracle.com.yaml >> $(CRD_TEMPLATE)
printf "\n{{- if (eq .Values.allowCoherenceJobs true) }}\n" >> $(CRD_TEMPLATE)
echo "---" >> $(CRD_TEMPLATE)
cat $(BUILD_HELM)/temp/apiextensions.k8s.io_v1_customresourcedefinition_coherencejob.coherence.oracle.com.yaml >> $(CRD_TEMPLATE)
echo "" >> $(CRD_TEMPLATE)
echo "{{- end }}" >> $(CRD_TEMPLATE)
echo "{{- end }}" >> $(CRD_TEMPLATE)
$(call replaceprop,$(BUILD_HELM)/coherence-operator/Chart.yaml $(BUILD_HELM)/coherence-operator/values.yaml $(BUILD_HELM)/coherence-operator/templates/deployment.yaml $(BUILD_HELM)/coherence-operator/templates/rbac.yaml)
helm lint $(BUILD_HELM)/coherence-operator
helm package $(BUILD_HELM)/coherence-operator --destination $(BUILD_HELM)
rm -rf $(BUILD_HELM)/temp

# ---------------------------------------------------------------------------
# Do a search and replace of properties in selected files in the Helm charts.
Expand Down
5 changes: 5 additions & 0 deletions api/v1/coherence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,11 @@ type CoherenceUtilsSpec struct {
// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
// +optional
ImagePullPolicy *corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
// Image is used to set the utils image used in Coherence Pods.
//
// Deprecated: This field is deprecated and no longer used, any value set will be ignored.
// +optional
Image *string `json:"image,omitempty"`
}

// EnsureImage ensures that the image value is set.
Expand Down
157 changes: 0 additions & 157 deletions api/v1/coherenceresource_utils.go

This file was deleted.

9 changes: 9 additions & 0 deletions config/components/helm/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

labels:
- pairs:
control-plane: coherence
app.kubernetes.io/name: coherence-operator
app.kubernetes.io/version: "3.5.0"
app.kubernetes.io/part-of: coherence-operator
2 changes: 1 addition & 1 deletion config/components/no-coherencejob/no-jobs-patch.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- op: add
path: /spec/template/spec/containers/0/args/-
value:
- --install-job-crd=false
- --enable-jobs=false
3 changes: 0 additions & 3 deletions config/components/restricted/single-namespace-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
- op: add
path: /spec/template/spec/containers/0/args/-
value: --enable-webhook=false
- op: add
path: /spec/template/spec/containers/0/args/-
value: --install-crd=false
- op: add
path: /spec/template/spec/containers/0/args/-
value: --node-lookup-enabled=false
1 change: 0 additions & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ spec:
args:
- operator
- --enable-leader-election
- --install-crd=false
envFrom:
- configMapRef:
name: env-vars
Expand Down
8 changes: 8 additions & 0 deletions config/overlays/helm/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../crd-small

components:
- ../../components/helm
3 changes: 0 additions & 3 deletions config/rbac/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ rules:
resources:
- customresourcedefinitions
verbs:
- create
- delete
- get
- update
- apiGroups:
- admissionregistration.k8s.io
resources:
Expand Down
8 changes: 4 additions & 4 deletions controllers/coherence_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
}

// ensure that the state store exists
storage, err := utils.NewStorage(request.NamespacedName, in.GetManager())
storage, err := utils.NewStorage(request.NamespacedName, in.GetManager(), in.GetPatcher())
if err != nil {
err = errors.Wrap(err, "obtaining desired state store")
in.GetEventRecorder().Event(deployment, coreV1.EventTypeWarning, reconciler.EventReasonFailed,
Expand All @@ -235,7 +235,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque

if hash == storeHash && deployment.IsBeforeOrSameVersion("3.4.3") {
deployment.UpdateStatusVersion(operator.GetVersion())
if err = storage.ResetHash(deployment); err != nil {
if err = storage.ResetHash(ctx, deployment); err != nil {
return result, errors.Wrap(err, "error updating storage status hash")
}
hashNew := deployment.GetGenerationString()
Expand All @@ -261,7 +261,7 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
desiredResources.SetHashLabelAndAnnotations(hash)

// update the store to have the desired state as the latest state.
if err = storage.Store(desiredResources, deployment); err != nil {
if err = storage.Store(ctx, desiredResources, deployment); err != nil {
err = errors.Wrap(err, "storing latest state in state store")
return reconcile.Result{}, err
}
Expand Down Expand Up @@ -323,7 +323,7 @@ func (in *CoherenceReconciler) SetupWithManager(mgr ctrl.Manager, cs clients.Cli

in.reconcilers = reconcilers
in.SetCommonReconciler(controllerName, mgr, cs)
in.SetPatchType(types.MergePatchType)
in.GetPatcher().SetPatchType(types.MergePatchType)

template := &coh.Coherence{}

Expand Down
8 changes: 4 additions & 4 deletions controllers/coherencejob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (in *CoherenceJobReconciler) ReconcileDeployment(ctx context.Context, reque
}

// ensure that the state store exists
storage, err := utils.NewStorage(request.NamespacedName, in.GetManager())
storage, err := utils.NewStorage(request.NamespacedName, in.GetManager(), in.GetPatcher())
if err != nil {
err = errors.Wrap(err, "obtaining desired state store")
return in.HandleErrAndRequeue(ctx, err, nil, fmt.Sprintf(reconcileFailedMessage, request.Name, request.Namespace, err), in.Log)
Expand All @@ -162,7 +162,7 @@ func (in *CoherenceJobReconciler) ReconcileDeployment(ctx context.Context, reque

if hash == storeHash && deployment.IsBeforeOrSameVersion("3.4.3") {
deployment.UpdateStatusVersion(operator.GetVersion())
if err = storage.ResetHash(deployment); err != nil {
if err = storage.ResetHash(ctx, deployment); err != nil {
return result, errors.Wrap(err, "error updating storage status hash")
}
hashNew := deployment.GetGenerationString()
Expand Down Expand Up @@ -193,7 +193,7 @@ func (in *CoherenceJobReconciler) ReconcileDeployment(ctx context.Context, reque
desiredResources.SetHashLabelAndAnnotations(hash)

// update the store to have the desired state as the latest state.
if err = storage.Store(desiredResources, deployment); err != nil {
if err = storage.Store(ctx, desiredResources, deployment); err != nil {
err = errors.Wrap(err, "storing latest state in state store")
return reconcile.Result{}, err
}
Expand Down Expand Up @@ -252,7 +252,7 @@ func (in *CoherenceJobReconciler) SetupWithManager(mgr ctrl.Manager, cs clients.

in.reconcilers = reconcilers
in.SetCommonReconciler(jobControllerName, mgr, cs)
in.SetPatchType(types.MergePatchType)
in.GetPatcher().SetPatchType(types.MergePatchType)

template := &coh.CoherenceJob{}

Expand Down
5 changes: 3 additions & 2 deletions controllers/job/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
coh "github.com/oracle/coherence-operator/api/v1"
"github.com/oracle/coherence-operator/controllers/reconciler"
"github.com/oracle/coherence-operator/pkg/clients"
"github.com/oracle/coherence-operator/pkg/patching"
"github.com/oracle/coherence-operator/pkg/probe"
"github.com/oracle/coherence-operator/pkg/utils"
"github.com/pkg/errors"
Expand Down Expand Up @@ -72,7 +73,7 @@ func (in *ReconcileJob) Reconcile(ctx context.Context, request reconcile.Request
// Make sure that the request is unlocked when this method exits
defer in.Unlock(request)

storage, err := utils.NewStorage(request.NamespacedName, in.GetManager())
storage, err := utils.NewStorage(request.NamespacedName, in.GetManager(), in.GetPatcher())
if err != nil {
return reconcile.Result{}, err
}
Expand Down Expand Up @@ -305,7 +306,7 @@ func (in *ReconcileJob) patchJob(ctx context.Context, deployment coh.CoherenceRe
// fix the CreationTimestamp so that it is not in the patch
desired.SetCreationTimestamp(current.GetCreationTimestamp())
// create the patch to see whether there is anything to update
patch, data, err := in.CreateThreeWayPatch(current.GetName(), original, desired, current, reconciler.PatchIgnore)
patch, data, err := in.CreateThreeWayPatch(current.GetName(), original, desired, current, patching.PatchIgnore)
if err != nil {
return reconcile.Result{}, errors.Wrapf(err, "failed to create patch for Job/%s", current.GetName())
}
Expand Down
Loading
Loading