Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Pod Security #879

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM gcr.io/distroless/static:debug-nonroot
FROM gcr.io/distroless/static:debug-nonroot AS builder

# Stage 2:
FROM gcr.io/distroless/static:nonroot

# Grab the cp binary so we can cp the unpack
# binary to a shared volume in the bundle image.
COPY --from=builder /busybox/cp /busybox/ls /

WORKDIR /

Expand Down
6 changes: 3 additions & 3 deletions pkg/source/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (i *Image) getDesiredPodApplyConfig(bundle *rukpakv1alpha2.BundleDeployment
WithName("install-unpacker").
WithImage(i.UnpackImage).
WithImagePullPolicy(corev1.PullIfNotPresent).
WithCommand("cp", "-Rv", "/unpack", "/util/bin/unpack").
WithCommand("/cp", "-Rv", "/unpack", "/util/bin/unpack").
WithVolumeMounts(applyconfigurationcorev1.VolumeMount().
WithName("util").
WithMountPath("/util/bin"),
Expand All @@ -154,15 +154,15 @@ func (i *Image) getDesiredPodApplyConfig(bundle *rukpakv1alpha2.BundleDeployment
WithName("util").
WithMountPath("/bin"),
).
WithSecurityContext(containerSecurityContext).
WithSecurityContext(containerSecurityContext.WithRunAsUser(1001)).
WithTerminationMessagePolicy(corev1.TerminationMessageFallbackToLogsOnError),
).
WithVolumes(applyconfigurationcorev1.Volume().
WithName("util").
WithEmptyDir(applyconfigurationcorev1.EmptyDirVolumeSource()),
).
WithSecurityContext(applyconfigurationcorev1.PodSecurityContext().
WithRunAsNonRoot(false).
WithRunAsNonRoot(true).
WithSeccompProfile(applyconfigurationcorev1.SeccompProfile().
WithType(corev1.SeccompProfileTypeRuntimeDefault),
),
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/plain_provisioner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ func checkProvisionerBundleDeployment(ctx context.Context, object client.Object,
SubResource("exec").
VersionedParams(&corev1.PodExecOptions{
Container: "manager",
Command: []string{"ls", filepath.Join(storage.DefaultBundleCacheDir, fmt.Sprintf("%s.tgz", object.GetName()))},
Command: []string{"/ls", filepath.Join(storage.DefaultBundleCacheDir, fmt.Sprintf("%s.tgz", object.GetName()))},
Stdin: true,
Stdout: true,
Stderr: true,
Expand Down
Loading