fix: variable namespaces for networkpolicies #3342
Open
+5
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✏️ Summary of Changes
This PR fixes an issue #3319 where NetworkPolicies for various core components were incorrectly being applied to the
kubeflownamespace. This was caused by a hardcodednamespace: kubeflowin the base kustomization.yaml.Additionally, this PR updates the
tests/multi_tenancy_install.shscript to proactively create the required target namespaces before applying the policies, ensuring the installation succeeds even if components are installed in a pick-and-choose manner.The Problem
flowchart TB subgraph "Before Fix (Broken)" K[kustomization.yaml<br>namespace: kubeflow] --> |Forces ALL resources| KF[kubeflow namespace] P1[cert-manager-webhook.yaml<br>namespace: cert-manager] --> K P2[default-allow-auth.yaml<br>namespace: auth] --> K P3[istio-policy.yaml<br>namespace: istio-system] --> K K --> |All end up in| KF KF --> |Contains policies for| WRONG[❌ Wrong namespaces!] endThe Solution
flowchart TB subgraph "After Fix (Correct)" K2[kustomization.yaml<br>NO namespace override] --> |Respects each file|SPLIT SPLIT{Each policy goes<br>to its own namespace} SPLIT --> CM[cert-manager namespace] SPLIT --> AU[auth namespace] SPLIT --> IS[istio-system namespace] SPLIT --> KS[knative-serving namespace] SPLIT --> KF2[kubeflow namespace] SPLIT --> KFS[kubeflow-system namespace] CM --> |✅ Protects| CMP[cert-manager pods] AU --> |✅ Protects| AUP[auth pods] IS --> |✅ Protects| ISP[istio pods] endVerification
kustomize build common/networkpolicies/basegenerates policies with correct namespaces.shellcheck tests/multi_tenancy_install.shon the modified script to ensure robustness.Continuing work by @juhyeon-cha with addition of namespace creation in test scripts.
📦 Dependencies
🐛 Related Issues
✅ Contributor Checklist