Skip to content

Conversation

jyizheng
Copy link
Contributor

What type of PR is this?

feature

What this PR does / why we need it:
Provides a convenient default without the need to explicitly set when running in a namespace other than default.
Use flag (--pool-namespce) if set, else NAMESPACE env var, else default; add documentation for behavior

Which issue(s) this PR fixes:

#1569

Does this PR introduce a user-facing change?:
NONE

…v var, else default; add documentation for behavior
Copy link

netlify bot commented Sep 12, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 166f784
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/68c4c0d8c0648e000824d76a
😎 Deploy Preview https://deploy-preview-1578--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

linux-foundation-easycla bot commented Sep 12, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 12, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @jyizheng!

It looks like this is your first PR to kubernetes-sigs/gateway-api-inference-extension 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/gateway-api-inference-extension has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 12, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @jyizheng. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 12, 2025
@@ -188,9 +188,16 @@ func (r *Runner) Run(ctx context.Context) error {
FilterProvider: filters.WithAuthenticationAndAuthorization,
}

// Determine pool namespace: flag > NAMESPACE env var > default
Copy link
Contributor

Choose a reason for hiding this comment

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

the user may intentionally set the default in the flag, the logic below doesn't account for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Just changed my code.

@@ -188,9 +188,16 @@ func (r *Runner) Run(ctx context.Context) error {
FilterProvider: filters.WithAuthenticationAndAuthorization,
}

// Determine pool namespace: flag > NAMESPACE env var > default
resolvedPoolNamespace := *poolNamespace
if resolvedPoolNamespace == runserver.DefaultPoolNamespace {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should just check if flag is nil/empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense. Just fixed it.

@ahg-g
Copy link
Contributor

ahg-g commented Sep 12, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 12, 2025
// Determine pool namespace: if flag set, use it; else NAMESPACE env var; else default
resolvedPoolNamespace := ""
poolNamespaceFlagSet := false
flag.Visit(func(f *flag.Flag) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do something like this? No need to check the flag name I think.

func resolvePoolNamespace() string {
   // check if --pool-namespace flag is set
    if *poolNamespace != "" {
      return *poolNamespace
    }
    
    // Check if NAMESPACE env var is set
    nsEnv := os.Getenv("NAMESPACE")
    if nsEnv != "" {
       return nsEnv   
}
    // Fallback to default
    return runserver.DefaultPoolNamespace
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh to do this we should set the default value of the flag to "", which I think we we should do.

poolNamespace = flag.String("pool-namespace", runserver.DefaultPoolNamespace, "Namespace of the InferencePool this Endpoint Picker is associated with.")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry pls see my last comment we should set the default value of the flag to "", right now the flag is defaulted to default so it will never be empty. We should change that, otherwise it's misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Just replace runserver.DefaultPoolNamespace with empty string. Is this ok?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry one last comment, I suggest we add a new flags.md doc under https://github.com/kubernetes-sigs/gateway-api-inference-extension/tree/main/site-src/guides/epp-configuration, this is where we document how to configure the EPP binary.

In flags.md we can just start with the pool-namespace flag. Most flags should be self explanatory in their flag description so we don't need to document everything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. File relocated.

@liu-cong
Copy link
Contributor

Thanks @jyizheng !

/lgtm

@ahg-g Can you approve if this looks good?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 15, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Sep 15, 2025

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, jyizheng

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 15, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Sep 15, 2025

as a followup, can you please update the helm chart of the epp deployment to add the namespace envvar?

@k8s-ci-robot k8s-ci-robot merged commit 0ed667e into kubernetes-sigs:main Sep 15, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants