mockserver
mockserver copied to clipboard
Support to add Image Pull Secrets for Docker Image
Describe the feature request To consume docker image of mockserver from a private docker hub.
What you are trying to do I would like to bundle the docker image in my private docker repository to ensure i am able to run security scans on them , but in order to consume the image i would like to have an imagePullSecrets Section in mockServer chart.
The solution you'd like
{{- $imagePullSecret:= .Values.mockserver.imagePullSecret.name }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "release.name" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "chart.name" . }}
release: {{ .Release.Name }}
chart: {{ template "chart.name_version" . }}
spec: #1682
imagePullSecrets:
- name: {{ $imagePullSecret}} ############### Add Image Pull Secrets ###############
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "chart.name" . }}
release: {{ .Release.Name }}
template:
metadata:
{{- if .Values.podAnnotations }}
# Allows custom annotations to be specified
annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
name: {{ template "release.name" . }}
labels:
app: {{ template "chart.name" . }}
release: {{ .Release.Name }}
spec:
serviceAccountName: {{ .Values.app.serviceAccountName }}
containers:
- name: {{ template "release.name" . }}
image: {{ if .Values.image.repositoryNameAndTag }}{{ .Values.image.repositoryNameAndTag }}{{- else }}{{ .Values.image.repository }}/mockserver:mockserver-{{- if .Values.image.snapshot }}snapshot{{- else }}{{ .Chart.AppVersion }}{{- end }}{{- end }}
{{- if .Values.image.snapshot }}
imagePullPolicy: Always
{{- else }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- end }}
securityContext:
{{- if .Values.app.runAsUser }}
runAsUser: {{ .Values.app.runAsUser }}
{{- end }}
readOnlyRootFilesystem: {{ .Values.app.readOnlyRootFilesystem }}
allowPrivilegeEscalation: false
ports:
- name: serviceport
containerPort: {{ .Values.app.serverPort }}
protocol: TCP
readinessProbe:
tcpSocket:
port: serviceport
initialDelaySeconds: 2
periodSeconds: 2
successThreshold: 1
failureThreshold: 10
livenessProbe:
tcpSocket:
port: serviceport
initialDelaySeconds: 10
periodSeconds: 5
successThreshold: 1
failureThreshold: 10
env:
- name: MOCKSERVER_LOG_LEVEL
value: {{ .Values.app.logLevel | quote }}
- name: SERVER_PORT
value: {{ .Values.app.serverPort | quote }}
{{- if .Values.app.proxyRemoteHost }}
- name: PROXY_REMOTE_HOST
value: {{ .Values.app.proxyRemoteHost | quote }}
{{- end }}
{{- if .Values.app.proxyRemotePort }}
- name: PROXY_REMOTE_PORT
value: {{ .Values.app.proxyRemotePort | quote }}
{{- end }}
{{- if .Values.app.jvmOptions }}
- name: JVM_OPTIONS
value: {{ .Values.app.jvmOptions | quote }}
{{- end }}
{{- if .Values.app.mountConfigMap }}
- name: MOCKSERVER_PROPERTY_FILE
value: /config/{{ .Values.app.propertiesFileName }}
{{- end }}
volumeMounts:
- name: config-volume
mountPath: /config
{{- if .Values.app.mountedLibsConfigMapName}}
- name: libs-volume
mountPath: /libs
{{- end}}
{{- if .Values.resources }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- end }}
volumes:
- name: config-volume
configMap:
name: {{ .Values.app.mountedConfigMapName }}
optional: true
{{- if .Values.app.mountedLibsConfigMapName}}
- name: libs-volume
configMap:
name: {{ .Values.app.mountedLibsConfigMapName }}
optional: true
{{- end}}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
Describe alternatives you've considered N/A , although this would mean moving away from the base chart