Files

199 lines
8.6 KiB
YAML
Raw Permalink Normal View History

{{- if .Values.localpv.enabled }}
{{- if not .Values.localpv.nodeDeployment.enabled }}
{{- $healthPort := default 8081 .Values.localpv.healthCheck.port }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "localpv.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- with .Values.localpv.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 4 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.localpv.replicas }}
strategy:
type: "Recreate"
rollingUpdate: null
selector:
matchLabels:
{{- include "localpv.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.localpv.podAnnotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "localpv.labels" . | nindent 8 }}
{{- if .Values.extraLabels -}}
{{- toYaml .Values.extraLabels | nindent 8 }}
{{- end }}
{{- with .Values.localpv.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.loggingLabels}}
{{ toYaml . | nindent 8 -}}
{{- end}}
spec:
{{- if .Values.localpv.priorityClassName }}
priorityClassName: {{ tpl .Values.localpv.priorityClassName . }}
{{- end }}
{{- if or .Values.global.imagePullSecrets .Values.imagePullSecrets }}
imagePullSecrets:
{{- include "localpv.common.pullSecrets" . | indent 6 }}
{{- end }}
serviceAccountName: {{ template "localpv.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ template "localpv.fullname" . }}
image: "{{ include "localpv.common.image" (dict "imageRoot" .Values.localpv.image "global" .Values.global "override" .Values.globalImageRegistryOverride) }}"
imagePullPolicy: {{ default .Values.localpv.image.pullPolicy .Values.global.imagePullPolicy }}
resources:
{{ toYaml .Values.localpv.resources | indent 10 }}
env:
# OPENEBS_IO_K8S_MASTER enables openebs provisioner to connect to K8s
# based on this address. This is ignored if empty.
# This is supported for openebs provisioner version 0.5.2 onwards
#- name: OPENEBS_IO_K8S_MASTER
# value: "http://10.128.0.12:8080"
# OPENEBS_IO_KUBE_CONFIG enables openebs provisioner to connect to K8s
# based on this config. This is ignored if empty.
# This is supported for openebs provisioner version 0.5.2 onwards
#- name: OPENEBS_IO_KUBE_CONFIG
# value: "/home/ubuntu/.kube/config"
- name: OPENEBS_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
# OPENEBS_SERVICE_ACCOUNT provides the service account of this pod as
# environment variable
- name: OPENEBS_SERVICE_ACCOUNT
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
# OPENEBS_IO_BASE_PATH is the environment variable that provides the
# default base path on the node where host-path PVs will be provisioned.
{{- if kindIs "bool" .Values.global.analytics.enabled }}
- name: OPENEBS_IO_ENABLE_ANALYTICS
value: "{{ .Values.global.analytics.enabled }}"
{{- else }}
- name: OPENEBS_IO_ENABLE_ANALYTICS
value: "{{ .Values.analytics.enabled }}"
{{- end }}
# OPENEBS_IO_ANALYTICS_STATE_CM names the ConfigMap consulted to
# decide whether to emit the install event for this Helm release
# and to persist ping/heartbeat timestamps across pod restarts.
# The provisioner creates and updates this ConfigMap itself; it
# is not managed by Helm. helm uninstall does not remove it, so
# reinstalls into the same namespace will not re-fire the install
# event unless the ConfigMap is deleted manually.
- name: OPENEBS_IO_ANALYTICS_STATE_CM
value: {{ include "localpv.analyticsStateCM.name" . | quote }}
{{- if .Values.global.analytics.gaId }}
- name: GA_ID
value: {{ .Values.global.analytics.gaId | quote }}
{{- else if .Values.analytics.gaId }}
- name: GA_ID
value: {{ .Values.analytics.gaId | quote }}
{{- end }}
{{- if .Values.global.analytics.gaKey }}
- name: GA_KEY
value: {{ .Values.global.analytics.gaKey | quote }}
{{- else if .Values.analytics.gaKey }}
- name: GA_KEY
value: {{ .Values.analytics.gaKey | quote }}
{{- end }}
- name: OPENEBS_IO_BASE_PATH
value: "{{ .Values.localpv.basePath }}"
- name: OPENEBS_IO_WORKER_THREADS
value: {{ .Values.localpv.controller.workers | quote }}
{{- if .Values.localpv.controller.client.qps }}
- name: OPENEBS_IO_CLIENT_QPS
value: {{ .Values.localpv.controller.client.qps | quote }}
{{- end }}
{{- if .Values.localpv.controller.client.burst }}
- name: OPENEBS_IO_CLIENT_BURST
value: {{ .Values.localpv.controller.client.burst | quote }}
{{- end }}
- name: OPENEBS_IO_IMAGE_PULL_POLICY
value: "{{ default .Values.helperPod.image.pullPolicy .Values.global.imagePullPolicy }}"
- name: OPENEBS_IO_HELPER_IMAGE
value: "{{ include "localpv.common.image" (dict "imageRoot" .Values.helperPod.image "global" .Values.global "override" .Values.globalImageRegistryOverride) }}"
- name: OPENEBS_IO_HELPER_POD_HOST_NETWORK
value: "{{ .Values.helperPod.hostNetwork }}"
- name: OPENEBS_IO_INSTALLER_TYPE
value: "localpv-charts-helm-helperpod"
- name: OPENEBS_IO_HELPER_POD_TIMEOUT_SECS
value: {{ .Values.helperPod.timeoutSecs | quote }}
# LEADER_ELECTION_ENABLED is used to enable/disable leader election. By default
# leader election is enabled.
- name: LEADER_ELECTION_ENABLED
value: "{{ .Values.localpv.enableLeaderElection }}"
# OPENEBS_IO_HEALTH_PROBE_BIND_ADDRESS is the address the health-probe
# HTTP server binds to. /healthz serves liveness, /readyz serves readiness.
- name: OPENEBS_IO_HEALTH_PROBE_BIND_ADDRESS
value: ":{{ $healthPort }}"
{{- include "localpv.helper.pullSecrets" . | indent 8 }}
{{/* Add args below */}}
{{/* All args are optional (so far, at least), so the 'args' PodTemplate key
* is only included if there is at least one arg. And that's why we're doing
* it this way.
*/}}
{{- $args := list }}
{{- if .Values.localpv.allowInsecurePvcBasePathOverride }}
{{- $args = append $args "--allow-insecure-pvc-basepath-override" }}
{{- end }}
{{- if $args }}
args:
{{- range $args }}
- {{ . | quote }} {{/* Add new args to the above $args list */}}
{{- end }}
{{- end }}
ports:
- name: healthz
containerPort: {{ $healthPort }}
protocol: TCP
{{- if .Values.localpv.healthCheck.liveness.enabled }}
livenessProbe:
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: {{ .Values.localpv.healthCheck.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.localpv.healthCheck.liveness.periodSeconds }}
timeoutSeconds: {{ .Values.localpv.healthCheck.liveness.timeoutSeconds }}
failureThreshold: {{ .Values.localpv.healthCheck.liveness.failureThreshold }}
{{- end }}
{{- if .Values.localpv.healthCheck.readiness.enabled }}
readinessProbe:
httpGet:
path: /readyz
port: healthz
initialDelaySeconds: {{ .Values.localpv.healthCheck.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.localpv.healthCheck.readiness.periodSeconds }}
timeoutSeconds: {{ .Values.localpv.healthCheck.readiness.timeoutSeconds }}
failureThreshold: {{ .Values.localpv.healthCheck.readiness.failureThreshold }}
{{- end }}
{{- if .Values.localpv.nodeSelector }}
nodeSelector:
{{ toYaml .Values.localpv.nodeSelector | indent 8 }}
{{- end }}
{{- if $tolerations := include "tolerations_with_early_eviction" . }}
tolerations: {{ $tolerations }}
{{- end }}
{{- if .Values.localpv.affinity }}
affinity:
{{ toYaml .Values.localpv.affinity | indent 8 }}
{{- end }}
{{- end }}
{{- end }}