Skip to content

security.networkPolicy.allowedIngressNamespaces is accepted but never applied #587

Description

@makbill

Summary

OpenClawInstance.spec.security.networkPolicy.allowedIngressNamespaces is a valid CRD field and
setting it succeeds, but the controller never actually adds those namespaces to the generated
NetworkPolicy's ingress rules. The field is silently a no-op.

Environment

  • Chart: oci://ghcr.io/paperclipinc/charts/openclaw-operator, version 0.38.3
  • Kubernetes: v1.35.5+k3s1 (k3s/k3d)

Steps to reproduce

  1. Apply an OpenClawInstance with:
    spec:
      security:
        networkPolicy:
          enabled: true
          allowedIngressNamespaces:
            - some-other-namespace
  2. Confirm the field landed: kubectl get openclawinstance <name> -o jsonpath='{.spec.security.networkPolicy}' — shows allowedIngressNamespaces: ["some-other-namespace"] correctly.
  3. Inspect the generated NetworkPolicy: kubectl get networkpolicy <name> -o yaml

Actual behavior

The ingress[].from list only ever contains the same-namespace namespaceSelector — the
namespace(s) listed in allowedIngressNamespaces never appear, regardless of how long you wait
or how many times you force a reconcile (verified via annotation-triggered reconcile + watching
resourceVersion/generation on the NetworkPolicy object, which don't change, and via operator
logs, which don't mention NetworkPolicy at all during that reconcile cycle — this isn't a
propagation delay, the controller isn't attempting the update).

Expected behavior

Namespaces listed in allowedIngressNamespaces should produce additional namespaceSelector
entries in the generated NetworkPolicy's ingress from list.

Workaround used

Created a separate, additional NetworkPolicy targeting the same pod labels
(app.kubernetes.io/instance/app.kubernetes.io/name) with the extra namespace's ingress rule,
since Kubernetes unions multiple NetworkPolicies' rules for the same pod. Left the
operator-managed NetworkPolicy alone since editing it directly would just get reverted on the
next reconcile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions