fix(chartutil): Create with seperated registry and repository

Signed-off-by: WrenIX <133280015+wrenix@users.noreply.github.com>
pull/12523/head
WrenIX 9 months ago committed by WrenIX
parent ff94455e2b
commit 3f83378f01
No known key found for this signature in database
GPG Key ID: 7AFDB012974B1BB5

@ -108,13 +108,30 @@ const defaultValues = `# Default values for %s.
replicaCount: 1 replicaCount: 1
global:
image: image:
repository: nginx # if set it will overwrite all registry entries
registry: ""
# if set it will overwrite all pullPolicy
pullPolicy:
image:
registry: docker.io
repository: library/nginx
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "" tag: ""
imagePullSecrets: [] imagePullSecrets: []
testConnection:
enabled: true
image:
registry: docker.io
repository: library/busybox
# default without any tag
tag: ""
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
@ -326,8 +343,10 @@ spec:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" {{- with .Values.image }}
imagePullPolicy: {{ .Values.image.pullPolicy }} image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ coalesce .Values.global.image.pullPolicy .pullPolicy }}
{{- end }}
ports: ports:
- name: http - name: http
containerPort: {{ .Values.service.port }} containerPort: {{ .Values.service.port }}
@ -518,7 +537,10 @@ Create the name of the service account to use
{{- end }} {{- end }}
` `
const defaultTestConnection = `apiVersion: v1 const defaultTestConnection = `{{- with .Values.testConnection }}
{{- if .enabled }}
---
apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: "{{ include "<CHARTNAME>.fullname" . }}-test-connection" name: "{{ include "<CHARTNAME>.fullname" . }}-test-connection"
@ -529,10 +551,15 @@ metadata:
spec: spec:
containers: containers:
- name: wget - name: wget
image: busybox {{- with .image }}
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}{{ if .tag }}{{ printf ":%s" .tag }}{{ end }}
imagePullPolicy: {{ coalesce $.Values.global.pullPolicy .pullPolicy }}
{{- end }}
command: ['wget'] command: ['wget']
args: ['{{ include "<CHARTNAME>.fullname" . }}:{{ .Values.service.port }}'] args: ['{{ include "<CHARTNAME>.fullname" $ }}:{{ $.Values.service.port }}']
restartPolicy: Never restartPolicy: Never
{{- end }}{{/* end-if enabled */}}
{{- end }}{{/* end-with testConnection*/}}
` `
// Stderr is an io.Writer to which error messages can be written // Stderr is an io.Writer to which error messages can be written

Loading…
Cancel
Save