Skip to content
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

✨ Support override addon images by the cluster's annotation #197

Merged

Conversation

zhujian7
Copy link
Member

@zhujian7 zhujian7 commented Jul 26, 2023

Make the addon framework support override addon agents' images by the cluster's annotation.
If the managedCluster has annotation open-cluster-management.io/image-registries in format:

{
   "registries":[
      {
         "mirror":"quay.io/ocm/addon-examples",
         "source":"quay.io/open-cluster-management/addon-examples"
      }
   ]
}

For example:

apiVersion: cluster.open-cluster-management.io/v1
kind: ManagedCluster
metadata:
  annotations:
    open-cluster-management.io/image-registries: '{"registries":[{"mirror":"quay.io/ocm/addon-examples","source":"quay.io/open-cluster-management/addon-examples"}]}'

If the addon manager uses the GetAgentImageValues func in the addon manager like:

			addonfactory.GetAgentImageValues(
				addonfactory.NewAddOnDeploymentConfigGetter(addonClient),
				"global.imageOverrides.helloWorldHelm",
				"quay.io/open-cluster-management/addon-examples",
			),

and use the "global.imageOverrides.helloWorldHelm" placeholder in the agent manifests yaml like:

      - name: helloWorld-agent
        image: {{ .Values.global.imageOverrides.helloWorldHelm }}

The image will be overridden to "quay.io/ocm/addon-examples"

Note: if the addon is also configured by the addonDeploymentConfig to override the image, the addonDeploymentConfig will take precedence over this annotation.

@openshift-ci openshift-ci bot requested review from deads2k and elgnay July 26, 2023 04:45
@zhujian7
Copy link
Member Author

/hold

@zhujian7 zhujian7 force-pushed the image-override branch 3 times, most recently from fd66140 to 9ace1a6 Compare July 26, 2023 06:42
Signed-off-by: zhujian <jiazhu@redhat.com>
@zhujian7 zhujian7 force-pushed the image-override branch 3 times, most recently from 4bd992c to 545ce69 Compare July 27, 2023 06:55
Signed-off-by: zhujian <jiazhu@redhat.com>
@zhujian7
Copy link
Member Author

/unhold
/assign @zhiweiyin318
/cc @qiujian16

@zhiweiyin318
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jul 28, 2023
Signed-off-by: zhujian <jiazhu@redhat.com>
@qiujian16
Copy link
Member

/approve
/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qiujian16, zhujian7

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 5c2bd0b into open-cluster-management-io:main Jul 28, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants