-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclusterrole.yaml
More file actions
85 lines (75 loc) · 3.13 KB
/
Copy pathclusterrole.yaml
File metadata and controls
85 lines (75 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 5-Spot Controller ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: 5spot-controller
labels:
app.kubernetes.io/name: 5spot
app.kubernetes.io/component: controller
rules:
# ScheduledMachine CRD management
- apiGroups: ["5spot.finos.org"]
resources: ["scheduledmachines", "scheduledmachines/status"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# ScheduledMachine finalizers — required because the controller sets
# `blockOwnerDeletion: true` on the ownerReference it writes from every
# child CAPI Machine back to its parent ScheduledMachine
# (src/reconcilers/helpers.rs). The API server treats blockOwnerDeletion
# as equivalent to holding a finalizer on the owner, so it checks that
# the creating identity has `update` on <owner-resource>/finalizers.
# Without this rule, Machine creation is rejected with:
# cannot set blockOwnerDeletion if an ownerReference refers to a
# resource you can't set finalizers on
# Verb is intentionally just `update` — the minimum the subresource
# check requires; the broader CRUD set on the main resource above is
# not needed here.
- apiGroups: ["5spot.finos.org"]
resources: ["scheduledmachines/finalizers"]
verbs: ["update"]
# CAPI Machine management
- apiGroups: ["cluster.x-k8s.io"]
resources: ["machines", "machines/status"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# Bootstrap provider resources (wildcard required — controller is provider-agnostic
# and must support any CAPI bootstrap provider installed in the cluster)
- apiGroups: ["bootstrap.cluster.x-k8s.io"]
resources: ["*"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# Infrastructure provider resources (wildcard required — provider-agnostic)
- apiGroups: ["infrastructure.cluster.x-k8s.io"]
resources: ["*"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# k0smotron resources — explicitly enumerated (known provider)
- apiGroups: ["k0smotron.io"]
resources:
- "k0sworkerconfigs"
- "k0sworkerconfigs/status"
- "remotemachines"
- "remotemachines/status"
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# Events for recording reconciliation events (core v1 and events.k8s.io/v1)
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
- apiGroups: ["events.k8s.io"]
resources: ["events"]
verbs: ["create", "patch"]
# Secrets for SSH keys and bootstrap data
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch"]
# Nodes for drain operations
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch", "patch", "update"]
# Pods for eviction during drain
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch", "delete"]
- apiGroups: [""]
resources: ["pods/eviction"]
verbs: ["create"]
# Leases for leader election (no delete needed for HA)
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "create", "update", "patch"]