rancher-partner-charts/charts/ngrok/kubernetes-ingress-controller/0.12.1/templates/controller-deployment.yaml

132 lines
5.2 KiB
YAML

{{- $component := "controller" }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- include "kubernetes-ingress-controller.labels" . | nindent 4 }}
app.kubernetes.io/component: {{ $component }}
name: {{ include "kubernetes-ingress-controller.fullname" . }}-manager
namespace: {{ .Release.Namespace }}
annotations:
checksum/controller-role: {{ include (print $.Template.BasePath "/rbac/role.yaml") . | sha256sum }}
checksum/rbac: {{ include (print $.Template.BasePath "/controller-rbac.yaml") . | sha256sum }}
spec:
replicas: {{.Values.replicaCount}}
selector:
matchLabels:
{{- include "kubernetes-ingress-controller.selectorLabels" . | nindent 6 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 6 }}
{{- end }}
app.kubernetes.io/component: {{ $component }}
template:
metadata:
annotations:
{{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
prometheus.io/path: /metrics
prometheus.io/port: '8080'
prometheus.io/scrape: 'true'
labels:
{{- include "kubernetes-ingress-controller.selectorLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
app.kubernetes.io/component: {{ $component }}
spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" $component "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" $component "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
serviceAccountName: {{ template "kubernetes-ingress-controller.serviceAccountName" . }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml .Values.image.pullSecrets | nindent 8 }}
{{- end }}
containers:
- name: ngrok-ingress-controller
image: {{ include "kubernetes-ingress-controller.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /manager
args:
{{- if .Values.region }}
- --region={{ .Values.region}}
{{- end }}
{{- if .Values.serverAddr }}
- --server-addr={{ .Values.serverAddr}}
{{- end }}
{{- if .Values.metaData }}
- --metadata={{- $metadataArgs := list -}}
{{- range $key, $value := .Values.metaData }}
{{- $metadataArgs = append $metadataArgs (printf "%s=%s" $key $value) -}}
{{- end }}
{{- $metadataArgs | join "," }}
{{- end }}
- --controller-name={{ .Values.controllerName }}
{{- if .Values.watchNamespace }}
- --watch-namespace={{ .Values.watchNamespace}}
{{- end }}
- --zap-log-level={{ .Values.log.level }}
- --zap-stacktrace-level={{ .Values.log.stacktraceLevel }}
- --zap-encoder={{ .Values.log.format }}
- --health-probe-bind-address=:8081
- --metrics-bind-address=:8080
- --election-id={{ include "kubernetes-ingress-controller.fullname" . }}-leader
- --manager-name={{ include "kubernetes-ingress-controller.fullname" . }}-manager
securityContext:
allowPrivilegeEscalation: false
env:
- name: NGROK_API_KEY
valueFrom:
secretKeyRef:
key: API_KEY
name: {{ include "kubernetes-ingress-controller.credentialsSecretName" . }}
- name: NGROK_AUTHTOKEN
valueFrom:
secretKeyRef:
key: AUTHTOKEN
name: {{ include "kubernetes-ingress-controller.credentialsSecretName" . }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- range $key, $value := .Values.extraEnv }}
- name: {{ $key }}
value: {{- toYaml $value | nindent 12 }}
{{- end }}
{{- if .Values.extraVolumeMounts }}
volumeMounts:
{{ toYaml .Values.extraVolumeMounts | nindent 10 }}
{{- end }}
{{- if .Values.lifecycle }}
lifecycle:
{{ toYaml .Values.lifecycle | nindent 10 }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 10 }}
{{- if .Values.extraVolumes }}
volumes:
{{ toYaml .Values.extraVolumes | nindent 6 }}
{{- end }}