Skip to content

Commit

Permalink
feat: operator 0.89 no longer pull images across regions
Browse files Browse the repository at this point in the history
  • Loading branch information
daixuwang committed Oct 10, 2024
1 parent 638a150 commit 88fc686
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
4 changes: 2 additions & 2 deletions incubator/opentelemetry-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: tencent-opentelemetry-operator
version: 0.88.0
version: 0.89.0
description: OpenTelemetry Operator Helm chart for Kubernetes
type: application
home: https://opentelemetry.io/
Expand All @@ -9,5 +9,5 @@ sources:
maintainers:
- name: erichchen
icon: https://cloudcache.tencent-cloud.com/qcloud/ui/static/Industry_tke/80444e53-c142-4896-bc8a-ef4ecf75c682.png
appVersion: 0.88.0
appVersion: 0.89.0
kubeVersion: '>= 1.19.0-0'
52 changes: 52 additions & 0 deletions incubator/opentelemetry-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,55 @@ Create an ordered name of the MutatingWebhookConfiguration
{{- $ss := $endpoint | split ":" -}}
{{- printf "%s:%s" (index $ss "_0") (index $ss "_1") -}}
{{end}}


{{- define "regionRepositoryMap" -}}
{{- $region := . -}}
{{- $map := dict
"ap-guangzhou" "ccr.ccs.tencentyun.com"
"ap-shanghai-fsi" "shjrccr.ccs.tencentyun.com"
"ap-beijing-fsi" "bjjrccr.ccs.tencentyun.com"
"ap-hongkong" "hkccr.ccs.tencentyun.com"
"ap-singapore" "sgccr.ccs.tencentyun.com"
"na-siliconvalley" "uswccr.ccs.tencentyun.com"
"eu-frankfurt" "deccr.ccs.tencentyun.com"
"na-ashburn" "useccr.ccs.tencentyun.com"
"sa-saopaulo" "saoccr.ccs.tencentyun.com"
"ap-bangkok" "thccr.ccs.tencentyun.com"
"ap-jakarta" "jktccr.ccs.tencentyun.com"
"na-toronto" "caccr.ccs.tencentyun.com"
"ap-seoul" "krccr.ccs.tencentyun.com"
"ap-tokyo" "jpccr.ccs.tencentyun.com"
"ap-mumbai" "inccr.ccs.tencentyun.com"
"ap-shenzhen-fsi" "szjrccr.ccs.tencentyun.com"
"ap-taipei" "tpeccr.ccs.tencentyun.com" -}}
{{- $result := index $map $region | default "ccr.ccs.tencentyun.com" -}}
{{- $result -}}
{{- end -}}


{{/*
Modify image repository by region.
*/}}
{{- define "opentelemetry-operator.managerImageRepository" -}}
{{- $parts := regexSplit "/" .Values.manager.image.repository -1 -}}
{{- printf "%s/%s" (include "regionRepositoryMap" .Values.env.TKE_REGION) (join "/" (slice $parts 1 (len $parts))) -}}
{{- end -}}


{{/*
Modify collector image repository by region.
*/}}
{{- define "opentelemetry-operator.managerCollectorImageRepository" -}}
{{- $parts := regexSplit "/" .Values.manager.collectorImage.repository -1 -}}
{{- printf "%s/%s" (include "regionRepositoryMap" .Values.env.TKE_REGION) (join "/" (slice $parts 1 (len $parts))) -}}
{{- end -}}


{{/*
Modify kubeRBACProxy image repository by region.
*/}}
{{- define "opentelemetry-operator.proxyImageRepository" -}}
{{- $parts := regexSplit "/" .Values.kubeRBACProxy.image.repository -1 -}}
{{- printf "%s/%s" (include "regionRepositoryMap" .Values.env.TKE_REGION) (join "/" (slice $parts 1 (len $parts))) -}}
{{- end -}}
10 changes: 6 additions & 4 deletions incubator/opentelemetry-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ spec:
{{- if or .Values.admissionWebhooks.create .Values.admissionWebhooks.secretName }}
- --webhook-port={{ .Values.manager.ports.webhookPort }}
{{- end }}
{{- if and .Values.manager.collectorImage.repository .Values.manager.collectorImage.tag }}
- --collector-image={{ .Values.manager.collectorImage.repository }}:{{ .Values.manager.collectorImage.tag }}
{{- if and (include "opentelemetry-operator.managerCollectorImageRepository" .) .Values.manager.collectorImage.tag }}
- --collector-image={{ include "opentelemetry-operator.managerCollectorImageRepository" . }}:{{ .Values.manager.collectorImage.tag }}
{{- end }}
{{- if and .Values.manager.targetAllocatorImage.repository .Values.manager.targetAllocatorImage.tag }}
- --target-allocator-image={{ .Values.manager.targetAllocatorImage.repository }}:{{ .Values.manager.targetAllocatorImage.tag }}
Expand Down Expand Up @@ -108,8 +108,10 @@ spec:
value: {{ .Values.manager.image.tag | quote }}
- name: HELM_CHART_VERSION
value: {{ .Chart.Version | quote }}
- name: IMAGE_REPOSITORY
value: {{ include "regionRepositoryMap" .Values.env.TKE_REGION | default (include "regionRepositoryMap" "ap-guangzhou") | quote }}
{{- end }}
image: "{{ .Values.manager.image.repository }}:{{ .Values.manager.image.tag }}"
image: "{{ include "opentelemetry-operator.managerImageRepository" . }}:{{ .Values.manager.image.tag }}"
name: manager
ports:
- containerPort: {{ .Values.manager.ports.metricsPort }}
Expand Down Expand Up @@ -151,7 +153,7 @@ spec:
{{- if .Values.kubeRBACProxy.extraArgs }}
{{- .Values.kubeRBACProxy.extraArgs | toYaml | nindent 12 }}
{{- end }}
image: "{{ .Values.kubeRBACProxy.image.repository }}:{{ .Values.kubeRBACProxy.image.tag }}"
image: "{{ include "opentelemetry-operator.proxyImageRepository" . }}:{{ .Values.kubeRBACProxy.image.tag }}"
name: kube-rbac-proxy
ports:
- containerPort: {{ .Values.kubeRBACProxy.ports.proxyPort }}
Expand Down
2 changes: 1 addition & 1 deletion incubator/opentelemetry-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pdb:
manager:
image:
repository: ccr.ccs.tencentyun.com/tke-market/opentelemetry-operator
tag: 20240819-1936_apm_0.88.0_auto_e847236e
tag: 20240904-2027_apm_0.89.0_auto_fc53219c
collectorImage:
repository: ccr.ccs.tencentyun.com/tke-market/opentelemetry-collector-contrib
tag: 0.85.0
Expand Down

0 comments on commit 88fc686

Please sign in to comment.