helm/cosmo/charts/router/templates/deployment.yaml (243 lines of code) (raw):

apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "router.fullname" . }} annotations: # Support for k14s.io. This annotation will form a group to coordinate deployments with kapp. kapp.k14s.io/change-group: "cosmo.apps.router.wundergraph.com/deployment" labels: {{- include "router.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} {{- with .Values.deploymentStrategy }} strategy: {{- toYaml . | nindent 4 }} {{- end }} selector: matchLabels: {{- include "router.selectorLabels" . | nindent 6 }} template: metadata: annotations: # Roll deployments when this config changes. Name doesn't matter, just needs to be unique. checksum/config: {{ include (print $.Template.BasePath "/config-map.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "router.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "router.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: {{- if .Values.initContainers }} {{- range $key, $value := .Values.initContainers }} - name: "{{ $key }}" {{- toYaml $value | nindent 10 }} {{- end }} {{- end }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ include "router.image" . }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.service.port }} protocol: TCP {{ if .Values.configuration.prometheus.enabled }} - name: metrics containerPort: {{ .Values.configuration.prometheus.port }} protocol: TCP {{- end }} env: {{- if .Values.extraEnvVars }} {{- toYaml .Values.extraEnvVars | nindent 12 }} {{- end }} {{ if .Values.configuration.executionConfig }} - name: ROUTER_CONFIG_PATH value: /execution-config.json {{- end }} {{ if .Values.configuration.configPath }} - name: CONFIG_PATH value: {{ .Values.configuration.configPath }} {{- end }} - name: LISTEN_ADDR valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: listenAddress {{ if .Values.configuration.devMode }} - name: DEV_MODE valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: devMode {{- end }} {{ if .Values.configuration.logLevel }} - name: LOG_LEVEL valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: logLevel {{- end }} {{ if .Values.configuration.controlplaneUrl }} - name: CONTROLPLANE_URL valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: controlplaneUrl {{- end }} {{ if .Values.configuration.graphqlMetricsCollectorUrl }} - name: GRAPHQL_METRICS_COLLECTOR_ENDPOINT valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: graphqlMetricsCollectorUrl {{- end }} {{ if .Values.configuration.otelCollectorUrl }} - name: DEFAULT_TELEMETRY_ENDPOINT valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: otelCollectorUrl {{- end }} {{ if .Values.configuration.cdnUrl }} - name: CDN_URL valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: cdnUrl {{- end }} {{ if .Values.configuration.routerConfigPath }} - name: ROUTER_CONFIG_PATH valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: routerConfigPath {{- end }} {{ if .Values.configuration.graphApiToken }} - name: GRAPH_API_TOKEN valueFrom: secretKeyRef: name: {{ include "router.secretName" . }} key: graphApiToken {{- end }} {{- if .Values.configuration.httpsProxy }} - name: HTTPS_PROXY valueFrom: secretKeyRef: name: {{ include "router.secretName" . }} key: httpsProxy {{- end }} {{- if .Values.configuration.httpProxy }} - name: HTTP_PROXY valueFrom: secretKeyRef: name: {{ include "router.secretName" . }} key: httpProxy {{- end }} {{- if .Values.configuration.noProxy }} - name: NO_PROXY valueFrom: secretKeyRef: name: {{ include "router.secretName" . }} key: noProxy {{- end }} - name: PROMETHEUS_ENABLED valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: prometheusEnabled {{ if .Values.configuration.prometheus.enabled }} - name: PROMETHEUS_LISTEN_ADDR valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: prometheusListenAddr - name: PROMETHEUS_HTTP_PATH valueFrom: configMapKeyRef: name: {{ include "router.fullname" . }} key: prometheusPath {{- end }} envFrom: {{- if .Values.extraEnvVarsCM }} - configMapRef: name: {{ .Values.extraEnvVarsCM }} {{- end }} {{- if .Values.extraEnvVarsSecret }} - secretRef: name: {{ .Values.extraEnvVarsSecret }} {{- end }} {{ with .Values.probes.liveness }} livenessProbe: {{- toYaml . | nindent 12 }} {{- end }} {{ with .Values.probes.readiness }} readinessProbe: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: {{- if .Values.existingConfigmap }} - name: router-config mountPath: /config.yaml subPath: config.yaml {{- else if .Values.commonConfiguration }} - name: router-config mountPath: /config.yaml subPath: config.yaml {{- end }} {{ if .Values.configuration.executionConfig }} - name: execution-config mountPath: /execution-config.json subPath: execution-config.json {{- end }} {{- if .Values.extraVolumeMounts }} {{- .Values.extraVolumeMounts | nindent 12 }} {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} volumes: {{- if .Values.configuration.executionConfig }} - name: execution-config configMap: name: {{ include "router.fullname" . }}-execution-config {{- end }} {{- if .Values.existingConfigmap }} - name: router-config configMap: name: {{ .Values.existingConfigmap }} {{- else if .Values.commonConfiguration }} - name: router-config configMap: name: {{ include "router.fullname" . }} {{- end }} {{- if .Values.extraVolumes }} {{- .Values.extraVolumes | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} {{- if .Values.terminationGracePeriodSeconds }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- end }}