# License terms and conditions for Gluu Cloud Native Edition:
# https://www.apache.org/licenses/LICENSE-2.0
apiVersion: apps/v1
kind: Deployment
metadata:
  name: radius
spec:
  replicas: 1
  selector:
    matchLabels:
      app: radius
  template:
    spec:
      containers:
      - name: radius
        imagePullPolicy: Always
        image: gluufederation/radius:4.2.0_01
        command:
          - /bin/sh
          - -c
          - |
              /usr/bin/python3 /scripts/update-lb-ip.py &
              /app/scripts/entrypoint.sh
        resources:
          requests:
            memory: "700Mi"
            cpu: "700m"
          limits:
            memory: "700Mi"
            cpu: "700m"
        ports:
        - containerPort: 8080
        - containerPort: 1812
        - containerPort: 1813
        envFrom:
        - configMapRef:
            name: gluu-config-cm
        volumeMounts:
          - name: cb-pass
            mountPath: "/etc/gluu/conf/couchbase_password"
            subPath: couchbase_password
          - name: cb-crt
            mountPath: "/etc/certs/couchbase.crt"
            subPath: couchbase.crt            
          - mountPath: /scripts
            name: update-lb-ip
        livenessProbe:
          exec:
            command:
            - cat
            - /tmp/gluu-radius-health
          initialDelaySeconds: 30
          periodSeconds: 30
        readinessProbe:
          exec:
            command:
            - cat
            - /tmp/gluu-radius-health
          initialDelaySeconds: 25
          periodSeconds: 25
      hostAliases:
      - ip: NGINX_IP
        hostnames:
        - FQDN
      volumes:
      - name: cb-pass
        secret:
          secretName: cb-pass
      - name: cb-crt
        secret:
          secretName: cb-crt
      - name: update-lb-ip
        configMap:
          name: updatelbip