Files
deprecated-helm-charts/stable/anchore-engine/templates/api_deployment.yaml
T
Gabor Kozma 2733615628 [stable/anchore-engine] Small improvement about secret end env (#12996)
* extraEnv vars change

Signed-off-by: Gabor Kozma <gabo@kozmagabor.com>

* bump version

Signed-off-by: Gabor Kozma <gabo@kozmagabor.com>

* add existing secret support

Signed-off-by: Gabor Kozma <gabo@kozmagabor.com>

* extraEnv map to array in values.yaml

Signed-off-by: Gabor Kozma <gabo@kozmagabor.com>
2019-04-22 10:39:46 -07:00

271 lines
9.3 KiB
YAML

{{- $component := "api" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "anchore-engine.api.fullname" . }}
labels:
app: {{ template "anchore-engine.fullname" . }}
component: {{ $component }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "anchore-engine.fullname" . }}
component: {{ $component }}
replicas: {{ .Values.anchoreApi.replicaCount }}
template:
metadata:
labels:
app: {{ template "anchore-engine.fullname" . }}
component: {{ $component }}
{{- if .Values.anchoreApi.annotations }}
annotations:
{{ toYaml .Values.anchoreApi.annotations | indent 8 }}
{{- end }}
spec:
volumes:
- name: config-volume
configMap:
name: {{ template "anchore-engine.fullname" . }}
{{- if and .Values.anchoreEnterpriseGlobal.enabled .Values.anchoreEnterpriseRbac.enabled }}
- name: anchore-license
secret:
secretName: {{ .Values.anchoreEnterpriseGlobal.licenseSecretName }}
- name: rbac-config-volume
configMap:
name: {{ template "anchore-engine.enterprise.fullname" . }}
{{- end}}
{{- if .Values.anchoreGlobal.internalServicesSslEnabled }}
- name: certs
secret:
secretName: {{ .Values.anchoreGlobal.internalServicesSsl.certSecret }}
{{- end }}
containers:
{{- if .Values.cloudsql.enabled }}
- name: cloudsql-proxy
image: {{ .Values.cloudsql.image.repository }}:{{ .Values.cloudsql.image.tag }}
imagePullPolicy: {{ .Values.cloudsql.image.pullPolicy }}
command: ["/cloud_sql_proxy"]
args: ["-instances={{ .Values.cloudsql.instance }}=tcp:5432"]
{{- end }}
- name: "{{ .Chart.Name }}-{{ $component }}"
image: {{ .Values.anchoreGlobal.image }}
imagePullPolicy: {{ .Values.anchoreGlobal.imagePullPolicy }}
command: ["/usr/local/bin/anchore-manager"]
args: ["service", "start", "apiext"]
envFrom:
- secretRef:
name: {{ default (include "anchore-engine.fullname" .) .Values.anchoreGlobal.existingSecret }}
- configMapRef:
name: {{ template "anchore-engine.fullname" . }}
env:
{{- with .Values.anchoreGlobal.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.anchoreApi.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: ANCHORE_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- containerPort: {{ .Values.anchoreApi.service.port }}
name: external-api
volumeMounts:
- name: config-volume
mountPath: /config/config.yaml
subPath: config.yaml
{{- if .Values.anchoreGlobal.internalServicesSslEnabled }}
- name: certs
mountPath: {{ default "/certs" .Values.anchoreGlobal.internalServicesSsl.certDir }}
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /health
port: external-api
initialDelaySeconds: 120
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 6
successThreshold: 1
readinessProbe:
httpGet:
path: /health
port: external-api
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 3
successThreshold: 1
resources:
{{ toYaml .Values.anchoreApi.resources | indent 10 }}
{{- if and .Values.anchoreEnterpriseGlobal.enabled .Values.anchoreEnterpriseRbac.enabled }}
- name: {{ .Chart.Name }}-rbac-manager
image: {{ .Values.anchoreEnterpriseGlobal.image }}
imagePullPolicy: {{ .Values.anchoreEnterpriseGlobal.imagePullPolicy }}
command: ["/usr/local/bin/anchore-enterprise-manager"]
args: ["service", "start", "rbac_manager"]
envFrom:
- secretRef:
name: {{ default (include "anchore-engine.fullname" .) .Values.anchoreGlobal.existingSecret }}
- configMapRef:
name: {{ template "anchore-engine.fullname" . }}
env:
{{- with .Values.anchoreGlobal.extraEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.anchoreEnterpriseRbac.extraEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
- name: ANCHORE_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- containerPort: {{ .Values.anchoreEnterpriseRbac.service.apiPort }}
name: rbac-manager
volumeMounts:
- name: anchore-license
mountPath: /license.yaml
subPath: license.yaml
- name: rbac-config-volume
mountPath: /config/config.yaml
subPath: config.yaml
{{- if .Values.anchoreGlobal.internalServicesSslEnabled }}
- name: certs
mountPath: {{ default "/certs" .Values.anchoreGlobal.internalServicesSsl.certDir }}
readOnly: true
{{- end }}
livenessProbe:
httpGet:
path: /health
port: rbac-manager
initialDelaySeconds: 120
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 6
successThreshold: 1
readinessProbe:
httpGet:
path: /health
port: rbac-manager
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 3
successThreshold: 1
resources:
{{ toYaml .Values.anchoreEnterpriseRbac.managerResources | indent 10 }}
- name: {{ .Chart.Name }}-rbac-authorizer
image: {{ .Values.anchoreEnterpriseGlobal.image }}
imagePullPolicy: {{ .Values.anchoreEnterpriseGlobal.imagePullPolicy }}
command: ["/usr/local/bin/anchore-enterprise-manager"]
args: ["service", "start", "rbac_authorizer"]
envFrom:
- secretRef:
name: {{ default (include "anchore-engine.fullname" .) .Values.anchoreGlobal.existingSecret }}
- configMapRef:
name: {{ template "anchore-engine.fullname" . }}
env:
{{- with .Values.anchoreGlobal.extraEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.anchoreEnterpriseRbac.extraEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
- name: ANCHORE_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- containerPort: {{ .Values.anchoreEnterpriseRbac.service.authPort }}
name: rbac-auth
volumeMounts:
- name: anchore-license
mountPath: /license.yaml
subPath: license.yaml
- name: rbac-config-volume
mountPath: /config/config.yaml
subPath: config.yaml
{{- if .Values.anchoreGlobal.internalServicesSslEnabled }}
- name: certs
mountPath: {{ default "/certs" .Values.anchoreGlobal.internalServicesSsl.certDir }}
readOnly: true
{{- end }}
livenessProbe:
exec:
command:
- curl
- -f
- 'localhost:{{ .Values.anchoreEnterpriseRbac.service.authPort }}/health'
initialDelaySeconds: 120
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 6
successThreshold: 1
readinessProbe:
exec:
command:
- curl
- -f
- 'localhost:{{ .Values.anchoreEnterpriseRbac.service.authPort }}/health'
timeoutSeconds: 10
periodSeconds: 10
failureThreshold: 3
successThreshold: 1
resources:
{{ toYaml .Values.anchoreEnterpriseRbac.authResources | indent 10 }}
imagePullSecrets:
- name: {{ .Values.anchoreEnterpriseGlobal.imagePullSecretName }}
{{- end }}
{{- if .Values.anchoreApi.nodeSelector }}
nodeSelector:
{{ toYaml .Values.anchoreApi.nodeSelector | indent 8 }}
{{- end }}
{{- with .Values.anchoreApi.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.anchoreApi.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "anchore-engine.api.fullname" . }}
labels:
app: {{ template "anchore-engine.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
component: {{ $component }}
{{- if .Values.anchoreApi.service.annotations }}
annotations:
{{ toYaml .Values.anchoreApi.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.anchoreApi.service.type }}
ports:
- name: anchore-external-api
port: {{ .Values.anchoreApi.service.port }}
targetPort: {{ .Values.anchoreApi.service.port }}
protocol: TCP
{{- if and .Values.anchoreEnterpriseGlobal.enabled .Values.anchoreEnterpriseRbac.enabled }}
- name: anchore-rbac-manager
port: {{ .Values.anchoreEnterpriseRbac.service.apiPort }}
targetPort: {{ .Values.anchoreEnterpriseRbac.service.apiPort }}
protocol: TCP
{{- end }}
selector:
app: {{ template "anchore-engine.fullname" . }}
component: {{ $component }}