feat: Add custom section for corporate CA Certificate in falco chart as requested in feature request #3907 - #3908
feat: Add custom section for corporate CA Certificate in falco chart as requested in feature request #3907#3908heitzflorian wants to merge 7 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: heitzflorian The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @heitzflorian! It looks like this is your first PR to falcosecurity/falco 🎉 |
…st issue falcosecurity [falcosecurity#3907] Ref: falcosecurity#3907 Signed-off-by: Florian HEITZ <heitz.florian@proton.me>
Signed-off-by: Florian HEITZ <heitz.florian@proton.me>
Signed-off-by: Florian HEITZ <heitz.florian@proton.me>
… containers using "volumeMounts" section of values.yaml. Signed-off-by: Florian HEITZ <heitz.florian@proton.me>
Signed-off-by: Florian HEITZ <heitz.florian@proton.me>
…not needed. The volume is created dynamically when rendering "volumes" section of the falco.podTemplate template in "pod-template.tpl" file Signed-off-by: Florian HEITZ <heitz.florian@proton.me>
kunalworldwide
left a comment
There was a problem hiding this comment.
A couple of things I noticed reviewing the Helm template changes:
1. data vs stringData in the Secret template
falcoctl-cacert-secret.yaml puts the PEM certificate under data:, but Kubernetes data fields require base64-encoded values. Since toYaml outputs the raw PEM string, this will either fail to create the Secret or produce a garbled certificate. You probably want stringData: instead, which accepts plain text and handles the encoding automatically:
stringData:
registry-cacert.pem: |-
{{- toYaml .Values.extra.registryCustomCaCert.cacert | nindent 4 }}2. Mount path shadows system certs
The example in values.yaml mounts the volume at /etc/ssl/certs, which would replace the container's entire system certificate directory. That means falcoctl loses access to all public CAs. A subPath mount or a path like /etc/ssl/certs/custom-ca.pem would be safer — lets the custom CA coexist with the system trust store.
3. Minor: missing trailing newline
falcoctl-cacert-secret.yaml is missing a trailing newline at EOF.
Overall the approach makes sense. The data/stringData fix is the main blocker.
Hi @kunalworldwide and thanks for your reply.
I either have to chose between using stringData which is easier, or find a way to base64encode prior piping it to What may have bothered me with stringData example: $ cat stringData-secret.yml
apiVersion: v1
kind: Secret
metadata:
name: dummysecret
type: Opaque
stringData:
my-secret: "clearValue"
$ kubectl apply -f stringData-secret.yml
secret/dummysecret created
$ kubectl get secrets dummysecret -o yaml
apiVersion: v1
data:
my-secret: Y2xlYXJWYWx1ZQ==
kind: Secret
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Secret","metadata":{"annotations":{},"name":"dummysecret","namespace":"default"},"stringData":{"my-secret":"clearValue"},"type":"Opaque"}
creationTimestamp: "2026-06-25T16:03:10Z"
name: dummysecret
namespace: default
resourceVersion: "22296700"
uid: 5822068f-afe9-48fd-ab80-7035fd59c196
type: OpaqueAs you can see, in the data example: $ cat data-secret.yml
apiVersion: v1
kind: Secret
metadata:
name: dummysecret2
type: Opaque
data:
my-secret: Y2xlYXJWYWx1ZQ==
$ kubectl apply -f data-secret.yml
secret/dummysecret2 created
$ kubectl get secrets dummysecret2 -o yaml
apiVersion: v1
data:
my-secret: Y2xlYXJWYWx1ZQ==
kind: Secret
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"my-secret":"Y2xlYXJWYWx1ZQ=="},"kind":"Secret","metadata":{"annotations":{},"name":"dummysecret2","namespace":"default"},"type":"Opaque"}
creationTimestamp: "2026-06-25T16:06:58Z"
name: dummysecret2
namespace: default
resourceVersion: "22298068"
uid: cd207bf0-7d75-4fe6-a95c-97faec317d87
type: OpaqueIn the case of I'll check if i have any way to base64 encode the content before chaining with I'll let you know and update my PR in any case. |
|
Adding label DetailsInstructions 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. |
kunalworldwide
left a comment
There was a problem hiding this comment.
Thanks for adding this — custom CA certs for corporate registries are a real gap in the chart.
I reviewed the Secret template and I think there is a base64 encoding issue:
chart/falco/templates/falcoctl-cacert-secret.yamlusesdata:and stores the raw PEM string underregistry-cacert.pem. Kubernetesdatafields must be base64-encoded, so a raw PEM value will render as invalid base64 and the Pod will not be able to mount it.- The fix is to switch to
stringData:(which Kubernetes encodes automatically) or to base64-encode the value in the template. Given that users are already pasting PEM text in values,stringData:is the safer UX.
A couple of other small things:
- The docs example mounts to
/etc/ssl/certs. That shadows the entire system certificate directory inside the falcoctl container. If the image already has distro CAs there, they will be hidden. Consider usingsubPath: registry-cacert.pemand mounting to a specific file path (e.g./etc/ssl/certs/registry-cacert.pem) so the base image CAs remain visible. - The volume name
{{ include "falco.fullname" . }}-falcoctl-registry-cacert-volumecould exceed 63 characters for long release names. Helm chart helpers usually do not truncatefalco.fullname, so this is worth clamping or using a shorter static suffix. - The new template file is missing a trailing newline.
- There are no chart tests for the new Secret/volume. Even a simple
helm templaterender test withregistryCustomCaCert.enabled=truewould catch thedatavsstringDataissue.
Happy to re-review once the Secret encoding is fixed.
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area chart
What this PR does / why we need it:
At the moment mounts.volumes, falcoctl.artifact.install.mounts and falcoctl.artifact.follow.mounts sections already exists in the falco upstream chart, but no extra section to declare the secret object in which you put the CACert content in.
Having an optional setting in the extra section in which we can provide a custom corporate CA certificate used by the target registry falcoctl is interacting with can help on-premise customized deployment to work out of the box after helm install command without manual post-install actions.
Which issue(s) this PR fixes:
Fixes #3907
Special notes for your reviewer:
Does this PR introduce a user-facing change?: