diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index 8f2eb4944..92a09e2a6 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -446,6 +446,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -7675,6 +7676,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -7869,6 +7871,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -11607,6 +11610,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -13220,6 +13224,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -14188,6 +14193,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -14377,6 +14383,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index 506aae257..02f4c63e3 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -448,6 +448,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -7670,6 +7671,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -7864,6 +7866,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -11598,6 +11601,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -13211,6 +13215,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -14176,6 +14181,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool @@ -14365,6 +14371,7 @@ spec: type: string enableCrushUpdates: description: Allow rook operator to change the pool CRUSH tunables once the pool is created + nullable: true type: boolean enableRBDStats: description: EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index ffb2f9512..ccfc70dc6 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -948,8 +948,9 @@ type PoolSpec struct { DeviceClass string `json:"deviceClass,omitempty"` // Allow rook operator to change the pool CRUSH tunables once the pool is created + // +nullable // +optional - EnableCrushUpdates bool `json:"enableCrushUpdates,omitempty"` + EnableCrushUpdates *bool `json:"enableCrushUpdates,omitempty"` // DEPRECATED: use Parameters instead, e.g., Parameters["compression_mode"] = "force" // The inline compression mode in Bluestore OSD to set to (options are: none, passive, aggressive, force) diff --git a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go index adeefa444..92a52dded 100644 --- a/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go +++ b/pkg/apis/ceph.rook.io/v1/zz_generated.deepcopy.go @@ -4552,6 +4552,11 @@ func (in *PoolPlacementSpec) DeepCopy() *PoolPlacementSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PoolSpec) DeepCopyInto(out *PoolSpec) { *out = *in + if in.EnableCrushUpdates != nil { + in, out := &in.EnableCrushUpdates, &out.EnableCrushUpdates + *out = new(bool) + **out = **in + } in.Replicated.DeepCopyInto(&out.Replicated) out.ErasureCoded = in.ErasureCoded if in.Parameters != nil { diff --git a/pkg/daemon/ceph/client/pool.go b/pkg/daemon/ceph/client/pool.go index 4e673beab..0f8981250 100644 --- a/pkg/daemon/ceph/client/pool.go +++ b/pkg/daemon/ceph/client/pool.go @@ -510,7 +510,7 @@ func createReplicatedPoolForApp(context *clusterd.Context, clusterInfo *ClusterI } func updatePoolCrushRule(context *clusterd.Context, clusterInfo *ClusterInfo, clusterSpec *cephv1.ClusterSpec, pool cephv1.NamedPoolSpec) error { - if !pool.EnableCrushUpdates { + if pool.EnableCrushUpdates == nil || !*pool.EnableCrushUpdates { logger.Debugf("Skipping crush rule update for pool %q: EnableCrushUpdates is disabled", pool.Name) return nil } diff --git a/pkg/daemon/ceph/client/pool_test.go b/pkg/daemon/ceph/client/pool_test.go index 556da669e..f68872190 100644 --- a/pkg/daemon/ceph/client/pool_test.go +++ b/pkg/daemon/ceph/client/pool_test.go @@ -286,12 +286,13 @@ func TestUpdateFailureDomain(t *testing.T) { return "", errors.Errorf("unexpected ceph command %q", args) } + enableCrushUpdates := true t.Run("no desired failure domain", func(t *testing.T) { p := cephv1.NamedPoolSpec{ Name: "mypool", PoolSpec: cephv1.PoolSpec{ Replicated: cephv1.ReplicatedSpec{Size: 3}, - EnableCrushUpdates: true, + EnableCrushUpdates: &enableCrushUpdates, }, } clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}} @@ -306,7 +307,7 @@ func TestUpdateFailureDomain(t *testing.T) { PoolSpec: cephv1.PoolSpec{ FailureDomain: currentFailureDomain, Replicated: cephv1.ReplicatedSpec{Size: 3}, - EnableCrushUpdates: true, + EnableCrushUpdates: &enableCrushUpdates, }, } testCrushRuleName = "mypool_rack" @@ -336,7 +337,7 @@ func TestUpdateFailureDomain(t *testing.T) { PoolSpec: cephv1.PoolSpec{ FailureDomain: "zone", Replicated: cephv1.ReplicatedSpec{Size: 3}, - EnableCrushUpdates: true, + EnableCrushUpdates: &enableCrushUpdates, }, } clusterSpec := &cephv1.ClusterSpec{Storage: cephv1.StorageScopeSpec{}} @@ -351,7 +352,7 @@ func TestUpdateFailureDomain(t *testing.T) { PoolSpec: cephv1.PoolSpec{ FailureDomain: "zone", Replicated: cephv1.ReplicatedSpec{Size: 3}, - EnableCrushUpdates: true, + EnableCrushUpdates: &enableCrushUpdates, }, } clusterSpec := &cephv1.ClusterSpec{