(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, driverContainer *corev1.Container)
| 3510 | } |
| 3511 | |
| 3512 | func applyLicensingConfig(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, driverContainer *corev1.Container) { |
| 3513 | podSpec := &obj.Spec.Template.Spec |
| 3514 | |
| 3515 | // add new volume mount |
| 3516 | licensingConfigVolMount := corev1.VolumeMount{Name: "licensing-config", ReadOnly: true, MountPath: consts.VGPULicensingConfigMountPath, SubPath: consts.VGPULicensingFileName} |
| 3517 | driverContainer.VolumeMounts = append(driverContainer.VolumeMounts, licensingConfigVolMount) |
| 3518 | |
| 3519 | // gridd.conf always mounted |
| 3520 | licenseItemsToInclude := []corev1.KeyToPath{ |
| 3521 | { |
| 3522 | Key: consts.VGPULicensingFileName, |
| 3523 | Path: consts.VGPULicensingFileName, |
| 3524 | }, |
| 3525 | } |
| 3526 | // client config token only mounted when NLS is enabled |
| 3527 | if config.Driver.LicensingConfig.IsNLSEnabled() { |
| 3528 | licenseItemsToInclude = append(licenseItemsToInclude, corev1.KeyToPath{ |
| 3529 | Key: consts.NLSClientTokenFileName, |
| 3530 | Path: consts.NLSClientTokenFileName, |
| 3531 | }) |
| 3532 | nlsTokenVolMount := corev1.VolumeMount{Name: "licensing-config", ReadOnly: true, MountPath: consts.NLSClientTokenMountPath, SubPath: consts.NLSClientTokenFileName} |
| 3533 | driverContainer.VolumeMounts = append(driverContainer.VolumeMounts, nlsTokenVolMount) |
| 3534 | } |
| 3535 | |
| 3536 | var licensingConfigVolumeSource corev1.VolumeSource |
| 3537 | if config.Driver.LicensingConfig.SecretName != "" { |
| 3538 | licensingConfigVolumeSource = corev1.VolumeSource{ |
| 3539 | Secret: &corev1.SecretVolumeSource{ |
| 3540 | SecretName: config.Driver.LicensingConfig.SecretName, |
| 3541 | Items: licenseItemsToInclude, |
| 3542 | }, |
| 3543 | } |
| 3544 | } else if config.Driver.LicensingConfig.ConfigMapName != "" { |
| 3545 | licensingConfigVolumeSource = corev1.VolumeSource{ |
| 3546 | ConfigMap: &corev1.ConfigMapVolumeSource{ |
| 3547 | LocalObjectReference: corev1.LocalObjectReference{ |
| 3548 | Name: config.Driver.LicensingConfig.ConfigMapName, |
| 3549 | }, |
| 3550 | Items: licenseItemsToInclude, |
| 3551 | }, |
| 3552 | } |
| 3553 | } |
| 3554 | licensingConfigVol := corev1.Volume{Name: "licensing-config", VolumeSource: licensingConfigVolumeSource} |
| 3555 | podSpec.Volumes = append(podSpec.Volumes, licensingConfigVol) |
| 3556 | } |
| 3557 | |
| 3558 | func transformDriverContainer(obj *appsv1.DaemonSet, config *gpuv1.ClusterPolicySpec, n ClusterPolicyController) error { |
| 3559 | podSpec := &obj.Spec.Template.Spec |
no test coverage detected