Skip to content

RHOSRFE-639: Add cloud-init ca_certs support for OpenStackBaremetalSet - #524

Open
dsedgmen wants to merge 1 commit into
openstack-k8s-operators:mainfrom
dsedgmen:add-cloudinit-ca-certs
Open

dsedgmen wants to merge 1 commit into
openstack-k8s-operators:mainfrom
dsedgmen:add-cloudinit-ca-certs

Conversation

@dsedgmen

@dsedgmen dsedgmen commented Nov 17, 2026 •

Copy link
Copy Markdown

Summary

  • Implements RHOSRFE-639: inject trusted CA certificates into provisioned bare metal hosts via cloud-init ca_certs at creation time.
  • Adds optional caCertsSecret (PEM certs / multi-PEM bundles) and caCertsRemoveDefaults to OpenStackBaremetalSet, and templates them into generated userdata.

Test plan

  • Unit: go test ./internal/openstackbaremetalset/
  • Functional: make test (covers new "BMH provisioned with CA certs secret" case)
  • Manual: create a secret with a PEM CA, set spec.caCertsSecret (+ optional caCertsRemoveDefaults), provision a BMH, and confirm userdata contains ca_certs.trusted (and remove_defaults when enabled)
  • Confirm hosts without caCertsSecret still generate userdata without a ca_certs block

JIRA: RHOSRFE-639

Made with Cursor

Allow injecting trusted CA certificates into provisioned hosts via an
optional caCertsSecret and caCertsRemoveDefaults, matching cloud-init's
ca_certs module.

Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-ci-robot

openshift-ci-robot commented Nov 17, 2026 •

Copy link
Copy Markdown

@dsedgmen: This pull request references RHOSRFE-639 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature request to target the "5.1.0" version, but no target version was set.

Details

In response to this:

Summary

  • Implements RHOSRFE-639: inject trusted CA certificates into provisioned bare metal hosts via cloud-init ca_certs at creation time.
  • Adds optional caCertsSecret (PEM certs / multi-PEM bundles) and caCertsRemoveDefaults to OpenStackBaremetalSet, and templates them into generated userdata.

Test plan

  • Unit: go test ./internal/openstackbaremetalset/
  • Functional: make test (covers new "BMH provisioned with CA certs secret" case)
  • Manual: create a secret with a PEM CA, set spec.caCertsSecret (+ optional caCertsRemoveDefaults), provision a BMH, and confirm userdata contains ca_certs.trusted (and remove_defaults when enabled)
  • Confirm hosts without caCertsSecret still generate userdata without a ca_certs block

JIRA: RHOSRFE-639

Made with Cursor

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from abays and dprince November 17, 2026 21:10
@openshift-ci

openshift-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dsedgmen
Once this PR has been reviewed and has the lgtm label, please assign abays for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4af013b4-91f8-4727-9211-18bc684ce525
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@openshift-ci

openshift-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Hi @dsedgmen. Thanks for your PR.

I'm waiting for a openstack-k8s-operators member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@rabi

rabi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Not sure why this is needed, we already have the install-certs dataplane service that installs the required CA certs on EDPM nodes. If a customer really wants custom userdata per node, OpenStackDataPlaneNodeSet already supports custom userData per node https://github.com/openstack-k8s-operators/openstack-operator/blob/main/api/dataplane/v1beta1/common.go#L116

@centosinfra-prod-github-app

Copy link
Copy Markdown

@dsedgmen

Copy link
Copy Markdown
Author

Not sure why this is needed, we already have the install-certs dataplane service that installs the required CA certs on EDPM nodes. If a customer really wants custom userdata per node, OpenStackDataPlaneNodeSet already supports custom userData per node https://github.com/openstack-k8s-operators/openstack-operator/blob/main/api/dataplane/v1beta1/common.go#L116

The problem with the install-certs is it does not actually update the ca trust store it just copies it into /var/lib/openstack/cacerts/{{ service }}

https://github.com/openstack-k8s-operators/edpm-ansible/blob/main/roles/edpm_install_certs/tasks/copy_ca_certs.yaml

If you are talking about the bootstrap.yml which imports caBundleSecretName.
https://github.com/openstack-k8s-operators/edpm-ansible/blob/main/roles/edpm_bootstrap/tasks/bootstrap.yml#L106-L126

This does not work for importing ca for satellite and container registries because it is not run until after
https://github.com/openstack-k8s-operators/openstack-operator/blob/main/config/services/dataplane_v1beta1_openstackdataplaneservice_bootstrap.yaml

https://github.com/openstack-k8s-operators/edpm-ansible/blob/main/playbooks/redhat.yml
https://github.com/openstack-k8s-operators/edpm-ansible/blob/main/roles/edpm_download_cache/tasks/main.yml

So we would either need to change the order or structure of playbooks so the certificate is imported before the redhat and download-cache playbooks are run or implement the ca-trusts earlier like using the userdata

The problem with using the custom userData is it overwrites the templated data from the operator.
So it means the end user needs to manually recreate the userData.
Which I don't think is a good solution for anyone using internal repos, container registries or https proxies for isolation.

@rabi

rabi commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

https://github.com/openstack-k8s-operators/edpm-ansible/blob/main/playbooks/redhat.yml
https://github.com/openstack-k8s-operators/edpm-ansible/blob/main/roles/edpm_download_cache/tasks/main.yml

I think redhat service runs the rhc system role first, and that role should install Satellite CA into the trust store. FWIW rhc_repo_ca_cert_fetch_from_satellite: true ansible var should help pull the certs and update trust store. I think you can set the service list to have bootstrap before download-cache which is the case in upstream ci.

@dsedgmen

Copy link
Copy Markdown
Author

I think redhat service runs the rhc system role first, and that role should install Satellite CA into the trust store. FWIW rhc_repo_ca_cert_fetch_from_satellite: true ansible var should help pull the certs and update trust store. I think you can set the service list to have bootstrap before download-cache which is the case in upstream ci.

yes, but none of this really invalidates the RFE, it is always going to be better to import the ca and update the trust earlier then later.

Also the fact the CI is using a hack to work, shows it is broken.

So from my point of view we should either import the CA using the userData or it should be the first task by default.

@rabi

rabi commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

So from my point of view we should either import the CA using the userData or it should be the first task by default.

I would rather keep the default cloud-init functionality to a minimum, just what's needed to make the node reachable, errors with cloud-init execution are not visible to the operator (BMH marked provisioned regardless) to only surface later during service deployment. That would also duplicate what bootstrap role is already doing.

We will discuss and change the default order of services to have bootstrap before download-cache and or anything else required during deployment instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants