apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: argocd-redis
    app.kubernetes.io/part-of: argocd
    app.kubernetes.io/component: redis
  name: argocd-redis
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: argocd-redis
  template:
    metadata:
      labels:
        app.kubernetes.io/name: argocd-redis
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 999
      serviceAccountName: argocd-redis        
      containers:
      - name: redis
        image: redis:7.0.0-alpine
        imagePullPolicy: Always
        args:
        - "--save"
        - ""
        - "--appendonly"
        - "no"
        ports:
        - containerPort: 6379
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - all
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchLabels:
                  app.kubernetes.io/name: argocd-redis
              topologyKey: kubernetes.io/hostname
          - weight: 5
            podAffinityTerm:
              labelSelector:
                matchLabels:
                  app.kubernetes.io/part-of: argocd
              topologyKey: kubernetes.io/hostname
