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"` } diff --git a/pkg/daemon/ceph/client/erasure-code-profile.go b/pkg/daemon/ceph/client/erasure-code-profile.go index bb8c2fbad..16579af81 100644 --- a/pkg/daemon/ceph/client/erasure-code-profile.go +++ b/pkg/daemon/ceph/client/erasure-code-profile.go @@ -72,6 +72,10 @@ func CreateErasureCodeProfile(context *clusterd.Context, clusterInfo *ClusterInf return errors.Wrap(err, "failed to look up default erasure code profile") } + if pool.ErasureCoded.Algorithm != "" { + defaultProfile.Plugin = pool.ErasureCoded.Algorithm + } + // define the profile with a set of key/value pairs profilePairs := []string{ fmt.Sprintf("k=%d", pool.ErasureCoded.DataChunks),