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

chore: Add ability to mount self-signed certs to kfp #10849

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

DharmitD
Copy link
Contributor

@DharmitD DharmitD commented May 23, 2024

Description of your changes:
Resolves #10848
This update allows CA bundles to be mounted to the launcher/executor pods since those make external connections to object store, which can be behind self signed certs.

users can already mount ca bundles to kfp pods themselves should they wish where applicable

This feature has been developed by @HumairAK and @VaniHaripriya, I'm merely proposing the PR and presenting it.

Checklist:

@google-oss-prow google-oss-prow bot requested review from chensun and Tomcli May 23, 2024 21:27
@DharmitD DharmitD force-pushed the mount-cert branch 3 times, most recently from 6058013 to 7037050 Compare May 23, 2024 22:18
@DharmitD DharmitD force-pushed the mount-cert branch 2 times, most recently from 59bc1fe to 87ad759 Compare May 28, 2024 23:32
Comment on lines 289 to 291
caBundleCfgMapName := os.Getenv("ARTIFACT_COPY_STEP_CABUNDLE_CONFIGMAP_NAME")
caBundleCfgMapKey := os.Getenv("ARTIFACT_COPY_STEP_CABUNDLE_CONFIGMAP_KEY")
caBundleMountPath := os.Getenv("ARTIFACT_COPY_STEP_CABUNDLE_MOUNTPATH")
Copy link
Contributor

@HumairAK HumairAK May 31, 2024

Choose a reason for hiding this comment

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

We initially picked these based on the kfp-tekton implementation, but I think we can pick better env vars now that are more generic, I propose:

EXECUTOR_CABUNDLE_CONFIGMAP_NAME
EXECUTOR_CABUNDLE_CONFIGMAP_KEY
EXECUTOR_CABUNDLE_MOUNTPATH

since these are utilized in the launcher/executor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, updated to have these new env vars.

@rimolive
Copy link
Member

@chensun from the kubeflow-pipeline-e2e-test script, I got it running successfully the following tests:

  • test/presubmit-backend-test.sh
  • test/kfp-functional-test/kfp-functional-test.sh
  • test/sample-test/sample_test_launcher.py

If these scripts run with no errors, can we consider approve?

This update allows CA bundles to be mounted to the launcher/executor pods since those make external connections to object store, which can be behind self signed certs.
Detailed Changes:
- Added `REQUESTS_CA_BUNDLE` to the environment variables. This is necessary
  because many Python-based libraries (e.g., requests) utilize this environment
  variable for SSL/TLS certificate verification. Notably, even though Boto3
  is documented to use `AWS_CA_BUNDLE`, tests have shown that it only respects
  `REQUESTS_CA_BUNDLE`. Reference:
  https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification
  and aws/aws-cli#3425.

- Configured `AWS_CA_BUNDLE` for AWS CLI and related utilities to ensure AWS
  services utilize our custom CA bundle for SSL/TLS.

- Set up `SSL_CERT_FILE` environment variable for OpenSSL's default certificate
  file. This setting is important as the `SSL_CERT_DIR` path adjustments had
  inconsistent results across different environments, as discussed in OpenSSL
  documentation: https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_default_verify_paths.html

Signed-off-by: ddalvi <ddalvi@redhat.com>
Co-authored-by: Vani Haripriya <vmudadla@redhat.com>
Co-authored-by: Humair Khan <HumairAK@users.noreply.github.com>
Signed-off-by: ddalvi <ddalvi@redhat.com>
@DharmitD
Copy link
Contributor Author

/hold

Comment on lines 57 to 62
defer func() {
// Clean up environment variables
os.Unsetenv("EXECUTOR_CABUNDLE_CONFIGMAP_NAME")
os.Unsetenv("EXECUTOR_CABUNDLE_CONFIGMAP_KEY")
os.Unsetenv("EXECUTOR_CABUNDLE_MOUNTPATH")
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

you probably don't need to call this every iteration, and can just call it at the end of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, updated to have the defer func in the end of the function.

}

// Call the function with a reference name
templateName := c.addContainerExecutorTemplate("test-ref")
Copy link
Contributor

@HumairAK HumairAK Jun 20, 2024

Choose a reason for hiding this comment

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

this should be the container-impl template name "system-container-impl" not executor template name which is what the function returns

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, updated to have the container-impl template name.

@DharmitD DharmitD force-pushed the mount-cert branch 2 times, most recently from 83d212e to 4aaaaf2 Compare June 20, 2024 21:16
@DharmitD
Copy link
Contributor Author

/unhold

@DharmitD
Copy link
Contributor Author

Added a unit test to test the feature, unit test is passing: https://github.com/kubeflow/pipelines/actions/runs/9604504756/job/26490130091?pr=10849
PR's ready for review.
cc: @HumairAK @rimolive @chensun

@rimolive
Copy link
Member

/lgtm

cc @HumairAK @chensun


for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Setup the environment variables for testing
Copy link
Contributor

@HumairAK HumairAK Jun 21, 2024

Choose a reason for hiding this comment

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

I would remove all the comments in this testing function they are stating what is obvious in the code that follows them

// Setup the environment variables for testing
// Creating an instance of workflowCompiler with properly initialized members
// Call the function with a reference name
// Fetch the template and check existence
// Check Volumes
// Check VolumeMounts in the container
// Clean up environment variables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, removed these comments.

Signed-off-by: ddalvi <ddalvi@redhat.com>
Copy link

@DharmitD: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
kubeflow-pipelines-components-google-cloud-python38 1cee088 link true /test kubeflow-pipelines-components-google-cloud-python38
kubeflow-pipeline-e2e-test 76a1429 link false /test kubeflow-pipeline-e2e-test
kubeflow-pipelines-samples-v2 0bc7cdf link false /test kubeflow-pipelines-samples-v2
kubeflow-pipeline-upgrade-test 0bc7cdf link false /test kubeflow-pipeline-upgrade-test

Instructions 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. I understand the commands that are listed here.

@DharmitD
Copy link
Contributor Author

Ready for review.
@rimolive could you lgtm again?
cc: @HumairAK @chensun

@DharmitD
Copy link
Contributor Author

cc @chensun @zijianjoy @james-jwu

@rimolive
Copy link
Member

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Jun 26, 2024
@HumairAK
Copy link
Contributor

HumairAK commented Jun 26, 2024

/lgtm
/approve

@rimolive
Copy link
Member

/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HumairAK, rimolive

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

The pull request process is described here

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

@google-oss-prow google-oss-prow bot merged commit 29b7d2f into kubeflow:master Jun 27, 2024
6 of 8 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.

[feature] Add ability to mount self-signed certs to kfp
3 participants