# JHipster Registry HA cluster
#
# Note that as this is based on a StatefulSet, it will only work on Kubernetes >= 1.5
#
# By default, the JHipster Registry and its UI is not accessible from outside the cluster for security reasons
# You can setup temporary access to it on localhost:8761 by running :
#   kubectl port-forward jhipster-registry-0 8761
#
# To scale your JHipster Registry cluster :
#   In this file, change the value of spec.replicas and CLUSTER_SIZE to any value
#   Apply the descriptor again : `kubectl apply -f jhipster-registry.yml`
#   This will create new replicas with the correct CLUSTER_SIZE which is mandatory so that all Eureka server can connect directly to all the others.
#   Then delete the previous replica pods one by one so that they can be recreated with the correct CLUSTER_SIZE configuration.
#   `kubectl delete pod jhipster-registry-0`, `kubectl delete pod jhipster-registry-1`
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jhipster-registry
spec:
  # added to circumvent kustomize bug
  volumeClaimTemplates: []
  serviceName: jhipster-registry
  replicas: 2
  selector:
    matchLabels:
      app: jhipster-registry
      version: "1.0"
  template:
    metadata:
      labels:
        app: jhipster-registry
        version: "1.0"
    spec:
      terminationGracePeriodSeconds: 10
      containers:
        - name: jhipster-registry
          image: jhipster/jhipster-registry:v6.7.1
          ports:
            - containerPort: 8761
          envFrom:
          - configMapRef:
              name: jhipster-registry
              optional: false
          - secretRef:
              name: registry-secret
          volumeMounts:
            - name: config-volume
              mountPath: /central-config
      volumes:
        - name: config-volume
          configMap:
            name: application-config
