You've already forked prometheus-fail2ban-exporter-charts
							
							
		
			
				
	
	
		
			439 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			439 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| chart:
 | |
|   appVersion: 0.1.0
 | |
|   version: 0.1.0
 | |
| suite: DaemonSet template (basic)
 | |
| release:
 | |
|   name: prometheus-fail2ban-exporter-unittest
 | |
|   namespace: testing
 | |
| templates:
 | |
| - templates/daemonSet.yaml
 | |
| - templates/secretWebConfig.yaml
 | |
| tests:
 | |
| - it: Rendering default
 | |
|   asserts:
 | |
|   - hasDocuments:
 | |
|       count: 1
 | |
|     template: templates/daemonSet.yaml
 | |
|   - containsDocument:
 | |
|       apiVersion: apps/v1
 | |
|       kind: DaemonSet
 | |
|       name: prometheus-fail2ban-exporter-unittest
 | |
|       namespace: testing
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: metadata.annotations
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: metadata.labels
 | |
|       value:
 | |
|         app.kubernetes.io/instance: prometheus-fail2ban-exporter-unittest
 | |
|         app.kubernetes.io/managed-by: Helm
 | |
|         app.kubernetes.io/name: prometheus-fail2ban-exporter
 | |
|         app.kubernetes.io/version: 0.1.0
 | |
|         helm.sh/chart: prometheus-fail2ban-exporter-0.1.0
 | |
|     template: templates/daemonSet.yaml
 | |
|   - exists:
 | |
|       path: spec.template.metadata.annotations.checksum/secret-web-config
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.metadata.labels
 | |
|       value:
 | |
|         app.kubernetes.io/instance: prometheus-fail2ban-exporter-unittest
 | |
|         app.kubernetes.io/managed-by: Helm
 | |
|         app.kubernetes.io/name: prometheus-fail2ban-exporter
 | |
|         app.kubernetes.io/version: 0.1.0
 | |
|         helm.sh/chart: prometheus-fail2ban-exporter-0.1.0
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.affinity
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.containers[0].envFrom
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].args
 | |
|       value:
 | |
|       # - --web.config.file=/etc/prometheus-fail2ban-exporter/config.d/webConfig.yaml
 | |
|       - --web.listen-address=:9191
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - mountPath: /var/run/fail2ban
 | |
|         name: socket
 | |
|       - mountPath: /etc/prometheus-fail2ban-exporter/config.d
 | |
|         name: config-d
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - hostPath:
 | |
|           path: /var/run/fail2ban
 | |
|           type: Directory
 | |
|         name: socket
 | |
|       - name: config-d
 | |
|         secret:
 | |
|           secretName: prometheus-fail2ban-exporter-unittest-web-config
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].image
 | |
|       value: git.cryptic.systems/volker.raschek/prometheus-fail2ban-exporter:0.1.0
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].imagePullPolicy
 | |
|       value: IfNotPresent
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.containers[0].resources
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.containers[0].securityContext
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.dnsConfig
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.dnsPolicy
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.hostname
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.hostNetwork
 | |
|       value: false
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.imagePullSecrets
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.nodeSelector
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.priorityClassName
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.restartPolicy
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.subdomain
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.terminationGracePeriodSeconds
 | |
|       value: 60
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.tolerations
 | |
|     template: templates/daemonSet.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.topologySpreadConstraints
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.updateStrategy
 | |
|       value:
 | |
|         rollingUpdate:
 | |
|           maxSurge: 1
 | |
|           maxUnavailable: 0
 | |
|         type: "RollingUpdate"
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test custom affinity
 | |
|   set:
 | |
|     daemonSet.affinity:
 | |
|       nodeAffinity:
 | |
|         requiredDuringSchedulingIgnoredDuringExecution:
 | |
|           nodeSelectorTerms:
 | |
|           - matchExpressions:
 | |
|             - key: topology.kubernetes.io/zone
 | |
|               operator: In
 | |
|               values:
 | |
