apiVersion: apps/v1
kind: Deployment                 # Type of Kubernetes resource
metadata:
  name: portal-demo-app          # Unique name of the Kubernetes resource
spec:
  replicas: 3                    # Number of pods to run at any given time
  selector:
    matchLabels:
      app: portal-demo-app       # This deployment applies to any Pods matching the specified label
  template:                      # This deployment will create a set of pods using the configurations in this template
    metadata:
      labels:                    # The labels that will be applied to all of the pods in this deployment
        app: portal-demo-app
    spec:
      initContainers:
      - name: init-mysql
        image: busybox:1.28
        command: ['sh', '-c', "until nslookup mysql-demo-db.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mysql-demo-db; sleep 2; done"]
      - name: init-redis
        image: busybox:1.28
        command: ['sh', '-c', "until nslookup redis-demo-db.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for redis-demo-db; sleep 2; done"]
      containers:
      - name: portal-demo-app-1
        image: bmutziu/portal-demo-app:1.0-alpha
        imagePullPolicy: Always
        resources:
          requests:
            cpu: 100m
            memory: 1000Mi
        ports:
          - containerPort: 3000  # Should match the port number that the Angular application listens on
