Clean up the code and basic improvements.

This commit is contained in:
2025-12-18 00:17:02 +00:00
parent 0de9397a2d
commit fb6498c4be
15 changed files with 154 additions and 437 deletions
+4 -4
View File
@@ -10,10 +10,10 @@ import (
var BACKUP_JOB_IMAGE string
func init() {
BACKUP_JOB_IMAGE = os.Getenv("WORKER_IMAGE")
if BACKUP_JOB_IMAGE == "" {
BACKUP_JOB_IMAGE = "ghcr.io/lukaszraczylo/kubernetes-images-sync-worker:latest" // fallback
}
BACKUP_JOB_IMAGE = os.Getenv("WORKER_IMAGE")
if BACKUP_JOB_IMAGE == "" {
BACKUP_JOB_IMAGE = "ghcr.io/lukaszraczylo/kubernetes-images-sync-worker:0.5.54" // fallback to known stable version
}
}
const (
+3 -3
View File
@@ -9,13 +9,13 @@ import (
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
type JobParams struct {
Name string
Namespace string
Annotations map[string]string
Annotations map[string]string
Image string
Commands []string
EnvVars []corev1.EnvVar
@@ -88,7 +88,7 @@ func CreateJob[T any](params JobParams, setupFunc func(T) []string) *batchv1.Job
VolumeMounts: volumeMounts,
Env: params.EnvVars,
SecurityContext: &corev1.SecurityContext{
Privileged: pointer.Bool(true),
Privileged: ptr.To(true),
},
},
},