|
|
47c289 |
# Spike: Investigate adding routes from apps.ci.centos.org
|
|
|
47c289 |
The Ingress Operator[1] manages `IngressController` resources which will allow us to achieve[3] this on Openshift 4.
|
|
|
47c289 |
|
|
|
47c289 |
### Resources
|
|
|
47c289 |
- [1] https://docs.openshift.com/container-platform/4.4/networking/ingress-operator.html
|
|
|
47c289 |
- [2] https://rcarrata.com/openshift/ocp4_route_sharding/
|
|
|
47c289 |
- [3] https://projects.engineering.redhat.com/browse/CPE-764
|
|
|
47c289 |
|
|
|
47c289 |
|
|
|
47c289 |
### POC
|
|
|
47c289 |
Performed the following steps to achieve goal:
|
|
|
47c289 |
|
|
|
47c289 |
```
|
|
|
47c289 |
-rw-rw-r--. 1 dkirwan dkirwan 1060 Jul 6 18:12 deployment.yaml
|
|
|
47c289 |
-rw-rw-r--. 1 dkirwan dkirwan 286 Jul 6 17:13 ingresscontroller.yaml
|
|
|
47c289 |
-rw-rw-r--. 1 dkirwan dkirwan 336 Jul 6 17:53 route.yaml
|
|
|
47c289 |
-rw-rw-r--. 1 dkirwan dkirwan 273 Jul 6 17:58 service.yaml
|
|
|
47c289 |
```
|
|
|
47c289 |
- Created an `IngressController` which creates 2 router replicas and configured to manage Routes which point at `*.apps.ci.centos.org`. It also has a `routeSelector` to match labels `type: sharded`
|
|
|
47c289 |
```
|
|
|
47c289 |
routeSelector:
|
|
|
47c289 |
matchLabels:
|
|
|
47c289 |
type: sharded
|
|
|
47c289 |
```
|
|
|
47c289 |
- Created a Deployment with simple app.
|
|
|
47c289 |
- Created Service and Route to expose the app externally at `ingress-controller-test.apps.ci.centos.org`.
|
|
|
47c289 |
- Route has been given a label: `type: sharded`
|
|
|
47c289 |
- Used `dig` to retrieve the public IP address of the cluster
|
|
|
47c289 |
```
|
|
|
47c289 |
dig console-openshift-console.apps.ocp.stg.ci.centos.org
|
|
|
47c289 |
|
|
|
47c289 |
; <<>> DiG 9.11.18-RedHat-9.11.18-1.fc32 <<>> console-openshift-console.apps.ocp.stg.ci.centos.org
|
|
|
47c289 |
;; global options: +cmd
|
|
|
47c289 |
;; Got answer:
|
|
|
47c289 |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21722
|
|
|
47c289 |
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
|
|
|
47c289 |
|
|
|
47c289 |
;; OPT PSEUDOSECTION:
|
|
|
47c289 |
; EDNS: version: 0, flags:; udp: 4096
|
|
|
47c289 |
;; QUESTION SECTION:
|
|
|
47c289 |
;console-openshift-console.apps.ocp.stg.ci.centos.org. IN A
|
|
|
47c289 |
|
|
|
47c289 |
;; ANSWER SECTION:
|
|
|
47c289 |
console-openshift-console.apps.ocp.stg.ci.centos.org. 600 IN A 8.43.84.237
|
|
|
47c289 |
|
|
|
47c289 |
;; Query time: 77 msec
|
|
|
47c289 |
;; SERVER: 10.38.5.26#53(10.38.5.26)
|
|
|
47c289 |
;; WHEN: Mon Jul 06 18:43:35 IST 2020
|
|
|
47c289 |
;; MSG SIZE rcvd: 97
|
|
|
47c289 |
```
|
|
|
47c289 |
- Configured my `/etc/hosts` file accordingly:
|
|
|
47c289 |
```
|
|
|
47c289 |
cat /etc/hosts
|
|
|
47c289 |
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
|
|
47c289 |
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
|
|
47c289 |
8.43.84.237 ingress-controller-test.apps.ci.centos.org
|
|
|
47c289 |
```
|
|
|
47c289 |
- Visited `http://ingress-controller-test.apps.ci.centos.org` and was greeted with the expected content in the deployed app.
|
|
|
47c289 |
- We should be able to achieve this spike CPE-764 using the Ingress Controller Operator.
|
|
|
47c289 |
|