Skip to content

Commit

Permalink
feat: include image digest to prevent supply chain issues
Browse files Browse the repository at this point in the history
  • Loading branch information
toscott committed Jul 1, 2024
1 parent 6d6c2a7 commit 8a16705
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion charts/opencost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords:
- finops
- monitoring
- opencost
version: 1.40.0
version: 1.41.0
maintainers:
- name: mattray
url: https://mattray.dev
Expand Down
24 changes: 24 additions & 0 deletions charts/opencost/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,27 @@ apiVersion: networking.k8s.io/v1
apiVersion: networking.k8s.io/v1beta1
{{- end }}
{{- end -}}

{{- define "opencost.imageTag" -}}
{{ .Values.opencost.exporter.image.tag | default (printf "%s" .Chart.AppVersion) }}
{{- end -}}

{{- define "opencost.fullImageName" -}}
{{- if .Values.opencost.exporter.image.fullImageName }}
{{- .Values.opencost.exporter.image.fullImageName -}}
{{- else}}
{{- .Values.opencost.exporter.image.registry -}}/{{- .Values.opencost.exporter.image.repository -}}:{{- include "opencost.imageTag" . -}}
{{- end -}}
{{- end -}}

{{- define "opencostUi.imageTag" -}}
{{- .Values.opencost.ui.image.tag | default (printf "%s" .Chart.AppVersion) -}}
{{- end -}}

{{- define "opencostUi.fullImageName" -}}
{{- if .Values.opencost.ui.image.fullImageName }}
{{- .Values.opencost.ui.image.fullImageName -}}
{{- else}}
{{- .Values.opencost.ui.image.registry -}}/{{- .Values.opencost.ui.image.repository -}}:{{- include "opencostUi.imageTag" . -}}
{{- end -}}
{{- end -}}
12 changes: 2 additions & 10 deletions charts/opencost/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ spec:
{{- end }}
containers:
- name: {{ include "opencost.fullname" . }}
{{- if .Values.opencost.exporter.image.fullImageName }}
image: {{ .Values.opencost.exporter.image.fullImageName }}
{{- else }}
image: "{{ .Values.opencost.exporter.image.registry }}/{{ .Values.opencost.exporter.image.repository }}:{{ .Values.opencost.exporter.image.tag | default (printf "%s" .Chart.AppVersion) }}"
{{- end}}
image: {{ include "opencost.fullImageName" . }}
imagePullPolicy: {{ .Values.opencost.exporter.image.pullPolicy }}
args:
{{- range .Values.opencost.exporter.extraArgs }}
Expand Down Expand Up @@ -268,11 +264,7 @@ spec:
{{- end }}
{{- if .Values.opencost.ui.enabled }}
- name: opencost-ui
{{- if .Values.opencost.ui.image.fullImageName }}
image: {{ .Values.opencost.ui.image.fullImageName }}
{{- else}}
image: "{{ .Values.opencost.ui.image.registry }}/{{ .Values.opencost.ui.image.repository }}:{{ .Values.opencost.ui.image.tag | default (printf "%s" .Chart.AppVersion) }}"
{{- end }}
image: {{ include "opencostUi.fullImageName" .}}
imagePullPolicy: {{ .Values.opencost.ui.image.pullPolicy }}
ports:
- containerPort: {{ .Values.opencost.ui.uiPort }}
Expand Down
5 changes: 2 additions & 3 deletions charts/opencost/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ opencost:
# -- Exporter container image name
repository: opencost/opencost
# -- Exporter container image tag
# @default -- `""` (use appVersion in Chart.yaml)
tag: ""
tag: "1.111.0@sha256:6aa68e52a24b14ba41f23db08d1b9db1429a1c0300f4c0381ecc2c61fc311a97"
# -- Exporter container image pull policy
pullPolicy: IfNotPresent
# -- Override the full image name for development purposes
Expand Down Expand Up @@ -374,7 +373,7 @@ opencost:
repository: opencost/opencost-ui
# -- UI container image tag
# @default -- `""` (use appVersion in Chart.yaml)
tag: ""
tag: "1.111.0@sha256:f7221e7a708d71663f5eca6c238268757eb4352f3e9f46b1029d33ab4e53fd8a"
# -- UI container image pull policy
pullPolicy: IfNotPresent
# -- Override the full image name for development purposes
Expand Down

0 comments on commit 8a16705

Please sign in to comment.