From 7b082939b86d3ccf60ef6fa0aa29c8530f52ed34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Tue, 8 Jul 2025 20:43:31 +0200 Subject: [PATCH] core: only support isa and jerasure algorithms on ec pools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `CephBlockPool` CR allowed any algorithm to be specified in `spec.erasureCoded.algorithm`, but in practice only `isa` or `jerasure` would work. Make that restriction explicit by restricting this field to `isa` or `jerasure` in the CRD. Signed-off-by: BenoƮt Knecht (cherry picked from commit 0b423a30f9af0fb558dce8e43a1bc8bd42dafeda) --- Documentation/CRDs/specification.md | 3 +- .../charts/rook-ceph/templates/resources.yaml | 49 ++++++++++++++++--- deploy/examples/crds.yaml | 49 ++++++++++++++++--- pkg/apis/ceph.rook.io/v1/types.go | 4 +- 4 files changed, 89 insertions(+), 16 deletions(-) diff --git a/Documentation/CRDs/specification.md b/Documentation/CRDs/specification.md index f9068e312..da8e65910 100644 --- a/Documentation/CRDs/specification.md +++ b/Documentation/CRDs/specification.md @@ -6678,7 +6678,8 @@ string (Optional) -

The algorithm for erasure coding

+

The algorithm for erasure coding. +If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile.

diff --git a/deploy/charts/rook-ceph/templates/resources.yaml b/deploy/charts/rook-ceph/templates/resources.yaml index ae42d500e..9e1a4e391 100644 --- a/deploy/charts/rook-ceph/templates/resources.yaml +++ b/deploy/charts/rook-ceph/templates/resources.yaml @@ -454,7 +454,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7551,7 +7556,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7740,7 +7750,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -11445,7 +11460,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -13046,7 +13066,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -14006,7 +14031,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -14190,7 +14220,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- diff --git a/deploy/examples/crds.yaml b/deploy/examples/crds.yaml index 79f6700aa..4853b19b1 100644 --- a/deploy/examples/crds.yaml +++ b/deploy/examples/crds.yaml @@ -456,7 +456,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7546,7 +7551,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -7735,7 +7745,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -11436,7 +11451,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -13037,7 +13057,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -13994,7 +14019,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- @@ -14178,7 +14208,12 @@ spec: description: The erasure code settings properties: algorithm: - description: The algorithm for erasure coding + description: |- + The algorithm for erasure coding. + If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + enum: + - isa + - jerasure type: string codingChunks: description: |- diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index fae5e1e07..a57a25f7f 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -1315,7 +1315,9 @@ type ErasureCodedSpec struct { // +kubebuilder:validation:Minimum=0 DataChunks uint `json:"dataChunks"` - // The algorithm for erasure coding + // The algorithm for erasure coding. + // If absent, defaults to the plugin specified in osd_pool_default_erasure_code_profile. + // +kubebuilder:validation:Enum=isa;jerasure // +optional Algorithm string `json:"algorithm,omitempty"` }