pulumi / pulumi-kubernetes-operator

A Kubernetes Operator that automates the deployment of Pulumi Stacks
Apache License 2.0
221 stars 55 forks source link

Deprecate cross-namespace refs and watching multiple namespaces #329

Closed squaremo closed 2 years ago

squaremo commented 2 years ago

Cross-namespace refs won't work with the provided configuration, which gives RBAC permissions for one namespace only. Granting permissions to other namespaces means they are also accessible to the programs run by stacks, which is a security hole.

Therefore: guard the use of api/pulumi/shared/SecretRef.Namespace, and watching >1 (or all) namespaces with WATCH_NAMESPACE, with an environment variable INSECURE_NO_NAMESPACE_ISOLATION. This must be set to 1 or true to enable cross-namespace operation.

This is a breaking change for anyone running the operator with either an empty value, or a comma-separated list (e.g., ns1,ns2 for WATCH_NAMESPACE; and, for anyone using cross-namespace secret references (i.e., with a value in .namespace under one of the fields listed below). The documented means of installing the operator sets WATCH_NAMESPACE to be the namespace in which the operator is deployed.

References in Stack which can be cross-namespace (* indicates there's a list or map):

To fix the breakage:

yoyoraso commented 7 months ago

Hi, I have a question related to the namespace isolation is it possible to deploy one pulumi operator in one namespace to watch and create stacks across the cluster in all namespaces ?