Skip to content

Add UDF to discover namespace where Vizier is deployed#1307

Merged
aimichelle merged 2 commits intopixie-io:mainfrom
rosenhouse:vizier-namespace-udf
May 11, 2023
Merged

Add UDF to discover namespace where Vizier is deployed#1307
aimichelle merged 2 commits intopixie-io:mainfrom
rosenhouse:vizier-namespace-udf

Conversation

@rosenhouse
Copy link
Copy Markdown
Contributor

@rosenhouse rosenhouse commented May 9, 2023

Summary: Adds a new px.vizier_namespace() function usable from PxL scripts to discover the namespace that the Vizier components are deployed into.

Type of change: /kind feature

Test Plan: Added some unit tests. Manually tested on a minikube.

Relevant Issues: Fixes #1304

@pixie-io-buildbot
Copy link
Copy Markdown
Member

Can one of the admins verify this patch?

@rosenhouse
Copy link
Copy Markdown
Contributor Author

I mentioned this in Slack too, but just to surface the issue here:

I'm naming this thing vizier_namespace throughout, but I notice there is some prior art on this value:

So perhaps I should:

  1. have the env var as PL_POD_NAMESPACE or PL_NAMESPACE
  2. have the fields in the metadata code be pod_namespace
  3. keep the UDF as vizier_namespace() in order to make it clear that this UDF is about the vizier itself, not the http event data that it's processing.

Thoughts?

@JamesMBartlett
Copy link
Copy Markdown
Member

Thanks for your contribution, love the idea of making this programmatic rather than hardcoding pl in scripts.

I mentioned this in Slack too, but just to surface the issue here:

I'm naming this thing vizier_namespace throughout, but I notice there is some prior art on this value:

* kelvin has a `PL_NAMESPACE` environment variable flowing into a `FLAGS_namespace` https://github.com/pixie-io/pixie/blob/093d66e251e4cdf45cf72430cdd4f64ca83b5cb1/src/vizier/services/agent/kelvin/kelvin_main.cc#L41-L42

* other components have a `PL_POD_NAMESPACE` , e.g. https://github.com/pixie-io/pixie/blob/093d66e251e4cdf45cf72430cdd4f64ca83b5cb1/k8s/vizier/persistent_metadata/base/metadata_statefulset.yaml#L79-L82

So perhaps I should:

1. have the env var as `PL_POD_NAMESPACE` or `PL_NAMESPACE`

I would call the env var PL_POD_NAMESPACE

2. have the fields in the metadata code be `pod_namespace`

I think leaving these as vizier_namespace is good.

3. keep the UDF as `vizier_namespace()` in order to make it clear that this UDF is about the vizier itself, not the http event data that it's processing.

yeah I think vizier_namespace is good here

@JamesMBartlett
Copy link
Copy Markdown
Member

@pixie-io-buildbot test this please

@rosenhouse rosenhouse force-pushed the vizier-namespace-udf branch from c512b7d to 853811d Compare May 11, 2023 06:30
Signed-off-by: Gabe Rosenhouse <grosenhouse@vmware.com>
@rosenhouse rosenhouse force-pushed the vizier-namespace-udf branch from 853811d to fc3a332 Compare May 11, 2023 06:44
@rosenhouse rosenhouse marked this pull request as ready for review May 11, 2023 06:49
@rosenhouse rosenhouse requested review from a team as code owners May 11, 2023 06:49
This wasn't necessary for my manual testing, but could
be useful to enable filtering on the PEM, per Michelle.

Signed-off-by: Gabriel Rosenhouse <grosenhouse@vmware.com>
@aimichelle aimichelle merged commit 6182360 into pixie-io:main May 11, 2023
@rosenhouse rosenhouse deleted the vizier-namespace-udf branch May 11, 2023 19:19
ddelnano pushed a commit to k8sstormcenter/pixie that referenced this pull request Feb 25, 2026
Summary: Adds a new `px.vizier_namespace()` function usable from PxL
scripts to discover the namespace that the Vizier components are
deployed into.

Type of change: /kind feature

Test Plan: Added some unit tests.  Manually tested on a minikube.

Relevant Issues: Fixes pixie-io#1304

Changelog Message:
```release-note
Add `px.vizier_namespace()` UDF to get namespace that Vizier is running in.
```

---------

Signed-off-by: Gabe Rosenhouse <grosenhouse@vmware.com>
ddelnano pushed a commit to k8sstormcenter/pixie that referenced this pull request Feb 25, 2026
Summary: Adds a new `px.vizier_namespace()` function usable from PxL
scripts to discover the namespace that the Vizier components are
deployed into.

Type of change: /kind feature

Test Plan: Added some unit tests.  Manually tested on a minikube.

Relevant Issues: Fixes pixie-io#1304

Changelog Message:
```release-note
Add `px.vizier_namespace()` UDF to get namespace that Vizier is running in.
```

---------

Signed-off-by: Gabe Rosenhouse <grosenhouse@vmware.com>
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.

Feature request: discover Vizier namespace from PxL script

4 participants