# SFU CMPT 756
#
# Kubernetes yaml to deploy pods as Endpoints of a Service.
# The matchLabels connect this Deployment to a Service.
# There can be several Deployments implementing Endpoints of the same Service.
# Each Deployment will typically be a different version.
#
# The Istio VirtualService and DestinationRules will route traffic to the
# different Deployments.
#
# Deployment's .spec.template.spec.containers.livenessProbe & readinessProbe
#    can be removed to clean up the logs
#
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cmpt756s3-v2
  labels:
    app: cmpt756s3
    version: v2
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cmpt756s3
      version: v2
  template:
    metadata:
      name: service3-pod
      labels:
        app: cmpt756s3
        version: v2
    spec:
      serviceAccountName: svc-s3
      containers:
      - name: cmpt756s3
        image: 'ZZ-CR-ID/ZZ-REG-ID/cmpt756s3:v2'
        imagePullPolicy: Always
        ports:
        - containerPort: 30003
        livenessProbe:
          httpGet:
            path: /api/v1/playlist/health
            port: 30003
          initialDelaySeconds: 10
          periodSeconds: 5
          failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /api/v1/playlist/readiness
            port: 30003
          initialDelaySeconds: 10
          periodSeconds: 5
          timeoutSeconds: 2
          successThreshold: 1
          failureThreshold: 5