github.com/replicatedcom/ship@v0.50.0/integration/init/grafana-with-values/expected/.ship/upstream/templates/deployment.yaml (about) 1 apiVersion: apps/v1beta2 2 kind: Deployment 3 metadata: 4 name: {{ template "grafana.fullname" . }} 5 labels: 6 app: {{ template "grafana.name" . }} 7 chart: {{ template "grafana.chart" . }} 8 release: {{ .Release.Name }} 9 heritage: {{ .Release.Service }} 10 {{- with .Values.annotations }} 11 annotations: 12 {{ toYaml . | indent 4 }} 13 {{- end }} 14 spec: 15 replicas: {{ .Values.replicas }} 16 selector: 17 matchLabels: 18 app: {{ template "grafana.name" . }} 19 release: {{ .Release.Name }} 20 strategy: 21 type: {{ .Values.deploymentStrategy }} 22 {{- if ne .Values.deploymentStrategy "RollingUpdate" }} 23 rollingUpdate: null 24 {{- end }} 25 template: 26 metadata: 27 labels: 28 app: {{ template "grafana.name" . }} 29 release: {{ .Release.Name }} 30 {{- with .Values.podAnnotations }} 31 annotations: 32 {{ toYaml . | indent 8 }} 33 {{- end }} 34 spec: 35 serviceAccountName: {{ template "grafana.serviceAccountName" . }} 36 {{- if .Values.schedulerName }} 37 schedulerName: "{{ .Values.schedulerName }}" 38 {{- end }} 39 {{- if .Values.securityContext }} 40 securityContext: 41 {{ toYaml .Values.securityContext | indent 8 }} 42 {{- end }} 43 {{- if .Values.priorityClassName }} 44 priorityClassName: {{ .Values.priorityClassName }} 45 {{- end }} 46 {{- if .Values.dashboards }} 47 initContainers: 48 - name: download-dashboards 49 image: "{{ .Values.downloadDashboardsImage.repository }}:{{ .Values.downloadDashboardsImage.tag }}" 50 imagePullPolicy: {{ .Values.downloadDashboardsImage.pullPolicy }} 51 command: ["sh", "/etc/grafana/download_dashboards.sh"] 52 volumeMounts: 53 - name: config 54 mountPath: "/etc/grafana/download_dashboards.sh" 55 subPath: download_dashboards.sh 56 - name: storage 57 mountPath: "/var/lib/grafana" 58 subPath: {{ .Values.persistence.subPath }} 59 {{- range .Values.extraSecretMounts }} 60 - name: {{ .name }} 61 mountPath: {{ .mountPath }} 62 readOnly: {{ .readOnly }} 63 {{- end }} 64 {{- end }} 65 {{- if .Values.image.pullSecrets }} 66 imagePullSecrets: 67 {{- range .Values.image.pullSecrets }} 68 - name: {{ . }} 69 {{- end}} 70 {{- end }} 71 containers: 72 {{- if .Values.sidecar.dashboards.enabled }} 73 - name: {{ template "grafana.name" . }}-sc-dashboard 74 image: "{{ .Values.sidecar.image }}" 75 imagePullPolicy: {{ .Values.sidecar.imagePullPolicy }} 76 env: 77 - name: LABEL 78 value: "{{ .Values.sidecar.dashboards.label }}" 79 - name: FOLDER 80 value: "{{ .Values.sidecar.dashboards.folder }}" 81 {{- if .Values.sidecar.dashboards.searchNamespace }} 82 - name: NAMESPACE 83 value: "{{ .Values.sidecar.dashboards.searchNamespace }}" 84 {{- end }} 85 resources: 86 {{ toYaml .Values.sidecar.resources | indent 12 }} 87 volumeMounts: 88 - name: sc-dashboard-volume 89 mountPath: {{ .Values.sidecar.dashboards.folder | quote }} 90 {{- end}} 91 {{- if .Values.sidecar.datasources.enabled }} 92 - name: {{ template "grafana.name" . }}-sc-datasources 93 image: "{{ .Values.sidecar.image }}" 94 imagePullPolicy: {{ .Values.sidecar.imagePullPolicy }} 95 env: 96 - name: LABEL 97 value: "{{ .Values.sidecar.datasources.label }}" 98 - name: FOLDER 99 value: "/etc/grafana/provisioning/datasources" 100 {{- if .Values.sidecar.datasources.searchNamespace }} 101 - name: NAMESPACE 102 value: "{{ .Values.sidecar.datasources.searchNamespace }}" 103 {{- end }} 104 resources: 105 {{ toYaml .Values.sidecar.resources | indent 12 }} 106 volumeMounts: 107 - name: sc-datasources-volume 108 mountPath: "/etc/grafana/provisioning/datasources" 109 {{- end}} 110 - name: {{ .Chart.Name }} 111 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 112 imagePullPolicy: {{ .Values.image.pullPolicy }} 113 volumeMounts: 114 - name: config 115 mountPath: "/etc/grafana/grafana.ini" 116 subPath: grafana.ini 117 - name: ldap 118 mountPath: "/etc/grafana/ldap.toml" 119 subPath: ldap.toml 120 - name: storage 121 mountPath: "/var/lib/grafana" 122 subPath: {{ .Values.persistence.subPath }} 123 {{- if .Values.dashboards }} 124 {{- range $provider, $dashboards := .Values.dashboards }} 125 {{- range $key, $value := $dashboards }} 126 {{- if hasKey $value "json" }} 127 - name: dashboards-{{ $provider }} 128 mountPath: "/var/lib/grafana/dashboards/{{ $provider }}/{{ $key }}.json" 129 subPath: "{{ $key }}.json" 130 {{- end }} 131 {{- end }} 132 {{- end }} 133 {{- end -}} 134 {{- if .Values.dashboardsConfigMaps }} 135 {{- range keys .Values.dashboardsConfigMaps }} 136 - name: dashboards-{{ . }} 137 mountPath: "/var/lib/grafana/dashboards/{{ . }}" 138 {{- end }} 139 {{- end }} 140 {{- if .Values.datasources }} 141 - name: config 142 mountPath: "/etc/grafana/provisioning/datasources/datasources.yaml" 143 subPath: datasources.yaml 144 {{- end }} 145 {{- if .Values.dashboardProviders }} 146 - name: config 147 mountPath: "/etc/grafana/provisioning/dashboards/dashboardproviders.yaml" 148 subPath: dashboardproviders.yaml 149 {{- end }} 150 {{- if .Values.sidecar.dashboards.enabled }} 151 - name: sc-dashboard-volume 152 mountPath: {{ .Values.sidecar.dashboards.folder | quote }} 153 - name: sc-dashboard-provider 154 mountPath: "/etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml" 155 subPath: provider.yaml 156 {{- end}} 157 {{- if .Values.sidecar.datasources.enabled }} 158 - name: sc-datasources-volume 159 mountPath: "/etc/grafana/provisioning/datasources" 160 {{- end}} 161 {{- range .Values.extraSecretMounts }} 162 - name: {{ .name }} 163 mountPath: {{ .mountPath }} 164 readOnly: {{ .readOnly }} 165 {{- end }} 166 ports: 167 - name: service 168 containerPort: {{ .Values.service.port }} 169 protocol: TCP 170 - name: grafana 171 containerPort: 3000 172 protocol: TCP 173 env: 174 - name: GF_SECURITY_ADMIN_USER 175 valueFrom: 176 secretKeyRef: 177 name: {{ template "grafana.fullname" . }} 178 key: admin-user 179 - name: GF_SECURITY_ADMIN_PASSWORD 180 valueFrom: 181 secretKeyRef: 182 name: {{ template "grafana.fullname" . }} 183 key: admin-password 184 {{- if .Values.plugins }} 185 - name: GF_INSTALL_PLUGINS 186 valueFrom: 187 configMapKeyRef: 188 name: {{ template "grafana.fullname" . }} 189 key: plugins 190 {{- end }} 191 {{- if .Values.smtp.existingSecret }} 192 - name: GF_SMTP_USER 193 valueFrom: 194 secretKeyRef: 195 name: {{ .Values.smtp.existingSecret }} 196 key: user 197 - name: GF_SMTP_PASSWORD 198 valueFrom: 199 secretKeyRef: 200 name: {{ .Values.smtp.existingSecret }} 201 key: password 202 {{- end }} 203 {{- range $key, $value := .Values.env }} 204 - name: "{{ $key }}" 205 value: "{{ $value }}" 206 {{- end }} 207 {{- if .Values.envFromSecret }} 208 envFrom: 209 - secretRef: 210 name: {{ .Values.envFromSecret }} 211 {{- end }} 212 livenessProbe: 213 {{ toYaml .Values.livenessProbe | indent 12 }} 214 readinessProbe: 215 {{ toYaml .Values.readinessProbe | indent 12 }} 216 resources: 217 {{ toYaml .Values.resources | indent 12 }} 218 {{- with .Values.nodeSelector }} 219 nodeSelector: 220 {{ toYaml . | indent 8 }} 221 {{- end }} 222 {{- with .Values.affinity }} 223 affinity: 224 {{ toYaml . | indent 8 }} 225 {{- end }} 226 {{- with .Values.tolerations }} 227 tolerations: 228 {{ toYaml . | indent 8 }} 229 {{- end }} 230 volumes: 231 - name: config 232 configMap: 233 name: {{ template "grafana.fullname" . }} 234 {{- if .Values.dashboards }} 235 {{- range keys .Values.dashboards }} 236 - name: dashboards-{{ . }} 237 configMap: 238 name: {{ template "grafana.fullname" $ }}-dashboards-{{ . }} 239 {{- end }} 240 {{- end }} 241 {{- if .Values.dashboardsConfigMaps }} 242 {{- range $provider, $name := .Values.dashboardsConfigMaps }} 243 - name: dashboards-{{ $provider }} 244 configMap: 245 name: {{ $name }} 246 {{- end }} 247 {{- end }} 248 - name: ldap 249 secret: 250 {{- if .Values.ldap.existingSecret }} 251 secretName: {{ .Values.ldap.existingSecret }} 252 {{- else }} 253 secretName: {{ template "grafana.fullname" . }} 254 {{- end }} 255 items: 256 - key: ldap-toml 257 path: ldap.toml 258 - name: storage 259 {{- if .Values.persistence.enabled }} 260 persistentVolumeClaim: 261 claimName: {{ .Values.persistence.existingClaim | default (include "grafana.fullname" .) }} 262 {{- else }} 263 emptyDir: {} 264 {{- end -}} 265 {{- if .Values.sidecar.dashboards.enabled }} 266 - name: sc-dashboard-volume 267 emptyDir: {} 268 - name: sc-dashboard-provider 269 configMap: 270 name: {{ template "grafana.fullname" . }}-config-dashboards 271 {{- end }} 272 {{- if .Values.sidecar.datasources.enabled }} 273 - name: sc-datasources-volume 274 emptyDir: {} 275 {{- end -}} 276 {{- range .Values.extraSecretMounts }} 277 - name: {{ .name }} 278 secret: 279 secretName: {{ .secretName }} 280 defaultMode: {{ .defaultMode }} 281 {{- end }}