-
Notifications
You must be signed in to change notification settings - Fork 30
[BUG] Unable to turn off tserver UI service due to inconsistencies in the CRD #33
Description
Describe the bug
The code in func (r *ReconcileYBCluster) reconcileUIServices(cluster *yugabytev1alpha1.YBCluster) indicates that we can turn off the tserver UI service by changing the port number to <= 0:
} else if err == nil && cluster.Spec.Tserver.TserverUIPort <= 0 {
// Delete the service if it existed before & it is not needed going forward.
logger.Info("deleting tserver ui service")
if err := r.client.Delete(context.TODO(), found); err != nil {
logger.Errorf("failed to delete tserver ui service object. err: %+v", err)
return err
}
}
However, we find the feature is actually not supported as the min value of Spec.Tserver.TserverUIPort specified in the CRD (yugabyte.com_ybclusters_crd.yaml) is 1. Kubernetes will prevent the users from trying to set the TserverUIPort to <= 0, so the tserver UI service will never be turned off.
A follow-up question: In convention, port 0 is a wildcard port that tells the system to find a suitable port number. So maybe setting cluster.Spec.Tserver.TserverUIPort to -1 would be a better choice for deleting the service.
To reproduce
- Create YBCluster with
cluster.Spec.Tserver.TserverUIPortset to a 7000, which creates the tserverUI service. - Set
Spec.Tserver.TserverUIPortto -1 to delete the tserverUI service. The will not work as -1 is a forbidden value for this field by Kubernetes.
Expected behavior
Users should be able to turn off the tserverUI service by setting Spec.Tserver.TserverUIPort to a negative value as indicated in the code.
Fix
We are willing to issue a fix to solve this inconsistency.
We can just remove the min: 1 constraint on Spec.Tserver.TserverUIPort or change the min value to -1 in yugabyte.com_ybclusters_crd.yaml.