Skip to content

fix(RELEASE-2158): use trusted-ca mounts to support self hosted Quay#360

Closed
querti wants to merge 1 commit intokonflux-ci:mainfrom
querti:add-trusted-ca-support
Closed

fix(RELEASE-2158): use trusted-ca mounts to support self hosted Quay#360
querti wants to merge 1 commit intokonflux-ci:mainfrom
querti:add-trusted-ca-support

Conversation

@querti
Copy link
Copy Markdown

@querti querti commented Apr 2, 2026

Add trusted-ca volume mounts to system certificate paths to be consistent with other tasks in the push-to-external-registry pipeline. Go-based tools (cosign, mobster) require the CA bundle at /etc/ssl/certs/ to include it in the system cert pool. This is needed for push-to-external-registry to work with self-hosted Quay instances that use custom CA certificates.

Assisted-by: Cursor

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 2, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@querti querti force-pushed the add-trusted-ca-support branch from 2583420 to 6829795 Compare April 2, 2026 08:46
@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add trusted-ca mounts for self-hosted Quay support

✨ Enhancement 🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Add trusted-ca ConfigMap support for custom CA certificates
• Mount CA bundle to standard system certificate paths
• Enable self-hosted Quay instances with custom CA support
• Make CA configuration optional with sensible defaults
Diagram
flowchart LR
  params["Task Parameters"]
  params -- "caTrustConfigMapName" --> configmap["ConfigMap Volume"]
  params -- "caTrustConfigMapKey" --> configmap
  configmap -- "ca-bundle.crt" --> mount1["/etc/pki/tls/certs/"]
  configmap -- "ca-bundle.crt" --> mount2["/etc/ssl/certs/"]
  mount1 --> gotools["Go-based Tools<br/>cosign, mobster"]
  mount2 --> gotools
Loading

Grey Divider

File Changes

1. tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml ✨ Enhancement +23/-0

Add trusted-ca volume mounts for custom CA support

• Added two new parameters: caTrustConfigMapName and caTrustConfigMapKey for CA bundle
 configuration
• Created trusted-ca volume from ConfigMap with optional flag for flexibility
• Mounted CA bundle to two standard system certificate paths: /etc/pki/tls/certs/ca-bundle.crt and
 /etc/ssl/certs/ca-custom-bundle.crt
• Configured read-only mounts to ensure CA certificates are accessible to Go-based tools

tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Apr 2, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Optional subPath mount fails 🐞 Bug ☼ Reliability
Description
The trusted-ca ConfigMap volume is marked optional: true, but it is always mounted via subPath
into /etc/...; if the ConfigMap or key is missing, the subPath file won’t exist and the Pod can
fail to start before any step executes.
Code

tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[R185-204]

+    - name: trusted-ca
+      configMap:
+        name: $(params.caTrustConfigMapName)
+        items:
+          - key: $(params.caTrustConfigMapKey)
+            path: ca-bundle.crt
+        optional: true

  stepTemplate:
    volumeMounts:
      - mountPath: /var/workdir
        name: workdir
+      - name: trusted-ca
+        mountPath: /etc/pki/tls/certs/ca-bundle.crt
+        subPath: ca-bundle.crt
+        readOnly: true
+      - name: trusted-ca
+        mountPath: /etc/ssl/certs/ca-custom-bundle.crt
+        subPath: ca-bundle.crt
+        readOnly: true
Evidence
The task declares the ConfigMap volume as optional, but then unconditionally mounts a specific file
from it (subPath: ca-bundle.crt) into two container file paths. With subPath, Kubernetes expects
the referenced file to exist in the volume; an optional/missing ConfigMap (or missing key) means the
file may not be present, causing container creation to fail before steps run.

tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[185-204]
Best Practice: Kubernetes Volumes: subPath semantics

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The Task marks the `trusted-ca` ConfigMap volume as `optional: true`, but mounts a specific file from it using `subPath`. If the ConfigMap (or key) is absent, the `subPath` file won’t exist, and the Pod may fail to start before executing any steps.

### Issue Context
The intent appears to be: “use trusted-ca when present, otherwise proceed normally.” The current approach does not reliably allow that.

### Fix Focus Areas
- tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[185-204]

### Suggested fix approaches (pick one)
1) **If the ConfigMap is required in practice:** remove `optional: true` so failures are explicit and consistent.
2) **If it must be optional:** avoid `subPath` mounts for the optional file. For example:
  - Mount the ConfigMap volume to a neutral directory (e.g. `/var/run/trusted-ca/`) without `subPath`.
  - In each step (or via a shared script wrapper), conditionally detect `/var/run/trusted-ca/ca-bundle.crt` and either:
    - set `SSL_CERT_FILE` / tool-specific CA env var to point to it, or
    - append/copy it into the system trust store (only if you have permissions and won’t clobber system CAs).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Undocumented CA ConfigMap params 🐞 Bug ⚙ Maintainability
