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 1 commit
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
5 changes: 5 additions & 0 deletions api/v1alpha1/smbcommonconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ type SmbCommonConfigSpec struct {
// under PodSettings allow admins and users to customize how pods
// are scheduled in a kubernetes cluster.
PodSettings *SmbCommonConfigPodSettings `json:"podSettings,omitempty"`

// 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.

}

// SmbCommonNetworkSpec values define networking properties for the services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,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