Editing an egress policy in the console can clear its existing credential-injection rules. networkPolicyFromMode and networkPolicyFromDetailed in ui/src/lib/network-policy.ts construct replacement policies without copying network_credential_rules. networkPoliciesEqual also ignores those rules, so credential-only differences compare equal.
Synthetic reproduction:
- Load a policy with
network_credential_rulescontaining a rule forapi.example.comand a synthetic credential reference ID. - Pass that policy to either
networkPolicyFromMode(open or closed) ornetworkPolicyFromDetailedwhile editing egress settings. - The resulting policy omits the credential rule. Saving the replacement therefore removes credential injection, although the operator only edited egress settings.
Expected: egress edits retain credential rules; policy equality detects changes to them while treating absent and empty rule lists consistently.
Proposed fix: preserve the existing rules in both builders and include them in normalized policy comparison. PR #540 contains the fix and the regression tests egress edits preserve credential injection rules in every designer mode and policy equality detects credential changes and normalizes absent rules.
Self-assessed severity: moderate. An ordinary egress edit can break workloads that rely on injected credentials.
AI assistance: Codex drafted this issue and contributed the implementation, regression tests, and PR description. Filed to complete the maintainer-requested issue link for #540.
Thanks for opening this issue! A SPACE maintainer will take a look.
CONTRIBUTING.md explains how we review outside contributions.