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