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

Broker.Id data type is incorrect and some within range numbers would result in reconciler error #913

Closed
panyuenlau opened this issue Dec 15, 2022 · 1 comment · Fixed by #924 or #939
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@panyuenlau
Copy link
Member

panyuenlau commented Dec 15, 2022

Describe the bug

Currently, the KafkaCluster.spec.Broker.Id field has type int32, with supported range [-2,147,483,648, 2,147,483,647]. However, it is not possible to set the broker id to be negative, otherwise users would see the following error:

{"level":"error","ts":"2022-12-15T16:50:28.951Z","msg":"Reconciler error","controller":"KafkaCluster","controllerGroup":"kafka.banzaicloud.io","controllerKind":"KafkaCluster","KafkaCluster":{"name":"kafka","namespace":"kafka"},"namespace":"kafka","name":"kafka","reconcileID":"1b3299b0-a1dc-4bce-8f27-b809e7ccc374","error":"failed to reconcile resource: creating resource failed: PersistentVolumeClaim \"kafka--1-storage-0-prpfx\" is invalid: metadata.labels: Invalid value: \"-1\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')","errorVerbose":"creating resource failed: PersistentVolumeClaim \"kafka--1-storage-0-prpfx\" is invalid: metadata.labels: Invalid value: \"-1\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')\nfailed to reconcile resource\ngithub.com/banzaicloud/koperator/pkg/resources/kafka.(*Reconciler).Reconcile\n\t/workspace/pkg/resources/kafka/kafka.go:273\ngithub.com/banzaicloud/koperator/controllers.(*KafkaClusterReconciler).Reconcile\n\t/workspace/controllers/kafkacluster_controller.go:125\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:121\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:320\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:273\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:234\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1594","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:326\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:273\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:234"}
{"level":"info","ts":"2022-12-15T17:07:09.005Z","msg":"failed to reconcile resource: creating resource failed: PersistentVolumeClaim \"kafka--1-storage-0-l95xh\" is invalid: metadata.labels: Invalid value: \"-1\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')","controller":"KafkaCluster","controllerGroup":"kafka.banzaicloud.io","controllerKind":"KafkaCluster","KafkaCluster":{"name":"kafka","namespace":"kafka"},"namespace":"kafka","name":"kafka","reconcileID":"2fb20bd0-b0db-41bf-bac8-804790ae6cab"}

Also, setting the broker id to be 65535(which is within the range of int32 and also positive) would result in the following error:

{"level":"info","ts":"2022-12-15T20:42:03.762Z","msg":"updating resource failed: admission webhook \"rev.validation.istio.io\" denied the request: configuration is invalid: port number 84625 must be in the range 1..65535","controller":"KafkaCluster","controllerGroup":"kafka.banzaicloud.io","controllerKind":"KafkaCluster","KafkaCluster":{"name":"kafka","namespace":"kafka"},"namespace":"kafka","name":"kafka","reconcileID":"93e69d4b-d3fa-4142-bdd7-0a8f9a905850"}
{"level":"error","ts":"2022-12-15T20:42:03.762Z","msg":"Reconciler error","controller":"KafkaCluster","controllerGroup":"kafka.banzaicloud.io","controllerKind":"KafkaCluster","KafkaCluster":{"name":"kafka","namespace":"kafka"},"namespace":"kafka","name":"kafka","reconcileID":"93e69d4b-d3fa-4142-bdd7-0a8f9a905850","error":"updating resource failed: admission webhook \"rev.validation.istio.io\" denied the request: configuration is invalid: port number 84625 must be in the range 1..65535","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:326\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:273\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:234"}

Steps to reproduce the issue:

Set one of the broker id in KafkaCluster spec to the numbers described above

Expected behavior

Koperator has correct range for broker id at data type definition

@mihaialexandrescu
Copy link
Contributor

#924 should partially (not fully) address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
2 participants