|               - antarctica-east1
 | |
|               - antarctica-west1
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.affinity
 | |
|       value:
 | |
|         nodeAffinity:
 | |
|           requiredDuringSchedulingIgnoredDuringExecution:
 | |
|             nodeSelectorTerms:
 | |
|             - matchExpressions:
 | |
|               - key: topology.kubernetes.io/zone
 | |
|                 operator: In
 | |
|                 values:
 | |
|                 - antarctica-east1
 | |
|                 - antarctica-west1
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test additional arguments
 | |
|   set:
 | |
|     daemonSet.fail2banExporter.args:
 | |
|     - "--foo=bar"
 | |
|     - "--bar=foo"
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].args
 | |
|       value:
 | |
|       # - --web.config.file=/etc/prometheus-fail2ban-exporter/config.d/webConfig.yaml
 | |
|       - --web.listen-address=:9191
 | |
|       - --foo=bar
 | |
|       - --bar=foo
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test custom imageRegistry and imageRepository
 | |
|   set:
 | |
|     daemonSet.fail2banExporter.image.registry: registry.example.local
 | |
|     daemonSet.fail2banExporter.image.repository: path/special/prometheus-fail2ban-exporter
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].image
 | |
|       value: registry.example.local/path/special/prometheus-fail2ban-exporter:0.1.0
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test custom imagePullPolicy
 | |
|   set:
 | |
|     daemonSet.fail2banExporter.image.pullPolicy: Always
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].imagePullPolicy
 | |
|       value: Always
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test config.webConfig.existingSecret
 | |
|   set:
 | |
|     config.webConfig.existingSecret.enabled: true
 | |
|     config.webConfig.existingSecret.secretName: web-config-secret
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - mountPath: /var/run/fail2ban
 | |
|         name: socket
 | |
|       - mountPath: /etc/prometheus-fail2ban-exporter/config.d
 | |
|         name: config-d
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - hostPath:
 | |
|           path: /var/run/fail2ban
 | |
|           type: Directory
 | |
|         name: socket
 | |
|       - name: config-d
 | |
|         secret:
 | |
|           secretName: web-config-secret
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test custom resource limits and requests
 | |
|   set:
 | |
|     daemonSet.fail2banExporter.resources:
 | |
|       limits:
 | |
|         cpu: 100m
 | |
|         memory: 250MB
 | |
|       requests:
 | |
|         cpu: 25m
 | |
|         memory: 100MB
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].env
 | |
|       value:
 | |
|       - name: GOMAXPROCS
 | |
|         valueFrom:
 | |
|           resourceFieldRef:
 | |
|             divisor: "1"
 | |
|             resource: limits.cpu
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].resources
 | |
|       value:
 | |
|         limits:
 | |
|           cpu: 100m
 | |
|           memory: 250MB
 | |
|         requests:
 | |
|           cpu: 25m
 | |
|           memory: 100MB
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test custom securityContext
 | |
|   set:
 | |
|     daemonSet.fail2banExporter.securityContext:
 | |
|       capabilities:
 | |
|         add:
 | |
|         - NET_RAW
 | |
|         drop:
 | |
|         - ALL
 | |
|       privileged: false
 | |
|       readOnlyRootFilesystem: true
 | |
|       runAsNonRoot: true
 | |
|       runAsUser: 1000
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].securityContext
 | |
|       value:
 | |
|         capabilities:
 | |
|           add:
 | |
|           - NET_RAW
 | |
|           drop:
 | |
|           - ALL
 | |
|         privileged: false
 | |
|         readOnlyRootFilesystem: true
 | |
|         runAsNonRoot: true
 | |
|         runAsUser: 1000
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test dnsConfig
 | |
|   set:
 | |
|     daemonSet.dnsConfig:
 | |
|       nameservers:
 | |
|       - "8.8.8.8"
 | |
|       - "8.8.4.4"
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.dnsConfig
 | |
|       value:
 | |
|         nameservers:
 | |
