Azure / azure-service-operator

Azure Service Operator allows you to create Azure resources using kubectl
https://azure.github.io/azure-service-operator/
MIT License
793 stars 204 forks source link

Use a more specific selector than control-plane: controller-manager #4277

Open matthchr opened 2 months ago

matthchr commented 2 months ago

Describe the current behavior We use the kubebuilder default selector control-plane: controller-manager, which many other projects may also use. We should be good citizens and at least in theory support being installed into the same namespace, but if we're using the same labels as other deployments webhooks and other selectors may get confused.

See #4274 as an example.

Describe the improvement Use a label unique to ASO.

matthchr commented 1 month ago

The challenge here is that we have to delete the deployment in order to change this field.

We can do this with a Helm hook, but given it's a bit involved I'm going to kick this out to 2.11 for now. See: https://github.com/giantswarm/azure-scheduled-events/pull/20/files for a simple example of what I'm talking about

matthchr commented 4 days ago

The actual error is:

  • spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/name":"azure-service-operator", "control-plane":"controller-manager"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

Note that this happens even if the deployment mode is Recreate - the only solution is to delete and recreate the deployment itself.