Skip to content
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

Fields immutable #2070

Merged
merged 4 commits into from
Apr 14, 2024
Merged

Fields immutable #2070

merged 4 commits into from
Apr 14, 2024

Conversation

pjuarezd
Copy link
Member

@pjuarezd pjuarezd commented Apr 12, 2024

What does it do?

Adds validations in the fields spec.pools.*.volumesPerServer and spec.pools.*.servers to make the fields read-only after being created.

This could be helpful to prevent undesired changes on volumesPerServer and servers that could cause a Pool to not start.

As a side-effect the field spec.pools.*.name needed to be changed from Optional to Required, to overcome a limitation on OpenAPI.

The CustomResourceDefinition "tenants.minio.min.io" is invalid: spec.validation.openAPIV3Schema.properties[spec].properties[pools].items.properties[volumesPerServer].x-kubernetes-validations[0].rule: Invalid value: "self == oldSelf": oldSelf cannot be used on the uncorrelatable portion of the schema within spec.validation.openAPIV3Schema.properties[spec].properties[pools]

How does it look?

On creation the fields are writtable
On edition are not editable anymore, a validation error as following will be shown:

# tenants.minio.min.io "minio-tenant-1" was not valid:
# * spec.pools[0].volumesPerServer: Invalid value: "integer": volumesPerServer is immutable
#

field immutable

Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>
Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>
…add validations

Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>
@pjuarezd pjuarezd self-assigned this Apr 12, 2024
@allanrogerr
Copy link
Contributor

Looks good to me

Signed-off-by: pjuarezd <pjuarezd@users.noreply.github.com>
@pjuarezd pjuarezd changed the title POC: field immutable Fields immutable Apr 13, 2024
@cniackz cniackz self-requested a review April 13, 2024 17:27
Copy link
Contributor

@cniackz cniackz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cniackz cniackz added the enhancement New feature or request label Apr 13, 2024
@@ -609,18 +611,19 @@ type CustomCertificateConfig struct {
//
// See the https://min.io/docs/minio/kubernetes/upstream/operations/install-deploy-manage/deploy-minio-tenant.html#procedure-command-line[MinIO Operator CRD] reference for the `pools` object for examples and more complete documentation. +
type Pool struct {
// *Optional* +
// *Required*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may break legacy pools without a name, we should document this change

Copy link

@xoxys xoxys May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not may. It will break existing pools:

failed to create manager for existing fields: failed to convert new object (minio-private/minio; minio.min.io/v2, Kind=Tenant) to smd typed: .spec.pools: element 0: associative list with keys has an element that omits key field "name" (and doesn't have default value)

I don't get why this change was approved and even released already (btw. as a bug fix release - do you follow SemVer?) without any existing documentation. Sorry to say, but the entire release process for the operator is somehow broken.

@dvaldivia dvaldivia merged commit cf7fe17 into minio:master Apr 14, 2024
26 checks passed
Copy link
Contributor

@ramondeklein ramondeklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR contains a lot of formatting changes. There are also some changes that don't seem to be mentioned in the PRs description.. It may be a good idea to do do styling changes in a separate PR to make reviewing easier. I think we should also be aware that we don't push auto-formatted files, because of different editor settings. Either we should synchronize them or ignore it when checking in.

|*Required* +


TenantRef Reference for minio Tenant to eun the jobs against
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TenantRef Reference for minio Tenant to eun the jobs against
TenantRef Reference for minio Tenant to run the jobs against

Comment on lines +171 to +172
|*`mcImage`* __string__
|mc job image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is in this PR.

@@ -101,6 +107,51 @@ CertificateStatus keeps track of all the certificates managed by the operator
|===


[id="{anchor_prefix}-github-com-minio-operator-pkg-apis-minio-min-io-v2-customcertificateconfig"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is not part of this PR.

@pjuarezd pjuarezd mentioned this pull request May 28, 2024
1 task
@pjuarezd pjuarezd deleted the poc-field-immutable branch May 28, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants