Skip to content

Commit fdd1dec

Browse files
committed
feat: Replace podmand with oras in backup container
Signed-off-by: Ales Raszka <[email protected]>
1 parent efe0538 commit fdd1dec

11 files changed

+71
-21
lines changed

apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ type RegistryConfig struct {
8181
// type kubernetes.io/dockerconfigjson
8282
// +kubebuilder:validation:Optional
8383
AuthSecret string `json:"authSecret,omitempty"`
84+
85+
// ExtraArgs are additional arguments passed to the oras CLI
86+
// +kubebuilder:validation:Optional
87+
ExtraArgs string `json:"extraArgs,omitempty"`
8488
}
8589

8690
type BackupCronJobConfig struct {

controllers/backupcronjob/backupcronjob_controller.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,10 @@ func (r *BackupCronJobReconciler) createBackupJob(
365365
Value: "/workspace/" + workspacePath,
366366
},
367367
{Name: "DEVWORKSPACE_BACKUP_REGISTRY", Value: backUpConfig.Registry.Path},
368-
{Name: "PODMAN_PUSH_OPTIONS", Value: "--tls-verify=false"},
368+
{Name: "ORAS_EXTRA_ARGS", Value: backUpConfig.Registry.ExtraArgs},
369369
},
370-
Image: images.GetProjectBackupImage(),
370+
Image: images.GetProjectBackupImage(),
371+
ImagePullPolicy: "Always",
371372
Args: []string{
372373
"/workspace-recovery.sh",
373374
"--backup",
@@ -383,7 +384,7 @@ func (r *BackupCronJobReconciler) createBackupJob(
383384
},
384385
},
385386
SecurityContext: &corev1.SecurityContext{
386-
RunAsUser: ptr.To[int64](1000),
387+
AllowPrivilegeEscalation: ptr.To[bool](false),
387388
},
388389
},
389390
},
@@ -422,12 +423,12 @@ func (r *BackupCronJobReconciler) createBackupJob(
422423
})
423424
job.Spec.Template.Spec.Containers[0].VolumeMounts = append(job.Spec.Template.Spec.Containers[0].VolumeMounts, corev1.VolumeMount{
424425
Name: "registry-auth-secret",
425-
MountPath: "/home/podman/.docker",
426+
MountPath: "/tmp/.docker",
426427
ReadOnly: true,
427428
})
428429
job.Spec.Template.Spec.Containers[0].Env = append(job.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{
429430
Name: "REGISTRY_AUTH_FILE",
430-
Value: "/home/podman/.docker/.dockerconfigjson",
431+
Value: "/tmp/.docker/.dockerconfigjson",
431432
})
432433

433434
}

deploy/bundle/manifests/controller.devfile.io_devworkspaceoperatorconfigs.yaml

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

deploy/deployment/kubernetes/combined.yaml

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

deploy/deployment/kubernetes/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml

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

deploy/deployment/openshift/combined.yaml

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

deploy/deployment/openshift/objects/devworkspaceoperatorconfigs.controller.devfile.io.CustomResourceDefinition.yaml

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

deploy/templates/crd/bases/controller.devfile.io_devworkspaceoperatorconfigs.yaml

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

project-backup/Containerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
FROM quay.io/podman/stable:latest
1+
FROM quay.io/konflux-ci/oras:3d83c68 AS oras
2+
FROM registry.access.redhat.com/ubi10/ubi@sha256:8405dd7146117f019670429f93ce044f0839f47ff81ec45bb53cf528f1f6ce11
23

3-
RUN set -e && \
4-
dnf update -y && \
4+
LABEL project="devworkspace-operator"
5+
6+
RUN dnf update -y && \
57
dnf clean all
68

7-
COPY --chown=1000:1000 entrypoint.sh /
8-
COPY --chown=1000:1000 workspace-recovery.sh /
9+
RUN useradd -u 1000 -g 0 -m oras && \
10+
mkdir -p /home/oras/ && \
11+
chown -R oras:0 /home/oras
12+
13+
COPY --chown=1000:0 entrypoint.sh /
14+
COPY --chown=1000:0 workspace-recovery.sh /
915

1016
RUN chmod +x /entrypoint.sh ; \
1117
chmod +x /workspace-recovery.sh
1218

19+
COPY --from=oras /usr/bin/oras /usr/bin/oras
20+
1321
ENTRYPOINT ["/entrypoint.sh"]

project-backup/entrypoint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ set -x
44
set -e
55

66
exec "$@"
7-

0 commit comments

Comments
 (0)