| |
| |
| |
| |
| @@ -568,6 +568,8 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -618,6 +620,8 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -676,6 +680,8 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -726,6 +732,8 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| |
| |
| |
| |
| @@ -2519,6 +2519,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/conf.d |
| name: pgbackrest-config |
| |
| |
| |
| |
| @@ -169,6 +169,8 @@ securityContext: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /conf |
| name: exporter-config |
| |
| |
| |
| |
| @@ -776,6 +776,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| terminationMessagePath: /dev/termination-log |
| terminationMessagePolicy: File |
| volumeMounts: |
| @@ -834,6 +836,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| terminationMessagePath: /dev/termination-log |
| terminationMessagePolicy: File |
| volumeMounts: |
| @@ -894,6 +898,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| terminationMessagePath: /dev/termination-log |
| terminationMessagePolicy: File |
| volumeMounts: |
| |
| |
| |
| |
| @@ -120,6 +120,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin/conf.d |
| name: pgadmin-config |
| @@ -172,6 +174,8 @@ initContainers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin |
| name: pgadmin-config-system |
| @@ -298,6 +302,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin/conf.d |
| name: pgadmin-config |
| @@ -354,6 +360,8 @@ initContainers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin |
| name: pgadmin-config-system |
| |
| |
| |
| |
| @@ -20,6 +20,7 @@ import ( |
| "testing" |
| |
| "gotest.tools/v3/assert" |
| + corev1 "k8s.io/api/core/v1" |
| |
| "github.com/crunchydata/postgres-operator/internal/initialize" |
| ) |
| @@ -59,9 +60,10 @@ func TestPodSecurityContext(t *testing.T) { |
| assert.Assert(t, psc.RunAsUser == nil, |
| `Containers must not set runAsUser to 0`) |
| |
| - // TODO(cbandy): delegate to v1.SecurityContext |
| - assert.Assert(t, psc.SeccompProfile == nil, |
| - `Seccomp profile must be explicitly set to one of the allowed values. Both the Unconfined profile and the absence of a profile are prohibited.`) |
| + if assert.Check(t, psc.SeccompProfile == nil) { |
| + assert.Assert(t, initialize.RestrictedSecurityContext().SeccompProfile != nil, |
| + `SeccompProfile should be delegated to the container-level v1.SecurityContext`) |
| + } |
| }) |
| } |
| |
| @@ -121,7 +123,7 @@ func TestRestrictedSecurityContext(t *testing.T) { |
| // of OpenShift 4.11 uses the "runtime/default" profile. |
| // - https://docs.openshift.com/container-platform/4.10/security/seccomp-profiles.html |
| // - https://docs.openshift.com/container-platform/4.11/security/seccomp-profiles.html |
| - assert.Assert(t, sc.SeccompProfile == nil, |
| + assert.Assert(t, sc.SeccompProfile.Type == corev1.SeccompProfileTypeRuntimeDefault, |
| `Seccomp profile must be explicitly set to one of the allowed values. Both the Unconfined profile and the absence of a profile are prohibited.`) |
| }) |
| |
| |
| |
| |
| |
| @@ -244,6 +244,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin |
| name: pgadmin-startup |
| @@ -284,6 +286,8 @@ initContainers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin |
| name: pgadmin-startup |
| @@ -482,6 +486,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin |
| name: pgadmin-startup |
| @@ -526,6 +532,8 @@ initContainers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgadmin |
| name: pgadmin-startup |
| |
| |
| |
| |
| @@ -620,6 +620,8 @@ func TestAddServerToInstancePod(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -669,6 +671,8 @@ func TestAddServerToInstancePod(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -736,6 +740,8 @@ func TestAddServerToInstancePod(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -787,6 +793,8 @@ func TestAddServerToInstancePod(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -855,6 +863,8 @@ func TestAddServerToRepoPod(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| @@ -900,6 +910,8 @@ func TestAddServerToRepoPod(t *testing.T) { |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbackrest/server |
| name: pgbackrest-server |
| |
| |
| |
| |
| @@ -148,6 +148,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbouncer |
| name: pgbouncer-config |
| @@ -179,6 +181,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbouncer |
| name: pgbouncer-config |
| @@ -258,6 +262,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbouncer |
| name: pgbouncer-config |
| @@ -294,6 +300,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbouncer |
| name: pgbouncer-config |
| @@ -364,6 +372,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbouncer |
| name: pgbouncer-config |
| @@ -399,6 +409,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /etc/pgbouncer |
| name: pgbouncer-config |
| |
| |
| |
| |
| @@ -160,6 +160,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /pgconf/tls |
| name: cert-volume |
| @@ -201,6 +203,8 @@ containers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /pgconf/tls |
| name: cert-volume |
| @@ -289,6 +293,8 @@ initContainers: |
| privileged: false |
| readOnlyRootFilesystem: true |
| runAsNonRoot: true |
| + seccompProfile: |
| + type: RuntimeDefault |
| volumeMounts: |
| - mountPath: /pgconf/tls |
| name: cert-volume |
| |
| new file mode 100644 |
| |
| |
| @@ -0,0 +1,10 @@ |
| +H4sIAAAAAAAAA+2V32/aMBDHec5fYaFqah+ABAp7YhKimlSpldhA29uQsW/UmrGR7fTHxB+/SwIt |
| +RJSqBVRVu8+LHZ9957vvJalPUqXlGMxto3IsYuRzu52PSHnM50m7GTdxU9I6r8RJ0onbFdY+2o3W |
| +SH3gjrGKszbs2veS/YNSf9I/gA9jYWczbmTd3xwuxgv6o+ytR/3jTgf1P+9gG7D4cFd4nv9cfyFZ |
| +LvwEZBR5CKwGEdyrrBEkdOMoAnFjWbXb7bIRblNmypQJ4AzXDWVUUFyrv8DQXo2mlmWuWE3Y1IRu |
| +wmpBzcCmgbXi2LN6Y8vJBmt++ZSwxYI9RU1WUau7os+nXM6UeW3o5bF94k64+OOyaKcOhDVCaRhn |
| +0et4C2v0w9nr77Ry2WA1lxpW/XWaxe1J+R3m9ofV6Qz8yA6sXCzX+9b8VtORvTTYv0bAFlN2dOuy |
| +D9atHxiCuwW31dfKtO4L51oJ3nfAA/SL70VuGIJwEM5OqvvUFmslwB2ytIXHzcoWxbjm87WL59NV |
| +kgPrw9TB8NvVXvkUXvzh0lk63MzmggdeNMl15iBP4Gfvqrx0Ye/MHXeyN7gsm0Z8osHPuYCypdwU |
| +OGK5UqfCAxYxwP1egmNRgrNaoz5ZGMm1NTB+46u909lmxdayKVrhK0rjj5vgSjuh8Z+DLf727Eqe |
| +nvuW4QM7eVyK3vtXQxAEQRAEQRAEQRAEQRAEQRAEQRAEQRyRfwy2oScAKAAA |
| |
| new file mode 100755 |
| |
| |
| @@ -0,0 +1,6 @@ |
| +#!/usr/bin/env bash |
| + |
| +set -uo pipefail |
| +cd /testbed || exit 1 |
| +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 |
| +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' |
|
|