apiVersion: v1
kind: Namespace
metadata:
  name: shared-infra-ns
---
apiVersion: v1
kind: Namespace
metadata:
  name: foobar-ns
---
apiVersion: v1
kind: Namespace
metadata:
  name: bam-ns
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: foo
  namespace: foobar-ns
spec:
  replicas: 2
  selector:
    matchLabels:
      app: foo
  template:
    metadata:
      labels:
        app: foo
    spec:
      containers:
      - name: whereami
        image: us-docker.pkg.dev/google-samples/containers/gke/whereami:v1.2.20
        ports:
          - containerPort: 8080
        env:
        - name: METADATA
          value: "foo"
---
apiVersion: v1
kind: Service
metadata:
  name: foo-svc
  namespace: foobar-ns
  annotations:
    cloud.google.com/neg: '{"exposed_ports": {"80":{}}}'
spec:
  selector:
    app: foo
  ports:
  - port: 80
    targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bar
  namespace: foobar-ns
spec:
  replicas: 2
  selector:
    matchLabels:
      app: bar
  template:
    metadata:
      labels:
        app: bar
    spec:
      containers:
      - name: whereami
        image: us-docker.pkg.dev/google-samples/containers/gke/whereami:v1.2.20
        ports:
          - containerPort: 8080
        env:
        - name: METADATA
          value: "bar"
---
apiVersion: v1
kind: Service
metadata:
  name: bar-svc
  namespace: foobar-ns
  annotations:
    cloud.google.com/neg: '{"exposed_ports": {"80":{}}}'
spec:
  selector:
    app: bar
  ports:
  - port: 80
    targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bam
  namespace: bam-ns
spec:
  replicas: 2
  selector:
    matchLabels:
      app: bam
  template:
    metadata:
      labels:
        app: bam
    spec:
      containers:
      - name: whereami
        image: us-docker.pkg.dev/google-samples/containers/gke/whereami:v1.2.20
        ports:
          - containerPort: 8080
        env:
        - name: METADATA
          value: "bam"
---
apiVersion: v1
kind: Service
metadata:
  name: bam-svc
  namespace: bam-ns
  annotations:
    cloud.google.com/neg: '{"exposed_ports": {"80":{}}}'
spec:
  selector:
    app: bam
  ports:
  - port: 80
    targetPort: 8080
