Skip to content

Instantly share code, notes, and snippets.

@Miciah
Created October 7, 2021 18:10
Show Gist options
  • Save Miciah/cc308b717a9e8c9b74d3f97393a5827b to your computer and use it in GitHub Desktop.
Save Miciah/cc308b717a9e8c9b74d3f97393a5827b to your computer and use it in GitHub Desktop.
% cat ~/tmp/ingresscontroller-sharding-example/cluster-ingress-config.yaml
apiVersion: config.openshift.io/v1
kind: Ingress
metadata:
name: cluster
spec:
domain: apps.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
appsDomain: custom.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
% cat ~/tmp/ingresscontroller-sharding-example/default-ingresscontroller.yaml
apiVersion: operator.openshift.io/v1
kind: IngressController
metadata:
name: default
namespace: openshift-ingress-operator
spec:
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: In
values:
- openshift-authentication
- openshift-console
- openshift-ingress-canary
- openshift-monitoring
% cat ~/tmp/ingresscontroller-sharding-example/custom-ingresscontroller.yaml
apiVersion: operator.openshift.io/v1
kind: IngressController
metadata:
name: custom
namespace: openshift-ingress-operator
spec:
domain: custom.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: NotIn
values:
- openshift-authentication
- openshift-console
- openshift-ingress-canary
- openshift-monitoring
% oc apply -f ~/tmp/ingresscontroller-sharding-example
Warning: oc apply should be used on resource created by either oc create --save-config or oc apply
ingress.config.openshift.io/cluster configured
ingresscontroller.operator.openshift.io/custom created
Warning: oc apply should be used on resource created by either oc create --save-config or oc apply
ingresscontroller.operator.openshift.io/default configured
% # Wait a few minutes for openshift-apiserver to restart all pods.
% oc -n openshift-apiserver get pods
NAME READY STATUS RESTARTS AGE
apiserver-5c9b8cb5b6-2p8dg 2/2 Running 0 4m1s
apiserver-5c9b8cb5b6-d2gjc 2/2 Running 0 5m23s
apiserver-5c9b8cb5b6-hv4r4 2/2 Running 0 6m45s
% oc adm new-project hello-openshift && oc -n hello-openshift create -f ~/src/github.com/openshift/origin/examples/hello-openshift/hello-pod.json && oc -n hello-openshift expose pod/hello-openshift && oc -n hello-openshift expose svc/hello-openshift && oc -n hello-openshift get routes
Created project hello-openshift
pod/hello-openshift created
service/hello-openshift exposed
route.route.openshift.io/hello-openshift exposed
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
hello-openshift hello-openshift-hello-openshift.custom.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com hello-openshift 8080 None
% curl http://hello-openshift-hello-openshift.custom.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
Hello OpenShift!
% oc -n openshift-console get routes
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
console console-openshift-console.apps.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com console https reencrypt/Redirect None
downloads downloads-openshift-console.apps.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com downloads http edge/Redirect None
% curl -kI https://console-openshift-console.apps.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
HTTP/1.1 200 OK
referrer-policy: strict-origin-when-cross-origin
set-cookie: csrf-token=ryp8LwoR26pRXlfI9CSnhZvatGfXpsCcav+PDE0/iZJIYvFQTLXZYfaoA/6vbprG5JMYIwplOuz+nL0GhrK8rw==; Path=/; Secure
x-content-type-options: nosniff
x-dns-prefetch-control: off
x-frame-options: DENY
x-xss-protection: 1; mode=block
date: Thu, 07 Oct 2021 18:05:27 GMT
content-type: text/html; charset=utf-8
set-cookie: 1e2670d92730b515ce3a1bb65da45062=ce1cacff25b0f0af4169dc3c71f345cd; path=/; HttpOnly; Secure; SameSite=None
cache-control: private
% oc -n openshift-ingress rsh -c router deploy/router-default grep -e \^backend -- haproxy.config
backend be_sni
backend be_no_sni
backend openshift_default
backend be_tcp:openshift-authentication:oauth-openshift
backend be_secure:openshift-console:console
backend be_edge_http:openshift-console:downloads
backend be_edge_http:openshift-ingress-canary:canary
backend be_secure:openshift-monitoring:alertmanager-main
backend be_secure:openshift-monitoring:grafana
backend be_secure:openshift-monitoring:prometheus-k8s
backend be_secure:openshift-monitoring:thanos-querier
% oc -n openshift-ingress rsh -c router deploy/router-custom grep -e \^backend -- haproxy.config
backend be_sni
backend be_no_sni
backend openshift_default
backend be_http:hello-openshift:hello-openshift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment