Skip to content

Use default for replicas #393

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

Merged
merged 1 commit into from
Oct 20, 2020
Merged

Use default for replicas #393

merged 1 commit into from
Oct 20, 2020

Conversation

ansd
Copy link
Member

@ansd ansd commented Oct 19, 2020

Before this PR, when replicas is not specified, the following error occurs:

error: error validating "cr-example.yaml": error validating data: ValidationError(RabbitmqCluster.spec): missing required field "replicas" in com.rabbitmq.v1beta1.RabbitmqCluster.spec; if you choose to ignore these errors, turn validation off with --validate=false

After this PR, the error does not occur and the default specified in

// +kubebuilder:default:=1
gets used.

such that the default value of 1 will be used if not specified
Copy link
Contributor

@ferozjilla ferozjilla left a comment

Choose a reason for hiding this comment

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

LGTM

@ChunyiLyu ChunyiLyu added this to the GA milestone Oct 20, 2020
@ansd ansd merged commit 7bb5e4e into main Oct 20, 2020
@mkuratczyk
Copy link
Collaborator

mkuratczyk commented Oct 21, 2020

This doesn't really work for me. If you delete these 3 lines https://github.com/rabbitmq/cluster-operator/blob/main/api/v1beta1/rabbitmqcluster_types_test.go#L157-L159 and run make unit-tests, this test will actually fail with RabbitmqCluster.rabbitmq.com "rabbitmq-defaults" is invalid: spec.replicas: Invalid value: "null": spec.replicas in body must be of type integer: "null" while I would expect it to create a single replica instance. Same result when deployed in a real env (I tried 1.17 and 1.18).

@ansd
Copy link
Member Author

ansd commented Oct 22, 2020

@mkuratczyk this is fixed in #405

@ansd ansd deleted the optional-replicas branch October 22, 2020 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants