Skip to content

Commit d723111

Browse files
author
Frank Hsiao
committed
feat: add support for setting SC for state pvc
Add a new field statePVSCName in SmbCommonConfig.spec that allows users to specify StorageClass for Samba StatefulSet's state PVC. If not set, state PVC uses default StorageClass as before. Signed-off-by: FTS152 <[email protected]>
1 parent cc985a0 commit d723111

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

api/v1alpha1/smbcommonconfig_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ type SmbCommonConfigSpec struct {
3838
// under PodSettings allow admins and users to customize how pods
3939
// are scheduled in a kubernetes cluster.
4040
PodSettings *SmbCommonConfigPodSettings `json:"podSettings,omitempty"`
41+
42+
// StateSCName specifies which StorageClass is to be used for this share.
43+
// If left empty, the operator's default will be used.
44+
// +optional
45+
StatePVSCName string `json:"statePVSCName,omitempty"`
4146
}
4247

4348
// SmbCommonNetworkSpec values define networking properties for the services

config/crd/bases/samba-operator.samba.org_smbcommonconfigs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ spec:
510510
description: NodeSelector values will be assigned to a PodSpec's NodeSelector.
511511
type: object
512512
type: object
513+
statePVSCName:
514+
description: StateSCName specifies which StorageClass is to be used for this share. If left empty, the operator's default will be used.
515+
type: string
513516
type: object
514517
status:
515518
description: SmbCommonConfigStatus defines the observed state of SmbCommonConfig

internal/resources/getters.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ func (m *SmbShareManager) getOrCreateStatePVC(
119119
},
120120
},
121121
}
122+
123+
if planner.CommonConfig.Spec.StatePVSCName != "" {
124+
spec.StorageClassName = &planner.CommonConfig.Spec.StatePVSCName
125+
}
126+
122127
pvc, cr, err := m.getOrCreateGenericPVC(
123128
ctx, planner.SmbShare, spec, name, ns)
124129
if err != nil {

0 commit comments

Comments
 (0)