|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + name: {{ include "micronaut.fullname" . }} |
| 5 | + labels: |
| 6 | + {{- include "micronaut.labels" . | nindent 4 }} |
| 7 | +spec: |
| 8 | + {{- if not .Values.autoscaling.enabled }} |
| 9 | + replicas: {{ .Values.replicaCount }} |
| 10 | + {{- end }} |
| 11 | + {{- with .Values.strategy }} |
| 12 | + strategy: |
| 13 | + {{- toYaml . | nindent 4 }} |
| 14 | + {{- end }} |
| 15 | + selector: |
| 16 | + matchLabels: |
| 17 | + app.kubernetes.io/name: {{ include "micronaut.name" . }} |
| 18 | + app.kubernetes.io/instance: {{ .Release.Name }} |
| 19 | + template: |
| 20 | + metadata: |
| 21 | + labels: |
| 22 | + app.kubernetes.io/name: {{ include "micronaut.name" . }} |
| 23 | + app.kubernetes.io/instance: {{ .Release.Name }} |
| 24 | + {{- with .Values.podLabels }} |
| 25 | +{{ toYaml . | indent 8 }} |
| 26 | + {{- end }} |
| 27 | + annotations: |
| 28 | + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 29 | + {{- if and .Values.secrets.enabled .Values.secrets.files }} |
| 30 | + checksum/secrets: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} |
| 31 | + {{- end }} |
| 32 | + {{- with .Values.podAnnotations }} |
| 33 | +{{ toYaml . | indent 8 }} |
| 34 | + {{- end }} |
| 35 | + spec: |
| 36 | + {{- if .Values.imagePullSecrets }} |
| 37 | + imagePullSecrets: |
| 38 | +{{ toYaml .Values.imagePullSecrets | indent 8 }} |
| 39 | + {{- end }} |
| 40 | + serviceAccountName: {{- if .Values.serviceAccount.create }} {{ include "micronaut.fullname" . }} {{- else }} {{ default "default" .Values.serviceAccount.name }} {{- end }} |
| 41 | + {{- if .Values.securityContext.enabled }} |
| 42 | + securityContext: |
| 43 | + {{- omit .Values.securityContext "enabled" | toYaml | nindent 8 }} |
| 44 | + {{- end }} |
| 45 | + {{- with .Values.priorityClassName }} |
| 46 | + priorityClassName: {{ . }} |
| 47 | + {{- end }} |
| 48 | + {{- with .Values.nodeSelector }} |
| 49 | + nodeSelector: |
| 50 | + {{- toYaml . | nindent 8 }} |
| 51 | + {{- end }} |
| 52 | + {{- with .Values.affinity }} |
| 53 | + affinity: |
| 54 | + {{- toYaml . | nindent 8 }} |
| 55 | + {{- end }} |
| 56 | + {{- with .Values.tolerations }} |
| 57 | + tolerations: |
| 58 | + {{- toYaml . | nindent 8 }} |
| 59 | + {{- end }} |
| 60 | + {{- if .Values.tracing.enabled }} |
| 61 | + initContainers: |
| 62 | + - name: otel-agent |
| 63 | + image: {{ .Values.tracing.image }} |
| 64 | + command: ["cp", "/javaagent.jar", "/otel/javaagent.jar"] |
| 65 | + {{- if .Values.containerSecurityContext.enabled }} |
| 66 | + securityContext: |
| 67 | + {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} |
| 68 | + {{- end }} |
| 69 | + resources: |
| 70 | + {{- toYaml .Values.tracing.resources | nindent 12 }} |
| 71 | + volumeMounts: |
| 72 | + - name: otel-agent |
| 73 | + mountPath: /otel |
| 74 | + {{- end }} |
| 75 | + containers: |
| 76 | + - name: app |
| 77 | + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 78 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 79 | + {{- if .Values.containerSecurityContext.enabled }} |
| 80 | + securityContext: |
| 81 | + {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} |
| 82 | + {{- end }} |
| 83 | + ports: |
| 84 | + - name: http |
| 85 | + containerPort: {{ .Values.service.port }} |
| 86 | + env: |
| 87 | + - name: MICRONAUT_ENVIRONMENTS |
| 88 | + value: "{{ join "," .Values.profiles }}" |
| 89 | + - name: MICRONAUT_CONFIG_FILES |
| 90 | + value: "/config/application.yml{{- range $p := .Values.profiles }},/config/application-{{$p}}.yml{{- end }}{{- if and .Values.secrets.enabled .Values.secrets.files }}{{- range $p := .Values.profiles }},/secrets/application-{{$p}}.yml{{- end }}{{- end }}" |
| 91 | + {{- range .Values.env }} |
| 92 | + - name: {{ .name }} |
| 93 | + value: {{ .value | quote }} |
| 94 | + {{- end }} |
| 95 | + {{- if .Values.tracing.enabled }} |
| 96 | + # JDK_JAVA_OPTIONS is independent of JAVA_TOOL_OPTIONS (which |
| 97 | + # apps commonly override wholesale via .Values.env above), so |
| 98 | + # the agent attaches regardless of what that list contains. |
| 99 | + - name: JDK_JAVA_OPTIONS |
| 100 | + value: "-javaagent:/otel/javaagent.jar" |
| 101 | + - name: OTEL_SERVICE_NAME |
| 102 | + value: {{ .Release.Name | quote }} |
| 103 | + - name: OTEL_TRACES_EXPORTER |
| 104 | + value: "otlp" |
| 105 | + - name: OTEL_METRICS_EXPORTER |
| 106 | + value: "none" |
| 107 | + - name: OTEL_LOGS_EXPORTER |
| 108 | + value: "none" |
| 109 | + - name: OTEL_EXPORTER_OTLP_ENDPOINT |
| 110 | + value: {{ .Values.tracing.endpoint | quote }} |
| 111 | + - name: OTEL_EXPORTER_OTLP_PROTOCOL |
| 112 | + value: "grpc" |
| 113 | + {{- end }} |
| 114 | + {{- if .Values.envFrom }} |
| 115 | + envFrom: |
| 116 | +{{ toYaml .Values.envFrom | indent 12 }} |
| 117 | + {{- end }} |
| 118 | + {{- if .Values.startupProbe.enabled }} |
| 119 | + startupProbe: |
| 120 | + httpGet: |
| 121 | + path: {{ .Values.readinessProbe.path }} |
| 122 | + port: http |
| 123 | + failureThreshold: {{ .Values.startupProbe.failureThreshold }} |
| 124 | + periodSeconds: {{ .Values.startupProbe.periodSeconds }} |
| 125 | + {{- end }} |
| 126 | + readinessProbe: |
| 127 | + httpGet: |
| 128 | + path: {{ .Values.readinessProbe.path }} |
| 129 | + port: http |
| 130 | + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} |
| 131 | + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} |
| 132 | + livenessProbe: |
| 133 | + httpGet: |
| 134 | + path: {{ .Values.livenessProbe.path }} |
| 135 | + port: http |
| 136 | + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} |
| 137 | + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} |
| 138 | + resources: |
| 139 | +{{ toYaml .Values.resources | indent 12 }} |
| 140 | + volumeMounts: |
| 141 | + # The root filesystem is read-only; the JVM still wants a scratch |
| 142 | + # dir (java.io.tmpdir, Netty, JIT dumps). |
| 143 | + - name: tmp |
| 144 | + mountPath: /tmp |
| 145 | + - name: config |
| 146 | + mountPath: /config |
| 147 | + {{- if and .Values.secrets.enabled .Values.secrets.files }} |
| 148 | + - name: secrets |
| 149 | + mountPath: /secrets |
| 150 | + {{- end }} |
| 151 | + {{- if .Values.tracing.enabled }} |
| 152 | + - name: otel-agent |
| 153 | + mountPath: /otel |
| 154 | + readOnly: true |
| 155 | + {{- end }} |
| 156 | + volumes: |
| 157 | + - name: tmp |
| 158 | + emptyDir: {} |
| 159 | + - name: config |
| 160 | + configMap: |
| 161 | + name: {{ include "micronaut.fullname" . }}-config |
| 162 | + {{- if and .Values.secrets.enabled .Values.secrets.files }} |
| 163 | + - name: secrets |
| 164 | + secret: |
| 165 | + secretName: {{ include "micronaut.fullname" . }}-secrets |
| 166 | + {{- end }} |
| 167 | + {{- if .Values.tracing.enabled }} |
| 168 | + - name: otel-agent |
| 169 | + emptyDir: {} |
| 170 | + {{- end }} |
0 commit comments