Skip to content

Conversation

@alyssacgoins
Copy link
Contributor

@alyssacgoins alyssacgoins commented Nov 10, 2025

Description of your changes:
Update backend/src/v2/metadata/env.go DefaultConfig() to return a metadata service config containing the pod-specific namespace. This also includes a change to backend/src/apiserver/common/config.go GetPodNamespace() that sets the default pod namespace to "kubeflow"

Checklist:

@alyssacgoins alyssacgoins changed the title Update env.go fix(backend): Allow pod namespace configuration on env.go metadata-grpc service address Nov 10, 2025
@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch 3 times, most recently from a905fc7 to 3f769fb Compare November 10, 2025 19:43
CaBundleSecretName string = "CABUNDLE_SECRET_NAME"
RequireNamespaceForPipelines string = "REQUIRE_NAMESPACE_FOR_PIPELINES"
CompiledPipelineSpecPatch string = "COMPILED_PIPELINE_SPEC_PATCH"
DefaultPodNamespace string = "kubeflow"
Copy link
Member

@gmfrasca gmfrasca Nov 10, 2025

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

Copy link
Member

@gmfrasca gmfrasca left a comment

Choose a reason for hiding this comment

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

/lgtm



# Returns the default_value if the environment variable is not found.
def get_env_var_with_default(config_name: str, default_value: str) -> str:
Copy link
Member

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed

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

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")
Copy link
Collaborator

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.

Copy link
Contributor Author

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

@google-oss-prow google-oss-prow bot added size/M and removed size/S labels Nov 11, 2025
@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch from 8c44353 to 5e7d656 Compare November 12, 2025 16:30
@google-oss-prow google-oss-prow bot added size/XXL and removed size/M labels Nov 12, 2025
fmt.Sprintf("$(%s)", component.EnvMetadataHost),
"--mlmd_server_port",
fmt.Sprintf("$(%s)", component.EnvMetadataPort),
"--mlmd_server_address", mlmdServerAddress,
Copy link
Collaborator

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.

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

fmt.Sprintf("$(%s)", component.EnvMetadataHost),
"--mlmd_server_port",
fmt.Sprintf("$(%s)", component.EnvMetadataPort),
"--mlmd_server_address", mlmdServerAddress,
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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()

@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch 3 times, most recently from 3b113ca to e8be142 Compare November 12, 2025 18:10
@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch 4 times, most recently from 851ddd7 to 9036661 Compare November 12, 2025 19:45
@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch from 9036661 to 7510781 Compare November 12, 2025 19:48
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

@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch from 7510781 to 0f0aced Compare November 12, 2025 21:09
@google-oss-prow google-oss-prow bot removed the lgtm label Nov 12, 2025
@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch 2 times, most recently from c6aa124 to d9318d2 Compare November 13, 2025 19:03
…space configurable.

Signed-off-by: agoins <[email protected]>

# Conflicts:
#	test_data/compiled-workflows/ray_job_integration_compiled.yaml
@alyssacgoins alyssacgoins force-pushed the update-metadata-env-config branch from d9318d2 to faf43c6 Compare November 13, 2025 19:29
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 google-oss-prow bot added the lgtm label Nov 13, 2025
@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

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 caecb1e into kubeflow:master Nov 13, 2025
190 of 193 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.

3 participants