apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: squid
  name: squid
spec:
  replicas: 1
  selector:
    matchLabels:
      app: squid
  template:
    metadata:
      labels:
        app: squid
    spec:
      securityContext:
        runAsUser: 13
        runAsGroup: 13
        fsGroup: 13
      containers:
      - image: allir/squid
        imagePullPolicy: Always
        name: squid
        env:
        - name: SQUID_CONFIG
          value: /etc/squid/squid.conf
        - name: SQUID_CACHE_DIR
          value: /var/spool/squid
        - name: SQUID_CERT_DB_GENERATE
          value: 'true'
        - name: SQUID_CERT_DB_SIZE
          value: 4MB
        resources:
          requests:
            cpu: 10m
            memory: 64Mi
          limits:
            cpu: 1000m
            memory: 512Mi
        volumeMounts:
        - mountPath: /var/run/squid
          name: run-volume
        - mountPath: /var/spool/squid
          name: cache-volume
        - mountPath: /etc/squid/certs
          name: cert-volume
        - mountPath: /etc/squid/squid.conf
          name: config-volume
          subPath: squid.conf
      volumes:
      - name: run-volume
        emptyDir: {}
      - name: cache-volume
        emptyDir: {}
      - name: cert-volume
        secret:
          defaultMode: 0640
          secretName: squid-cert
      - name: config-volume
        configMap:
          defaultMode: 0644
          name: squid-config
