8
8
"fmt"
9
9
10
10
"github.com/gitpod-io/gitpod/installer/pkg/common"
11
+ "github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
11
12
12
13
rbacv1 "k8s.io/api/rbac/v1"
13
14
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -17,7 +18,7 @@ import (
17
18
func rolebinding (ctx * common.RenderContext ) ([]runtime.Object , error ) {
18
19
labels := common .DefaultLabels (Component )
19
20
20
- return []runtime.Object {
21
+ bindings := []runtime.Object {
21
22
& rbacv1.ClusterRoleBinding {
22
23
TypeMeta : common .TypeMetaClusterRoleBinding ,
23
24
ObjectMeta : metav1.ObjectMeta {
@@ -54,25 +55,33 @@ func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) {
54
55
Namespace : ctx .Namespace ,
55
56
}},
56
57
},
58
+ }
57
59
58
- & rbacv1.RoleBinding {
59
- TypeMeta : common .TypeMetaRoleBinding ,
60
- ObjectMeta : metav1.ObjectMeta {
61
- Name : Component ,
62
- Namespace : common .WorkspaceSecretsNamespace ,
63
- },
64
- RoleRef : rbacv1.RoleRef {
65
- APIGroup : "rbac.authorization.k8s.io" ,
66
- Kind : "Role" ,
67
- Name : Component ,
68
- },
69
- Subjects : []rbacv1.Subject {
70
- {
71
- Kind : "ServiceAccount" ,
60
+ _ = ctx .WithExperimental (func (ucfg * experimental.Config ) error {
61
+ if ucfg .Workspace != nil && ucfg .Workspace .UseWsmanagerMk2 {
62
+ bindings = append (bindings , & rbacv1.RoleBinding {
63
+ TypeMeta : common .TypeMetaRoleBinding ,
64
+ ObjectMeta : metav1.ObjectMeta {
72
65
Name : Component ,
73
- Namespace : ctx . Namespace ,
66
+ Namespace : common . WorkspaceSecretsNamespace ,
74
67
},
75
- },
76
- },
77
- }, nil
68
+ RoleRef : rbacv1.RoleRef {
69
+ APIGroup : "rbac.authorization.k8s.io" ,
70
+ Kind : "Role" ,
71
+ Name : Component ,
72
+ },
73
+ Subjects : []rbacv1.Subject {
74
+ {
75
+ Kind : "ServiceAccount" ,
76
+ Name : Component ,
77
+ Namespace : ctx .Namespace ,
78
+ },
79
+ },
80
+ })
81
+ }
82
+
83
+ return nil
84
+ })
85
+
86
+ return bindings , nil
78
87
}
0 commit comments