Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/cluster/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 cluster
6
7
import (
8
"fmt"
9
"github.com/gitpod-io/gitpod/installer/pkg/common"
10
v1 "k8s.io/api/rbac/v1"
11
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12
"k8s.io/apimachinery/pkg/runtime"
13
)
14
15
func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) {
16
return []runtime.Object{&v1.RoleBinding{
17
TypeMeta: common.TypeMetaRoleBinding,
18
ObjectMeta: metav1.ObjectMeta{
19
Name: fmt.Sprintf("%s-ns-%s", ctx.Namespace, NobodyComponent),
20
Namespace: ctx.Namespace,
21
},
22
Subjects: []v1.Subject{{
23
Kind: "ServiceAccount",
24
Name: NobodyComponent,
25
Namespace: ctx.Namespace,
26
}},
27
RoleRef: v1.RoleRef{
28
Kind: "ClusterRole",
29
Name: fmt.Sprintf("%s-ns-psp:unprivileged", ctx.Namespace),
30
APIGroup: "rbac.authorization.k8s.io",
31
},
32
}}, nil
33
}
34
35