Skip to content

Commit 5ec1b23

Browse files
committed
(catsrc) introduce spec.runAsRoot field
With the [change](operator-framework/operator-registry#974) in opm being copied to a /tmp folder rather than / (root), a registry pod created in a namespace labled enforce:restricted for the Pod Security Admission controller is created by the catalog operator with the (appropriate securityContext details) https://github.com/operator-framework/operator-lifecycle-manager/pull/2820/files#diff-fffdeef1fc140a5dc5dc92dda323f567a6e46fc2ecbb0b91ba907acd02bde50dR185-R210 to run it in restricted mode. However, Catalogs built with a version of opm that does not contain the above change still needs privileged permission to run in a namespace that has to be labeled as enforce:privileged for the PSA controller. This PR introduces a new field, spec.runAsRoot, so that admins can indiciate their intent to allow to run the old CatalogSource in a privileged mode. When the catalog operator sees this field set to true, it will not set the securityContext in the registry pod to `runAsNonRoot:true`. Instead, it will set the securityContext to `runAsNonRoot:false`.
1 parent 5f99430 commit 5ec1b23

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

crds/operators.coreos.com_catalogsources.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ spec:
120120
type: integer
121121
publisher:
122122
type: string
123+
runAsRoot:
124+
description: RunAsRoot allows admins to indicate that they wish to run the CatalogSource pod in a privileged more as root
125+
type: boolean
123126
secrets:
124127
description: Secrets represent set of secrets that can be used to access the contents of the catalog. It is best to keep this list small, since each will need to be tried for every catalog entry.
125128
type: array

crds/operators.coreos.com_clusterserviceversions.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ spec:
678678
metadata:
679679
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
680680
type: object
681-
x-kubernetes-preserve-unknown-fields: true
682681
spec:
683682
description: 'Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
684683
type: object

crds/zz_defs.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/operators/v1alpha1/catalogsource_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package v1alpha1
33
import (
44
"encoding/json"
55
"fmt"
6+
"time"
7+
68
"github.com/sirupsen/logrus"
79
corev1 "k8s.io/api/core/v1"
810
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
911
"k8s.io/apimachinery/pkg/types"
10-
"time"
1112
)
1213

1314
const (
@@ -88,6 +89,11 @@ type CatalogSourceSpec struct {
8889
// +optional
8990
Secrets []string `json:"secrets,omitempty"`
9091

92+
// RunAsRoot allows admins to indicate that they wish to run the CatalogSource pod in a privileged
93+
// more as root
94+
// +optional
95+
RunAsRoot bool `json:"runAsRoot,omitempty"`
96+
9197
// Metadata
9298
DisplayName string `json:"displayName,omitempty"`
9399
Description string `json:"description,omitempty"`

0 commit comments

Comments
 (0)