8000 fix: Allow CA bundle path without config map by fabiendupont · Pull Request #4451 · kserve/kserve · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Allow CA bundle path without config map #4451

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fabiendupont
Copy link
@fabiendupont fabiendupont commented May 6, 2025

What this PR does / why we need it:

In the previous code, the AWS_CA_BUNDLE environment variable is only considered if the CA_BUNDLE_CONFIGMAP_NAME environment variable is set, while the doc doesn't explicitely tie they together. This change allows using AWS_CA_BUNDLE independently to leverage a CA bundle certificate that would be preexisting in the image or injected by Kubernetes in a known path.

One use case is leveraging OpenShift service serving certificates, which injects the service CA in the containers via a projected ConfigMap. The service CA is always available in
/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt.

The documentation already says that this variable can be used to set the path to the CA bundle, while the ConfigMap uses a static file name (cabundle.crt) located in the ConfigMap volume mount point.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Type of changes
Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

ca_bundle_full_path = (
global_ca_bundle_volume_mount_path + "/cabundle.crt"
)
isvc_aws_ca_bundle_path = os.getenv("AWS_CA_BUNDLE")
Copy link
Contributor

Choose a reason for hiding this comment

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

The AWS_CA_BUNDLE environment variable is used to specify the path to the CA file, under the assumption that the CA is already present inside the pod. However, shouldn’t there be a logic to check whether this file actually exists?

Also, in the OpenShift use case, it's said that the service-ca.crt file is always present, but in reality, this is controlled by configuration. For example, in this link, if the value is set to false, the file is not attached to the pod. Our team discussed whether we really can remove this file from runtime. @VedantMahabaleshwarkar can you please share the result ?

Copy link
Author

Choose a reason for hiding this comment

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

There is a check for the file existence lower. I am just splitting the logic between AWS_CA_BUNDLE and CA_BUNDLE_VOLUME_MOUNT_POINT environment variables. Then, the if os.path.exists(ca_bundle_full_path): block is checking the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I missed the part! then I am ok with this change :)

Copy link
Contributor
@Jooho Jooho left a comment

Choose a reason for hiding this comment

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

/lgtm

ca_bundle_full_path = (
global_ca_bundle_volume_mount_path + "/cabundle.crt"
)
isvc_aws_ca_bundle_path = os.getenv("AWS_CA_B 8000 UNDLE")
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I missed the part! then I am ok with this change :)

@Jooho
Copy link
Contributor
Jooho commented May 7, 2025

/ok-to-test

@fabiendupont fabiendupont force-pushed the fix-allow-cabundle-without-configmap branch from 2744a5b to 9c1b57a Compare May 7, 2025 16:17
In the previous code, the AWS_CA_BUNDLE environment variable is only
considered if the CA_BUNDLE_CONFIGMAP_NAME environment variable is
set, while the doc doesn't explicitely tie they together. This change
allows using AWS_CA_BUNDLE independently to leverage a CA bundle
certificate that would be preexistent in the image or injected by
Kubernetes in a known path.

One use case is leveraging OpenShift service serving certificates, which
injects the service CA in the containers via a projected ConfigMap. The
service CA is always available in
/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt.

Signed-off-by: Fabien Dupont <fabiendupont@pm.me>
@fabiendupont fabiendupont force-pushed the fix-allow-cabundle-without-configmap branch from a89179c to 2f3fbda Compare May 12, 2025 06:53
@sivanantha321
Copy link
Member

@fabiendupont Can you add a unit test for this ?

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.

4 participants
< 2A60 /div>
0