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

Invalid characters in labele instance-type #645

Open
sasho4ek07 opened this issue May 22, 2024 · 0 comments
Open

Invalid characters in labele instance-type #645

sasho4ek07 opened this issue May 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sasho4ek07
Copy link

TL;DR

When trying to initialize a node on a bare metal host with a Dell PowerEdge™ type, an error occurs when setting the label: "instance-type"

Expected behavior

Node initialization without error

Observed behavior

When trying to initialize a node on a bare metal host with a Dell PowerEdge™ type, an error occurs when setting the label "instance-type". Since it contains the symbol ™, which is unacceptable for labels.

Minimal working example

it is necessary to remove invalid characters when obtaining instance-type from server data

func getInstanceTypeOfRobotServer(bmServer *models.Server) string {
	if bmServer == nil {
		panic("getInstanceTypeOfRobotServer called with nil server")
	}
	return regexp.MustCompile(`[^a-zA-Z0-9_.-]+`).ReplaceAllString(strings.ReplaceAll(bmServer.Product, " ", "-"), "")
}

Log output

E0521 09:46:06.971841       1 node_controller.go:240] error syncing 'bm-test-cluster-md-1-2djh8-mzbtq': Node "bm-test-cluster-md-1-2djh8-mzbtq" is invalid: metadata.labels: Invalid value: "Dell-PowerEdge™-R660-DX293": 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])?'), requeuing

Additional information

No response

@sasho4ek07 sasho4ek07 added the bug Something isn't working label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant