Bug #111533 Allow setting spec.router.instances to zero
Submitted: 22 Jun 2023 10:06 Modified: 26 Jun 2023 3:14
Reporter: Filip Zrůst (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Operator Severity:S3 (Non-critical)
Version:8.0.33-2.0.10 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: helm

[22 Jun 2023 10:06] Filip Zrůst
Description:
This bug tracks a contribution by me, Filip Zrůst (GitHub user f4z4on) originally submitted as GitHub pull request #26 (https://github.com/mysql/mysql-operator/pull/26).

InnoDBCluster Kubernetes custom resource can have zero router instances. However, Helm considers zero to be an empty value (see default function†), so we cannot rely on coalesce Helm function to source spec.router.instances from one of the following values:

• routerInstances
• router.instances

† https://helm.sh/docs/chart_template_guide/function_list/#default

How to repeat:
helm install \
	mycluster \
	mysql-innodbcluster \
	--repo https://mysql.github.io/mysql-operator \
	--set credentials.root.password=secret \
	--set routerInstances=0

Suggested fix:
Change implementation which relies on Helm functions which use “emptiness” to the implementation which checks if a value is defined in parent dict. No additional validation like checking if the value is an integer zero or any other value or type is necessary. This has been validated by Kubernetes using CRD so far, Helm properly reports this back, and we do not change this.

We also fix validation of source for spec.router.instances which can be of different types by converting them to strings.
[22 Jun 2023 10:19] Filip Zrůst
GH PR#26 commit 75ec013: Fix validation of source for spec.router.instances

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0001-Fix-validation-of-source-for-spec.router.instances.patch (application/octet-stream, text), 2.35 KiB.

[22 Jun 2023 10:20] Filip Zrůst
GH PR#26 commit ebd3b80: Allow setting spec.router.instances to zero

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0002-Allow-setting-spec.router.instances-to-zero.patch (application/octet-stream, text), 3.06 KiB.

[26 Jun 2023 3:14] MySQL Verification Team
Duplicate of #111537