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
This commit is contained in:
xuxant02@gmail.com 2021-11-29 10:22:35 +05:45
parent 311fb5bf69
commit 348f538f6d
9 changed files with 69 additions and 12 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Masakari description: OpenStack-Helm Masakari
name: masakari name: masakari
version: 0.1.1 version: 0.1.2
home: https://docs.openstack.org/developer/masakari home: https://docs.openstack.org/developer/masakari
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Masakari/OpenStack_Project_masakari_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Masakari/OpenStack_Project_masakari_vertical.png
sources: sources:

View File

@ -71,6 +71,7 @@ spec:
mountPath: /tmp/masakari-monitors-init.sh mountPath: /tmp/masakari-monitors-init.sh
subPath: masakari-monitors-init.sh subPath: masakari-monitors-init.sh
readOnly: true readOnly: true
hostNetwork: true
containers: containers:
- name: masakari-host-monitor - name: masakari-host-monitor
{{ tuple $envAll "masakari_host_monitor" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "masakari_host_monitor" | include "helm-toolkit.snippets.image" | indent 10 }}
@ -107,6 +108,8 @@ spec:
mountPath: /var/run mountPath: /var/run
- name: run - name: run
mountPath: /run mountPath: /run
- name: shm
mountPath: /dev/shm
volumes: volumes:
- name: pod-tmp - name: pod-tmp
emptyDir: {} emptyDir: {}
@ -114,6 +117,9 @@ spec:
emptyDir: {} emptyDir: {}
- name: masakarietc - name: masakarietc
emptyDir: {} emptyDir: {}
- name: shm
hostPath:
path: /dev/shm
- name: varrun - name: varrun
hostPath: hostPath:
path: /var/run path: /var/run

View File

@ -12,7 +12,17 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- define "metadata.annotations.job.db_init" }}
{{- if .Values.helm3_hook -}}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-5"
{{- end -}}
{{- end }}
{{- if .Values.manifests.job_db_init }} {{- if .Values.manifests.job_db_init }}
{{- $dbInitJob := dict "envAll" . "serviceName" "masakari" -}} {{- $dbInitJob := dict "envAll" . "serviceName" "masakari" -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $dbInitJob "jobAnnotations" (include "metadata.annotations.job.db_init" . | fromYaml ) }}
{{- end }}
{{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }} {{ $dbInitJob | include "helm-toolkit.manifests.job_db_init_mysql" }}
{{- end }} {{- end }}

View File

@ -24,6 +24,10 @@ metadata:
name: masakari-db-sync name: masakari-db-sync
annotations: annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
{{- if .Values.helm3_hook }}
"helm.sh/hook": "post-install,post-upgrade"
"helm.sh/hook-weight": "-4"
{{- end }}
spec: spec:
template: template:
metadata: metadata:

View File

@ -12,7 +12,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- define "metadata.annotations.job.ks_endpoints" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-2"
{{- end }}
{{- if .Values.manifests.job_ks_endpoints }} {{- if .Values.manifests.job_ks_endpoints }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "masakari" "serviceTypes" ( tuple "instance-ha" ) -}} {{- $ksServiceJob := dict "envAll" . "serviceName" "masakari" "serviceTypes" ( tuple "instance-ha" ) -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_endpoints" . | fromYaml ) }}
{{- end }}
{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_endpoints" }}
{{- end }} {{- end }}

View File

@ -12,7 +12,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- define "metadata.annotations.job.ks_service" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-3"
{{- end }}
{{- if .Values.manifests.job_ks_service }} {{- if .Values.manifests.job_ks_service }}
{{- $ksServiceJob := dict "envAll" . "serviceName" "masakari" "serviceTypes" ( tuple "instance-ha" ) -}} {{- $ksServiceJob := dict "envAll" . "serviceName" "masakari" "serviceTypes" ( tuple "instance-ha" ) -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $ksServiceJob "jobAnnotations" (include "metadata.annotations.job.ks_service" . | fromYaml ) }}
{{- end }}
{{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }} {{ $ksServiceJob | include "helm-toolkit.manifests.job_ks_service" }}
{{- end }} {{- end }}

View File

@ -12,7 +12,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- define "metadata.annotations.job.ks_user" }}
helm.sh/hook: post-install,post-upgrade
helm.sh/hook-weight: "-1"
{{- end }}
{{- if .Values.manifests.job_ks_user }} {{- if .Values.manifests.job_ks_user }}
{{- $ksUserJob := dict "envAll" . "serviceName" "masakari" -}} {{- $ksUserJob := dict "envAll" . "serviceName" "masakari" -}}
{{- if .Values.helm3_hook }}
{{- $_ := set $ksUserJob "jobAnnotations" (include "metadata.annotations.job.ks_user" . | fromYaml ) }}
{{- end }}
{{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }} {{ $ksUserJob | include "helm-toolkit.manifests.job_ks_user" }}
{{- end }} {{- end }}

View File

@ -25,7 +25,7 @@ images:
masakari_process_monitor: docker.io/xuxant/masakari-monitors:focal masakari_process_monitor: docker.io/xuxant/masakari-monitors:focal
masakari_instance_monitor: docker.io/xuxant/masakari-monitors:focal masakari_instance_monitor: docker.io/xuxant/masakari-monitors:focal
rabbit_init: docker.io/rabbitmq:3.7-management rabbit_init: docker.io/rabbitmq:3.7-management
dep_check: 'quay.io/airshipit/kubernetes-entrypoint:v1.0.0' dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0
pull_policy: "IfNotPresent" pull_policy: "IfNotPresent"
local_registry: local_registry:
active: false active: false
@ -71,7 +71,7 @@ endpoints:
path: path:
default: "/v1/%(tenant_id)s" default: "/v1/%(tenant_id)s"
scheme: scheme:
default: 'http' default: "http"
port: port:
api: api:
default: 15868 default: 15868
@ -184,7 +184,7 @@ endpoints:
default: null default: null
path: path:
default: null default: null
scheme: 'http' scheme: "http"
port: port:
service: service:
default: 24224 default: 24224
@ -281,23 +281,23 @@ pod:
masakari_api: masakari_api:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
runAsUser: 0 runAsUser: 42424
masakari_engine: masakari_engine:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
runAsUser: 0 runAsUser: 42424
masakari_db_sync: masakari_db_sync:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
runAsUser: 0 runAsUser: 42424
masakari_host_monitor: masakari_host_monitor:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: true
runAsUser: 0 runAsUser: 42424
masakari_process_monitir: masakari_process_monitir:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
runAsUser: 0 runAsUser: 42424
masakari_instance_monitor: masakari_instance_monitor:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
@ -564,6 +564,17 @@ conf:
introspectiveinstancemonitor: introspectiveinstancemonitor:
guest_monitor_interval: 10 guest_monitor_interval: 10
guest_monitor_timeout: 5 guest_monitor_timeout: 5
host:
monitoring_driver: default
monitoring_interval: 120
monitoring_samples: 1
disable_ipmi_checks: true
corosync_multicast_ports: 5405
pacemaker_node_type: remote
# Note(xuxant): Hooks will break the upgrade for helm2
# Set to false if using helm2.
helm3_hook: true
network: network:
masakari_api: masakari_api:
@ -589,6 +600,7 @@ manifests:
job_rabbit_init: true job_rabbit_init: true
service_api: true service_api: true
pdb_api: true pdb_api: true
host_monitor: true # Host Monitors in containers needs pacemaker remote.
host_monitor: false
instance_monitor: true instance_monitor: true
process_monitor: true process_monitor: false

View File

@ -2,4 +2,5 @@
masakari: masakari:
- 0.1.0 Initial Chart - 0.1.0 Initial Chart
- 0.1.1 Seperate node labels for monitors - 0.1.1 Seperate node labels for monitors
- 0.1.2 Added halm hook and fix for hostmonitors to support pacemaker remote
... ...