Files
openstack-helm/masakari/templates/daemonset-host-monitor.yaml
xuxant02@gmail.com 348f538f6d Introduced helm hook for masakari
When changes are made to config, helm upgrade failes with immutable fields in jobs. Addition of the helm hooks with post upgrade will delete the old job and create the new jobs which will solve the issue.
Also, mounted the shm and enabled hostNetwork in masakari monitors so that it can communicate with pacemaker remote for monitoring the cluster status.

Change-Id: I8a8bc5b7c77643872e65fac294d0ff48347c476b
2021-11-29 11:32:13 +05:45

138 lines
5.7 KiB
YAML

{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.host_monitor }}
{{- $envAll := . }}
{{- $daemonset := "masakari-host-monitor" }}
{{- $mounts_masakari_host_monitor := .Values.pod.mounts.masakari_host_monitor.masakari_host_monitor }}
{{- $mounts_masakari_host_monitor_init := .Values.pod.mounts.masakari_host_monitor.init_container }}
{{- $serviceAccountName := "masakari-host-monitor" }}
{{- tuple $envAll "masakari_host_monitor" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: masakari-host-monitor
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
{{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
selector:
matchLabels:
{{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
{{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
template:
metadata:
labels:
{{ tuple $envAll .Chart.Name $daemonset | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
{{- dict "envAll" $envAll "podName" "masakari-host-monitor" "containerNames" (list "masakari-monitor") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
spec:
{{ dict "envAll" $envAll "application" "masakari-host-monitor" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.monitors.node_selector_key }}: {{ .Values.labels.monitors.node_selector_value }}
initContainers:
{{ tuple $envAll "masakari_host_monitor" $mounts_masakari_host_monitor_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: hostmonitor-init
{{ tuple $envAll "masakari_host_monitor" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.masakari_host_monitor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "masakari" "container" "masakari_host_monitor" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/masakari-monitors-init.sh
env:
- name: COMPUTE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: pod-shared
mountPath: /tmp/pod-shared
- name: masakari-bin
mountPath: /tmp/masakari-monitors-init.sh
subPath: masakari-monitors-init.sh
readOnly: true
hostNetwork: true
containers:
- name: masakari-host-monitor
{{ tuple $envAll "masakari_host_monitor" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.masakari_host_monitor | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "masakari" "container" "masakari_host_monitor" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/masakari-host-monitor.sh
- start
env:
- name: COMPUTE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
lifecycle:
preStop:
exec:
command:
- /tmp/masakari-host-monitor.sh
- stop
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: pod-shared
mountPath: /tmp/pod-shared
- name: masakari-bin
mountPath: /tmp/masakari-host-monitor.sh
subPath: masakari-host-monitor.sh
- name: masakari-etc
mountPath: /etc/masakari/masakarimonitors.conf
subPath: masakarimonitors.conf
- name: masakarietc
mountPath: /etc/masakari
- name: varrun
mountPath: /var/run
- name: run
mountPath: /run
- name: shm
mountPath: /dev/shm
volumes:
- name: pod-tmp
emptyDir: {}
- name: pod-shared
emptyDir: {}
- name: masakarietc
emptyDir: {}
- name: shm
hostPath:
path: /dev/shm
- name: varrun
hostPath:
path: /var/run
- name: run
hostPath:
path: /run
- name: masakari-bin
configMap:
name: masakari-bin
defaultMode: 0555
- name: masakari-etc
secret:
secretName: masakari-etc
defaultMode: 0444
{{- end }}