openstack-helm-infra/prometheus-alertmanager/templates/snmp-notifier/snmp-deployment.yaml
diwakar thyagaraj 30afcad5a2 Add Apparmor to Prometheus alert manager and snmp-notifier
1) Added to service account name insted of traditional pod name
   to resolve for dynamic release names.
2) Added Apparmor Job to Prometheus Alert Manager.

Change-Id: Ib65f721c5b99b3ae3d3af924ca5187ad6174ed20
Signed-off-by: diwakar thyagaraj <diwakar.chitoor.thyagaraj@att.com>
2020-08-25 17:09:45 +00:00

77 lines
4.2 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.snmpnotifier.deployment }}
{{- $envAll := . }}
{{- $mounts_snmpnotifier := .Values.pod.mounts.snmpnotifier.snmpnotifier }}
{{- $mounts_snmpnotifier_init := .Values.pod.mounts.snmpnotifier.init_container }}
{{- $serviceAccountName := "snmpnotifier" }}
{{ tuple $envAll "snmpnotifier" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: snmpnotifier
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
labels:
{{ tuple $envAll "snmpnotifier" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
podManagementPolicy: "Parallel"
replicas: {{ .Values.pod.replicas.snmpnotifier }}
selector:
matchLabels:
{{ tuple $envAll "snmpnotifier" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
template:
metadata:
labels:
{{ tuple $envAll "snmpnotifier" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
{{ dict "envAll" $envAll "podName" $serviceAccountName "containerNames" (list "snmpnotifier") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
{{ dict "envAll" $envAll "application" "server" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
affinity:
{{ tuple $envAll "snmpnotifier" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
{{ .Values.labels.snmpnotifier.node_selector_key }}: {{ .Values.labels.snmpnotifier.node_selector_value | quote }}
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.snmpnotifier.timeout | default "30" }}
containers:
- name: snmpnotifier
{{ tuple $envAll "snmpnotifier" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.snmpnotifier | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "server" "container" "snmpnotifier" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
args:
- --alert.default-severity={{ .Values.conf.command_flags.snmpnotifier.alert_default_severity}}
- --alert.severities={{ .Values.conf.command_flags.snmpnotifier.alert_severities}}
- --alert.severity-label={{ .Values.conf.command_flags.snmpnotifier.alert_severity_label}}
- --log.level={{ .Values.conf.command_flags.snmpnotifier.log_level}}
- --snmp.community={{ .Values.conf.command_flags.snmpnotifier.snmp_community}}
- --snmp.destination={{ .Values.conf.command_flags.snmpnotifier.snmp_desination}}
- --snmp.trap-default-oid={{ .Values.conf.command_flags.snmpnotifier.snmp_trap_default_oid}}
- --snmp.trap-description-template={{ .Values.conf.command_flags.snmpnotifier.snmp_trap_description_template}}
- --snmp.version={{ .Values.conf.command_flags.snmpnotifier.snmp_version}}
ports:
- name: snmp-api
containerPort: {{ tuple "snmpnotifier" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe:
httpGet:
path: /health
port: {{ tuple "snmpnotifier" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
initialDelaySeconds: 30
timeoutSeconds: 30
{{- end }}