Skip to content

Conversation

@alyssacgoins
Copy link
Contributor

@alyssacgoins alyssacgoins commented Dec 22, 2025

Description of your changes:
Update the CA cert logic on driver/launcher so that if CABUNDLE_SECRET_NAME is set, even if pod-to-pod TLS is not enabled, the cert will be passed into the launcher.

backend/test/compiler/argo_ginkgo_test.go is updated to fix env var testing, in order to validate the change above.

Checklist:

@google-oss-prow
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@alyssacgoins alyssacgoins force-pushed the ca_cert_conditional branch 2 times, most recently from a3ef196 to 930b21b Compare December 22, 2025 17:05
@alyssacgoins alyssacgoins marked this pull request as ready for review December 22, 2025 17:10
@google-oss-prow google-oss-prow bot requested a review from hbelmiro December 22, 2025 17:10

setCABundle := false
if common.GetCaBundleSecretName() != "" && (c.mlPipelineTLSEnabled || common.GetMetadataTLSEnabled()) {
if common.GetCaBundleSecretName() != "" || c.mlPipelineTLSEnabled || common.GetMetadataTLSEnabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we still need to guarantee that the secret name is set.

Suggested change
if common.GetCaBundleSecretName() != "" || c.mlPipelineTLSEnabled || common.GetMetadataTLSEnabled() {
if common.GetCaBundleSecretName() != "" {

}
// If the apiserver is TLS-enabled, add the custom CA bundle to the executor.
if common.GetCaBundleSecretName() != "" && (c.mlPipelineTLSEnabled || common.GetMetadataTLSEnabled()) {
if common.GetCaBundleSecretName() != "" || c.mlPipelineTLSEnabled || common.GetMetadataTLSEnabled() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we still need to guarantee that the secret name is set.

Suggested change
if common.GetCaBundleSecretName() != "" || c.mlPipelineTLSEnabled || common.GetMetadataTLSEnabled() {
if common.GetCaBundleSecretName() != "" {

Copy link
Contributor

@hbelmiro hbelmiro left a comment

Choose a reason for hiding this comment

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

We should do the same in backend/src/v2/compiler/argocompiler/dag.go and backend/src/v2/compiler/argocompiler/importer.go.

volumeSource.Secret = &k8score.SecretVolumeSource{SecretName: caBundleSecretName}
} else if caBundleConfigMapName != "" {
caBundleConfigMapKey := common.GetCaBundleConfigMapKey()
if caBundleConfigMapKey == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should align the behavior between Secret and ConfigMap such that:

  1. Prefer Secret over ConfigMap (like your code)
  2. We have one configuration option of CABUNDLE_KEY_NAME that applies to both Secret and ConfigMap.
  3. If CABUNDLE_KEY_NAME is not set, then don't set SubPath on either the Secret or ConfigMap (matches existing Secret behavior).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@google-oss-prow google-oss-prow bot added size/XXL and removed size/XL labels Jan 5, 2026
@alyssacgoins alyssacgoins force-pushed the ca_cert_conditional branch 3 times, most recently from 1beaca0 to 90a3f40 Compare January 5, 2026 18:32
return GetStringConfigWithDefault(CaBundleSecretName, "")
}

func GetCaBundleConfigMapKey() string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
func GetCaBundleConfigMapKey() string {
func GetCABundleKey() string {

caBundleKeyName := common.GetCABundleKey()
volumeMount := k8score.VolumeMount{Name: "custom-ca", MountPath: common.CABundleDir}
if caBundleKeyName != "" {
volumeMount.SubPath = caBundleKeyName
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this logic is quite right. I think we want to do something like this instead where the key can change but the mounted path is always the same. Consider using a constant variable for ca.crt.

diff --git a/backend/src/v2/compiler/argocompiler/common.go b/backend/src/v2/compiler/argocompiler/common.go
index 8e4c8e081..6112679e3 100644
--- a/backend/src/v2/compiler/argocompiler/common.go
+++ b/backend/src/v2/compiler/argocompiler/common.go
@@ -58,12 +58,32 @@ func ConfigureCustomCABundle(tmpl *wfapi.Template) {
 	caBundleSecretName := common.GetCaBundleSecretName()
 	caBundleConfigMapName := common.GetCaBundleConfigMapName()
 	volumeSource := k8score.VolumeSource{}
+	caBundleKeyName := common.GetCABundleKey()
+	if caBundleKeyName == "" {
+		caBundleKeyName = "ca.crt"
+	}
 
 	// CABUNDLE_SECRET_NAME is prioritized above CABUNDLE_CONFIGMAP_NAME.
 	if caBundleSecretName != "" { // nolint:gocritic // ifElseChain is preferred here for clarity over a switch
-		volumeSource.Secret = &k8score.SecretVolumeSource{SecretName: caBundleSecretName}
+		volumeSource.Secret = &k8score.SecretVolumeSource{
+			SecretName: caBundleSecretName,
+			Items: []k8score.KeyToPath{
+				{
+					Key:  caBundleKeyName,
+					Path: "ca.crt",
+				},
+			},
+		}
 	} else if caBundleConfigMapName != "" {
-		volumeSource.ConfigMap = &k8score.ConfigMapVolumeSource{LocalObjectReference: k8score.LocalObjectReference{Name: caBundleConfigMapName}}
+		volumeSource.ConfigMap = &k8score.ConfigMapVolumeSource{
+			LocalObjectReference: k8score.LocalObjectReference{Name: caBundleConfigMapName},
+			Items: []k8score.KeyToPath{
+				{
+					Key:  caBundleKeyName,
+					Path: "ca.crt",
+				},
+			},
+		}
 	} else {
 		glog.Error("Neither CABUNDLE_SECRET_NAME nor CABUNDLE_CONFIGMAP_NAME is set. Failed to configure custom CA bundle.")
 		return
@@ -75,13 +95,8 @@ func ConfigureCustomCABundle(tmpl *wfapi.Template) {
 	tmpl.Volumes = append(tmpl.Volumes, volume)
 
 	// If CABUNDLE_KEY_NAME is set, set its value to the VolumeMount subpath.
-	caBundleKeyName := common.GetCABundleKey()
 	volumeMount := k8score.VolumeMount{Name: "custom-ca", MountPath: common.CABundleDir}
-	if caBundleKeyName != "" {
-		volumeMount.SubPath = caBundleKeyName
-	}
 	tmpl.Container.VolumeMounts = append(tmpl.Container.VolumeMounts, volumeMount)
-
 }
 
 // addExitTask adds an exit lifecycle hook to a task if exitTemplate is not empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Signed-off-by: alyssacgoins <agoins@redhat.com>
Copy link
Collaborator

@mprahl mprahl left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mprahl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

{
compilerOptions: argocompiler.Options{CacheDisabled: true},
envVars: map[string]string{"PIPELINE_RUN_AS_USER": "1001", "PIPELINE_LOG_LEVEL": "3"},
pipelineFilePaths: []string{filepath.Join(pipelineFilesRootDir, pipelineDirectory, "run_as_user_cache_disabled.yaml")},
Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused about this, why do you need a separate yaml? can the existing pipelines not run as a user and with a different log level? if so, we can always set the required values in the expected compiled workflow object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A separate YAML is necessary because the environment variables update the contents of the YAML - for example, the variable PIPELINE_RUN_AS_USER adds securityContext: runAsUser: 1001 to the compiled workflow. But we can't update the general YAML with this specialized case, because then the test cases with no env variables set will fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

in that case, we can check if we need to update or not based on the environment variable

envVars: map[string]string{"PIPELINE_RUN_AS_USER": "1001", "PIPELINE_LOG_LEVEL": "3"},
compilerOptions: argocompiler.Options{CacheDisabled: false},
envVars: map[string]string{"PIPELINE_RUN_AS_USER": "1001", "PIPELINE_LOG_LEVEL": "3"},
pipelineFilePaths: []string{filepath.Join(pipelineFilesRootDir, pipelineDirectory, "run_as_user_cache_enabled.yaml")},
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed above ^

@google-oss-prow google-oss-prow bot merged commit 460002b into kubeflow:master Jan 5, 2026
178 of 181 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants