Skip to content

fix: variable namespaces for networkpolicies#3319

Closed
juhyeon-cha wants to merge 2 commits into
kubeflow:masterfrom
juhyeon-cha:patch-1
Closed

fix: variable namespaces for networkpolicies#3319
juhyeon-cha wants to merge 2 commits into
kubeflow:masterfrom
juhyeon-cha:patch-1

Conversation

@juhyeon-cha

Copy link
Copy Markdown

Pull Request Template for Kubeflow Manifests

✏️ Summary of Changes

The problem is that all NetworkPolicies are being created in the kubeflow namespace because the namespace value is present in kustomization.yaml.

✅ Contributor Checklist

  • I have tested these changes with kustomize. See Installation Prerequisites.
  • All commits are signed-off to satisfy the DCO check.
  • I have considered adding my company to the adopters page to support Kubeflow and help the community, since I expect help from the community for my issue (see 1. and 2.).

You can join the CNCF Slack and access our meetings at the Kubeflow Community website. Our channel on the CNCF Slack is here #kubeflow-platform.

Signed-off-by: juhyeon <28646684+juhyeon-cha@users.noreply.github.com>
@juhyeon-cha

Copy link
Copy Markdown
Author

@juliusvonkohout Until recently, common/networkpolicies only contained policies for the kubeflow namespace.
Since this commit (3c338f4), policies for several namespaces, including kubeflow-system and cert-manager, have been added, but the namespace value in kustomization.yaml is changed to the kubeflow namespace.

https://github.com/kubeflow/manifests/blob/d23d747a05ca59e48c4bfbf039d23f4f3e6e2384/common/networkpolicies/base/cert-manager-webhook.yaml#L1-L7

@juliusvonkohout

juliusvonkohout commented Jan 7, 2026

Copy link
Copy Markdown
Member

@kunal-511 may you take a look?

I think we need to adjust the test scripts then to only use the specific networkpolicies. Or we make our life easier and just create the namespaces in the multi-tenancy script if they do not exist yet.
But to properly install parts of kubeflow we need to move them to the per application folders and upstream them long-term.

Error from server (NotFound): error when creating "STDIN": namespaces "auth" not found
Error from server (NotFound): error when creating "STDIN": namespaces "knative-serving" not found
Error: Process completed with exit code 1.

I will also do some dummy istio changes to trigger most tests.

@juliusvonkohout

Copy link
Copy Markdown
Member

Thank you @juhyeon-cha

@juliusvonkohout juliusvonkohout changed the title fix: make to create networkpolicy each namespaces fix: variable namespaces for networkpolicies Jan 7, 2026
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kimwnasptd for approval. For more information see the Kubernetes Code Review Process.

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

Details 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

@kunal-511

Copy link
Copy Markdown
Contributor

I think we need to adjust the test scripts then to only use the specific networkpolicies. Or we make our life easier and just create the namespaces in the multi-tenancy script if they do not exist yet.

Okay I think currently creating namespace in multi-tenancy script if they do not exist will work?
Will raise the PR

@juliusvonkohout

Copy link
Copy Markdown
Member

I think especially everything outside of the kubeflow namespaces so cert-manager, knative-serving etc. We should directly move in this PR to the respective folders.

@juliusvonkohout

Copy link
Copy Markdown
Member

@juhyeon-cha do you want to continue here? Otherwise we will for and continue.

@juhyeon-cha

Copy link
Copy Markdown
Author

@juliusvonkohout I'm good for now, so please feel free to take over. Thanks!

@danish9039

Copy link
Copy Markdown
Member

@juliusvonkohout i can take this up

@danish9039

Copy link
Copy Markdown
Member

/assign

danish9039 added a commit to danish9039/manifests that referenced this pull request Feb 9, 2026
Remove namespace override in kustomization.yaml to allow NetworkPolicies
to use their self-defined namespaces.

Also update multi_tenancy_install.sh to create required namespaces
before applying network policies, ensuring the installation succeeds.

Supersedes kubeflow#3319

Signed-off-by: Danish Ahuja <danish9039@gmail.com>
danish9039 added a commit to danish9039/manifests that referenced this pull request Feb 9, 2026
Remove namespace override in kustomization.yaml to allow NetworkPolicies
to use their self-defined namespaces.

Also update multi_tenancy_install.sh to create required namespaces
before applying network policies, ensuring the installation succeeds.

Supersedes kubeflow#3319

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
danish9039 added a commit to danish9039/manifests that referenced this pull request Feb 15, 2026
Remove namespace override in kustomization.yaml to allow NetworkPolicies
to use their self-defined namespaces.

Also update multi_tenancy_install.sh to create required namespaces
before applying network policies, ensuring the installation succeeds.

Supersedes kubeflow#3319

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
danish9039 added a commit to danish9039/manifests that referenced this pull request Feb 25, 2026
Remove namespace override in kustomization.yaml to allow NetworkPolicies
to use their self-defined namespaces.

Also update multi_tenancy_install.sh to create required namespaces
before applying network policies, ensuring the installation succeeds.

Supersedes kubeflow#3319

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
google-oss-prow Bot pushed a commit that referenced this pull request Feb 26, 2026
* fix: variable namespaces for networkpolicies

Remove namespace override in kustomization.yaml to allow NetworkPolicies
to use their self-defined namespaces.

Also update multi_tenancy_install.sh to create required namespaces
before applying network policies, ensuring the installation succeeds.

Supersedes #3319

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix: restore netpol namespace & refactor overlays

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix: update multi-tenancy script to include new overlays

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* refactor

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* format yaml disable modification of spec.selector

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* refactor: move networkpolicy files to canonical paths

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* refactor: wire subfolder kustomizations and remove dead overlays

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test: align cert-manager install and trivy scan paths

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* Update tests/cert_manager_install.sh

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Update tests/trivy_scan.py

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Update cert-manager installation script to use base

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* test: fix multitenancy wait and lint

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* Update tests/cert_manager_install.sh

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Update tests/trainer_install.sh

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Update multi_tenancy_install.sh

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Comment out default-allow-same-namespace.yaml

Comment out default network policy and note future changes.

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* test: enable istio-system default-allow-same-namespace only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test(netpol): add istiod control-plane allow policy only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test(netpol): add istiod webhook apiserver policy only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* lint

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test(netpol): add oauth2-proxy ingressgateway allow policy only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow oauth2-proxy and istio to reach dex

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow apiserver to reach knative webhook

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow apiserver to reach net-istio webhook

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: re-enable same-namespace allow for cert-manager

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: re-enable same-namespace allow for knative-serving

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow knative-serving to reach istio gateways

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow istio gateways to reach knative activator

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* move kubeflow network policy files into kubeflow namespace folder

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* rewire kubeflow namespace to apply moved network policies

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* addressed comments

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* move readme and owners

Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>

* cleanup

Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>

---------

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>
Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Raakshass added a commit to Raakshass/manifests that referenced this pull request Mar 27, 2026
* fix: variable namespaces for networkpolicies

Remove namespace override in kustomization.yaml to allow NetworkPolicies
to use their self-defined namespaces.

Also update multi_tenancy_install.sh to create required namespaces
before applying network policies, ensuring the installation succeeds.

Supersedes kubeflow#3319

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix: restore netpol namespace & refactor overlays

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix: update multi-tenancy script to include new overlays

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* refactor

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* fix

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* format yaml disable modification of spec.selector

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* refactor: move networkpolicy files to canonical paths

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* refactor: wire subfolder kustomizations and remove dead overlays

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test: align cert-manager install and trivy scan paths

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* Update tests/cert_manager_install.sh

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Update tests/trivy_scan.py

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Update cert-manager installation script to use base

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* test: fix multitenancy wait and lint

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* Update tests/cert_manager_install.sh

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Update tests/trainer_install.sh

Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Update multi_tenancy_install.sh

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestion from @juliusvonkohout

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Comment out default-allow-same-namespace.yaml

Comment out default network policy and note future changes.

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>

* test: enable istio-system default-allow-same-namespace only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test(netpol): add istiod control-plane allow policy only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test(netpol): add istiod webhook apiserver policy only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* lint

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* test(netpol): add oauth2-proxy ingressgateway allow policy only

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow oauth2-proxy and istio to reach dex

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow apiserver to reach knative webhook

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow apiserver to reach net-istio webhook

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: re-enable same-namespace allow for cert-manager

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: re-enable same-namespace allow for knative-serving

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow knative-serving to reach istio gateways

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* netpol: allow istio gateways to reach knative activator

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* move kubeflow network policy files into kubeflow namespace folder

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* rewire kubeflow namespace to apply moved network policies

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* addressed comments

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>

* move readme and owners

Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>

* cleanup

Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>

---------

Signed-off-by: danish9039 <danishsiddiqui040@gmail.com>
Signed-off-by: hippie-danish <133037056+danish9039@users.noreply.github.com>
Signed-off-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Signed-off-by: juliusvonkohout <45896133+juliusvonkohout@users.noreply.github.com>
Co-authored-by: Julius von Kohout <45896133+juliusvonkohout@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants