-
Notifications
You must be signed in to change notification settings - Fork 216
/
data.go
60 lines (58 loc) · 1.64 KB
/
data.go
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
package controllers
import (
fleetgroup "github.com/rancher/fleet/pkg/apis/fleet.cattle.io"
fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
fleetns "github.com/rancher/fleet/pkg/namespace"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func applyBootstrapResources(systemNamespace, systemRegistrationNamespace string, appCtx *appContext) error {
return appCtx.Apply.
WithSetID("fleet-bootstrap-data").
WithDynamicLookup().
WithNoDeleteGVK(fleetns.GVK()).
ApplyObjects(
// used by request-* service accounts from agents
&rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: "fleet-bundle-deployment",
},
Rules: []rbacv1.PolicyRule{
{
Verbs: []string{"get", "list", "watch"},
APIGroups: []string{fleetgroup.GroupName},
Resources: []string{fleet.BundleDeploymentResourceName},
},
{
Verbs: []string{"update"},
APIGroups: []string{fleetgroup.GroupName},
Resources: []string{fleet.BundleDeploymentResourceName + "/status"},
},
},
},
// used by request-* service accounts from agents
&rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: "fleet-content",
},
Rules: []rbacv1.PolicyRule{
{
Verbs: []string{"get"},
APIGroups: []string{fleetgroup.GroupName},
Resources: []string{fleet.ContentResourceName},
},
},
},
&corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: systemNamespace,
},
},
&corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: systemRegistrationNamespace,
},
},
)
}