opendatahub-io / model-registry-operator

Apache License 2.0
3 stars 17 forks source link

Fix override operator image #25

Closed lampajr closed 9 months ago

lampajr commented 10 months ago

Fixes https://github.com/opendatahub-io/model-registry-operator/issues/24

Description

Makes the operator image correcly overridable using make deploy IMG=<...> script.

The issue is here: $(KUSTOMIZE) edit set image controller=${IMG} where controller is not the actual image in manager.yaml, and as per my understanding the kustomize edit should have the following structure:

$(KUSTOMIZE) edit set image ${CURRENT_IMG}=${NEW_IMG}:${NEW_TAG}

Therefore replacing controller with the actual image quay.io/opendatahub/model-registry-operator should do the trick.

How Has This Been Tested?

  1. Run make deploy IMG=quay.io/opendatahub/model-registry-operator:main-4c04ff7
  2. Describe the operator pod: k describe pod/model-registry-operator-controller-manager-<...> -n model-registry-operator-system
  3. Normal Pulling 56s kubelet Pulling image "quay.io/opendatahub/model-registry-operator:main-4c04ff7"

Alternatively:

  1. Run cd config/manager && kustomize edit set image quay.io/opendatahub/model-registry-operator=quay.io/opendatahub/model-registry-operator:main-4c04ff7
  2. config/manager/kustomization.yaml should contain the following changes:
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    images:
    - name: quay.io/opendatahub/model-registry-operator
    newName: quay.io/opendatahub/model-registry-operator
    newTag: main-4c04ff7
  3. Issue kustomize build . or kustomize build config/manager depending if you are in the target directory or in the root.
  4. Check the generated output contains :main-4c04ff7 version of the operator image:
    ...
          value: "false"
        image: quay.io/opendatahub/model-registry-operator:main-4c04ff7
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
    ...

Merge criteria:

lampajr commented 9 months ago

I think line image: controller as part of https://github.com/opendatahub-io/model-registry-operator/pull/38 will do the same, it changes the manager.yaml container image to a placeholder controller that can be replaced during the deploy.

So I think we can close this PR :)