boynux/squid-exporter

View on GitHub
helm/templates/deployment.yaml

Summary

Maintainability
Test Coverage
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "squid-exporter.fullname" . }}
  labels:
    {{- include "squid-exporter.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "squid-exporter.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
      {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "squid-exporter.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "squid-exporter.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          envFrom:
            - secretRef:
                name: {{ include "squid-exporter.fullname" . }}
          env:
            - name: SQUID_EXPORTER_LISTEN
              value: "0.0.0.0:9301"
            - name: SQUID_EXPORTER_METRICS_PATH
              value: /metrics
            - name: SQUID_HOSTNAME
              value: {{ required ".Values.squidConfig.hostname must be defined" .Values.squidConfig.hostname }}
            - name: SQUID_PORT
              value: {{ .Values.squidConfig.port | quote }}
          ports:
            - name: metrics
              containerPort: 9301
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: metrics
          readinessProbe:
            httpGet:
              path: /
              port: metrics
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}