|
| 1 | +--- |
| 2 | +apiVersion: v1 |
| 3 | +kind: ServiceAccount |
| 4 | +metadata: |
| 5 | + namespace: cabotage |
| 6 | + name: cabotage-tailscale-operator-manager-account |
| 7 | +--- |
| 8 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 9 | +kind: ClusterRole |
| 10 | +metadata: |
| 11 | + name: cabotage-tailscale-operator-manager-role-cluster |
| 12 | +rules: |
| 13 | + |
| 14 | + # Framework: knowing which other operators are running (i.e. peering). |
| 15 | + - apiGroups: [kopf.dev] |
| 16 | + resources: [clusterkopfpeerings] |
| 17 | + verbs: [list, watch, patch, get] |
| 18 | + |
| 19 | + # Framework: runtime observation of namespaces & CRDs (addition/deletion). |
| 20 | + - apiGroups: [apiextensions.k8s.io] |
| 21 | + resources: [customresourcedefinitions] |
| 22 | + verbs: [get, list, watch] |
| 23 | + - apiGroups: [""] |
| 24 | + resources: [namespaces] |
| 25 | + verbs: [list, watch] |
| 26 | + |
| 27 | + # Framework: posting the events about the handlers progress/errors. |
| 28 | + - apiGroups: [""] |
| 29 | + resources: [events] |
| 30 | + verbs: [create] |
| 31 | + |
| 32 | + # Application: watch the CabotageTailscaleOperatorConfig CRD cluster-wide. |
| 33 | + - apiGroups: [cabotage.io] |
| 34 | + resources: [cabotagetailscaleoperatorconfigs, cabotagetailscaleoperatorconfigs/status] |
| 35 | + verbs: [list, watch, patch, get] |
| 36 | + |
| 37 | + # Manage K8s resources in org namespaces for the Tailscale operator. |
| 38 | + - apiGroups: [""] |
| 39 | + resources: [secrets, serviceaccounts] |
| 40 | + verbs: [get, list, watch, create, update, patch, delete] |
| 41 | + - apiGroups: [apps] |
| 42 | + resources: [deployments] |
| 43 | + verbs: [get, list, watch, create, update, patch, delete] |
| 44 | + - apiGroups: [rbac.authorization.k8s.io] |
| 45 | + resources: [roles, rolebindings] |
| 46 | + verbs: [get, list, watch, create, update, patch, delete, deletecollection] |
| 47 | + |
| 48 | + # Manage ClusterRoleBinding subjects (add/remove operator SAs). |
| 49 | + - apiGroups: [rbac.authorization.k8s.io] |
| 50 | + resources: [clusterrolebindings] |
| 51 | + verbs: [get, list, update, patch] |
| 52 | + |
| 53 | + # Delegated permissions — the manager must hold every permission it grants |
| 54 | + # via the tailscale-operator ClusterRole (K8s RBAC escalation prevention). |
| 55 | + - apiGroups: [""] |
| 56 | + resources: [nodes] |
| 57 | + verbs: [get, list, watch] |
| 58 | + - apiGroups: [""] |
| 59 | + resources: [configmaps, events, pods] |
| 60 | + verbs: [get, list, watch, create, update, patch, delete] |
| 61 | + - apiGroups: [""] |
| 62 | + resources: [services, services/status] |
| 63 | + verbs: [get, list, watch, create, update, patch, delete, deletecollection] |
| 64 | + - apiGroups: [apps] |
| 65 | + resources: [statefulsets] |
| 66 | + verbs: [get, list, watch, create, update, patch, delete] |
| 67 | + - apiGroups: [coordination.k8s.io] |
| 68 | + resources: [leases] |
| 69 | + verbs: [get, list, watch, create, update, patch] |
| 70 | + - apiGroups: [discovery.k8s.io] |
| 71 | + resources: [endpointslices] |
| 72 | + verbs: [get, list, watch] |
| 73 | + - apiGroups: [networking.k8s.io] |
| 74 | + resources: [ingresses, ingresses/status, ingressclasses] |
| 75 | + verbs: [get, list, watch, update, patch] |
| 76 | + - apiGroups: [tailscale.com] |
| 77 | + resources: ["*"] |
| 78 | + verbs: [get, list, watch, create, update, patch, delete] |
| 79 | +--- |
| 80 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 81 | +kind: Role |
| 82 | +metadata: |
| 83 | + namespace: cabotage |
| 84 | + name: cabotage-tailscale-operator-manager-role-namespaced |
| 85 | +rules: |
| 86 | + |
| 87 | + # Framework: knowing which other operators are running (i.e. peering). |
| 88 | + - apiGroups: [kopf.dev] |
| 89 | + resources: [kopfpeerings] |
| 90 | + verbs: [list, watch, patch, get] |
| 91 | + |
| 92 | + # Framework: posting the events about the handlers progress/errors. |
| 93 | + - apiGroups: [""] |
| 94 | + resources: [events] |
| 95 | + verbs: [create] |
| 96 | + |
| 97 | + # Application: watching & handling for the custom resource we declare. |
| 98 | + - apiGroups: [cabotage.io] |
| 99 | + resources: [cabotagetailscaleoperatorconfigs] |
| 100 | + verbs: [list, watch, patch] |
| 101 | +--- |
| 102 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 103 | +kind: ClusterRoleBinding |
| 104 | +metadata: |
| 105 | + name: cabotage-tailscale-operator-manager-rolebinding-cluster |
| 106 | +roleRef: |
| 107 | + apiGroup: rbac.authorization.k8s.io |
| 108 | + kind: ClusterRole |
| 109 | + name: cabotage-tailscale-operator-manager-role-cluster |
| 110 | +subjects: |
| 111 | + - kind: ServiceAccount |
| 112 | + name: cabotage-tailscale-operator-manager-account |
| 113 | + namespace: cabotage |
| 114 | +--- |
| 115 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 116 | +kind: RoleBinding |
| 117 | +metadata: |
| 118 | + namespace: cabotage |
| 119 | + name: cabotage-tailscale-operator-manager-rolebinding-namespaced |
| 120 | +roleRef: |
| 121 | + apiGroup: rbac.authorization.k8s.io |
| 122 | + kind: Role |
| 123 | + name: cabotage-tailscale-operator-manager-role-namespaced |
| 124 | +subjects: |
| 125 | + - kind: ServiceAccount |
| 126 | + name: cabotage-tailscale-operator-manager-account |
0 commit comments