mirror of
https://github.com/rancher/k3k.git
synced 2026-02-14 18:10:01 +00:00
Make the storageRequestSize immutable.
It can't be changed in the StatefulSet and modifying the value causes an error.
This commit is contained in:
@@ -443,6 +443,9 @@ spec:
|
||||
This field is only relevant in "dynamic" mode.
|
||||
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
|
||||
x-kubernetes-int-or-string: true
|
||||
x-kubernetes-validations:
|
||||
- message: storageRequestSize is immutable
|
||||
rule: self == oldSelf
|
||||
type:
|
||||
default: dynamic
|
||||
description: Type specifies the persistence mode.
|
||||
|
||||
@@ -190,14 +190,14 @@ func createAction(appCtx *AppContext, config *CreateConfig) func(cmd *cobra.Comm
|
||||
}
|
||||
|
||||
func newCluster(name, namespace string, config *CreateConfig) (*v1beta1.Cluster, error) {
|
||||
var storageRequestSize resource.Quantity
|
||||
var storageRequestSize *resource.Quantity
|
||||
if config.storageRequestSize != "" {
|
||||
parsed, err := resource.ParseQuantity(config.storageRequestSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
storageRequestSize = parsed
|
||||
storageRequestSize = ptr.To(parsed)
|
||||
}
|
||||
|
||||
cluster := &v1beta1.Cluster{
|
||||
@@ -225,7 +225,7 @@ func newCluster(name, namespace string, config *CreateConfig) (*v1beta1.Cluster,
|
||||
Persistence: v1beta1.PersistenceConfig{
|
||||
Type: v1beta1.PersistenceMode(config.persistenceType),
|
||||
StorageClassName: ptr.To(config.storageClassName),
|
||||
StorageRequestSize: ptr.To(storageRequestSize),
|
||||
StorageRequestSize: storageRequestSize,
|
||||
},
|
||||
MirrorHostNodes: config.mirrorHostNodes,
|
||||
},
|
||||
|
||||
@@ -364,6 +364,7 @@ type PersistenceConfig struct {
|
||||
// This field is only relevant in "dynamic" mode.
|
||||
//
|
||||
// +kubebuilder:default="2G"
|
||||
// +kubebuilder:validation:XValidation:message="storageRequestSize is immutable",rule="self == oldSelf"
|
||||
// +optional
|
||||
StorageRequestSize *resource.Quantity `json:"storageRequestSize,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user