Skip to content

Commit

Permalink
Merge pull request #63 from openshift-cherrypick-robot/cherry-pick-61…
Browse files Browse the repository at this point in the history
…-to-release-4.15

Bug 2259664: [release-4.15] csi: use static name for cephfs/rbd
  • Loading branch information
openshift-merge-bot[bot] authored Jan 24, 2024
2 parents 74b2221 + 98c192b commit 4024419
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions controllers/clusterversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ func (c *ClusterVersionReconciler) Reconcile(ctx context.Context, req ctrl.Reque
// Need to handle deletion of the csiDriver object, we cannot set
// ownerReference on it as its cluster scoped resource
cephfsCSIDriver := templates.CephFSCSIDriver.DeepCopy()
cephfsCSIDriver.ObjectMeta.Name = csi.GetCephFSDriverName(c.OperatorNamespace)
cephfsCSIDriver.ObjectMeta.Name = csi.GetCephFSDriverName()
err = csi.CreateCSIDriver(c.ctx, c.Client, cephfsCSIDriver)
if err != nil {
c.log.Error(err, "unable to create cephfs CSIDriver")
return ctrl.Result{}, err
}

rbdCSIDriver := templates.RbdCSIDriver.DeepCopy()
rbdCSIDriver.ObjectMeta.Name = csi.GetRBDDriverName(c.OperatorNamespace)
rbdCSIDriver.ObjectMeta.Name = csi.GetRBDDriverName()
err = csi.CreateCSIDriver(c.ctx, c.Client, rbdCSIDriver)
if err != nil {
c.log.Error(err, "unable to create rbd CSIDriver")
Expand Down
8 changes: 4 additions & 4 deletions controllers/storageclassclaim_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (r *StorageClassClaimReconciler) getCephFSStorageClass(data map[string]stri
},
ReclaimPolicy: &pvReclaimPolicy,
AllowVolumeExpansion: &allowVolumeExpansion,
Provisioner: fmt.Sprintf("%s.cephfs.csi.ceph.com", r.OperatorNamespace),
Provisioner: csi.GetCephFSDriverName(),
Parameters: data,
}
return storageClass
Expand All @@ -479,7 +479,7 @@ func (r *StorageClassClaimReconciler) getCephRBDStorageClass(data map[string]str
},
ReclaimPolicy: &pvReclaimPolicy,
AllowVolumeExpansion: &allowVolumeExpansion,
Provisioner: fmt.Sprintf("%s.rbd.csi.ceph.com", r.OperatorNamespace),
Provisioner: csi.GetRBDDriverName(),
Parameters: data,
}
return storageClass
Expand All @@ -490,7 +490,7 @@ func (r *StorageClassClaimReconciler) getCephFSVolumeSnapshotClass(data map[stri
ObjectMeta: metav1.ObjectMeta{
Name: r.storageClassClaim.Name,
},
Driver: fmt.Sprintf("%s.cephfs.csi.ceph.com", r.OperatorNamespace),
Driver: csi.GetCephFSDriverName(),
DeletionPolicy: snapapi.VolumeSnapshotContentDelete,
Parameters: data,
}
Expand All @@ -502,7 +502,7 @@ func (r *StorageClassClaimReconciler) getCephRBDVolumeSnapshotClass(data map[str
ObjectMeta: metav1.ObjectMeta{
Name: r.storageClassClaim.Name,
},
Driver: fmt.Sprintf("%s.rbd.csi.ceph.com", r.OperatorNamespace),
Driver: csi.GetRBDDriverName(),
DeletionPolicy: snapapi.VolumeSnapshotContentDelete,
Parameters: data,
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/csi/cephfsdaemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func GetCephFSDaemonSet(namespace string) *appsv1.DaemonSet {
driverRegistrar.Args,
fmt.Sprintf("--kubelet-registration-path=%s/plugins/%s/csi.sock",
templates.DefaultKubeletDirPath,
GetCephFSDriverName(namespace)),
GetCephFSDriverName()),
)
return &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -93,7 +93,7 @@ func GetCephFSDaemonSet(namespace string) *appsv1.DaemonSet {
"--pidlimit=-1",
"--type=cephfs",
"--nodeserver=true",
fmt.Sprintf("--drivername=%s", GetCephFSDriverName(namespace)),
fmt.Sprintf("--drivername=%s", GetCephFSDriverName()),
},
Resources: templates.CephFSPluginResourceRequirements,
Env: []corev1.EnvVar{
Expand Down Expand Up @@ -230,7 +230,7 @@ func GetCephFSDaemonSet(namespace string) *appsv1.DaemonSet {
Name: "plugin-dir",
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: fmt.Sprintf("%s/plugins/%s", templates.DefaultKubeletDirPath, GetCephFSDriverName(namespace)),
Path: fmt.Sprintf("%s/plugins/%s", templates.DefaultKubeletDirPath, GetCephFSDriverName()),
Type: &hostPathDirectoryorCreate,
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi/cephfsdeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func GetCephFSDeployment(namespace string) *appsv1.Deployment {
"--pidlimit=-1",
"--type=cephfs",
"--controllerserver=true",
fmt.Sprintf("--drivername=%s", GetCephFSDriverName(namespace)),
fmt.Sprintf("--drivername=%s", GetCephFSDriverName()),
},
Resources: templates.CephFSPluginResourceRequirements,
Env: []corev1.EnvVar{
Expand Down
8 changes: 4 additions & 4 deletions pkg/csi/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ func InitializeSidecars(ver string) error {
}

// GetCephFSDriverName returns the cephfs driver name
func GetCephFSDriverName(namespace string) string {
return fmt.Sprintf("%s.cephfs.csi.ceph.com", namespace)
func GetCephFSDriverName() string {
return "openshift-storage.cephfs.csi.ceph.com"
}

// GetRBDDriverName returns the rbd driver name
func GetRBDDriverName(namespace string) string {
return fmt.Sprintf("%s.rbd.csi.ceph.com", namespace)
func GetRBDDriverName() string {
return "openshift-storage.rbd.csi.ceph.com"
}
6 changes: 3 additions & 3 deletions pkg/csi/rbddaemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func GetRBDDaemonSet(namespace string) *appsv1.DaemonSet {
driverRegistrar.Args,
fmt.Sprintf("--kubelet-registration-path=%s/plugins/%s/csi.sock",
templates.DefaultKubeletDirPath,
GetRBDDriverName(namespace)),
GetRBDDriverName()),
)
return &appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -106,7 +106,7 @@ func GetRBDDaemonSet(namespace string) *appsv1.DaemonSet {
"--pidlimit=-1",
"--type=rbd",
"--nodeserver=true",
fmt.Sprintf("--drivername=%s", GetRBDDriverName(namespace)),
fmt.Sprintf("--drivername=%s", GetRBDDriverName()),
fmt.Sprintf("--stagingpath=%s/plugins/kubernetes.io/csi/", templates.DefaultKubeletDirPath),
"--csi-addons-endpoint=$(CSIADDONS_ENDPOINT)",
},
Expand Down Expand Up @@ -327,7 +327,7 @@ func GetRBDDaemonSet(namespace string) *appsv1.DaemonSet {
Name: "plugin-dir",
VolumeSource: corev1.VolumeSource{
HostPath: &corev1.HostPathVolumeSource{
Path: fmt.Sprintf("%s/plugins/%s", templates.DefaultKubeletDirPath, GetRBDDriverName(namespace)),
Path: fmt.Sprintf("%s/plugins/%s", templates.DefaultKubeletDirPath, GetRBDDriverName()),
Type: &hostPathDirectoryorCreate,
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/csi/rbddeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func GetRBDDeployment(namespace string) *appsv1.Deployment {
"--pidlimit=-1",
"--type=rbd",
"--controllerserver=true",
fmt.Sprintf("--drivername=%s", GetRBDDriverName(namespace)),
fmt.Sprintf("--drivername=%s", GetRBDDriverName()),
},
Resources: templates.RBDPluginResourceRequirements,
Env: []corev1.EnvVar{
Expand Down

0 comments on commit 4024419

Please sign in to comment.