kind: Namespace
apiVersion: v1
metadata:
  name: mcgi-bg
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample-app
  namespace: mcgi-bg
spec:
  replicas: 2
  selector:
    matchLabels:
      app: sample-app
      version: v1
  template:
    metadata:
      labels:
        app: sample-app
        version: v1
    spec:
      containers:
      - name: whereami
        image: us-docker.pkg.dev/google-samples/containers/gke/whereami:v1.2.20
        ports:
          - containerPort: 8080
        env:
        - name: METADATA
          value: "sample-app-green"
---
# used for explicit load balancing
apiVersion: v1
kind: Service
metadata:
  name: sample-app-green
  namespace: mcgi-bg
spec:
  selector:
    app: sample-app
    version: v1
  ports:
  - port: 8080
    targetPort: 8080
---
# used for explicit load balancing
kind: ServiceExport
apiVersion: net.gke.io/v1
metadata:
  name: sample-app-green
  namespace: mcgi-bg
---
# used for implicit load balancing
apiVersion: v1
kind: Service
metadata:
  name: sample-app
  namespace: mcgi-bg
spec:
  selector:
    app: sample-app
    version: v1
  ports:
  - port: 8080
    targetPort: 8080
---
# used for implicit load balancing
kind: ServiceExport
apiVersion: net.gke.io/v1
metadata:
  name: sample-app
  namespace: mcgi-bg
