Commit 6fabe893 authored by garciadeblas's avatar garciadeblas
Browse files

Merge branch 'secure_snmp_ee_chart' into 'master'

Move snmp exporter from a separate deployment to the EE statefulset

See merge request !219
parents ad59f343 f66bf296
Loading
Loading
Loading
Loading
Loading
+0 −64
Original line number Diff line number Diff line
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "snmpexporter.fullname" . }}
  labels:
    vnf: {{ .Values.global.osm.vnf_id | lower}}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "snmpexporter.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "snmpexporter.selectorLabels" . | nindent 8 }}
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: vnf
                operator: In
                values:
                - {{ .Values.global.osm.vnf_id | lower}}
            topologyKey: "kubernetes.io/hostname"
      securityContext:
        runAsUser: 0
      initContainers:
        - name: init-config
          image: busybox:1.28
          command: ['sh', '-c', 'if [ ! -f "/etc/snmp_exporter/snmp.yml" ]; then cp /etc/snmp_exporter_init/snmp.yml /etc/snmp_exporter; fi']
          volumeMounts:
            - name: config-volume
              mountPath: /etc/snmp_exporter
            - name: init-config-volume
              mountPath: /etc/snmp_exporter_init
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - containerPort: 9116
              protocol: TCP
          volumeMounts:
            - name: config-volume
              mountPath: /etc/snmp_exporter
          livenessProbe:
            exec:
              command:
                - /bin/sh
                - -c
                - if [ ! -f "/etc/snmp_exporter/generator.yml" ]; then exit 0; else rm -f /etc/snmp_exporter/generator.yml && exit 1; fi
            failureThreshold: 1
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      volumes:
        - name: config-volume
          hostPath: 
            path: "/var/lib/osm/snmp_exporter/{{ .Values.global.osm.vnf_id | lower }}/"
        - name: init-config-volume
          configMap:
            name: "snmp-init-config-{{ .Release.Name }}"
          
+2 −1
Original line number Diff line number Diff line
@@ -12,4 +12,5 @@ spec:
      protocol: TCP
      name: snmp
  selector:
    {{- include "snmpexporter.selectorLabels" . | nindent 4 }}
 No newline at end of file
    app.kubernetes.io/name: {{ include "eechart.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
+32 −4
Original line number Diff line number Diff line
@@ -21,7 +21,34 @@ spec:
      serviceAccountName: {{ template "eechart.serviceAccountName" . }}
      securityContext:
        runAsUser: 0
      initContainers:
        - name: init-config
          image: busybox:1.28
          command: ['sh', '-c', 'if [ ! -f "/etc/snmp_exporter/snmp.yml" ]; then cp /etc/snmp_exporter_init/snmp.yml /etc/snmp_exporter; fi']
          volumeMounts:
            - name: snmp-config-volume
              mountPath: /etc/snmp_exporter
            - name: init-config-volume
              mountPath: /etc/snmp_exporter_init
      containers:
        - name: snmpexporter
          image: "{{ .Values.snmp.image.repository }}:{{ .Values.snmp.image.version }}"
          imagePullPolicy: {{ .Values.snmp.image.pullPolicy }}
          ports:
            - containerPort: 9116
              protocol: TCP
          volumeMounts:
            - name: snmp-config-volume
              mountPath: /etc/snmp_exporter
          livenessProbe:
            exec:
              command:
                - /bin/sh
                - -c
                - if [ ! -f "/etc/snmp_exporter/generator.yml" ]; then exit 0; else rm -f /etc/snmp_exporter/generator.yml && exit 1; fi
            failureThreshold: 1
          resources:
            {{- toYaml .Values.snmp.resources | nindent 12 }}
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
@@ -47,8 +74,10 @@ spec:
        configMap: 
          name:  {{ include "eechart.fullname" . }}
      - name: snmp-config-volume
        hostPath: 
          path: "/var/lib/osm/snmp_exporter/{{ .Values.global.osm.vnf_id | lower }}/"
        emptyDir: {}
      - name: init-config-volume
        configMap:
          name: "snmp-init-config-{{ .Release.Name }}"
      - name: vnf-mibs
        configMap:
          name: "vnf-snmp-mibs-{{ .Release.Name }}"
@@ -56,5 +85,4 @@ spec:
        configMap:
          name: "vnf-snmp-generator-{{ .Release.Name }}"
      - name: osm-ee
        hostPath:
          path: /var/lib/osm/osm/osm_osm_packages/_data
        emptyDir: {}
+7 −0
Original line number Diff line number Diff line
@@ -13,6 +13,13 @@ image:
  tag: latest
  pullPolicy: IfNotPresent
  
snmp:
  image:
    repository: prom/snmp-exporter
    version: v0.17.0
    pullPolicy: IfNotPresent
  resources: {}

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""