CNTRLPLANE-631: Pass image registry CA via --bootstrap-certs to MCS bootstrap - #1
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…ootstrap When the image registry capability is enabled, the root CA (which signs the image registry serving cert in HyperShift) is written to a file and passed to the machine-config-server bootstrap command via --bootstrap-certs. This places the CA at /etc/docker/certs.d/<registry>/ca.crt in the ignition payload so worker nodes can pull from the internal image registry without the node-ca daemon set. Co-Authored-By: brcox <brcox@redhat.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
In HyperShift hosted clusters, the MCO runs only in bootstrap mode and the
node-cadaemonset does not run on worker nodes. This means there is no mechanism to distribute the image registry CA to nodes so they can pull from the internal registry atimage-registry.openshift-image-registry.svc:5000.This PR adds logic to the ignition server's
LocalIgnitionProvider.GetPayload()to pass the image registry CA to the machine-config-server (MCS) bootstrap command via--bootstrap-certs. The MCS then places the CA at/etc/docker/certs.d/<registry>/ca.crtin the ignition payload for worker nodes.The change:
--bootstrap-certs=image-registry.openshift-image-registry.svc:5000=<ca-file>to the MCS bootstrap command (gated on payload version >= 4.14, when--bootstrap-certswas introduced in MCO PR #3876)Which issue(s) this PR fixes:
Fixes https://issues.redhat.com/browse/CNTRLPLANE-631
Special notes for your reviewer:
Key items to verify:
Is the root CA the correct CA for the image registry endpoint? This PR uses the root CA (
mcsConfig.Data["root-ca.crt"]) based on the observation thatpki.ReconcileRegistryOperatorServingCertsigns with the root CA. However,ReconcileRegistryOperatorServingCertgenerates a cert for hostnamecluster-image-registry-operator(the operator's metrics endpoint), not forimage-registry.openshift-image-registry.svc:5000(the registry data endpoint). The registry data endpoint's serving cert may be generated by the service-ca operator in the guest cluster instead. Please confirm which CA actually signs the image registry's serving certificate that nodes use when pulling images.Is
--bootstrap-certs=hostname=filepaththe correct flag format? This is based on the enhancement doc and MCO PR NO-ISSUE: *: use the api package constant for the size label openshift/hypershift#3876 but has not been tested against a live MCS binary.Is the version gate (>= 4.14) correct? MCO PR NO-ISSUE: *: use the api package constant for the size label openshift/hypershift#3876 was merged 2023-09-25. If it landed in 4.15 instead of 4.14, passing
--bootstrap-certsto a 4.14 MCS binary would cause a hard failure.Silent failure pattern: Errors during CA setup (HCP list failure, file write failure) are logged but do not fail the payload generation. MCS runs without
--bootstrap-certsin those cases.Related PRs:
--image-registry-ca-fileflag torendercommand, though this PR does not invoke CVO render)Testing:
go build ./ignition-server/...passesgo vet ./ignition-server/...passesgo test ./ignition-server/...passesChecklist:
Devin Session: https://redhat.devinenterprise.com/sessions/53fe46443c224d87b66235e740659631
Requested by: brcox (brcox@redhat.com)