open-cluster-management-io / community

open-cluster-management governance material.
https://open-cluster-management.io
Apache License 2.0
61 stars 23 forks source link

Restrict the format of managed cluster's name field. #177

Open xuezhaojun opened 1 year ago

xuezhaojun commented 1 year ago

Description

The name of managed clusters is often used as a unique identifier by a variety of components. But sometimes, it causes trouble. For example:

In cluster-proxy-addon, there is an ExternalName type Service on the agent-side using the cluster's name as its name field.

https://github.com/open-cluster-management-io/cluster-proxy/blob/ecc688e4d7abee732df6a478d9d1583646d767e5/pkg/proxyagent/agent/manifests/charts/addon-agent/templates/cluster-service.yaml#L6

When the cluster's name starts with a number, the work-agent will return the error:

E1223 09:27:20.700245 1 base_controller.go:270] "ManifestWorkAgent" controller failed to sync "addon-cluster-proxy-deploy-0", err: Service "20pi8725abdjf5lccjlt61dnqidp1bm2" is invalid: metadata.name: Invalid value: "20pi8725abdjf5lccjlt61dnqidp1bm2": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')
xuezhaojun commented 1 year ago

cc @elgnay