From 9cabdfab06d9f2e26f0f7ea382440e2609c30adb Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Tue, 19 Nov 2024 16:58:04 +0100 Subject: [PATCH] Add support for SUSE SLE-Micro Signed-off-by: Egbert Eich --- controllers/object_controls.go | 16 +++++++++++++++- internal/state/driver_volumes.go | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/controllers/object_controls.go b/controllers/object_controls.go index 1b1801391..d8940082f 100644 --- a/controllers/object_controls.go +++ b/controllers/object_controls.go @@ -279,6 +279,20 @@ var SubscriptionPathMap = map[string](MountPathToVolumeSource){ }, }, }, + "sl-micro": { + "/etc/zypp/credentials.d": corev1.VolumeSource{ + HostPath: &corev1.HostPathVolumeSource{ + Path: "/etc/zypp/credentials.d", + Type: newHostPathType(corev1.HostPathDirectory), + }, + }, + "/etc/SUSEConnect": corev1.VolumeSource{ + HostPath: &corev1.HostPathVolumeSource{ + Path: "/etc/SUSEConnect", + Type: newHostPathType(corev1.HostPathFileOrCreate), + }, + }, + }, } type controlFunc []func(n ClusterPolicyController) (gpuv1.State, error) @@ -3304,7 +3318,7 @@ func transformDriverContainer(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicy } // set up subscription entitlements for RHEL(using K8s with a non-CRIO runtime) and SLES - if (release["ID"] == "rhel" && n.openshift == "" && n.runtime != gpuv1.CRIO) || release["ID"] == "sles" { + if (release["ID"] == "rhel" && n.openshift == "" && n.runtime != gpuv1.CRIO) || release["ID"] == "sles" || release["ID"] == "sl-micro" { n.logger.Info("Mounting subscriptions into the driver container", "OS", release["ID"]) pathToVolumeSource, err := getSubscriptionPathsToVolumeSources() if err != nil { diff --git a/internal/state/driver_volumes.go b/internal/state/driver_volumes.go index b11ad512b..009039327 100644 --- a/internal/state/driver_volumes.go +++ b/internal/state/driver_volumes.go @@ -111,6 +111,20 @@ var SubscriptionPathMap = map[string]MountPathToVolumeSource{ }, }, }, + "sl-micro": { + "/etc/zypp/credentials.d": corev1.VolumeSource{ + HostPath: &corev1.HostPathVolumeSource{ + Path: "/etc/zypp/credentials.d", + Type: newHostPathType(corev1.HostPathDirectory), + }, + }, + "/etc/SUSEConnect": corev1.VolumeSource{ + HostPath: &corev1.HostPathVolumeSource{ + Path: "/etc/SUSEConnect", + Type: newHostPathType(corev1.HostPathFileOrCreate), + }, + }, + }, } // TODO: make this a public utils method @@ -171,7 +185,7 @@ func (s *stateDriver) getDriverAdditionalConfigs(ctx context.Context, cr *v1alph } // set up subscription entitlements for RHEL(using K8s with a non-CRIO runtime) and SLES - if (pool.osRelease == "rhel" && openshiftVersion == "" && runtime != consts.CRIO) || pool.osRelease == "sles" { + if (pool.osRelease == "rhel" && openshiftVersion == "" && runtime != consts.CRIO) || pool.osRelease == "sles" || pool.osRelease == "sl-micro" { logger.Info("Mounting subscriptions into the driver container", "OS", pool.osVersion) pathToVolumeSource, err := getSubscriptionPathsToVolumeSources(pool.osRelease) if err != nil {