mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
Add the securitygroup-controller Helm package (Deployment, ServiceAccount, ClusterRole and binding, image build) and register it as a default system package so it ships with the platform. The ClusterRole grants cluster-wide pod patch — the controller stamps the SecurityGroup membership label on managed-app pods across dynamically-created tenant namespaces, so the grant cannot be namespace-scoped — plus read and finalizer patch on the backing CiliumNetworkPolicies, and leader-election leases. Tenants gain no new permissions; the membership label is written exclusively by this platform controller. helm-unittest pins the pod-patch and ciliumnetworkpolicies grants so a dropped verb fails the suite rather than silently failing closed at runtime. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
26 lines
1.0 KiB
YAML
26 lines
1.0 KiB
YAML
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: sdn.cozystack.io:securitygroup-controller
|
|
rules:
|
|
# Stamp and clear the per-SecurityGroup membership label on managed-app pods.
|
|
# Cluster-wide because tenant namespaces are created dynamically; the controller
|
|
# only ever patches the single membership-label key (see internal/
|
|
# securitygroupcontroller) and only on pods carrying the lineage identity.
|
|
- apiGroups: [""]
|
|
resources: ["pods"]
|
|
verbs: ["get", "list", "watch", "patch"]
|
|
# Watch the SecurityGroup-backing CiliumNetworkPolicies and manage the
|
|
# membership finalizer on them (via merge patches, never an Update that would
|
|
# drop the policy spec).
|
|
- apiGroups: ["cilium.io"]
|
|
resources: ["ciliumnetworkpolicies"]
|
|
verbs: ["get", "list", "watch", "patch"]
|
|
# Leader election (--leader-elect).
|
|
- apiGroups: ["coordination.k8s.io"]
|
|
resources: ["leases"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch"]
|
|
- apiGroups: [""]
|
|
resources: ["events"]
|
|
verbs: ["create", "patch"]
|