@@ -364,13 +364,13 @@ def get_object(self) -> dict:
364364 },
365365 }
366366
367- # Add snapshot controller CSI chart if either Cinder CSI or Manila CSI is enabled
367+ # Add snapshot controller CSI chart if either Cinder CSI or Manila CSI is enabled.
368368 if cinder .is_enabled (self .cluster ) or manila .is_enabled (self .cluster ):
369369
370- # Build volume snapshot classes based on enabled CSI drivers
370+ # Build volume snapshot classes based on enabled CSI drivers.
371371 volume_snapshot_classes = []
372372
373- # Add Cinder CSI volume snapshot class if enabled
373+ # Add Cinder CSI volume snapshot class if enabled.
374374 if cinder .is_enabled (self .cluster ):
375375 volume_snapshot_classes .append (
376376 {
@@ -383,22 +383,24 @@ def get_object(self) -> dict:
383383 }
384384 )
385385
386- # Add Manila CSI volume snapshot class if enabled
386+ # Add Manila CSI volume snapshot class if enabled and share_network_id is specified.
387387 if manila .is_enabled (self .cluster ):
388- volume_snapshot_classes .append (
389- {
390- "name" : "share-snapshot" ,
391- "annotations" : {
392- "snapshot.storage.kubernetes.io/is-default-class" : "true"
393- },
394- "driver" : "nfs.manila.csi.openstack.org" ,
395- "deletionPolicy" : "Delete" ,
396- "parameters" : {
397- "csi.storage.k8s.io/snapshotter-secret-name" : "csi-manila-secrets" ,
398- "csi.storage.k8s.io/snapshotter-secret-namespace" : "kube-system" ,
399- },
400- }
401- )
388+ share_network_id = self .cluster .labels .get ("manila_csi_share_network_id" )
389+ if share_network_id :
390+ volume_snapshot_classes .append (
391+ {
392+ "name" : "share-snapshot" ,
393+ "annotations" : {
394+ "snapshot.storage.kubernetes.io/is-default-class" : "true"
395+ },
396+ "driver" : "nfs.manila.csi.openstack.org" ,
397+ "deletionPolicy" : "Delete" ,
398+ "parameters" : {
399+ "csi.storage.k8s.io/snapshotter-secret-name" : "csi-manila-secrets" ,
400+ "csi.storage.k8s.io/snapshotter-secret-namespace" : "kube-system" ,
401+ },
402+ }
403+ )
402404
403405 controller_values = {
404406 "fullnameOverride" : "snapshot-controller" ,
0 commit comments