Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to add Image Pull Secrets for Docker Image #1864

Open
Hareshraman opened this issue Apr 22, 2024 · 0 comments
Open

Support to add Image Pull Secrets for Docker Image #1864

Hareshraman opened this issue Apr 22, 2024 · 0 comments

Comments

@Hareshraman
Copy link

Hareshraman commented Apr 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant