---
apiVersion: v1
kind: Service
metadata:
  name: redis-master
  namespace: {{ .Release.Namespace | quote }}
spec:
  ports:
  - name: tcp-redis
    port: 6379
    protocol: TCP
    targetPort: tcp-redis
  selector:
    app.kubernetes.io/instance: extra
    app.kubernetes.io/name: redis
  type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: redis
data:
  redis.conf: |
    bind 0.0.0.0
    port 6379
    user default on >pass ~* &* +@all
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
  namespace: {{ .Release.Namespace | quote }}
  labels:
    app.kubernetes.io/instance: extra
    app.kubernetes.io/name: redis
spec:
  selector:
    matchLabels:
      app.kubernetes.io/instance: extra
      app.kubernetes.io/name: redis
  replicas: 1
  template:
    metadata:
      labels:
        app.kubernetes.io/instance: extra
        app.kubernetes.io/name: redis
    spec:
      containers:
      - name: redis
        args:
          - redis-server
          - /usr/local/etc/redis/redis.conf
        image: "redis:8.2-alpine"
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 6379
          name: tcp-redis
        volumeMounts:
        - name: redis
          mountPath: "/usr/local/etc/redis"
          readOnly: true
      volumes:
      - name: redis
        configMap:
          name: redis
