Skip to content

Add support for setting StorageClass for state pvc #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion api/v1alpha1/smbcommonconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that storageClassName is a bit more common of a name for something like this. I've never seen it abbreviated as PVSC

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought was that storageClassName might cause confusion with storageClassName in smbShare, as the two are used to configure different PVCs' storageClass.


// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions internal/resources/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading