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 4 commits into
base: main
Choose a base branch
from
Open

Add custom tags to machines #158

wants to merge 4 commits into from

Conversation

mcbenjemaa
Copy link
Member

@mcbenjemaa mcbenjemaa commented Mar 27, 2024

This PR add Custom Tags to VM while preserving the current tags.

Copy link

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
@wikkyk wikkyk modified the milestones: v0.6.0, v0.7.0 Dec 5, 2024
Copy link

github-actions bot commented Feb 6, 2025

External PR

Test runs on external PRs require manual approval.

Note: This PR changes the following non-go, non-docs files:
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxclusters.yaml
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxclustertemplates.yaml
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml
go.mod

Copy link

github-actions bot commented Feb 6, 2025

External PR

Test runs on external PRs require manual approval.

Note: This PR changes the following non-go, non-docs files:
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxclusters.yaml
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxclustertemplates.yaml
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml
config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml

@mcbenjemaa mcbenjemaa removed the request for review from lubedacht February 6, 2025 17:26
@@ -427,6 +430,27 @@ func TestReconcileVirtualMachineConfig_ApplyConfig(t *testing.T) {
require.EqualValues(t, task.UPID, *machineScope.ProxmoxMachine.Status.TaskRef)
}

func TestReconcileVirtualMachineConfigTags(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a test case for multiple tags and for zero/empty tags?

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