feat(repo-server): Declare custom trust certs for repo-server and plugins#1876
feat(repo-server): Declare custom trust certs for repo-server and plugins#1876svghadi merged 24 commits intoargoproj-labs:masterfrom
Conversation
|
Compared to the proposal in #1876, it turned out 1 init container is enough. Also, this implements |
|
/ok-to-test |
9e0a19d to
4653fab
Compare
|
The "Code scans / Run golangci-lint and gosec (pull_request)" failure to be adressed by #1880 |
|
The test failures are related to the fact the code depends on a tech-preview features. Any advise on how to handle such functionality? |
93a8f75 to
2e5afb6
Compare
de515ac to
448e641
Compare
c0a9ad2 to
448e641
Compare
198d41d to
9c3639c
Compare
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
… CTB support Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
…rustBundles to repo-server automatically Signed-off-by: Oliver Gondža <ogondza@gmail.com>
…rest - Use default image pull policy - Use default security context - Propagate proxy env vars Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: Oliver Gondža <ogondza@gmail.com>
761c828 to
5d8cbb6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@controllers/argocd/repo_server.go`:
- Around line 628-649: The CA trust mounts are only applied when a container's
image equals argoImage (from getArgoContainerImage), which skips repo-server
when a custom repo image is set; update the injection logic in the repo-server
deployment to also consider the repo image (from getRepoServerContainerImage) —
i.e., compute both expected images (argoImage and repoImage or a set of allowed
images), then in the loop over deploy.Spec.Template.Spec.Containers (the same
loop that appends prodVolumeMounts() and records containerNames) compare
container.Image against both images (or the image set) so repo-server and any
sidecars inheriting the repo image receive the volume mounts; keep
caTrustInitContainer and prodVolumeMounts usage as-is.
🧹 Nitpick comments (4)
tests/ginkgo/fixture/utils/fixtureUtils.go (1)
6-6: Consider grouping with otherk8s.io/api/*imports.The
certificatesv1beta1import is placed separately from the otherk8s.io/api/*imports (lines 18-24). For consistency, consider moving it to that group. However, this may be addressed by the linter fix in PR#1880.deploy/olm-catalog/argocd-operator/0.18.0/argoproj.io_argocds.yaml (1)
21958-22030: Add CEL validation for mutually exclusive clusterTrustBundles selectors in the source CRD.The schema documents that
nameis mutually exclusive withsignerName/labelSelector, but it isn't enforced. Since this file is auto-generated from the source CRD atconfig/crd/bases/argoproj.io_argocds.yaml, addx-kubernetes-validations(CEL) rules to the source to ensure invalid combinations fail fast instead of silently no-oping. Other fields in the CRD already use this pattern (e.g., TLS termination validations).config/crd/bases/argoproj.io_argocds.yaml (1)
21938-22020: Consider adding CRD CEL validations to enforce mutually exclusive selector fields.The schema documents that
nameis mutually exclusive withsignerName, andlabelSelectoronly works withsignerName, but the CRD doesn't enforce these constraints at admission time. For Kubernetes 1.25+, you can addx-kubernetes-validationsrules to catch these invalid combinations early.Proposed schema validation additions
signerName: description: |- Select all ClusterTrustBundles that match this signer name. Mutually-exclusive with name. The contents of all selected ClusterTrustBundles will be unified and deduplicated. type: string + x-kubernetes-validations: + - rule: "(has(self.name) && self.name != '') || (has(self.signerName) && self.signerName != '')" + message: "Set either name or signerName." + - rule: "!(has(self.name) && self.name != '' && has(self.signerName) && self.signerName != '')" + message: "name and signerName are mutually exclusive." + - rule: "!(has(self.labelSelector) && (!has(self.signerName) || self.signerName == ''))" + message: "labelSelector requires signerName." required: - path type: objectcontrollers/argocd/util.go (1)
1033-1033: Consider consolidating mapper parameters into a struct.The function signature now accepts 7 mapper functions, which is getting unwieldy. Consider grouping these into a configuration struct for better maintainability:
type ResourceWatchConfig struct { ClusterResourceMapper handler.MapFunc TLSSecretMapper handler.MapFunc NamespaceResourceMapper handler.MapFunc ClusterSecretResourceMapper handler.MapFunc ApplicationSetGitlabSCMTLSConfigMapMapper handler.MapFunc NMMapper handler.MapFunc SystemCATrustMapper handler.MapFunc }This would make the function signature cleaner and easier to extend in the future.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@controllers/argocd/repo_server.go`:
- Around line 695-701: The code in caTrustVolumes currently panics on List
errors (panic(err)) which will crash the controller; change caTrustVolumes to
return an error instead of panicking and propagate that error to the caller so
transient API errors can be retried/handled. Specifically, replace panic(err) in
the ClusterTrustBundle List block and the other panic sites referenced in
caTrustVolumes with returned errors (e.g., fmt.Errorf("listing
ClusterTrustBundles: %w", err)) and update the callers of caTrustVolumes to
check and return or handle the error appropriately. Ensure the function
signature of caTrustVolumes is updated to include an error return and adapt any
callers to propagate or log the error so controller reconciliation can retry
rather than crash.
75f1271 to
36ed5f7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@controllers/argocd/repo_server.go`:
- Around line 742-747: The log call inside the ConfigMap lookup error handling
uses the wrong structured field key ("secret"); update the call to log.Error in
the block that handles err from r.Get (the ConfigMap fetch using
cmProjection.Name and cr.Namespace) to use "configmap" instead of "secret" so
the fields accurately reflect the resource (i.e., keep the same message and
variables but change the field key to "configmap" for cmProjection.Name).
…n checksum change Signed-off-by: Oliver Gondža <ogondza@gmail.com>
36ed5f7 to
253df50
Compare
What type of PR is this?
/kind enhancement
What does this PR do / why we need it:
Permit users to trust CAs on a repo-server system level
Have you updated the necessary documentation?
Which issue(s) this PR fixes:
Fixes #1830
How to test changes / Special notes to the reviewer:
Can be tested against:
Summary by CodeRabbit
New Features
Documentation
Tests
Chores