From d3bf218250545a54fe71aad1b8177705b2f7ea2f Mon Sep 17 00:00:00 2001 From: "Xiaoguang(William) Zhang" Date: Thu, 4 Feb 2021 15:19:56 -0500 Subject: [PATCH] Remove snmp_notifier subchart from alertmanager snmp_notifier lack of features to forward alert labels from Alertmanager. Change-Id: I4978df1bcdb45ad24e632d976eb407d4129715ad --- prometheus-alertmanager/Chart.yaml | 2 +- .../snmp-notifier/snmp-deployment.yaml | 76 ------------------- .../templates/snmp-notifier/snmp-service.yaml | 34 --------- prometheus-alertmanager/values.yaml | 57 +------------- .../values_overrides/apparmor.yaml | 2 - 5 files changed, 2 insertions(+), 169 deletions(-) delete mode 100644 prometheus-alertmanager/templates/snmp-notifier/snmp-deployment.yaml delete mode 100644 prometheus-alertmanager/templates/snmp-notifier/snmp-service.yaml diff --git a/prometheus-alertmanager/Chart.yaml b/prometheus-alertmanager/Chart.yaml index 8c7898a38..41d44776a 100644 --- a/prometheus-alertmanager/Chart.yaml +++ b/prometheus-alertmanager/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v0.20.0 description: OpenStack-Helm Alertmanager for Prometheus name: prometheus-alertmanager -version: 0.1.3 +version: 0.1.4 home: https://prometheus.io/docs/alerting/alertmanager/ sources: - https://github.com/prometheus/alertmanager diff --git a/prometheus-alertmanager/templates/snmp-notifier/snmp-deployment.yaml b/prometheus-alertmanager/templates/snmp-notifier/snmp-deployment.yaml deleted file mode 100644 index 9823286b8..000000000 --- a/prometheus-alertmanager/templates/snmp-notifier/snmp-deployment.yaml +++ /dev/null @@ -1,76 +0,0 @@ -{{/* -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 }} diff --git a/prometheus-alertmanager/templates/snmp-notifier/snmp-service.yaml b/prometheus-alertmanager/templates/snmp-notifier/snmp-service.yaml deleted file mode 100644 index e07da5f5a..000000000 --- a/prometheus-alertmanager/templates/snmp-notifier/snmp-service.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{/* -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.service }} -{{- $envAll := . }} ---- -apiVersion: v1 -kind: Service -metadata: - name: {{ tuple "snmpnotifier" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} -spec: - ports: - - name: snmpnotifier-api - {{ if .Values.network.snmpnotifier.node_port.enabled }} - nodePort: {{ .Values.network.snmpnotifier.node_port.port }} - {{ end }} - port: {{ tuple "snmpnotifier" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - selector: -{{ tuple $envAll "snmpnotifier" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} - {{ if .Values.network.snmpnotifier.node_port.enabled }} - type: NodePort - {{ end }} -{{- end }} diff --git a/prometheus-alertmanager/values.yaml b/prometheus-alertmanager/values.yaml index 2837ca183..333e90cc7 100644 --- a/prometheus-alertmanager/values.yaml +++ b/prometheus-alertmanager/values.yaml @@ -20,7 +20,6 @@ images: tags: apache_proxy: docker.io/httpd:2.4 prometheus-alertmanager: docker.io/prom/alertmanager:v0.20.0 - snmpnotifier: docker.io/maxwo/snmp-notifier:v1.0.0 dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0 image_repo_sync: docker.io/docker:17.07.0 pull_policy: IfNotPresent @@ -34,9 +33,6 @@ labels: alertmanager: node_selector_key: openstack-control-plane node_selector_value: enabled - snmpnotifier: - node_selector_key: openstack-control-plane - node_selector_value: enabled job: node_selector_key: openstack-control-plane node_selector_value: enabled @@ -68,12 +64,8 @@ pod: alertmanager: alertmanager: init_container: null - snmpnotifier: - snmpnotifier: - init_container: null replicas: alertmanager: 1 - snmpnotifier: 1 lifecycle: upgrades: deployment: @@ -83,8 +75,6 @@ pod: termination_grace_period: alertmanager: timeout: 30 - snmpnotifier: - timeout: 30 resources: enabled: false apache_proxy: @@ -109,13 +99,6 @@ pod: limits: memory: "1024Mi" cpu: "2000m" - snmpnotifier: - limits: - memory: "1024Mi" - cpu: "2000m" - requests: - memory: "128Mi" - cpu: "500m" endpoints: cluster_domain_suffix: cluster.local @@ -179,20 +162,6 @@ endpoints: port: ldap: default: 389 - snmpnotifier: - name: snmpnotifier - namespace: null - hosts: - default: snmp-engine - host_fqdn_override: - default: null - path: - default: /alerts - scheme: - default: 'http' - port: - api: - default: 9464 alerta: name: alerta namespace: null @@ -237,10 +206,6 @@ network: node_port: enabled: false port: 30903 - snmpnotifier: - node_port: - enabled: false - port: 30464 secrets: tls: @@ -270,9 +235,6 @@ manifests: service_discovery: true service_ingress: true statefulset: true - snmpnotifier: - service: true - deployment: true network_policy: alertmanager: @@ -385,16 +347,6 @@ conf: alertmanager: storage.path: /var/lib/alertmanager/data cluster.listen_address: "0.0.0.0:9094" - snmpnotifier: - alert_default_severity: crititcal - alert_severities: "critical,warning,info,page" - alert_severity_label: severity - log_level: debug - snmp_community: public - snmp_desination: 127.0.0.1:162 - snmp_trap_default_oid: 1.3.6.1.4.1.98789.0.1 - snmp_trap_description_template: /etc/snmp_notifier/description-template.tpl - snmp_version: V2c alertmanager: | global: # The smarthost and SMTP sender used for mail notifications. @@ -432,7 +384,7 @@ conf: repeat_interval: 3h # A default receiver # receiver: team-X-mails - receiver: snmp_notifier + receiver: alerta # All the above attributes are inherited by all child routes and can # overwritten on each. # The child route trees. @@ -442,8 +394,6 @@ conf: # services. - receiver: "alerta" continue: true - - receiver: "snmp_notifier" - continue: true - match_re: service: ^(foo1|foo2|baz)$ receiver: team-X-mails @@ -493,11 +443,6 @@ conf: - cluster - service receivers: - - name: 'snmp_notifier' - webhook_configs: - - send_resolved: true - #url: http://snmp-engine.osh-infra.svc.cluster.local:9464/alerts - url: {{ tuple "snmpnotifier" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }} - name: 'alerta' webhook_configs: - send_resolved: true diff --git a/prometheus-alertmanager/values_overrides/apparmor.yaml b/prometheus-alertmanager/values_overrides/apparmor.yaml index 4849de5db..04d378289 100644 --- a/prometheus-alertmanager/values_overrides/apparmor.yaml +++ b/prometheus-alertmanager/values_overrides/apparmor.yaml @@ -6,6 +6,4 @@ pod: prometheus-alertmanager: runtime/default prometheus-alertmanager-perms: runtime/default init: runtime/default - snmpnotifier: - snmpnotifier: runtime/default ...