The kongctl plan command provides built-in namespace guardrails:
--require-any-namespace forces every managed resource to declare a namespace
via kongctl.namespace or _defaults.kongctl.namespace.
--require-namespace=<ns> restricts planning to the provided namespaces
(repeat or comma-separate the flag to allow multiple values).
These flags help prevent accidentally operating on unexpected namespaces,
especially when running in sync mode.
External resources do not participate in namespace enforcement and do not
inherit kongctl metadata. If no managed parent resources are present, an
explicit _defaults.kongctl.namespace satisfies --require-any-namespace and
must match one of the values allowed by --require-namespace. Defaults on
external-only files are retained for enforcement without adding namespaces to
sync’s deletion scope. Defaults-only files still select namespaces for sync
deletion.
_deck steps do not independently participate in namespace enforcement. For a
managed control plane, enforcement checks the control plane’s namespace. A file
containing only external control planes with _deck must declare a matching
file-level default to satisfy namespace enforcement. This validates the
manifest’s declared namespace; it does not check the external control plane’s
labels or assign namespaces to Gateway entities managed by decK.
[site-ai-gateway-federation-guide]:
https://github.com/Kong/kongctl/blob/main/docs/ai-gateway-federation.md