Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/workspace/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 workspace
6
7
import (
8
"github.com/gitpod-io/gitpod/installer/pkg/common"
9
rbacv1 "k8s.io/api/rbac/v1"
10
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
11
"k8s.io/apimachinery/pkg/runtime"
12
)
13
14
func role(ctx *common.RenderContext) ([]runtime.Object, error) {
15
labels := common.DefaultLabels(Component)
16
17
return []runtime.Object{
18
&rbacv1.Role{
19
TypeMeta: common.TypeMetaRole,
20
ObjectMeta: metav1.ObjectMeta{
21
Name: Component,
22
Namespace: ctx.Namespace,
23
Labels: labels,
24
},
25
Rules: []rbacv1.PolicyRule{
26
{
27
APIGroups: []string{""},
28
Resources: []string{"events"},
29
Verbs: []string{
30
"create",
31
"patch",
32
},
33
},
34
},
35
},
36
}, nil
37
}
38
39