#@ load("@ytt:data", "data")

#@ ns = data.values.application.namespace

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
  namespace: #@ ns
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: redis
  template:
    metadata:
      labels:
        app.kubernetes.io/name: redis
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 999
        runAsGroup: 999
        fsGroup: 999
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: redis
          image: docker.io/redis:7-alpine
          imagePullPolicy: IfNotPresent
          command: ["redis-server", "--save", "", "--appendonly", "no"]
          ports:
            - name: redis
              containerPort: 6379
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop:
                - ALL
          resources:
            requests:
              cpu: 10m
              memory: 16Mi
            limits:
              memory: 64Mi
---
apiVersion: v1
kind: Service
metadata:
  name: redis
  namespace: #@ ns
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: redis
  ports:
    - name: redis
      port: 6379
      targetPort: redis