|         - "8.8.8.8"
 | |
|         - "8.8.4.4"
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test dnsPolicy
 | |
|   set:
 | |
|     daemonSet.dnsPolicy: ClusterFirst
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.dnsPolicy
 | |
|       value: ClusterFirst
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test hostNetwork, hostname, subdomain
 | |
|   set:
 | |
|     daemonSet.hostNetwork: true
 | |
|     daemonSet.hostname: pg-exporter
 | |
|     daemonSet.subdomain: exporters.internal
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.hostNetwork
 | |
|       value: true
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.hostname
 | |
|       value: pg-exporter
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.subdomain
 | |
|       value: exporters.internal
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test imagePullSecrets
 | |
|   set:
 | |
|     daemonSet.imagePullSecrets:
 | |
|     - name: my-pull-secret
 | |
|     - name: my-special-secret
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.imagePullSecrets
 | |
|       value:
 | |
|       - name: my-pull-secret
 | |
|       - name: my-special-secret
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test nodeSelector
 | |
|   set:
 | |
|     daemonSet.nodeSelector:
 | |
|       foo: bar
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.nodeSelector
 | |
|       value:
 | |
|         foo: bar
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test priorityClassName
 | |
|   set:
 | |
|     daemonSet.priorityClassName: my-priority
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.priorityClassName
 | |
|       value: my-priority
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test restartPolicy
 | |
|   set:
 | |
|     daemonSet.restartPolicy: Always
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.restartPolicy
 | |
|       value: Always
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test terminationGracePeriodSeconds
 | |
|   set:
 | |
|     daemonSet.terminationGracePeriodSeconds: 120
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.terminationGracePeriodSeconds
 | |
|       value: 120
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test tolerations
 | |
|   set:
 | |
|     daemonSet.tolerations:
 | |
|     - key: database/type
 | |
|       operator: Equal
 | |
|       value: fail2ban
 | |
|       effect: NoSchedule
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.tolerations
 | |
|       value:
 | |
|       - key: database/type
 | |
|         operator: Equal
 | |
|         value: fail2ban
 | |
|         effect: NoSchedule
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test topologySpreadConstraints
 | |
|   set:
 | |
|     daemonSet.topologySpreadConstraints:
 | |
|     - topologyKey: kubernetes.io/hostname
 | |
|       whenUnsatisfiable: DoNotSchedule
 | |
|       labelSelector:
 | |
|         matchLabels:
 | |
|           app.kubernetes.io/instance: prometheus-fail2ban-exporter
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.topologySpreadConstraints
 | |
|       value:
 | |
|       - topologyKey: kubernetes.io/hostname
 | |
|         whenUnsatisfiable: DoNotSchedule
 | |
|         labelSelector:
 | |
|           matchLabels:
 | |
|             app.kubernetes.io/instance: prometheus-fail2ban-exporter
 | |
|     template: templates/daemonSet.yaml
 | |
| 
 | |
| - it: Test additional volumeMounts and volumes
 | |
|   set:
 | |
|     daemonSet.fail2banExporter.volumeMounts:
 | |
|     - name: data
 | |
|       mountPath: /usr/lib/prometheus-fail2ban-exporter/data
 | |
|     daemonSet.volumes:
 | |
|     - name: data
 | |
|       hostPath:
 | |
|         path: /usr/lib/prometheus-fail2ban-exporter/data
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - name: data
 | |
|         mountPath: /usr/lib/prometheus-fail2ban-exporter/data
 | |
|       - name: config-d
 | |
|         mountPath: /etc/prometheus-fail2ban-exporter/config.d
 | |
|     template: templates/daemonSet.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - name: data
 | |
|         hostPath:
 | |
|           path: /usr/lib/prometheus-fail2ban-exporter/data
 | |
|       - name: config-d
 | |
|         secret:
 | |
|           secretName: prometheus-fail2ban-exporter-unittest-web-config
 | |
|     template: templates/daemonSet.yaml |