Skip to content

Commit

Permalink
Merge pull request red-hat-storage#2545 from iamniting/root
Browse files Browse the repository at this point in the history
bundle: add readOnlyRootFilesystem for ocs-operator
  • Loading branch information
openshift-merge-bot[bot] authored Apr 8, 2024
2 parents 4689ec0 + 1e28d79 commit 0a7b8c1
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ spec:
allowPrivilegeEscalation: false
capabilities:
drop:
- all
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /etc/private-key
name: onboarding-private-key
Expand Down
3 changes: 2 additions & 1 deletion controllers/storagecluster/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ func deployMetricsExporter(ctx context.Context, r *StorageClusterReconciler, ins
{ContainerPort: 8081},
},
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.To(true),
RunAsNonRoot: ptr.To(true),
ReadOnlyRootFilesystem: ptr.To(true),
},
VolumeMounts: []corev1.VolumeMount{{
Name: "ceph-config",
Expand Down
4 changes: 4 additions & 0 deletions controllers/storagecluster/provider_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ func GetProviderAPIServerDeployment(instance *ocsv1.StorageCluster) *appsv1.Depl
ContainerPort: ocsProviderServicePort,
},
},
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.To(true),
ReadOnlyRootFilesystem: ptr.To(true),
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "cert-secret",
Expand Down
5 changes: 5 additions & 0 deletions controllers/storagecluster/provider_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/tools/record"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -396,6 +397,10 @@ func GetProviderAPIServerDeploymentForTest(instance *ocsv1.StorageCluster) *apps
ContainerPort: ocsProviderServicePort,
},
},
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.To(true),
ReadOnlyRootFilesystem: ptr.To(true),
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "cert-secret",
Expand Down
1 change: 1 addition & 0 deletions deploy/csv-templates/ocs-operator.csv.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ spec:
capabilities:
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /etc/private-key
name: onboarding-private-key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ spec:
capabilities:
drop:
- all
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /etc/private-key
name: onboarding-private-key
Expand Down Expand Up @@ -689,6 +690,9 @@ spec:
ports:
- containerPort: 8080
resources: {}
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
volumeMounts:
- mountPath: /etc/private-key
name: onboarding-private-key
Expand All @@ -712,6 +716,9 @@ spec:
ports:
- containerPort: 8888
resources: {}
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
volumeMounts:
- mountPath: /etc/proxy/secrets
name: ux-proxy-secret
Expand Down
8 changes: 8 additions & 0 deletions tools/csv-merger/csv-merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ func getUXBackendServerDeployment() appsv1.DeploymentSpec {
},
},
},
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.To(true),
ReadOnlyRootFilesystem: ptr.To(true),
},
},
{
Name: "oauth-proxy",
Expand Down Expand Up @@ -702,6 +706,10 @@ func getUXBackendServerDeployment() appsv1.DeploymentSpec {
ContainerPort: 8888,
},
},
SecurityContext: &corev1.SecurityContext{
RunAsNonRoot: ptr.To(true),
ReadOnlyRootFilesystem: ptr.To(true),
},
},
},
Volumes: []corev1.Volume{
Expand Down

0 comments on commit 0a7b8c1

Please sign in to comment.