-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(backend): Allow pod namespace configuration on env.go metadata-grpc service address #12428
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
fix(backend): Allow pod namespace configuration on env.go metadata-grpc service address #12428
Conversation
a905fc7 to
3f769fb
Compare
| CaBundleSecretName string = "CABUNDLE_SECRET_NAME" | ||
| RequireNamespaceForPipelines string = "REQUIRE_NAMESPACE_FOR_PIPELINES" | ||
| CompiledPipelineSpecPatch string = "COMPILED_PIPELINE_SPEC_PATCH" | ||
| DefaultPodNamespace string = "kubeflow" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for consistency, I think this should go in backend/src/apiserver/common/const.go
3f769fb to
bb58bbc
Compare
gmfrasca
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
bb58bbc to
db5e7d6
Compare
|
|
||
|
|
||
| # Returns the default_value if the environment variable is not found. | ||
| def get_env_var_with_default(config_name: str, default_value: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is essentially just renaming os.getenv, so we should probably just use that directly rather than create a new function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| metadata_service_host = os.environ.get("METADATA_GRPC_SERVICE_SERVICE_HOST", "metadata-grpc-service.kubeflow") | ||
| metadata_service_port = int(os.environ.get("METADATA_GRPC_SERVICE_SERVICE_PORT", 8080)) | ||
| metadata_service_host = "metadata-grpc-service.kubeflow" | ||
| pod_namespace = get_env_var_with_default("POD_NAMESPACE", "kubeflow") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check to see if metadawriter runs in the user's namespace in the multi-user mode or in the kubeflow namespace? If it's the former, then the POD_NAMESPACE will be incorrect similar to my comment on driver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-upstream TLS implementation, metadata-writer hard-coded the service host as "metadata-grpc-service.kubeflow", (https://github.com/kubeflow/pipelines/blob/e31038da5f124e309f5e71193bce0c0959acb7e0/backend/metadata_writer/src/metadata_helpers.py) and this env var is only set in the TLS manifests - so it looks like metadata-writer runs in the kubeflow namespace only
8c44353 to
5e7d656
Compare
| fmt.Sprintf("$(%s)", component.EnvMetadataHost), | ||
| "--mlmd_server_port", | ||
| fmt.Sprintf("$(%s)", component.EnvMetadataPort), | ||
| "--mlmd_server_address", mlmdServerAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need this change in addImporterTemplate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| fmt.Sprintf("$(%s)", component.EnvMetadataHost), | ||
| "--mlmd_server_port", | ||
| fmt.Sprintf("$(%s)", component.EnvMetadataPort), | ||
| "--mlmd_server_address", mlmdServerAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will also need the equivalent change in addContainerExecutorTemplate. Please scan for other areas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I added the mlmd address/host in driver.initPodSpecpatch(), those arguments are applied to the container executor pod - but does it make more sense to add those arguments via addContainerExecutorTemplate() instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's just let the API server own that to make it consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - updated. Removed these two flags from initPodSpecPatch(), and added them to addContainerExecutorTemplate()
3b113ca to
e8be142
Compare
851ddd7 to
9036661
Compare
9036661 to
7510781
Compare
mprahl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
7510781 to
0f0aced
Compare
c6aa124 to
d9318d2
Compare
…space configurable. Signed-off-by: agoins <[email protected]> # Conflicts: # test_data/compiled-workflows/ray_job_integration_compiled.yaml
d9318d2 to
faf43c6
Compare
mprahl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
|
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
caecb1e
into
kubeflow:master
Description of your changes:
Update
backend/src/v2/metadata/env.goDefaultConfig()to return a metadata service config containing the pod-specific namespace. This also includes a change tobackend/src/apiserver/common/config.goGetPodNamespace()that sets the default pod namespace to"kubeflow"Checklist: