Skip to content

Commit

Permalink
Use e2e images instead of latest (open-cluster-management-io#756) (#196)
Browse files Browse the repository at this point in the history
* Use e2e images instead of latest (open-cluster-management-io#756)

Signed-off-by: zhujian <[email protected]>

* override images in helm chart (open-cluster-management-io#771)

Signed-off-by: Zhiwei Yin <[email protected]>

* use images overrides in operator deploy (open-cluster-management-io#795)

Signed-off-by: Zhiwei Yin <[email protected]>

---------

Signed-off-by: zhujian <[email protected]>
Signed-off-by: Zhiwei Yin <[email protected]>
Co-authored-by: Zhiwei Yin <[email protected]>
  • Loading branch information
zhujian7 and zhiweiyin318 authored Jan 9, 2025
1 parent e1a2d39 commit 834370c
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,52 @@



{{/* Define the image tag. */}}
{{- define "imageTag" }}
{{- if .Values.images.tag }}
{{- printf "%s" .Values.images.tag }}
{{- define "registrationImage" }}
{{- if .Values.images.overrides.registrationImage }}
{{- printf "%s" .Values.images.overrides.registrationImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/registration:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s" .Chart.AppVersion }}
{{- printf "%s/registration:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}

{{- define "workImage" }}
{{- if .Values.images.overrides.workImage }}
{{- printf "%s" .Values.images.overrides.workImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/work:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s/work:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}

{{- define "addOnManagerImage" }}
{{- if .Values.images.overrides.addOnManagerImage }}
{{- printf "%s" .Values.images.overrides.addOnManagerImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/addon-manager:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s/addon-manager:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}

{{- define "placementImage" }}
{{- if .Values.images.overrides.placementImage }}
{{- printf "%s" .Values.images.overrides.placementImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/placement:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s/placement:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}

{{- define "operatorImage" }}
{{- if .Values.images.overrides.operatorImage }}
{{- printf "%s" .Values.images.overrides.operatorImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/registration-operator:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s/registration-operator:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: ClusterManager
metadata:
name: cluster-manager
spec:
registrationImagePullSpec: {{ .Values.images.registry }}/registration:{{ template "imageTag" . }}
workImagePullSpec: {{ .Values.images.registry }}/work:{{ template "imageTag" . }}
placementImagePullSpec: {{ .Values.images.registry }}/placement:{{ template "imageTag" . }}
addOnManagerImagePullSpec: {{ .Values.images.registry }}/addon-manager:{{ template "imageTag" . }}
registrationImagePullSpec: "{{ template "registrationImage" . }}"
workImagePullSpec: "{{ template "workImage" . }}"
placementImagePullSpec: "{{ template "placementImage" . }}"
addOnManagerImagePullSpec: "{{ template "addOnManagerImage" . }}"
deployOption:
mode: {{ .Values.clusterManager.mode }}
{{- with .Values.clusterManager.resourceRequirement }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
serviceAccountName: cluster-manager
containers:
- name: registration-operator
image: "{{ .Values.images.registry }}/registration-operator:{{ template "imageTag" . }}"
image: "{{ template "operatorImage" . }}"
imagePullPolicy: {{ .Values.images.imagePullPolicy }}
args:
- "/registration-operator"
Expand Down
10 changes: 10 additions & 0 deletions deploy/cluster-manager/chart/cluster-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ replicaCount: 3

# image configurations for all images used in operator deployment and clusterManager CR.
images:
# the overrides can replace the corresponding image if not empty.
overrides:
registrationImage: ""
workImage: ""
placementImage: ""
addOnManagerImage: ""
operatorImage: ""
# registry and tag work on all images, but the image will be replaced by overrides if the image in overrides is not empty.
# The registry name must NOT contain a trailing slash.
registry: quay.io/open-cluster-management
# The image tag is the appVersion by default, can be replaced by this version.
tag: ""
imagePullPolicy: IfNotPresent
# The image pull secret name is open-cluster-management-image-pull-credentials.
# Please set the userName/password or the dockerConfigJson if you use a private image registry.
# The registry will be set in the generated credential if you set userName/password.
# Suggest to use dockerConfigJson if you set overrides here.
# The image pull secret is fixed into the serviceAccount, you can also set
# `createImageCredentials` to `false` and create the pull secret manually.
imageCredentials:
Expand Down
31 changes: 26 additions & 5 deletions deploy/klusterlet/chart/klusterlet/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,32 @@ Create secret to access docker registry
{{- end }}
{{- end }}

{{/* Define the image tag. */}}
{{- define "imageTag" }}
{{- if .Values.images.tag }}
{{- printf "%s" .Values.images.tag }}
{{- define "registrationImage" }}
{{- if .Values.images.overrides.registrationImage }}
{{- printf "%s" .Values.images.overrides.registrationImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/registration:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s" .Chart.AppVersion }}
{{- printf "%s/registration:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}

{{- define "workImage" }}
{{- if .Values.images.overrides.workImage }}
{{- printf "%s" .Values.images.overrides.workImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/work:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s/work:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}

{{- define "operatorImage" }}
{{- if .Values.images.overrides.operatorImage }}
{{- printf "%s" .Values.images.overrides.operatorImage }}
{{- else if .Values.images.tag }}
{{- printf "%s/registration-operator:%s" .Values.images.registry .Values.images.tag }}
{{- else }}
{{- printf "%s/registration-operator:%s" .Values.images.registry .Chart.AppVersion }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions deploy/klusterlet/chart/klusterlet/templates/klusterlet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ metadata:
spec:
deployOption:
mode: {{ .Values.klusterlet.mode | default "Singleton" }}
registrationImagePullSpec: "{{ .Values.images.registry }}/registration:{{ template "imageTag" . }}"
workImagePullSpec: "{{ .Values.images.registry }}/work:{{ template "imageTag" . }}"
imagePullSpec: "{{ .Values.images.registry }}/registration-operator:{{ template "imageTag" . }}"
registrationImagePullSpec: "{{ template "registrationImage" . }}"
workImagePullSpec: "{{ template "workImage" . }}"
imagePullSpec: "{{ template "operatorImage" . }}"
clusterName: {{ .Values.klusterlet.clusterName }}
{{- if or ( eq .Values.klusterlet.mode "Hosted") (eq .Values.klusterlet.mode "SingletonHosted") }}
namespace: "open-cluster-management-{{ .Values.klusterlet.clusterName }}"
Expand Down
2 changes: 1 addition & 1 deletion deploy/klusterlet/chart/klusterlet/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: klusterlet
image: "{{ .Values.images.registry }}/registration-operator:{{ template "imageTag" . }}"
image: "{{ template "operatorImage" . }}"
imagePullPolicy: {{ .Values.images.imagePullPolicy }}
args:
- "/registration-operator"
Expand Down
8 changes: 8 additions & 0 deletions deploy/klusterlet/chart/klusterlet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ replicaCount: 3

# image configurations for all images used in operator deployment and klusterlet CR.
images:
# the overrides can replace the corresponding image if not empty.
overrides:
registrationImage: ""
workImage: ""
operatorImage: ""
# registry and tag work on all images, but the image will be replaced by overrides if the image in overrides is not empty.
# The registry name must NOT contain a trailing slash.
registry: quay.io/open-cluster-management
# The image tag is the appVersion by default, can be replaced by this version.
tag: ""
imagePullPolicy: IfNotPresent
# The image pull secret name is open-cluster-management-image-pull-credentials.
# Please set the userName/password or the dockerConfigJson if you use a private image registry.
# The registry will be set in the generated credential if you set userName/password.
# Suggest to use dockerConfigJson if you set overrides here.
# The image pull secret is fixed into the serviceAccount, you can also set
# `createImageCredentials` to `false` and create the pull secret manually.
imageCredentials:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e-test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ hub-kubeconfig:
deploy-hub: deploy-hub-helm hub-kubeconfig cluster-ip

deploy-hub-helm: ensure-helm
$(HELM) install cluster-manager deploy/cluster-manager/chart/cluster-manager --namespace=open-cluster-management --create-namespace --set images.registry=$(IMAGE_REGISTRY),image.tag=$(IMAGE_TAG)
$(HELM) install cluster-manager deploy/cluster-manager/chart/cluster-manager --namespace=open-cluster-management --create-namespace --set images.overrides.operatorImage=$(OPERATOR_IMAGE_NAME),images.overrides.registrationImage=$(REGISTRATION_IMAGE),images.overrides.workImage=$(WORK_IMAGE),images.overrides.placementImage=$(PLACEMENT_IMAGE),images.overrides.addOnManagerImage=$(ADDON_MANAGER_IMAGE)

deploy-hub-operator: ensure-kustomize
cp deploy/cluster-manager/config/kustomization.yaml deploy/cluster-manager/config/kustomization.yaml.tmp
Expand Down Expand Up @@ -56,7 +56,7 @@ bootstrap-secret:
$(KUSTOMIZE) build deploy/klusterlet/config/samples/bootstrap | $(KUBECTL) apply -f -

deploy-spoke-operator-helm: ensure-helm
$(HELM) install klusterlet deploy/klusterlet/chart/klusterlet --namespace=open-cluster-management --set klusterlet.create=false,images.registry=$(IMAGE_REGISTRY),image.tag=$(IMAGE_TAG) --set-file bootstrapHubKubeConfig=$(HUB_KUBECONFIG)
$(HELM) install klusterlet deploy/klusterlet/chart/klusterlet --namespace=open-cluster-management --set-file bootstrapHubKubeConfig=$(HUB_KUBECONFIG) --set klusterlet.create=false,images.overrides.operatorImage=$(OPERATOR_IMAGE_NAME),images.overrides.registrationImage=$(REGISTRATION_IMAGE),images.overrides.workImage=$(WORK_IMAGE)

deploy-spoke-operator: ensure-kustomize
cp deploy/klusterlet/config/kustomization.yaml deploy/klusterlet/config/kustomization.yaml.tmp
Expand Down

0 comments on commit 834370c

Please sign in to comment.