MGMT-20207: avoid adding system CA bundle to AdditionalTrustBundle
When generating the install config, it should not include the entire system CA bundle. I.e. when setting the AdditionalTrustBundle[1]. However, when using a mirror regsitry (e.g. with MirrorRegistryRef[2] in ASC), the installConfigBuilder is adding the content of tls-ca-bundle.pem[3]. This pem file is created[4] by ASC controller, and includes the full system CA bundle since the bundle[5] is injected into 'cluster-trusted-ca-bundle'.
Therefore, the suggestion solution is to create a separate pem file just for the certificates specified in MirrorRegistryRef. I.e. generate a new 'user-registry-ca-bundle.pem' file, that will be included as part of AdditionalTrustBundle. These certificates will propagate into the 'user-ca-bundle' CM during cluster installation. This will ensure that 'user-ca-bundle' CM indeed includes only custom certificates mandatory for the user, instead of the system CA bundle.
Note: as backwards compatibility, for flows like ABI, we keep a fallback to the current behaviour (i.e. include 'tls-ca-bundle.pem' only when 'user-registry-ca-bundle.pem' doesn't exist).
[1] https://github.com/openshift/assisted-service/blob/40ab10db5e872e519ab0a97e82fc318423feeaba/internal/installcfg/builder/builder.go#L275 [2] https://github.com/openshift/assisted-service/blob/cb169a2d2c97bb3dccd06ad4b75f2937e01f78f4/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go#L82 [3] https://github.com/openshift/assisted-service/blob/a1c3229afee1f0f774b286283fb0d0098b9eac03/internal/common/common.go#L35 [4] https://github.com/openshift/assisted-service/blob/341f9860c455cccc42741f350024d05aa72755f8/internal/controller/controllers/agentserviceconfig_controller.go#L1848 [5] https://github.com/openshift/assisted-service/blob/341f9860c455cccc42741f350024d05aa72755f8/internal/controller/controllers/agentserviceconfig_controller.go#L1059
List all the issues related to this PR
- [ ] New Feature
- [ ] Enhancement
- [x] Bug fix
- [ ] Tests
- [ ] Documentation
- [ ] CI/CD
What environments does this code impact?
- [ ] Automation (CI, tools, etc)
- [ ] Cloud
- [x] Operator Managed Deployments
- [ ] None
How was this code tested?
- [ ] assisted-test-infra environment
- [x] dev-scripts environment
- [ ] Reviewer's test appreciated
- [ ] Waiting for CI to do a full test run
- [ ] Manual (Elaborate on how it was tested)
- [ ] No tests needed
Checklist
- [x] Title and description added to both, commit and PR.
- [x] Relevant issues have been associated (see CONTRIBUTING guide)
- [x] This change does not require a documentation update (docstring,
docs, README, etc) - [x] Does this change include unit-tests (note that code changes require unit-tests)
Reviewers Checklist
- Are the title and description (in both PR and commit) meaningful and clear?
- Is there a bug required (and linked) for this change?
- Should this PR be backported?
@danielerez: This pull request references MGMT-20207 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 bug to target the "4.19.0" version, but no target version was set.
In response to this:
When generating the install config, it should not include the entire system CA bundle. I.e. when setting the AdditionalTrustBundle[1]. However, when using a mirror regsitry (e.g. with MirrorRegistryRef[2] in ASC), the installConfigBuilder is adding the content of tls-ca-bundle.pem[3]. This pem file is created[4] by ASC controller, and includes the full system CA bundle since the bundle[5] is injected into 'cluster-trusted-ca-bundle'.
Therefore, the suggestion solution is to create a separate pem file just for the certificates specified in MirrorRegistryRef. I.e. generate a new 'user-registry-ca-bundle.pem' file, that will be included as part of AdditionalTrustBundle. These certificates will propagate into the 'user-ca-bundle' CM during cluster installation. This will ensure that 'user-ca-bundle' CM indeed includes only custom certificates mandatory for the user, instead of the system CA bundle.
Note: as backwards compatibility, for flows as ABI, we keep a fallback to the current behaviour (i.e. include 'tls-ca-bundle.pem' only when 'user-registry-ca-bundle.pem' doesn't exist).
[1] https://github.com/openshift/assisted-service/blob/40ab10db5e872e519ab0a97e82fc318423feeaba/internal/installcfg/builder/builder.go#L275 [2] https://github.com/openshift/assisted-service/blob/cb169a2d2c97bb3dccd06ad4b75f2937e01f78f4/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go#L82 [3] https://github.com/openshift/assisted-service/blob/a1c3229afee1f0f774b286283fb0d0098b9eac03/internal/common/common.go#L35 [4] https://github.com/openshift/assisted-service/blob/341f9860c455cccc42741f350024d05aa72755f8/internal/controller/controllers/agentserviceconfig_controller.go#L1848 [5] https://github.com/openshift/assisted-service/blob/341f9860c455cccc42741f350024d05aa72755f8/internal/controller/controllers/agentserviceconfig_controller.go#L1059
List all the issues related to this PR
- [ ] New Feature
- [ ] Enhancement
- [x] Bug fix
- [ ] Tests
- [ ] Documentation
- [ ] CI/CD
What environments does this code impact?
- [ ] Automation (CI, tools, etc)
- [ ] Cloud
- [x] Operator Managed Deployments
- [ ] None
How was this code tested?
- [ ] assisted-test-infra environment
- [x] dev-scripts environment
- [ ] Reviewer's test appreciated
- [ ] Waiting for CI to do a full test run
- [ ] Manual (Elaborate on how it was tested)
- [ ] No tests needed
Checklist
- [x] Title and description added to both, commit and PR.
- [x] Relevant issues have been associated (see CONTRIBUTING guide)
- [x] This change does not require a documentation update (docstring,
docs, README, etc)- [x] Does this change include unit-tests (note that code changes require unit-tests)
Reviewers Checklist
- Are the title and description (in both PR and commit) meaningful and clear?
- Is there a bug required (and linked) for this change?
- Should this PR be backported?
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.
Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all
/test all
@danielerez: This pull request references MGMT-20207 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 bug to target the "4.19.0" version, but no target version was set.
In response to this:
When generating the install config, it should not include the entire system CA bundle. I.e. when setting the AdditionalTrustBundle[1]. However, when using a mirror regsitry (e.g. with MirrorRegistryRef[2] in ASC), the installConfigBuilder is adding the content of tls-ca-bundle.pem[3]. This pem file is created[4] by ASC controller, and includes the full system CA bundle since the bundle[5] is injected into 'cluster-trusted-ca-bundle'.
Therefore, the suggestion solution is to create a separate pem file just for the certificates specified in MirrorRegistryRef. I.e. generate a new 'user-registry-ca-bundle.pem' file, that will be included as part of AdditionalTrustBundle. These certificates will propagate into the 'user-ca-bundle' CM during cluster installation. This will ensure that 'user-ca-bundle' CM indeed includes only custom certificates mandatory for the user, instead of the system CA bundle.
Note: as backwards compatibility, for flows like ABI, we keep a fallback to the current behaviour (i.e. include 'tls-ca-bundle.pem' only when 'user-registry-ca-bundle.pem' doesn't exist).
[1] https://github.com/openshift/assisted-service/blob/40ab10db5e872e519ab0a97e82fc318423feeaba/internal/installcfg/builder/builder.go#L275 [2] https://github.com/openshift/assisted-service/blob/cb169a2d2c97bb3dccd06ad4b75f2937e01f78f4/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go#L82 [3] https://github.com/openshift/assisted-service/blob/a1c3229afee1f0f774b286283fb0d0098b9eac03/internal/common/common.go#L35 [4] https://github.com/openshift/assisted-service/blob/341f9860c455cccc42741f350024d05aa72755f8/internal/controller/controllers/agentserviceconfig_controller.go#L1848 [5] https://github.com/openshift/assisted-service/blob/341f9860c455cccc42741f350024d05aa72755f8/internal/controller/controllers/agentserviceconfig_controller.go#L1059
List all the issues related to this PR
- [ ] New Feature
- [ ] Enhancement
- [x] Bug fix
- [ ] Tests
- [ ] Documentation
- [ ] CI/CD
What environments does this code impact?
- [ ] Automation (CI, tools, etc)
- [ ] Cloud
- [x] Operator Managed Deployments
- [ ] None
How was this code tested?
- [ ] assisted-test-infra environment
- [x] dev-scripts environment
- [ ] Reviewer's test appreciated
- [ ] Waiting for CI to do a full test run
- [ ] Manual (Elaborate on how it was tested)
- [ ] No tests needed
Checklist
- [x] Title and description added to both, commit and PR.
- [x] Relevant issues have been associated (see CONTRIBUTING guide)
- [x] This change does not require a documentation update (docstring,
docs, README, etc)- [x] Does this change include unit-tests (note that code changes require unit-tests)
Reviewers Checklist
- Are the title and description (in both PR and commit) meaningful and clear?
- Is there a bug required (and linked) for this change?
- Should this PR be backported?
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.
/test all
/cc @carbonin
/retest
Codecov Report
Attention: Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.
Project coverage is 67.29%. Comparing base (
f5c6846) to head (c99b438). Report is 14 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| pkg/mirrorregistries/generator.go | 80.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #7448 +/- ##
==========================================
+ Coverage 67.26% 67.29% +0.02%
==========================================
Files 334 334
Lines 42265 42309 +44
==========================================
+ Hits 28431 28470 +39
- Misses 11261 11265 +4
- Partials 2573 2574 +1
| Files with missing lines | Coverage Δ | |
|---|---|---|
| internal/common/common.go | 30.98% <ø> (ø) |
|
| ...oller/controllers/agentserviceconfig_controller.go | 84.10% <100.00%> (+0.14%) |
:arrow_up: |
| internal/controller/controllers/common.go | 77.12% <ø> (ø) |
|
| pkg/mirrorregistries/generator.go | 67.56% <80.00%> (+0.90%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
/retest
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: carbonin, danielerez
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [carbonin,danielerez]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/cherry-pick release-ocm-2.12
@danielerez: once the present PR merges, I will cherry-pick it on top of release-ocm-2.12 in a new PR and assign it to you.
In response to this:
/cherry-pick release-ocm-2.12
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.
/cherry-pick release-ocm-2.13
@danielerez: once the present PR merges, I will cherry-pick it on top of release-ocm-2.13 in a new PR and assign it to you.
In response to this:
/cherry-pick release-ocm-2.13
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.
/retest-required
Remaining retests: 0 against base HEAD 1de1416d9f900c64b7287134b8655d524e7bdc1a and 2 for PR HEAD c99b438736c4e96448d36d1322e629b5fb382819 in total
/retest-required
Remaining retests: 0 against base HEAD 1de1416d9f900c64b7287134b8655d524e7bdc1a and 2 for PR HEAD c99b438736c4e96448d36d1322e629b5fb382819 in total
/retest-required
Remaining retests: 0 against base HEAD 03b3c1c1a50e9ded67ca49ca40d8cffd5c37f62b and 1 for PR HEAD c99b438736c4e96448d36d1322e629b5fb382819 in total
/retest
/retest
/retest-required
Remaining retests: 0 against base HEAD 1dc66326d304c3c2bffe346de6e2ab278f0d0ac9 and 2 for PR HEAD c99b438736c4e96448d36d1322e629b5fb382819 in total
@giladravid16 @pastequo Do you have an idea why these 2 konflux jobs are not triggering for a long time ?
@danielerez: all tests passed!
Full PR test history. Your PR dashboard.
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. I understand the commands that are listed here.
/retest
/retest
/retest
/retest
@danielerez: #7448 failed to apply on top of branch "release-ocm-2.12":
Applying: MGMT-20207: avoid adding system CA bundle to AdditionalTrustBundle
Using index info to reconstruct a base tree...
M internal/common/common.go
M internal/controller/controllers/agentserviceconfig_controller.go
M internal/controller/controllers/agentserviceconfig_controller_test.go
M internal/controller/controllers/common.go
M pkg/mirrorregistries/generator.go
A pkg/mirrorregistries/mirror_registry_test.go
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): pkg/mirrorregistries/mirror_registry_test.go deleted in HEAD and modified in MGMT-20207: avoid adding system CA bundle to AdditionalTrustBundle. Version MGMT-20207: avoid adding system CA bundle to AdditionalTrustBundle of pkg/mirrorregistries/mirror_registry_test.go left in tree.
Auto-merging pkg/mirrorregistries/generator.go
Auto-merging internal/controller/controllers/common.go
Auto-merging internal/controller/controllers/agentserviceconfig_controller_test.go
Auto-merging internal/controller/controllers/agentserviceconfig_controller.go
Auto-merging internal/common/common.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 MGMT-20207: avoid adding system CA bundle to AdditionalTrustBundle
In response to this:
/cherry-pick release-ocm-2.12
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.
@danielerez: new pull request created: #7514
In response to this:
/cherry-pick release-ocm-2.13
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.
[ART PR BUILD NOTIFIER]
Distgit: ose-agent-installer-api-server This PR has been included in build ose-agent-installer-api-server-container-v4.20.0-202504080239.p0.g8422dc4.assembly.stream.el9. All builds following this will include this PR.