Skip to content

Commit 541f6f6

Browse files
authored
Remove unused PodSecurityPolicy feature (#17176)
1 parent 8e0646a commit 541f6f6

File tree

23 files changed

+16
-640
lines changed

23 files changed

+16
-640
lines changed

components/ws-manager-mk2/controllers/create.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ func createDefiniteWorkspacePod(sctx *startWorkspaceContext) (*corev1.Pod, error
369369
Affinity: affinity,
370370
SecurityContext: &corev1.PodSecurityContext{
371371
// We're using a custom seccomp profile for user namespaces to allow clone, mount and chroot.
372-
// Those syscalls don't make much sense in a non-userns setting, where we default to runtime/default using the PodSecurityPolicy.
373372
SeccompProfile: &corev1.SeccompProfile{
374373
Type: corev1.SeccompProfileTypeLocalhost,
375374
LocalhostProfile: pointer.String(sctx.Config.SeccompProfile),

components/ws-manager/cmd/integrationtest-objs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func init() {
4545

4646
var desiredObjTypes = []string{
4747
"ServiceAccount",
48-
"PodSecurityPolicy",
4948
}
5049

5150
func getIntegrationTestPrerequisiteObjects(out io.Writer, namespace, gpHelmChartPath, version string) error {

components/ws-manager/pkg/manager/create.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ func (m *Manager) createDefiniteWorkspacePod(startContext *startWorkspaceContext
495495
Affinity: affinity,
496496
SecurityContext: &corev1.PodSecurityContext{
497497
// We're using a custom seccomp profile for user namespaces to allow clone, mount and chroot.
498-
// Those syscalls don't make much sense in a non-userns setting, where we default to runtime/default using the PodSecurityPolicy.
499498
SeccompProfile: &corev1.SeccompProfile{
500499
Type: corev1.SeccompProfileTypeLocalhost,
501500
LocalhostProfile: pointer.String(m.Config.SeccompProfile),

install/installer/pkg/common/common.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,6 @@ var (
723723
APIVersion: "v1",
724724
Kind: "Secret",
725725
}
726-
TypeMetaPodSecurityPolicy = metav1.TypeMeta{
727-
APIVersion: "policy/v1beta1",
728-
Kind: "PodSecurityPolicy",
729-
}
730726
TypeMetaResourceQuota = metav1.TypeMeta{
731727
APIVersion: "v1",
732728
Kind: "ResourceQuota",

install/installer/pkg/common/display.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var sortOrder = []string{
2525
"Issuer",
2626
"Certificate",
2727
"LimitRange",
28-
"PodSecurityPolicy",
2928
"PodDisruptionBudget",
3029
"ServiceAccount",
3130
"Secret",

install/installer/pkg/components/agent-smith/role.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
package agentsmith
66

77
import (
8-
"fmt"
9-
108
"github.com/gitpod-io/gitpod/installer/pkg/common"
11-
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
129

1310
rbacv1 "k8s.io/api/rbac/v1"
1411
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -18,18 +15,6 @@ import (
1815
func role(ctx *common.RenderContext) ([]runtime.Object, error) {
1916
var rules []rbacv1.PolicyRule
2017

21-
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
22-
if cfg.Common != nil && cfg.Common.UsePodSecurityPolicies {
23-
rules = append(rules, rbacv1.PolicyRule{
24-
APIGroups: []string{"policy"},
25-
Resources: []string{"podsecuritypolicies"},
26-
Verbs: []string{"use"},
27-
ResourceNames: []string{fmt.Sprintf("%s-ns-privileged-unconfined", ctx.Namespace)},
28-
})
29-
}
30-
return nil
31-
})
32-
3318
return []runtime.Object{
3419
&rbacv1.Role{
3520
TypeMeta: common.TypeMetaRole,

install/installer/pkg/components/cluster/clusterrole.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99

1010
"github.com/gitpod-io/gitpod/installer/pkg/common"
11-
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
1211
v1 "k8s.io/api/rbac/v1"
1312
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1413
"k8s.io/apimachinery/pkg/runtime"
@@ -36,55 +35,5 @@ func clusterrole(ctx *common.RenderContext) ([]runtime.Object, error) {
3635
},
3736
}
3837

39-
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
40-
if cfg.Common != nil && cfg.Common.UsePodSecurityPolicies {
41-
resources = append(resources,
42-
&v1.ClusterRole{
43-
TypeMeta: common.TypeMetaClusterRole,
44-
ObjectMeta: metav1.ObjectMeta{
45-
Name: fmt.Sprintf("%s-ns-psp:privileged", ctx.Namespace),
46-
},
47-
Rules: []v1.PolicyRule{
48-
{
49-
APIGroups: []string{"policy"},
50-
Resources: []string{"podsecuritypolicies"},
51-
Verbs: []string{"use"},
52-
ResourceNames: []string{fmt.Sprintf("%s-ns-privileged", ctx.Namespace)},
53-
},
54-
},
55-
},
56-
&v1.ClusterRole{
57-
TypeMeta: common.TypeMetaClusterRole,
58-
ObjectMeta: metav1.ObjectMeta{
59-
Name: fmt.Sprintf("%s-ns-psp:restricted-root-user", ctx.Namespace),
60-
},
61-
Rules: []v1.PolicyRule{
62-
{
63-
APIGroups: []string{"policy"},
64-
Resources: []string{"podsecuritypolicies"},
65-
Verbs: []string{"use"},
66-
ResourceNames: []string{fmt.Sprintf("%s-ns-restricted-root-user", ctx.Namespace)},
67-
},
68-
},
69-
},
70-
&v1.ClusterRole{
71-
TypeMeta: common.TypeMetaClusterRole,
72-
ObjectMeta: metav1.ObjectMeta{
73-
Name: fmt.Sprintf("%s-ns-psp:unprivileged", ctx.Namespace),
74-
},
75-
Rules: []v1.PolicyRule{
76-
{
77-
APIGroups: []string{"policy"},
78-
Resources: []string{"podsecuritypolicies"},
79-
Verbs: []string{"use"},
80-
ResourceNames: []string{fmt.Sprintf("%s-ns-unprivileged", ctx.Namespace)},
81-
},
82-
},
83-
},
84-
)
85-
}
86-
return nil
87-
})
88-
8938
return resources, nil
9039
}

install/installer/pkg/components/cluster/objects.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import "github.com/gitpod-io/gitpod/installer/pkg/common"
1212
var Objects = common.CompositeRenderFunc(
1313
certmanager,
1414
clusterrole,
15-
podsecuritypolicies,
1615
resourcequota,
1716
rolebinding,
1817
common.DefaultServiceAccount(NobodyComponent),

install/installer/pkg/components/cluster/podsecuritypolicies.go

Lines changed: 0 additions & 198 deletions
This file was deleted.

install/installer/pkg/components/image-builder-mk3-wsman/clusterrole.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

install/installer/pkg/components/image-builder-mk3-wsman/objects.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var Objects common.RenderFunc = func(cfg *common.RenderContext) ([]runtime.Objec
2323
}
2424

2525
return common.CompositeRenderFunc(
26-
clusterrole,
2726
configmap,
2827
deployment,
2928
networkpolicy,

0 commit comments

Comments
 (0)