diff --git a/charts/fluentd/Chart.yaml b/charts/fluentd/Chart.yaml index e3a6fa6a..f19fa1a5 100644 --- a/charts/fluentd/Chart.yaml +++ b/charts/fluentd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: fluentd description: A Helm chart for Kubernetes # type: application -version: 0.4.3 +version: 0.4.4 appVersion: v1.15.2 icon: https://www.fluentd.org/images/miscellany/fluentd-logo_2x.png home: https://www.fluentd.org/ diff --git a/charts/fluentd/templates/_helpers.tpl b/charts/fluentd/templates/_helpers.tpl index 72e878df..3b321b5f 100644 --- a/charts/fluentd/templates/_helpers.tpl +++ b/charts/fluentd/templates/_helpers.tpl @@ -90,3 +90,12 @@ Name of the configMap used for additional configuration files; allows users to o {{ printf "%s-%s" "fluentd-config" ( include "fluentd.shortReleaseName" . ) }} {{- end -}} {{- end -}} + +{{/* +Fluentd image with tag/digest +*/}} +{{- define "fluentd.image" -}} +{{- $tag := ternary "" (printf ":%s" (toString .tag)) (or (empty .tag) (eq "-" (toString .tag))) -}} +{{- $digest := ternary "" (printf "@%s" .digest) (empty .digest) -}} +{{- printf "%s%s%s" .repository $tag $digest -}} +{{- end -}} \ No newline at end of file diff --git a/charts/fluentd/templates/_pod.tpl b/charts/fluentd/templates/_pod.tpl index f77fb2f8..dd732a43 100644 --- a/charts/fluentd/templates/_pod.tpl +++ b/charts/fluentd/templates/_pod.tpl @@ -21,7 +21,7 @@ containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 6 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default $defaultTag }}" + image: {{ include "fluentd.image" (merge .Values.image (dict "tag" (default $defaultTag .Values.image.tag))) }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.plugins }} command: diff --git a/charts/fluentd/templates/tests/test-connection.yaml b/charts/fluentd/templates/tests/test-connection.yaml index 7c0f8150..768899d4 100644 --- a/charts/fluentd/templates/tests/test-connection.yaml +++ b/charts/fluentd/templates/tests/test-connection.yaml @@ -1,3 +1,4 @@ +{{- if .Values.testFramework.enabled }} apiVersion: v1 kind: Pod metadata: @@ -9,7 +10,13 @@ metadata: spec: containers: - name: wget - image: busybox + image: {{ include "fluentd.image" .Values.testFramework.image }} + imagePullPolicy: {{ .Values.testFramework.image.pullPolicy }} command: ['wget'] - args: ['{{ include "fluentd.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "fluentd.fullname" . }}:24231/metrics'] + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 4 }} + {{- end }} restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/charts/fluentd/values.yaml b/charts/fluentd/values.yaml index b9ac8d98..f34ac5ec 100644 --- a/charts/fluentd/values.yaml +++ b/charts/fluentd/values.yaml @@ -10,7 +10,16 @@ kind: "DaemonSet" image: repository: "fluent/fluentd-kubernetes-daemonset" pullPolicy: "IfNotPresent" - tag: "" + tag: "" # Set to "-" to not use the default value + digest: "" + +testFramework: + enabled: true + image: + repository: busybox + pullPolicy: Always + tag: latest + digest: "" ## Optional array of imagePullSecrets containing private registry credentials ## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/