Skip to content

Commit

Permalink
Use restricted namespace for opensource apiserver (#3489)
Browse files Browse the repository at this point in the history
* use restricted namespace for opensource apiserver

* when hostNetwork is required, use PSSPrivileged namespace label
  • Loading branch information
mihivagyok authored Sep 25, 2024
1 parent 57b61bc commit 62b56a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/render/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,13 @@ func (c *apiServerComponent) Objects() ([]client.Object, []client.Object) {
objsToDelete = append(objsToDelete, &admregv1.MutatingWebhookConfiguration{ObjectMeta: metav1.ObjectMeta{Name: SidecarMutatingWebhookConfigName}})
}

podSecurityNamespaceLabel := PodSecurityStandard(PSSRestricted)
if c.hostNetwork() {
podSecurityNamespaceLabel = PSSPrivileged
}
// Global OSS-only objects.
globalCalicoObjects := []client.Object{
CreateNamespace(rmeta.APIServerNamespace(operatorv1.Calico), c.cfg.Installation.KubernetesProvider, PSSPrivileged),
CreateNamespace(rmeta.APIServerNamespace(operatorv1.Calico), c.cfg.Installation.KubernetesProvider, podSecurityNamespaceLabel),
}

// Compile the final arrays based on the variant.
Expand Down

0 comments on commit 62b56a8

Please sign in to comment.