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

Add custom tags to machines #158

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add custom tags to machines #158

wants to merge 2 commits into from

Conversation

mcbenjemaa
Copy link
Member

@mcbenjemaa mcbenjemaa commented Mar 27, 2024

Custom Tags

Copy link

sonarcloud bot commented Mar 27, 2024

tags = append(tags, tag)
}
}
if len(tags) > length {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check does not account for removal of tags. is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so we don't delete existing tags.
The IP tag i mean.
Which means tags are also immutable as per the machine.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then you need to add this to the webhook or a CRD kubebuilder annotation

@@ -131,3 +144,14 @@ func validateNetworkDeviceMTU(device *infrav1.NetworkDevice) error {

return nil
}

func validateTags(tags []string) error {
re := regexp.MustCompile(`^[a-zA-Z0-9-_]*$`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be + not * to prevent empty string. Also, have you tried +kubebuilder:validation:Pattern?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm,

Let me check

@wikkyk wikkyk added this to the v0.5.0 milestone Apr 23, 2024
@wikkyk wikkyk modified the milestones: v0.5.0, v0.6.0 Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants