-
Notifications
You must be signed in to change notification settings - Fork 62
Add support for mounting CA certificates from ConfigMaps on vanilla K8s #1554
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?
Conversation
…ubernetes Extends mount_trusted_ca to support mounting CA certificates from ConfigMaps on vanilla Kubernetes while maintaining OpenShift CNO compatibility. Added mount_trusted_ca_configmap_key field (format: "configmap-name:key") to specify the ConfigMap and key containing CA bundles. The ConfigMap can be managed manually or kept up to date using cert-manager's trust-manager. Required on vanilla K8s when mount_trusted_ca is enabled; optional on OpenShift which uses CNO injection. Enhanced MountCASpec (exported from mountCASpec) to handle both modes: - ConfigMap mode: parses "name:key" format, maps key to tls-ca-bundle.pem - OpenShift mode: uses operator-created ConfigMap with CNO injection Both mount to /etc/pki/ca-trust/extracted/pem. Added defaultsForVanillaDeployment to configure CA mounting for vanilla K8s deployments (API, Content, Worker). Validates configuration and mounts only when both mount_trusted_ca and mount_trusted_ca_configmap_key are set. Refactored deployment hash calculation by introducing CalculateDeploymentHash to strip DeprecatedServiceAccount field before hashing, preventing reconciliation loops. Updated CheckDeploymentSpec, AddHashLabel, and HashFromMutated to use new function. Removed redundant AddHashLabel call in updateObject. Fixed mount_trusted_ca CSV description by consolidating multi-line comment to single-line format that operator-sdk recognizes. Includes unit tests, documentation, and example configuration showing trust-manager integration.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: josephtate The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @josephtate. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Hi @josephtate Thank you for your contribution!! and the controller got stuck in an infinite loop I believe this is happening because in https://github.com/pulp/pulp-operator/pull/1554/files#diff-4772d4d22e96ad7ded951cfaf8aeec535468a2fa2499fb8775568c891479afffR108 we are modifying the pulp-operator/controllers/deployment.go Lines 71 to 113 in cb467f6
One idea that I had was to move the instructions from: pulp-operator/controllers/deployment.go Line 430 in cb467f6
and from: pulp-operator/controllers/deployment.go Line 631 in cb467f6
What do you think about this? |
So this infinite loop is endemic to the original code. Once I switched to mount_trusted_ca, even with no code changes, this infinite reconcile loop started happening. I worked really hard to try to resolve it. I'd like to note that the final resolution is not a one pass: it actually takes 2-3 reconcile steps to get to steady state. My testing shows this still. Does yours eventually settle down? Let me take another look over the next couple of days. |
Extends mount_trusted_ca to support mounting CA certificates from ConfigMaps on vanilla Kubernetes while maintaining OpenShift CNO compatibility.
Added mount_trusted_ca_configmap_key field (format: "configmap-name:key") to specify the ConfigMap and key containing CA bundles. The ConfigMap can be managed manually or kept up to date using cert-manager's trust-manager. Required on vanilla K8s when mount_trusted_ca is enabled; optional on OpenShift which uses CNO injection.
Enhanced MountCASpec (exported from mountCASpec) to handle both modes:
Added defaultsForVanillaDeployment to configure CA mounting for vanilla K8s deployments (API, Content, Worker). Validates configuration and mounts only when both mount_trusted_ca and mount_trusted_ca_configmap_key are set.
Refactored deployment hash calculation by introducing CalculateDeploymentHash to strip DeprecatedServiceAccount field before hashing, preventing reconciliation loops. Updated CheckDeploymentSpec, AddHashLabel, and HashFromMutated to use new function. Removed redundant AddHashLabel call in updateObject.
Fixed mount_trusted_ca CSV description by consolidating multi-line comment to single-line format that operator-sdk recognizes.
Includes unit tests, documentation, and example configuration showing trust-manager integration.
Fixes #1469