Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/agent-smith/role.go
2501 views
1
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package agentsmith
6
7
import (
8
"github.com/gitpod-io/gitpod/installer/pkg/common"
9
10
rbacv1 "k8s.io/api/rbac/v1"
11
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12
"k8s.io/apimachinery/pkg/runtime"
13
)
14
15
func role(ctx *common.RenderContext) ([]runtime.Object, error) {
16
var rules []rbacv1.PolicyRule
17
18
return []runtime.Object{
19
&rbacv1.Role{
20
TypeMeta: common.TypeMetaRole,
21
ObjectMeta: metav1.ObjectMeta{
22
Name: Component,
23
Namespace: ctx.Namespace,
24
Labels: common.DefaultLabels(Component),
25
},
26
Rules: append(rules, rbacv1.PolicyRule{
27
APIGroups: []string{""},
28
Resources: []string{"pods"},
29
Verbs: []string{"get", "update"},
30
}),
31
},
32
}, nil
33
}
34
35