Repository navigation
Trust cluster-wide proxy CA out of the box #580
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| labels: | ||
| config.openshift.io/inject-trusted-cabundle: "true" | ||
| name: external-dns-operator-trusted-ca | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -484,6 +484,7 @@ spec: | |
| - name: RELATED_IMAGE_EXTERNAL_DNS | ||
| value: quay.io/external-dns-operator/external-dns:latest | ||
| - name: TRUSTED_CA_CONFIGMAP_NAME | ||
| value: external-dns-operator-trusted-ca | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (fragility): The env value hardcodes |
||
| image: quay.io/openshift/origin-external-dns-operator:latest | ||
| livenessProbe: | ||
| httpGet: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,14 @@ resources: | |
|
|
||
| generatorOptions: | ||
| disableNameSuffixHash: true | ||
| # Empty configmap labeled for the Cluster Network Operator to inject the | ||
| # merged trusted CA bundle (system CAs + the cluster-wide proxy's trustedCA). | ||
| # Shipped in the bundle so proxy CA trust works out of the box on OpenShift. | ||
| configMapGenerator: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (correctness): Making injection default-on creates a hard, cluster-wide dependency on this configmap being present and already carrying a Two failure windows, even on OpenShift:
Consider skipping the volume until the |
||
| - name: external-dns-operator-trusted-ca | ||
| options: | ||
| labels: | ||
| config.openshift.io/inject-trusted-cabundle: "true" | ||
|
Comment on lines
+12
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: printf '%s\n' '--- deployment and local development references ---'
rg -n -C 4 'make deploy|TRUSTED_CA_CONFIGMAP_NAME|external-dns-operator-trusted-ca|inject-trusted-cabundle|ca-bundle\.crt|trusted-ca' docs/localdev.md config/manager config/manifests bundle/manifests pkg/operator/controller/externaldns
printf '%s\n' '--- manager kustomization ---'
sed -n '1,100p' config/manager/kustomization.yaml
printf '%s\n' '--- manager deployment ---'
sed -n '1,130p' config/manager/manager.yaml
printf '%s\n' '--- operand volume and reconciliation ---'
sed -n '1,240p' pkg/operator/controller/externaldns/pod.go
sed -n '1,220p' pkg/operator/controller/externaldns/controller.goRepository: openshift/external-dns-operator Length of output: 36681 🏁 Script executed: printf '%s\n' '--- make deploy and manager flag binding ---'
rg -n -C 8 '(^deploy:|make deploy|trusted-ca-configmap|InjectTrustedCA|injectTrustedCA|TrustedCAConfigMap)' Makefile cmd config pkg docs/localdev.md
printf '%s\n' '--- trusted CA volume construction ---'
rg -n -C 12 'trustedCAVolumeName|trustedCAFileKey|ConfigMapVolumeSource|trustCAConfigMap|InjectTrustedCA' pkg/operator/controller/externaldns
printf '%s\n' '--- localdev deployment context ---'
sed -n '1,170p' docs/localdev.mdRepository: openshift/external-dns-operator Length of output: 50389 🏁 Script executed: printf '%s\n' '--- deploy target ---'
sed -n '156,185p' Makefile
printf '%s\n' '--- trusted CA flag setup ---'
rg -n -C 6 'TrustedCAConfigMapName|trusted-ca-configmap|StringVar|String\(' pkg/operator
printf '%s\n' '--- operand deployment volume code ---'
sed -n '90,230p' pkg/operator/controller/externaldns/deployment.go
rg -n -C 8 'trustedCAConfigMapName|trustedCAVolumeName|trustedCAFileKey|KeyToPath|ConfigMapVolumeSource' pkg/operator/controller/externaldns/pod.go pkg/operator/controller/externaldns/deployment.goRepository: openshift/external-dns-operator Length of output: 50387 🏁 Script executed: printf '%s\n' '--- production trusted CA references ---'
rg -n 'trustedCA|ConfigMapVolumeSource|KeyToPath|Items|Volumes' pkg/operator/controller/externaldns/pod.go pkg/operator/controller/externaldns/deployment.go
printf '%s\n' '--- relevant pod.go section ---'
sed -n '240,430p' pkg/operator/controller/externaldns/pod.go
printf '%s\n' '--- relevant deployment.go section ---'
sed -n '90,180p' pkg/operator/controller/externaldns/deployment.goRepository: openshift/external-dns-operator Length of output: 17007 🏁 Script executed: printf '%s\n' '--- config/default composition ---'
sed -n '1,100p' config/default/kustomization.yaml
printf '%s\n' '--- exact trusted CA volume implementation ---'
sed -n '520,565p' pkg/operator/controller/externaldns/pod.go
printf '%s\n' '--- all trusted CA configuration branches ---'
rg -n -C 5 'InjectTrustedCA|TrustedCAConfigMapName|trusted-ca-configmap|isOpenShift' pkg/operator/config pkg/operator/operator.go pkg/operator/controller/externaldns pkg/operator/controller/ca-configmapRepository: openshift/external-dns-operator Length of output: 24289 Do not enable trusted-CA injection by default outside OpenShift.
Keep the ConfigMap and flag in the OpenShift bundle only, or omit the flag from non-OpenShift deployments. 🤖 Prompt for AI Agents |
||
| images: | ||
| - name: quay.io/openshift/origin-external-dns-operator | ||
| newName: quay.io/openshift/origin-external-dns-operator | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ spec: | |
| # Ref: https://issues.redhat.com/browse/OCPBUGS-57339. | ||
| value: quay.io/external-dns-operator/external-dns:latest | ||
| - name: TRUSTED_CA_CONFIGMAP_NAME | ||
| value: external-dns-operator-trusted-ca | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (correctness): Defaulting On any cluster without the Cluster Network Operator (vanilla Kubernetes installed via Consider gating the default-on behavior on OpenShift (where CNO exists), or marking the CA volume/key |
||
| securityContext: | ||
| capabilities: | ||
| drop: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,30 +40,30 @@ kubectl -n external-dns-operator set env deployment/external-dns-operator HTTP_P | |
|
|
||
| ## OpenShift instructions | ||
|
|
||
| If a global proxy is configured on the OpenShift cluster, OLM automatically configures Operators with cluster-wide proxy settings. `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` environment variables are added to the ExternalDNS Operator's deployment. | ||
| If a global proxy is configured on the OpenShift cluster, OLM automatically configures Operators with cluster-wide proxy settings. `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` environment variables are added to the ExternalDNS Operator's deployment. The proxy's CA is trusted out of the box: the operator bundle ships an `external-dns-operator-trusted-ca` configmap populated by the Cluster Network Operator with the system and proxy's CA merged together and `TRUSTED_CA_CONFIGMAP_NAME` defaults to it. | ||
|
|
||
| ### Custom CA | ||
|
|
||
| The manual steps below are only needed to trust an additional CA which is not part of the cluster-wide proxy. As the operator consumes a single configmap, such a CA has to be merged with the proxy's CA into one configmap. | ||
|
|
||
| #### For running operator | ||
|
|
||
| 1. Create a configmap for the proxy CA certificate in the `external-dns-operator` namespace: | ||
| 1. Create a configmap holding the merged bundle (the proxy's CA and the additional CA) under `ca-bundle.crt` in the `external-dns-operator` namespace. Do not add the `inject-trusted-cabundle` label, otherwise the Cluster Network Operator overwrites its contents: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (maintainability): Because |
||
| ```bash | ||
| oc -n external-dns-operator create configmap trusted-ca | ||
| oc -n external-dns-operator label cm trusted-ca config.openshift.io/inject-trusted-cabundle=true | ||
| oc -n external-dns-operator create configmap custom-trusted-ca --from-file=ca-bundle.crt=/path/to/merged-ca-bundle.pem | ||
| ``` | ||
|
|
||
| 2. Add `spec.config.env` with the name of the configmap created in the previous step to your subscription created by OperatorHub: | ||
| ```bash | ||
| oc -n external-dns-operator patch subscription external-dns-operator --type='json' -p='[{"op": "add", "path": "/spec/config", "value":{"env":[{"name":"TRUSTED_CA_CONFIGMAP_NAME","value":"trusted-ca"}]}}]' | ||
| oc -n external-dns-operator patch subscription external-dns-operator --type='json' -p='[{"op": "add", "path": "/spec/config", "value":{"env":[{"name":"TRUSTED_CA_CONFIGMAP_NAME","value":"custom-trusted-ca"}]}}]' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Preserve existing When Update only 🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| #### Manual deployment | ||
| You can use the following steps after the `external-dns-operator` namespace has been created and before the operator deployment has been created. | ||
|
|
||
| 1. Create a configmap for the proxy CA certificate in the `external-dns-operator` namespace: | ||
| 1. Create a configmap holding the merged bundle (the proxy's CA and the additional CA) under `ca-bundle.crt` in the `external-dns-operator` namespace. Do not add the `inject-trusted-cabundle` label, otherwise the Cluster Network Operator overwrites its contents: | ||
| ```bash | ||
| oc -n external-dns-operator create configmap trusted-ca | ||
| oc -n external-dns-operator label cm trusted-ca config.openshift.io/inject-trusted-cabundle=true | ||
| oc -n external-dns-operator create configmap custom-trusted-ca --from-file=ca-bundle.crt=/path/to/merged-ca-bundle.pem | ||
| ``` | ||
|
|
||
| 2. Create the `Subscription` object: | ||
|
|
@@ -82,6 +82,6 @@ You can use the following steps after the `external-dns-operator` namespace has | |
| config: | ||
| env: | ||
| - name: TRUSTED_CA_CONFIGMAP_NAME | ||
| value: trusted-ca | ||
| value: custom-trusted-ca | ||
| EOF | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question (reliability): This configmap is shipped as a bundle object with empty data and relies on the CNO to fill
ca-bundle.crt. On operator upgrade OLM re-applies bundle manifests, which can momentarily reset this configmap to empty data before the CNO re-injects — transiently breaking the operand's trust store (and, per the volume-mount issue noted elsewhere, potentially the operand pod). Worth confirming OLM does not re-apply/overwrite this on upgrade.