Skip to content

Commit 7053619

Browse files
committed
OCPBUGS-33787: Add cluster wide trusted CA bundle to operator
The alternative ingress can be provided via the console config API. This commit ensures that health checks to the alternative ingress pass TLS certificate validation even when the TLS certificate has an unknown CA.
1 parent c608dec commit 7053619

File tree

4 files changed

+56
-7
lines changed

4 files changed

+56
-7
lines changed

docs/alb-ingress-rosa-hcp.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The use case in mind is [HyperShift hosted clusters where the Ingress capability
1515

1616
In order to configure an HTTPS listener on AWS ALB you need to have a certificate created in AWS Certificate Manager.
1717
You can import an existing certificate or request a new one. Make sure the certificate is created in the same region as your cluster.
18-
Note the certificate ARN, you will need it later.
18+
Note the certificate ARN and the DNS name used in the certificate, you will need it later.
1919

2020
### Create Ingress resources for the NodePort services
2121

@@ -73,12 +73,32 @@ EOF
7373
### Update console config
7474

7575
Once the console ALBs are ready you need to let the console operator know which urls to use.
76+
77+
#### Add custom trusted CA (optional)
78+
79+
To add the CA of the certificates used in the ingress objects to [the trusted bundle of the OpenShift cluster](https://docs.openshift.com/container-platform/latest/networking/configuring-a-custom-pki.html#nw-proxy-configure-object_configuring-a-custom-pki), follow these steps:
80+
```bash
81+
$ oc -n openshift-config create configmap console-ca-bundle --from-file=ca-bundle.crt=/path/to/pemencoded/cacert
82+
$ oc patch proxy cluster --type=merge -p '{"spec":{"trustedCA":{"name":"console-ca-bundle"}}}'
83+
```
84+
85+
#### Setup DNS (optional)
86+
87+
The console ALBs have public DNS names that might not match the Subject Alternative Name (SAN) from the certificates. Ensure public DNS records matching the certificates' SANs are created and target the following hostnames:
88+
```bash
89+
$ oc -n openshift-console get ing console -o yaml | yq .status.loadBalancer.ingress[0].hostname
90+
k8s-openshif-console-xxxxxxxxxx-xxxxxxxx.us-east-2.elb.amazonaws.comdd
91+
$ oc -n openshift-console get ing downloads -o yaml | yq .status.loadBalancer.ingress[0].hostname
92+
k8s-openshif-download-xxxxxxxxxx-xxxxxxxxxx.us-east-2.elb.amazonaws.com
93+
```
94+
95+
#### Update console operator config
96+
7697
Update the console operator config providing the custom urls:
7798
```bash
78-
$ CONSOLE_ALB_HOST=$(oc -n openshift-console get ing console -o yaml | yq .status.loadBalancer.ingress[0].hostname)
79-
$ DOWNLOADS_ALB_HOST=$(oc -n openshift-console get ing downloads -o yaml | yq .status.loadBalancer.ingress[0].hostname)
80-
$ oc patch console.operator.openshift.io cluster --type=merge -p "{\"spec\":{\"ingress\":{\"consoleURL\":\"https://${CONSOLE_ALB_HOST}\",\"clientDownloadsURL\":\"https://${DOWNLOADS_ALB_HOST}\"}}}"
99+
$ oc patch console.operator.openshift.io cluster --type=merge -p "{\"spec\":{\"ingress\":{\"consoleURL\":\"https://${CONSOLE_HOST}\",\"clientDownloadsURL\":\"https://${DOWNLOADS_HOST}\"}}}"
81100
```
101+
**Note**: ensure that the hosts used in the urls match the SAN from the corresponding certificates.
82102

83103
## Notes
84104

@@ -110,6 +130,3 @@ $ oc -n openshift-console rsh deploy/console curl -k https://openshift.default.s
110130
```bash
111131
$ oc -n openshift-ingress-operator patch ingresscontroller default --type='json' -p='[{"op": "replace", "path": "/spec/replicas", "value":0}]'
112132
```
113-
114-
## Links
115-
- [Demo of ALB ingress for the console on ROSA HCP](https://drive.google.com/file/d/1uWZgFbSeZTlDzlFyPW7QcH-625JsbSbw/view)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# The network operator is responsible for injecting
2+
# the trusted ca bundle into this configmap.
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
annotations:
7+
capability.openshift.io/name: Console
8+
include.release.openshift.io/hypershift: "true"
9+
include.release.openshift.io/ibm-cloud-managed: "true"
10+
include.release.openshift.io/self-managed-high-availability: "true"
11+
include.release.openshift.io/single-node-developer: "true"
12+
release.openshift.io/create-only: "true"
13+
labels:
14+
config.openshift.io/inject-trusted-cabundle: "true"
15+
name: trusted-ca
16+
namespace: openshift-console-operator

manifests/07-operator-ibm-cloud-managed.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ spec:
7272
name: config
7373
- mountPath: /var/run/secrets/serving-cert
7474
name: serving-cert
75+
- mountPath: /etc/pki/ca-trust/extracted/pem
76+
name: trusted-ca
7577
priorityClassName: system-cluster-critical
7678
securityContext:
7779
runAsNonRoot: true
@@ -98,3 +100,9 @@ spec:
98100
secret:
99101
optional: true
100102
secretName: serving-cert
103+
- configMap:
104+
items:
105+
- key: ca-bundle.crt
106+
path: tls-ca-bundle.pem
107+
name: trusted-ca
108+
name: trusted-ca

manifests/07-operator.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ spec:
6464
name: config
6565
- mountPath: /var/run/secrets/serving-cert
6666
name: serving-cert
67+
- mountPath: /etc/pki/ca-trust/extracted/pem
68+
name: trusted-ca
6769
env:
6870
- name: CONSOLE_IMAGE
6971
value: registry.svc.ci.openshift.org/openshift:console
@@ -99,3 +101,9 @@ spec:
99101
secret:
100102
secretName: serving-cert
101103
optional: true
104+
- name: trusted-ca
105+
configMap:
106+
name: trusted-ca
107+
items:
108+
- key: ca-bundle.crt
109+
path: tls-ca-bundle.pem

0 commit comments

Comments
 (0)