Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RHTAPWATCH-1039): mount custom certificate #1814

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/modules/ROOT/pages/verify-enterprise-contract.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ certificates issued by a not-commonly trusted root CA. In such cases,
`/var/run/secrets/kubernetes.io/serviceaccount` is a good value. Multiple
paths can be provided by using the `:` separator.

*CA_TRUST_CONFIGMAP_NAME* (`string`):: The name of the ConfigMap to read CA bundle data from.
+
*Default*: `trusted-ca`
*CA_TRUST_CONFIG_MAP_KEY* (`string`):: The name of the key in the ConfigMap that contains the CA bundle data.
+
*Default*: `ca-bundle.crt`
*INFO* (`string`):: Include rule titles and descriptions in the output. Set to `"false"` to disable it.
+
*Default*: `true`
Expand Down
2 changes: 2 additions & 0 deletions tasks/verify-enterprise-contract/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ kubectl apply -f https://raw.githubusercontent.com/enterprise-contract/ec-cli/ma
* **REKOR_HOST**: Rekor host for transparency log lookups
* **SSL_CERT_DIR**: Path to a directory containing SSL certs to be used when communicating
with external services.
* **CA_TRUST_CONFIGMAP_NAME**: The name of the ConfigMap to read CA bundle data from.
* **CA_TRUST_CONFIG_MAP_KEY**: The name of the key in the ConfigMap that contains the CA bundle data.
* **STRICT**: Fail the task if policy fails. Set to "false" to disable it.
* **HOMEDIR**: Value for the HOME environment variable.
* **EFFECTIVE_TIME**: Run policy checks with the provided time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ spec:
paths can be provided by using the `:` separator.
default: ""

- name: CA_TRUST_CONFIGMAP_NAME
type: string
description: The name of the ConfigMap to read CA bundle data from.
default: trusted-ca

- name: CA_TRUST_CONFIG_MAP_KEY
type: string
description: The name of the key in the ConfigMap that contains the CA bundle data.
default: ca-bundle.crt

- name: INFO
type: string
description: Include rule titles and descriptions in the output. Set to `"false"` to disable it.
Expand Down Expand Up @@ -207,6 +217,11 @@ spec:
memory: 2Gi
limits:
memory: 2Gi
volumeMounts:
- name: trusted-ca
mountPath: /etc/pki/tls/certs/ca-custom-bundle.crt
subPath: ca-bundle.crt
readOnly: true

- name: report
image: quay.io/enterprise-contract/ec-cli:snapshot
Expand Down Expand Up @@ -259,3 +274,12 @@ spec:
- >
.result == "SUCCESS" or .result == "WARNING" or ($strict | not)
- "$(results.TEST_OUTPUT.path)"

volumes:
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason a volume, instead of a workspace, was used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason. Any best practices around this? I'm not sure what's the impact of using one vs. the other.

Copy link
Member

Choose a reason for hiding this comment

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

I usually prefer a workspace because it provide more flexibility. While a volume is tied to a particular "storage" type, e.g. ConfigMap, a workspace is not. A workspace can be from a Secret, ConfigMap, PVC, emptyDir, etc. Although most of those would not be applicable in this case, I can see either Secret or ConfigMap being used.

More info here: https://tekton.dev/docs/pipelines/workspaces/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanation! I'll keep that in mind going forward.

- name: trusted-ca
configMap:
name: $(params.CA_TRUST_CONFIGMAP_NAME)
items:
- key: $(params.CA_TRUST_CONFIG_MAP_KEY)
path: ca-bundle.crt
optional: true
Loading