Description
The task adds caTrustConfigMapName and caTrustConfigMapKey params that control which
ConfigMap/key is mounted, but the v0.3 README parameters table doesn’t mention them, reducing
discoverability and making configuration error-prone.
Code

tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[R160-167]

+    - name: caTrustConfigMapName
+      type: string
+      description: The name of the ConfigMap to read CA bundle data from
+      default: trusted-ca
+    - name: caTrustConfigMapKey
+      type: string
+      description: The name of the key in the ConfigMap that contains the CA bundle data
+      default: ca-bundle.crt
Evidence
The task spec defines two new parameters for selecting the trusted CA ConfigMap and key, but the
associated v0.3 README parameter list does not include these parameters.

tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[160-167]
tasks/augment-component-sboms-ta/0.3/README.md[5-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The v0.3 README does not document the newly-added CA trust ConfigMap parameters, so users won’t know how to configure the new trusted-ca behavior.

### Issue Context
The Task now supports customizing the ConfigMap name/key via params. The README should list these params alongside the others.

### Fix Focus Areas
- tasks/augment-component-sboms-ta/0.3/README.md[5-30]
- tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[160-167]

### Expected change
Add rows for:
- `caTrustConfigMapName` (default `trusted-ca`)
- `caTrustConfigMapKey` (default `ca-bundle.crt`)
And briefly describe how these are used for mounting trusted CA bundles.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +185 to +204
- name: trusted-ca
configMap:
name: $(params.caTrustConfigMapName)
items:
- key: $(params.caTrustConfigMapKey)
path: ca-bundle.crt
optional: true

stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
- name: trusted-ca
mountPath: /etc/pki/tls/certs/ca-bundle.crt
subPath: ca-bundle.crt
readOnly: true
- name: trusted-ca
mountPath: /etc/ssl/certs/ca-custom-bundle.crt
subPath: ca-bundle.crt
readOnly: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Optional subpath mount fails 🐞 Bug ☼ Reliability

The trusted-ca ConfigMap volume is marked optional: true, but it is always mounted via subPath
into /etc/...; if the ConfigMap or key is missing, the subPath file won’t exist and the Pod can
fail to start before any step executes.
Agent Prompt
### Issue description
The Task marks the `trusted-ca` ConfigMap volume as `optional: true`, but mounts a specific file from it using `subPath`. If the ConfigMap (or key) is absent, the `subPath` file won’t exist, and the Pod may fail to start before executing any steps.

### Issue Context
The intent appears to be: “use trusted-ca when present, otherwise proceed normally.” The current approach does not reliably allow that.

### Fix Focus Areas
- tasks/augment-component-sboms-ta/0.3/augment-component-sboms-ta.yaml[185-204]

### Suggested fix approaches (pick one)
1) **If the ConfigMap is required in practice:** remove `optional: true` so failures are explicit and consistent.
2) **If it must be optional:** avoid `subPath` mounts for the optional file. For example:
   - Mount the ConfigMap volume to a neutral directory (e.g. `/var/run/trusted-ca/`) without `subPath`.
   - In each step (or via a shared script wrapper), conditionally detect `/var/run/trusted-ca/ca-bundle.crt` and either:
     - set `SSL_CERT_FILE` / tool-specific CA env var to point to it, or
     - append/copy it into the system trust store (only if you have permissions and won’t clobber system CAs).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@querti querti force-pushed the add-trusted-ca-support branch from 6829795 to 0ee0191 Compare April 2, 2026 09:17
querti added a commit to querti/release-service-catalog that referenced this pull request Apr 2, 2026
Fix remaining incompatibilities in the push-to-external-registry
pipeline when used with self-hosted Quay instances:

- make-repo-public: detect Quay registries via /api/v1/discovery API
  instead of hardcoding quay.io. Enforce single Quay registry limit
  per release due to how the API token is passed. Add custom CA bundle
  support for self-signed certificates.
- collect-signing-params, collect-tpa-params: mount trusted CA to
  system cert paths, consistent with other tasks in the pipeline.

The mobster augment-component-sboms task is updated with trusted-ca
mounts in a companion PR [1].

Self-hosted Quay e2e test improvements:
- Enable SBOM tasks (TPA and signing) by adding required secrets
  to the vault and configuring the Conforma public key.
- Add verification that released repository is made public.

Other changes:
- Remove duplicated diagnoseFailedPLR function in wait-for-release.sh,
  use shared diagnose_failed_pipelinerun from test-functions.sh.

[1] konflux-ci/mobster#360

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.54%. Comparing base (6b19c10) to head (78ad47e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #360   +/-   ##
=======================================
  Coverage   95.54%   95.54%           
=======================================
  Files          57       57           
  Lines        3863     3863           
=======================================
  Hits         3691     3691           
  Misses        172      172           
Flag Coverage Δ
unit-tests 95.54% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@querti querti force-pushed the add-trusted-ca-support branch from 0ee0191 to aa18caa Compare April 2, 2026 09:42
Add trusted-ca volume mounts to system certificate paths to be
consistent with other tasks in the push-to-external-registry pipeline.
Go-based tools (cosign, mobster) require the CA bundle at
/etc/ssl/certs/ to include it in the system cert pool. This is needed
for push-to-external-registry to work with self-hosted Quay instances
that use custom CA certificates.

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
@querti querti force-pushed the add-trusted-ca-support branch from aa18caa to 78ad47e Compare April 2, 2026 10:10
@querti
Copy link
Copy Markdown
Author

querti commented Apr 2, 2026

/retest

@Allda
Copy link
Copy Markdown
Collaborator

Allda commented Apr 2, 2026

Is the jira RELEASE-2158 correctly assigned to this? I see the Jira talks about Quay

@Allda
Copy link
Copy Markdown
Collaborator

Allda commented Apr 2, 2026

Is the jira RELEASE-2158 correctly assigned to this? I see the Jira talks about Quay

I see the relation now.. please ignore

- mountPath: /var/workdir
name: workdir
- name: trusted-ca
mountPath: /etc/pki/tls/certs/ca-bundle.crt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I encountered some problems with this setup on fresh clusters without the configmap. See our Slack messages.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue has been filed as RELEASE-2383. This PR is blocked until the right approach for mounting is established in RELEASE-2383.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this PR is blocked on anything. In the build-pipelines and tasks we use custom CA bundles for long time and it works perfectly fine. We can just replicate the way it's done in build definition.
Note that depend on the task, the built in trust store should be updated, of the tools that need the custom CA bundle, need to get a reference to the path it was mounted in.

You can this how it was implemented in the git-clone task https://github.com/konflux-ci/build-definitions/blob/main/task/git-clone/0.1/git-clone.yaml

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are suggesting that we explicitly pass the cert to every tool that needs it, right? That is definitely a viable solution, but if we commit to that path, we would need to do this for every task in push-to-external-registry pipeline. Perhaps there is also an alternative solution where we can mount the cert without risk and we wouldn't need to make such extensive changes to all of our tasks. I'm not saying what the right solution should be, but I think it should be established and implemented as a part of RELEASE-2383, not in this PR. I will then apply the chosen approach here, whatever it may be.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm saying that it depends on the task.

  1. You can mount it to any location, and the update the global ca certs of the systemlike done in the build tasks - https://github.com/konflux-ci/build-definitions/blob/b5248cc849ac74735b36b4ba45ab950fce28854c/task/buildah-oci-ta/0.9/buildah-oci-ta.yaml#L510

  2. You can mount it to a known location used by a particular programming language (for example /etc/ssl/certs/ when the tool is written in go)

  3. You can mount it to any location you want, and expose the path using an environment variable (like some of the Python libraries support).

The important thing to keep in mind:

  1. The configmap with the trusted ca should be optional, that is the task pod can start and work properly if it doesn't exist.

  2. We should be careful with overriding existing certificates builtinto the image if some tools need them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on your comment I'm not sure if we are in agreement or not. There seem to be multiple approaches to solve this and we should establish the best one by weighing pros and cons. The pattern of usage in this task is repeated across many tasks in push-to-external-registry, so once we establish the right approach , we can use it here as well. My point is that this PR shouldn't be the place where this is established.

querti added a commit to querti/release-service-catalog that referenced this pull request Apr 7, 2026
Fix remaining incompatibilities in the push-to-external-registry
pipeline when used with self-hosted Quay instances:

- make-repo-public: detect Quay registries via /api/v1/discovery API
  instead of hardcoding quay.io. Enforce single Quay registry limit
  per release due to how the API token is passed. Add custom CA bundle
  support for self-signed certificates.
- collect-signing-params, collect-tpa-params: mount trusted CA to
  system cert paths, consistent with other tasks in the pipeline.

The mobster augment-component-sboms task is updated with trusted-ca
mounts in a companion PR [1].

Self-hosted Quay e2e test improvements:
- Enable SBOM tasks (TPA and signing) by adding required secrets
  to the vault and configuring the Conforma public key.
- Add verification that released repository is made public.

Other changes:
- Remove duplicated diagnoseFailedPLR function in wait-for-release.sh,
  use shared diagnose_failed_pipelinerun from test-functions.sh.

[1] konflux-ci/mobster#360

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
querti added a commit to querti/release-service-catalog that referenced this pull request Apr 7, 2026
Fix remaining incompatibilities in the push-to-external-registry
pipeline when used with self-hosted Quay instances:

- make-repo-public: detect Quay registries via /api/v1/discovery API
  instead of hardcoding quay.io. Enforce single Quay registry limit
  per release due to how the API token is passed. Add custom CA bundle
  support for self-signed certificates.
- collect-signing-params, collect-tpa-params: mount trusted CA to
  system cert paths, consistent with other tasks in the pipeline.

The mobster augment-component-sboms task is updated with trusted-ca
mounts in a companion PR [1].

Self-hosted Quay e2e test improvements:
- Enable SBOM tasks (TPA and signing) by adding required secrets
  to the vault and configuring the Conforma public key.
- Add verification that released repository is made public.

Other changes:
- Remove duplicated diagnoseFailedPLR function in wait-for-release.sh,
  use shared diagnose_failed_pipelinerun from test-functions.sh.

[1] konflux-ci/mobster#360

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
querti added a commit to querti/release-service-catalog that referenced this pull request Apr 7, 2026
Fix remaining incompatibilities in the push-to-external-registry
pipeline when used with self-hosted Quay instances:

- make-repo-public: detect Quay registries via /api/v1/discovery API
  instead of hardcoding quay.io. Enforce single Quay registry limit
  per release due to how the API token is passed. Add custom CA bundle
  support for self-signed certificates.
- collect-signing-params, collect-tpa-params: mount trusted CA to
  system cert paths, consistent with other tasks in the pipeline.

The mobster augment-component-sboms task is updated with trusted-ca
mounts in a companion PR [1].

Self-hosted Quay e2e test improvements:
- Enable SBOM tasks (TPA and signing) by adding required secrets
  to the vault and configuring the Conforma public key.
- Add verification that released repository is made public.

Other changes:
- Remove duplicated diagnoseFailedPLR function in wait-for-release.sh,
  use shared diagnose_failed_pipelinerun from test-functions.sh.

[1] konflux-ci/mobster#360

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
@BorekZnovustvoritel
Copy link
Copy Markdown
Contributor

Closing in favor of #363

querti added a commit to querti/release-service-catalog that referenced this pull request Apr 14, 2026
Fix remaining incompatibilities in the push-to-external-registry
pipeline when used with self-hosted Quay instances:

- make-repo-public: detect Quay registries via /api/v1/discovery API
  instead of hardcoding quay.io. Enforce single Quay registry limit
  per release due to how the API token is passed. Add custom CA bundle
  support for self-signed certificates.
- collect-signing-params, collect-tpa-params: mount trusted CA to
  system cert paths, consistent with other tasks in the pipeline.

The mobster augment-component-sboms task is updated with trusted-ca
mounts in a companion PR [1].

Self-hosted Quay e2e test improvements:
- Enable SBOM tasks (TPA and signing) by adding required secrets
  to the vault and configuring the Conforma public key.
- Add verification that released repository is made public.

Other changes:
- Remove duplicated diagnoseFailedPLR function in wait-for-release.sh,
  use shared diagnose_failed_pipelinerun from test-functions.sh.

[1] konflux-ci/mobster#360

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
querti added a commit to querti/release-service-catalog that referenced this pull request Apr 14, 2026
Fix remaining incompatibilities in the push-to-external-registry
pipeline when used with self-hosted Quay instances:

- make-repo-public: detect Quay registries via /api/v1/discovery API
  instead of hardcoding quay.io. Enforce single Quay registry limit
  per release due to how the API token is passed. Add custom CA bundle
  support for self-signed certificates.
- collect-signing-params, collect-tpa-params: mount trusted CA to
  system cert paths, consistent with other tasks in the pipeline.

The mobster augment-component-sboms task is updated with trusted-ca
mounts in a companion PR [1].

Self-hosted Quay e2e test improvements:
- Enable SBOM tasks (TPA and signing) by adding required secrets
  to the vault and configuring the Conforma public key.
- Add verification that released repository is made public.

Other changes:
- Remove duplicated diagnoseFailedPLR function in wait-for-release.sh,
  use shared diagnose_failed_pipelinerun from test-functions.sh.

[1] konflux-ci/mobster#360

Assisted-by: Cursor
Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants