Skip to content

Instantly share code, notes, and snippets.

@ironcladlou
Created October 16, 2019 22:05
Show Gist options
  • Save ironcladlou/70e9e25c42bb625c3737ff5e964bb77a to your computer and use it in GitHub Desktop.
Save ironcladlou/70e9e25c42bb625c3737ff5e964bb77a to your computer and use it in GitHub Desktop.
kind: Template
apiVersion: v1
metadata:
name: traffic-policy-demo
parameters:
- name: GATEWAY_NODE
required: true
- name: NON_GATEWAY_NODE
required: true
objects:
#
# This app is co-located with an LB gateway node (i.e. router node)
#
- kind: Pod
apiVersion: v1
metadata:
name: local-app
labels:
component: local-app
spec:
nodeName: ${GATEWAY_NODE}
containers:
- name: nginx
image: nginx
ports:
- name: http
containerPort: 80
protocol: TCP
- kind: Service
apiVersion: v1
metadata:
name: local-app
spec:
selector:
component: local-app
ports:
- protocol: TCP
port: 80
targetPort: http
- apiVersion: v1
kind: Route
metadata:
name: local-app
spec:
host: local-traffic-policy-demo.apps.dmace.devcluster.openshift.com
to:
kind: Service
name: local-app
#
# This app is NOT colocated with an LB gateway node (i.e. router node)
#
- kind: Pod
apiVersion: v1
metadata:
name: nonlocal-app
labels:
component: nonlocal-app
spec:
nodeName: ${NON_GATEWAY_NODE}
containers:
- name: nginx
image: nginx
ports:
- name: http
containerPort: 80
protocol: TCP
- kind: Service
apiVersion: v1
metadata:
name: nonlocal-app
spec:
selector:
component: nonlocal-app
ports:
- protocol: TCP
port: 80
targetPort: http
- apiVersion: v1
kind: Route
metadata:
name: nonlocal-app
spec:
host: nonlocal-traffic-policy-demo.apps.dmace.devcluster.openshift.com
to:
kind: Service
name: nonlocal-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment