Skip to content

Remove unused PodSecurityPolicy feature #17176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion components/ws-manager-mk2/controllers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ func createDefiniteWorkspacePod(sctx *startWorkspaceContext) (*corev1.Pod, error
Affinity: affinity,
SecurityContext: &corev1.PodSecurityContext{
// We're using a custom seccomp profile for user namespaces to allow clone, mount and chroot.
// Those syscalls don't make much sense in a non-userns setting, where we default to runtime/default using the PodSecurityPolicy.
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeLocalhost,
LocalhostProfile: pointer.String(sctx.Config.SeccompProfile),
Expand Down
1 change: 0 additions & 1 deletion components/ws-manager/cmd/integrationtest-objs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func init() {

var desiredObjTypes = []string{
"ServiceAccount",
"PodSecurityPolicy",
}

func getIntegrationTestPrerequisiteObjects(out io.Writer, namespace, gpHelmChartPath, version string) error {
Expand Down
1 change: 0 additions & 1 deletion components/ws-manager/pkg/manager/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ func (m *Manager) createDefiniteWorkspacePod(startContext *startWorkspaceContext
Affinity: affinity,
SecurityContext: &corev1.PodSecurityContext{
// We're using a custom seccomp profile for user namespaces to allow clone, mount and chroot.
// Those syscalls don't make much sense in a non-userns setting, where we default to runtime/default using the PodSecurityPolicy.
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeLocalhost,
LocalhostProfile: pointer.String(m.Config.SeccompProfile),
Expand Down
4 changes: 0 additions & 4 deletions install/installer/pkg/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,6 @@ var (
APIVersion: "v1",
Kind: "Secret",
}
TypeMetaPodSecurityPolicy = metav1.TypeMeta{
APIVersion: "policy/v1beta1",
Kind: "PodSecurityPolicy",
}
TypeMetaResourceQuota = metav1.TypeMeta{
APIVersion: "v1",
Kind: "ResourceQuota",
Expand Down
1 change: 0 additions & 1 deletion install/installer/pkg/common/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var sortOrder = []string{
"Issuer",
"Certificate",
"LimitRange",
"PodSecurityPolicy",
"PodDisruptionBudget",
"ServiceAccount",
"Secret",
Expand Down
15 changes: 0 additions & 15 deletions install/installer/pkg/components/agent-smith/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
package agentsmith

import (
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"

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

_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.Common != nil && cfg.Common.UsePodSecurityPolicies {
rules = append(rules, rbacv1.PolicyRule{
APIGroups: []string{"policy"},
Resources: []string{"podsecuritypolicies"},
Verbs: []string{"use"},
ResourceNames: []string{fmt.Sprintf("%s-ns-privileged-unconfined", ctx.Namespace)},
})
}
return nil
})

return []runtime.Object{
&rbacv1.Role{
TypeMeta: common.TypeMetaRole,
Expand Down
51 changes: 0 additions & 51 deletions install/installer/pkg/components/cluster/clusterrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
v1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -36,55 +35,5 @@ func clusterrole(ctx *common.RenderContext) ([]runtime.Object, error) {
},
}

_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
if cfg.Common != nil && cfg.Common.UsePodSecurityPolicies {
resources = append(resources,
&v1.ClusterRole{
TypeMeta: common.TypeMetaClusterRole,
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-ns-psp:privileged", ctx.Namespace),
},
Rules: []v1.PolicyRule{
{
APIGroups: []string{"policy"},
Resources: []string{"podsecuritypolicies"},
Verbs: []string{"use"},
ResourceNames: []string{fmt.Sprintf("%s-ns-privileged", ctx.Namespace)},
},
},
},
&v1.ClusterRole{
TypeMeta: common.TypeMetaClusterRole,
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-ns-psp:restricted-root-user", ctx.Namespace),
},
Rules: []v1.PolicyRule{
{
APIGroups: []string{"policy"},
Resources: []string{"podsecuritypolicies"},
Verbs: []string{"use"},
ResourceNames: []string{fmt.Sprintf("%s-ns-restricted-root-user", ctx.Namespace)},
},
},
},
&v1.ClusterRole{
TypeMeta: common.TypeMetaClusterRole,
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-ns-psp:unprivileged", ctx.Namespace),
},
Rules: []v1.PolicyRule{
{
APIGroups: []string{"policy"},
Resources: []string{"podsecuritypolicies"},
Verbs: []string{"use"},
ResourceNames: []string{fmt.Sprintf("%s-ns-unprivileged", ctx.Namespace)},
},
},
},
)
}
return nil
})

return resources, nil
}
1 change: 0 additions & 1 deletion install/installer/pkg/components/cluster/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import "github.com/gitpod-io/gitpod/installer/pkg/common"
var Objects = common.CompositeRenderFunc(
certmanager,
clusterrole,
podsecuritypolicies,
resourcequota,
rolebinding,
common.DefaultServiceAccount(NobodyComponent),
Expand Down
198 changes: 0 additions & 198 deletions install/installer/pkg/components/cluster/podsecuritypolicies.go

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var Objects common.RenderFunc = func(cfg *common.RenderContext) ([]runtime.Objec
}

return common.CompositeRenderFunc(
clusterrole,
configmap,
deployment,
networkpolicy,
Expand Down
Loading