c7d0317768
This adds the ability to drive the CGI configuration for nagios via values, similar to the other nagios configuration entities Change-Id: I8e9de21d141e0a87cdda11c4a778abec210277f3
182 lines
6.6 KiB
YAML
182 lines
6.6 KiB
YAML
{{/*
|
|
Copyright 2017 The Openstack-Helm Authors.
|
|
|
|
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.deployment }}
|
|
{{- $envAll := . }}
|
|
|
|
{{- $nagiosUserSecret := .Values.secrets.nagios.admin }}
|
|
|
|
{{- $serviceAccountName := "nagios" }}
|
|
{{ tuple $envAll "nagios" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
rules:
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- nodes
|
|
- nodes/proxy
|
|
- services
|
|
- endpoints
|
|
- pods
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- ""
|
|
resources:
|
|
- configmaps
|
|
verbs:
|
|
- get
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: {{ $serviceAccountName }}
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: {{ $serviceAccountName }}
|
|
namespace: {{ .Release.Namespace }}
|
|
roleRef:
|
|
kind: ClusterRole
|
|
name: {{ $serviceAccountName }}
|
|
apiGroup: rbac.authorization.k8s.io
|
|
---
|
|
apiVersion: extensions/v1beta1
|
|
kind: Deployment
|
|
metadata:
|
|
name: nagios
|
|
spec:
|
|
replicas: {{ .Values.pod.replicas.nagios }}
|
|
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{ tuple $envAll "nagios" "monitoring" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
|
spec:
|
|
serviceAccountName: {{ $serviceAccountName }}
|
|
nodeSelector:
|
|
{{ .Values.labels.nagios.node_selector_key }}: {{ .Values.labels.nagios.node_selector_value }}
|
|
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.nagios.timeout | default "30" }}
|
|
initContainers:
|
|
{{ tuple $envAll "nagios" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
|
|
containers:
|
|
- name: apache-proxy
|
|
{{ tuple $envAll "apache_proxy" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.apache_proxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
command:
|
|
- /tmp/apache.sh
|
|
- start
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ tuple "nagios" "internal" "http" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
|
env:
|
|
- name: NAGIOS_PORT
|
|
value: {{ tuple "nagios" "internal" "nagios" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
|
|
- name: LDAP_URL
|
|
value: {{ tuple "ldap" "default" "ldap" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | quote }}
|
|
- name: NAGIOSADMIN_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $nagiosUserSecret }}
|
|
key: NAGIOSADMIN_USER
|
|
- name: NAGIOSADMIN_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $nagiosUserSecret }}
|
|
key: NAGIOSADMIN_PASS
|
|
- name: BIND_DN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $nagiosUserSecret }}
|
|
key: BIND_DN
|
|
- name: BIND_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $nagiosUserSecret }}
|
|
key: BIND_PASSWORD
|
|
volumeMounts:
|
|
- name: nagios-bin
|
|
mountPath: /tmp/apache.sh
|
|
subPath: apache.sh
|
|
readOnly: true
|
|
- name: nagios-etc
|
|
mountPath: /usr/local/apache2/conf/httpd.conf
|
|
subPath: httpd.conf
|
|
readOnly: true
|
|
- name: pod-etc-apache
|
|
mountPath: /usr/local/apache2/conf/sites-enabled
|
|
- name: nagios-etc
|
|
mountPath: /usr/local/apache2/conf/sites-enabled/nagios-host.conf
|
|
subPath: nagios-host.conf
|
|
readOnly: true
|
|
- name: nagios
|
|
{{ tuple $envAll "nagios" | include "helm-toolkit.snippets.image" | indent 10 }}
|
|
{{ tuple $envAll $envAll.Values.pod.resources.nagios | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
|
ports:
|
|
- name: nagios
|
|
containerPort: {{ tuple "nagios" "internal" "nagios" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
|
env:
|
|
- name: PROMETHEUS_SERVICE
|
|
value: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}
|
|
- name: SNMP_NOTIF_PRIMARY_TARGET_WITH_PORT
|
|
value: {{ $envAll.Values.conf.nagios.notification.snmp.primary_target }}
|
|
- name: SNMP_NOTIF_SECONDARY_TARGET_WITH_PORT
|
|
value: {{ $envAll.Values.conf.nagios.notification.snmp.secondary_target }}
|
|
- name: REST_NOTIF_PRIMARY_TARGET_URL
|
|
value: {{ $envAll.Values.conf.nagios.notification.http.primary_target }}
|
|
- name: REST_NOTIF_SECONDARY_TARGET_URL
|
|
value: {{ $envAll.Values.conf.nagios.notification.http.secondary_target }}
|
|
- name: NAGIOSADMIN_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $nagiosUserSecret }}
|
|
key: NAGIOSADMIN_USER
|
|
- name: NAGIOSADMIN_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $nagiosUserSecret }}
|
|
key: NAGIOSADMIN_PASS
|
|
volumeMounts:
|
|
- name: nagios-etc
|
|
mountPath: /opt/nagios/etc/nagios.cfg
|
|
subPath: nagios.cfg
|
|
readOnly: true
|
|
- name: nagios-etc
|
|
mountPath: /opt/nagios/etc/cgi.cfg
|
|
subPath: cgi.cfg
|
|
readOnly: true
|
|
- name: nagios-etc
|
|
mountPath: /opt/nagios/etc/nagios_objects.cfg
|
|
subPath: nagios_objects.cfg
|
|
readOnly: true
|
|
volumes:
|
|
- name: nagios-etc
|
|
configMap:
|
|
name: nagios-etc
|
|
defaultMode: 0444
|
|
- name: pod-etc-apache
|
|
emptyDir: {}
|
|
- name: nagios-bin
|
|
configMap:
|
|
name: nagios-bin
|
|
defaultMode: 0555
|
|
{{- end }}
|