Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/ws-proxy/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 wsproxy
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
rules := []rbacv1.PolicyRule{
17
{
18
APIGroups: []string{""},
19
Resources: []string{"pods"},
20
Verbs: []string{
21
"get",
22
"list",
23
"watch",
24
},
25
},
26
{
27
APIGroups: []string{"workspace.gitpod.io"},
28
Resources: []string{"workspaces"},
29
Verbs: []string{
30
"get",
31
"list",
32
"watch",
33
},
34
},
35
}
36
37
return []runtime.Object{&rbacv1.Role{
38
TypeMeta: common.TypeMetaRole,
39
ObjectMeta: metav1.ObjectMeta{
40
Name: Component,
41
Namespace: ctx.Namespace,
42
Labels: common.DefaultLabels(Component),
43
},
44
Rules: rules,
45
},
46
}, nil
47
}
48
49