-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[installer]: fix incorrectly configured pod security policies
This now makes Gitpod work in a cluster with pod security policies enabled.
- Loading branch information
Simon Emms
committed
Dec 7, 2021
1 parent
b6f50e0
commit 8d34bd9
Showing
17 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package cloudsql | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gitpod-io/gitpod/installer/pkg/common" | ||
rbacv1 "k8s.io/api/rbac/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) { | ||
return []runtime.Object{&rbacv1.RoleBinding{ | ||
TypeMeta: common.TypeMetaRoleBinding, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: Component, | ||
Namespace: ctx.Namespace, | ||
Labels: common.DefaultLabels(Component), | ||
}, | ||
RoleRef: rbacv1.RoleRef{ | ||
Kind: "ClusterRole", | ||
Name: fmt.Sprintf("%s-ns-psp:restricted-root-user", ctx.Namespace), | ||
APIGroup: "rbac.authorization.k8s.io", | ||
}, | ||
Subjects: []rbacv1.Subject{{ | ||
Kind: "ServiceAccount", | ||
Name: Component, | ||
}}, | ||
}}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
installer/pkg/components/database/incluster/rolebinding.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package incluster | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gitpod-io/gitpod/installer/pkg/common" | ||
rbacv1 "k8s.io/api/rbac/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) { | ||
return []runtime.Object{ | ||
&rbacv1.RoleBinding{ | ||
TypeMeta: common.TypeMetaRoleBinding, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: Component, | ||
Namespace: ctx.Namespace, | ||
Labels: common.DefaultLabels(Component), | ||
}, | ||
RoleRef: rbacv1.RoleRef{ | ||
Kind: "ClusterRole", | ||
Name: fmt.Sprintf("%s-ns-psp:restricted-root-user", ctx.Namespace), | ||
APIGroup: "rbac.authorization.k8s.io", | ||
}, | ||
Subjects: []rbacv1.Subject{ | ||
{ | ||
Kind: "ServiceAccount", | ||
Name: Component, | ||
}, | ||
}, | ||
}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package init | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gitpod-io/gitpod/installer/pkg/common" | ||
rbacv1 "k8s.io/api/rbac/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) { | ||
return []runtime.Object{&rbacv1.RoleBinding{ | ||
TypeMeta: common.TypeMetaRoleBinding, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: Component, | ||
Namespace: ctx.Namespace, | ||
Labels: common.DefaultLabels(Component), | ||
}, | ||
RoleRef: rbacv1.RoleRef{ | ||
Kind: "ClusterRole", | ||
Name: fmt.Sprintf("%s-ns-psp:restricted-root-user", ctx.Namespace), | ||
APIGroup: "rbac.authorization.k8s.io", | ||
}, | ||
Subjects: []rbacv1.Subject{{ | ||
Kind: "ServiceAccount", | ||
Name: Component, | ||
}}, | ||
}}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package minio | ||
|
||
import ( | ||
"github.com/gitpod-io/gitpod/installer/pkg/common" | ||
) | ||
|
||
const Component = "minio" | ||
|
||
var Objects = common.CompositeRenderFunc( | ||
rolebinding, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License-AGPL.txt in the project root for license information. | ||
|
||
package minio | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gitpod-io/gitpod/installer/pkg/common" | ||
rbacv1 "k8s.io/api/rbac/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
) | ||
|
||
func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) { | ||
return []runtime.Object{ | ||
&rbacv1.RoleBinding{ | ||
TypeMeta: common.TypeMetaRoleBinding, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: Component, | ||
Namespace: ctx.Namespace, | ||
Labels: common.DefaultLabels(Component), | ||
}, | ||
RoleRef: rbacv1.RoleRef{ | ||
Kind: "ClusterRole", | ||
Name: fmt.Sprintf("%s-ns-psp:unprivileged", ctx.Namespace), | ||
APIGroup: "rbac.authorization.k8s.io", | ||
}, | ||
Subjects: []rbacv1.Subject{{ | ||
Kind: "ServiceAccount", | ||
Name: Component, | ||
}}, | ||
}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters