Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Allow custom image names for OSM Helm chart
Browse files Browse the repository at this point in the history
Map image name in values.yaml and resolves #4331

Signed-off-by: Shalier Xia <[email protected]>
  • Loading branch information
shalier committed Mar 16, 2022
1 parent dafba7b commit 0145311
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 14 deletions.
28 changes: 14 additions & 14 deletions charts/osm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,62 +43,62 @@ securityContext:
{{/* osm-controller image */}}
{{- define "osmController.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/osm-controller:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmController .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/osm-controller@%s" .Values.osm.image.registry .Values.osm.image.digest.osmController -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmController .Values.osm.image.digest.osmController -}}
{{- end -}}
{{- end -}}

{{/* osm-injector image */}}
{{- define "osmInjector.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/osm-injector:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmInjector .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/osm-injector@%s" .Values.osm.image.registry .Values.osm.image.digest.osmInjector -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmInjector .Values.osm.image.digest.osmInjector -}}
{{- end -}}
{{- end -}}

{{/* Sidecar init image */}}
{{- define "osmSidecarInit.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/init:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmSidecarInit .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/init@%s" .Values.osm.image.registry .Values.osm.image.digest.osmSidecarInit -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmSidecarInit .Values.osm.image.digest.osmSidecarInit -}}
{{- end -}}
{{- end -}}

{{/* osm-bootstrap image */}}
{{- define "osmBootstrap.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/osm-bootstrap:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmBootstrap .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/osm-bootstrap@%s" .Values.osm.image.registry .Values.osm.image.digest.osmBootstrap -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmBootstrap .Values.osm.image.digest.osmBootstrap -}}
{{- end -}}
{{- end -}}

{{/* osm-crds image */}}
{{- define "osmCRDs.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/osm-crds:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmCRDs .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/osm-crds@%s" .Values.osm.image.registry .Values.osm.image.digest.osmCRDs -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmCRDs .Values.osm.image.digest.osmCRDs -}}
{{- end -}}
{{- end -}}

{{/* osm-preinstall image */}}
{{- define "osmPreinstall.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/osm-preinstall:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmPreinstall .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/osm-preinstall@%s" .Values.osm.image.registry .Values.osm.image.digest.osmPreinstall -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmPreinstall .Values.osm.image.digest.osmPreinstall -}}
{{- end -}}
{{- end -}}

{{/* osm-healthcheck image */}}
{{- define "osmHealthcheck.image" -}}
{{- if .Values.osm.image.tag -}}
{{- printf "%s/osm-healthcheck:%s" .Values.osm.image.registry .Values.osm.image.tag -}}
{{- printf "%s/%s:%s" .Values.osm.image.registry .Values.osm.image.name.osmHealthcheck .Values.osm.image.tag -}}
{{- else -}}
{{- printf "%s/osm-healthcheck@%s" .Values.osm.image.registry .Values.osm.image.digest.osmHealthcheck -}}
{{- printf "%s/%s@%s" .Values.osm.image.registry .Values.osm.image.name.osmHealthcheck .Values.osm.image.digest.osmHealthcheck -}}
{{- end -}}
{{- end -}}
61 changes: 61 additions & 0 deletions charts/osm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,14 @@
"examples": [
{
"registry": "openservicemesh",
"name": "osm-controller",
"pullPolicy": "IfNotPresent",
"tag": "v0.4.2"
}
],
"required": [
"registry",
"name",
"pullPolicy",
"tag",
"digest"
Expand All @@ -264,6 +266,65 @@
"openservicemesh"
]
},
"name": {
"$id": "#/properties/osm/properties/image/properties/name",
"type": "object",
"title": "Default image names",
"description": "Default image names for control plane.",
"required": [
"osmController",
"osmInjector",
"osmSidecarInit",
"osmBootstrap",
"osmCRDs",
"osmPreinstall",
"osmHealthcheck"
],
"properties": {
"osmController": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmController",
"type": "string",
"title": "osm-controller's image names",
"description": "osm-controller container's image names."
},
"osmInjector": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmInjector",
"type": "string",
"title": "osm-injector's image name",
"description": "osm-injector container's image name."
},
"osmSidecarInit": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmSidecarInit",
"type": "string",
"title": "osm-osmSidecarInit's image name",
"description": "osm-osmSidecarInit container's image name."
},
"osmBootstrap": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmBootstrap",
"type": "string",
"title": "osm-boostrap's image name",
"description": "osm-bootstrap container's image name."
},
"osmCRDs": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmCRDs",
"type": "string",
"title": "osm-crds' image name",
"description": "osm-crds container's image name."
},
"osmPreinstall": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmPreinstall",
"type": "string",
"title": "osm-preinstall's image name",
"description": "osm-preinstall container's image name."
},
"osmHealthcheck": {
"$id": "#/properties/osm/properties/image/properties/name/properties/osmHealthcheck",
"type": "string",
"title": "osm-healthcheck's image name",
"description": "osm-healthcheck container's image name."
}
}
},
"pullPolicy": {
"$id": "#/properties/osm/properties/image/properties/pullPolicy",
"type": "string",
Expand Down
16 changes: 16 additions & 0 deletions charts/osm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ osm:
pullPolicy: IfNotPresent
# -- Container image tag for control plane images
tag: "latest-main"
# -- Image name defaults
name:
# -- osm-controller's image name
osmController: osm-controller
# -- osm-injector's image name
osmInjector: osm-injector
# -- Sidecar init container's image name
osmSidecarInit: init
# -- osm-boostrap's image name
osmBootstrap: osm-bootstrap
# -- osm-crds' image name
osmCRDs: osm-crds
# -- osm-preinstall's image name
osmPreinstall: osm-preinstall
# -- osm-healthcheck's image name
osmHealthcheck: osm-healthcheck
# -- Image digest (defaults to latest compatible tag)
digest:
# -- osm-controller's image digest
Expand Down

0 comments on commit 0145311

Please sign in to comment.