Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiproject example #115

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/multi-cluster-ingress-projects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
417 changes: 417 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/README.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: whereami
namespace: whereami
spec:
replicas: 2
selector:
matchLabels:
app: whereami
version: v1
template:
metadata:
labels:
app: whereami
spec:
containers:
- name: whereami
image: us-docker.pkg.dev/google-samples/containers/gke/whereami:v1.2.11
ports:
- containerPort: 8080
87 changes: 87 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
apiVersion: networking.gke.io/v1
kind: MultiClusterIngress
metadata:
name: foobar-ingress
namespace: multi-cluster-demo
spec:
template:
spec:
backend:
serviceName: default-backend
servicePort: 8080
rules:
- host: foo.example.com
http:
paths:
- backend:
serviceName: foo
servicePort: 8080
- host: bar.example.com
http:
paths:
- backend:
serviceName: bar
servicePort: 8080
---
apiVersion: networking.gke.io/v1
kind: MultiClusterService
metadata:
name: foo
namespace: multi-cluster-demo
spec:
template:
spec:
selector:
app: foo
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: networking.gke.io/v1
kind: MultiClusterService
metadata:
name: bar
namespace: multi-cluster-demo
annotations:
beta.cloud.google.com/backend-config: '{"ports": {"8080":"backend-health-check"}}'
spec:
template:
spec:
selector:
app: bar
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: networking.gke.io/v1
kind: MultiClusterService
metadata:
name: default-backend
namespace: multi-cluster-demo
annotations:
beta.cloud.google.com/backend-config: '{"default": "backend-health-check"}'
spec:
template:
spec:
selector:
app: default-backend
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
---
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: backend-health-check
namespace: multi-cluster-demo
spec:
healthCheck:
requestPath: /healthz
port: 8080
type: HTTP
70 changes: 70 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/ingress_gw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingressgateway
spec:
replicas: 3
selector:
matchLabels:
asm: ingressgateway
template:
metadata:
annotations:
# This is required to tell Anthos Service Mesh to inject the gateway with the
# required configuration.
inject.istio.io/templates: gateway
labels:
asm: ingressgateway
spec:
containers:
- name: istio-proxy
image: auto # The image will automatically update each time the pod starts.
resources:
limits:
cpu: 2000m
memory: 1024Mi
requests:
cpu: 100m
memory: 128Mi
serviceAccountName: ingressgateway
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: ingressgateway
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: ingressgateway
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingressgateway
subjects:
- kind: ServiceAccount
name: ingressgateway
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ingressgateway
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: ingressgateway
spec:
selector:
asm: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
6 changes: 6 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio.io/rev: asm-managed-stable
name: whereami
11 changes: 11 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: whereami
namespace: whereami
spec:
selector:
app: whereami
ports:
- port: 80
targetPort: 8080
16 changes: 16 additions & 0 deletions ingress/multi-cluster/mci-multi-projects/virtual_service_app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: frontend
namespace: whereami
spec:
hosts:
- "whereami.example.com"
gateways:
- mesh
http:
- route:
- destination:
host: whereami
port:
number: 80
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: frontend
namespace: whereami
spec:
hosts:
- "whereami.example.com"
gateways:
- asmingress/ingressgateway
http:
- route:
- destination:
host: whereami
port:
number: 80