Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/workspace/rolebinding.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 rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) {
15
labels := common.DefaultLabels(Component)
16
17
return []runtime.Object{
18
19
&rbacv1.RoleBinding{
20
TypeMeta: common.TypeMetaRoleBinding,
21
ObjectMeta: metav1.ObjectMeta{
22
Name: Component,
23
Namespace: ctx.Namespace,
24
Labels: labels,
25
},
26
RoleRef: rbacv1.RoleRef{
27
APIGroup: "rbac.authorization.k8s.io",
28
Kind: "Role",
29
Name: Component,
30
},
31
Subjects: []rbacv1.Subject{
32
{
33
Kind: "ServiceAccount",
34
Name: Component,
35
Namespace: ctx.Namespace,
36
},
37
},
38
},
39
}, nil
40
}
41
42