File size: 13,241 Bytes
f9f6cee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | diff --git a/internal/controller/postgrescluster/instance_test.go b/internal/controller/postgrescluster/instance_test.go
index 2eff97aa71..06e38c055b 100644
--- a/internal/controller/postgrescluster/instance_test.go
+++ b/internal/controller/postgrescluster/instance_test.go
@@ -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
diff --git a/internal/controller/postgrescluster/pgbackrest_test.go b/internal/controller/postgrescluster/pgbackrest_test.go
index ccebca4563..999ec535fc 100644
--- a/internal/controller/postgrescluster/pgbackrest_test.go
+++ b/internal/controller/postgrescluster/pgbackrest_test.go
@@ -2519,6 +2519,8 @@ containers:
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
+ seccompProfile:
+ type: RuntimeDefault
volumeMounts:
- mountPath: /etc/pgbackrest/conf.d
name: pgbackrest-config
diff --git a/internal/controller/postgrescluster/pgmonitor_test.go b/internal/controller/postgrescluster/pgmonitor_test.go
index 1143035156..4549e5a523 100644
--- a/internal/controller/postgrescluster/pgmonitor_test.go
+++ b/internal/controller/postgrescluster/pgmonitor_test.go
@@ -169,6 +169,8 @@ securityContext:
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
+ seccompProfile:
+ type: RuntimeDefault
volumeMounts:
- mountPath: /conf
name: exporter-config
diff --git a/internal/controller/postgrescluster/volumes_test.go b/internal/controller/postgrescluster/volumes_test.go
index 6254f717a1..11e5974a0e 100644
--- a/internal/controller/postgrescluster/volumes_test.go
+++ b/internal/controller/postgrescluster/volumes_test.go
@@ -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:
diff --git a/internal/controller/standalone_pgadmin/pod_test.go b/internal/controller/standalone_pgadmin/pod_test.go
index 5f00138171..af5b9e0bea 100644
--- a/internal/controller/standalone_pgadmin/pod_test.go
+++ b/internal/controller/standalone_pgadmin/pod_test.go
@@ -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
diff --git a/internal/initialize/security_test.go b/internal/initialize/security_test.go
index da16f74ce6..86ff98f701 100644
--- a/internal/initialize/security_test.go
+++ b/internal/initialize/security_test.go
@@ -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.`)
})
diff --git a/internal/pgadmin/reconcile_test.go b/internal/pgadmin/reconcile_test.go
index 7036ec6575..7448552029 100644
--- a/internal/pgadmin/reconcile_test.go
+++ b/internal/pgadmin/reconcile_test.go
@@ -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
diff --git a/internal/pgbackrest/reconcile_test.go b/internal/pgbackrest/reconcile_test.go
index ef3ac7b1ea..257529fc0c 100644
--- a/internal/pgbackrest/reconcile_test.go
+++ b/internal/pgbackrest/reconcile_test.go
@@ -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
diff --git a/internal/pgbouncer/reconcile_test.go b/internal/pgbouncer/reconcile_test.go
index 72d31312c1..9747e8cdc1 100644
--- a/internal/pgbouncer/reconcile_test.go
+++ b/internal/pgbouncer/reconcile_test.go
@@ -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
diff --git a/internal/postgres/reconcile_test.go b/internal/postgres/reconcile_test.go
index 644bf3798a..40886fb97d 100644
--- a/internal/postgres/reconcile_test.go
+++ b/internal/postgres/reconcile_test.go
@@ -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
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
new file mode 100644
--- /dev/null
+++ b/mimo_build_env.tar.gz.b64
@@ -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
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
new file mode 100755
--- /dev/null
+++ b/mimo_test_command.sh
@@ -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'
|