---
apiVersion: "apps/v1"
kind: Deployment
metadata:
  name: pekko-bootstrap-demo
  labels:
    app: pekko-bootstrap-demo
spec:
  replicas: 3
  selector:
    matchLabels:
      app: pekko-bootstrap-demo
#update
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
 #update

  template:
    metadata:
      labels:
        app: pekko-bootstrap-demo
    spec:
      restartPolicy: Always
      containers:
      - name: pekko-bootstrap-demo
        image: "integration-test-kubernetes-dns:1.3.3.7"
        imagePullPolicy: IfNotPresent
        #health
        readinessProbe:
          httpGet:
            path: /ready
            port: management
        livenessProbe:
          httpGet:
            path: /alive
            port: management
        #health
        ports:
        - containerPort: 7626
          # when contact-point-discovery.port-name is set for cluster bootstrap,
          # the management port must be named accordingly:
          # name: management
        - containerPort: 7355
          name: remoting
        env:
        # Possibly can be removed now that async-dns supports search domains
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        # The DNS-based discovery will use this service name to look for the headless
        # service defined below
        - name: PEKKO_CLUSTER_BOOTSTRAP_SERVICE_NAME
          value: "integration-test-kubernetes-dns-internal"

---
#headless
apiVersion: v1
kind: Service
metadata:
  labels:
    app: pekko-bootstrap-demo
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
  name: "integration-test-kubernetes-dns-internal"
spec:
  ports:
  - name: management
    port: 7626
    protocol: TCP
    targetPort: 7626
  - name: remoting
    port: 7355
    protocol: TCP
    targetPort: 7355
  selector:
    app: pekko-bootstrap-demo
  clusterIP: None
  publishNotReadyAddresses: true
#headless
---
#public
apiVersion: v1
kind: Service
metadata:
  labels:
    app: pekko-bootstrap-demo
  name: "integration-test-kubernetes-dns"
spec:
  ports:
  - name: http
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: "pekko-bootstrap-demo"
  type: LoadBalancer
#public
