diff --git a/api/v1alpha1/smbcommonconfig_types.go b/api/v1alpha1/smbcommonconfig_types.go index 19b694de..54fa3694 100644 --- a/api/v1alpha1/smbcommonconfig_types.go +++ b/api/v1alpha1/smbcommonconfig_types.go @@ -39,7 +39,12 @@ type SmbCommonConfigSpec struct { // are scheduled in a kubernetes cluster. PodSettings *SmbCommonConfigPodSettings `json:"podSettings,omitempty"` - // GlobalConfig are configuration values that are applied to [global] + // StateSCName specifies which StorageClass is to be used for this share. + // If left empty, the operator's default will be used. + // +optional + StatePVSCName string `json:"statePVSCName,omitempty"` + + // GlobalConfig are configuration values that are applied to [global] // section in smb.conf for the smb server. This allows users to add or // override default configurations. // +opional diff --git a/config/crd/bases/samba-operator.samba.org_smbcommonconfigs.yaml b/config/crd/bases/samba-operator.samba.org_smbcommonconfigs.yaml index adb4a698..21dc77b3 100644 --- a/config/crd/bases/samba-operator.samba.org_smbcommonconfigs.yaml +++ b/config/crd/bases/samba-operator.samba.org_smbcommonconfigs.yaml @@ -522,6 +522,9 @@ spec: description: NodeSelector values will be assigned to a PodSpec's NodeSelector. type: object type: object + statePVSCName: + description: StateSCName specifies which StorageClass is to be used for this share. If left empty, the operator's default will be used. + type: string type: object status: description: SmbCommonConfigStatus defines the observed state of SmbCommonConfig diff --git a/internal/resources/getters.go b/internal/resources/getters.go index 609da723..e848061d 100644 --- a/internal/resources/getters.go +++ b/internal/resources/getters.go @@ -119,6 +119,11 @@ func (m *SmbShareManager) getOrCreateStatePVC( }, }, } + + if planner.CommonConfig.Spec.StatePVSCName != "" { + spec.StorageClassName = &planner.CommonConfig.Spec.StatePVSCName + } + pvc, cr, err := m.getOrCreateGenericPVC( ctx, planner.SmbShare, spec, name, ns) if err != nil {