Skip to content

Commit

Permalink
helm: opentelemetry addon allow configuration of registry with settin…
Browse files Browse the repository at this point in the history
…g tag (#9773)

* feat: allow configuration of registry, image, tag and digest in single values for opentelemetry addon

* feat: allow configuration of registry, image, tag and digest in single values for opentelemetry addon

* add ci test file

* fix: updated helm-docs with opentelemetry image value

* fix: ci test case

* fix: ci test case set default registry, image + tag

* fix: ci test case set default registry + image

* fix: remove unrequired comment

* feat!: use extraModules helper method for templating the image value

* image definition for OTel image is now split up in image, repo and registry values

* feat!: move distroless config under the image key

* update helm-docs

* Refactor template to generate the image name

* adapt test cases for extraModules

* implement code review

* try to fix ci test for opentelemetry
  • Loading branch information
patst authored Dec 8, 2023
1 parent 6807537 commit 7e31f81
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 11 deletions.
7 changes: 5 additions & 2 deletions charts/ingress-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,12 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| controller.opentelemetry.containerSecurityContext.runAsNonRoot | bool | `true` | |
| controller.opentelemetry.containerSecurityContext.runAsUser | int | `65532` | The image's default user, inherited from its base image `cgr.dev/chainguard/static`. |
| controller.opentelemetry.containerSecurityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
| controller.opentelemetry.distroless | bool | `true` | |
| controller.opentelemetry.enabled | bool | `false` | |
| controller.opentelemetry.image | string | `"registry.k8s.io/ingress-nginx/opentelemetry:v20230721-3e2062ee5@sha256:13bee3f5223883d3ca62fee7309ad02d22ec00ff0d7033e3e9aca7a9f60fd472"` | |
| controller.opentelemetry.image.digest | string | `"sha256:13bee3f5223883d3ca62fee7309ad02d22ec00ff0d7033e3e9aca7a9f60fd472"` | |
| controller.opentelemetry.image.distroless | bool | `true` | |
| controller.opentelemetry.image.image | string | `"ingress-nginx/opentelemetry"` | |
| controller.opentelemetry.image.registry | string | `"registry.k8s.io"` | |
| controller.opentelemetry.image.tag | string | `"v20230721-3e2062ee5"` | |
| controller.opentelemetry.name | string | `"opentelemetry"` | |
| controller.opentelemetry.resources | object | `{}` | |
| controller.podAnnotations | object | `{}` | Annotations to be added to controller pods # |
Expand Down
5 changes: 4 additions & 1 deletion charts/ingress-nginx/ci/daemonset-extra-modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ controller:
type: ClusterIP
extraModules:
- name: opentelemetry
image: busybox
image:
registry: registry.k8s.io
image: busybox
tag: latest
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ controller:
allowPrivilegeEscalation: false
extraModules:
- name: opentelemetry
image: busybox
image:
registry: registry.k8s.io
image: busybox
tag: latest
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ controller:
type: ClusterIP
extraModules:
- name: opentelemetry
image: busybox
image:
registry: registry.k8s.io
image: busybox
tag: latest
containerSecurityContext:
allowPrivilegeEscalation: false
5 changes: 4 additions & 1 deletion charts/ingress-nginx/ci/deployment-extra-modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ controller:
type: ClusterIP
extraModules:
- name: opentelemetry
image: busybox
image:
registry: registry.k8s.io
image: busybox
tag: latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
controller:
image:
repository: ingress-controller/controller
tag: 1.0.0-dev
digest: null
service:
type: ClusterIP
opentelemetry:
enabled: true
4 changes: 3 additions & 1 deletion charts/ingress-nginx/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ Extra modules.
*/}}
{{- define "extraModules" -}}
- name: {{ .name }}
image: {{ .image }}
{{- with .image }}
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{ end }}:{{ .tag }}{{ if .digest }}@{{ .digest }}{{ end }}
command:
{{- if .distroless }}
- /init_module
Expand All @@ -266,6 +267,7 @@ Extra modules.
- -c
- /usr/local/bin/init_module.sh
{{- end }}
{{- end }}
{{- if .containerSecurityContext }}
securityContext: {{ toYaml .containerSecurityContext | nindent 4 }}
{{- end }}
Expand Down
22 changes: 18 additions & 4 deletions charts/ingress-nginx/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,15 @@ controller:
# -- Modules, which are mounted into the core nginx image. See values.yaml for a sample to add opentelemetry module
extraModules: []
# - name: mytestmodule
# image: registry.k8s.io/ingress-nginx/mytestmodule
# distroless: false
# image:
# registry: registry.k8s.io
# image: ingress-nginx/mytestmodule
# ## for backwards compatibility consider setting the full image url via the repository value below
# ## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail
# ## repository:
# tag: "v1.0.0"
# digest: ""
# distroless: false
# containerSecurityContext:
# runAsNonRoot: true
# runAsUser: <user-id>
Expand All @@ -703,8 +710,15 @@ controller:
opentelemetry:
enabled: false
name: opentelemetry
image: registry.k8s.io/ingress-nginx/opentelemetry:v20230721-3e2062ee5@sha256:13bee3f5223883d3ca62fee7309ad02d22ec00ff0d7033e3e9aca7a9f60fd472
distroless: true
image:
registry: registry.k8s.io
image: ingress-nginx/opentelemetry
## for backwards compatibility consider setting the full image url via the repository value below
## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail
## repository:
tag: "v20230721-3e2062ee5"
digest: sha256:13bee3f5223883d3ca62fee7309ad02d22ec00ff0d7033e3e9aca7a9f60fd472
distroless: true
containerSecurityContext:
runAsNonRoot: true
# -- The image's default user, inherited from its base image `cgr.dev/chainguard/static`.
Expand Down

0 comments on commit 7e31f81

Please sign in to comment.