Skip to content

Commit

Permalink
Allow to create empty tags
Browse files Browse the repository at this point in the history
Issue: #640
  • Loading branch information
mjura committed Oct 24, 2024
1 parent c082e0a commit 61675fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pkg/aks/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ func createManagedCluster(ctx context.Context, cred *Credentials, workplacesClie

managedCluster.Tags = make(map[string]*string)
for key, val := range spec.Tags {
if val != "" {
managedCluster.Tags[key] = to.Ptr(val)
}
managedCluster.Tags[key] = to.Ptr(val)
}

nodeResourceGroupName := ""
Expand Down
4 changes: 3 additions & 1 deletion pkg/aks/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ var _ = Describe("newManagedCluster", func() {
Expect(err).ToNot(HaveOccurred())

Expect(managedCluster.Tags).To(HaveKeyWithValue("test-tag", to.Ptr("test-value")))
Expect(managedCluster.Tags).To(HaveKeyWithValue("empty-tag", to.Ptr("")))
Expect(*managedCluster.Properties.NetworkProfile.NetworkPolicy).To(Equal(armcontainerservice.NetworkPolicy(String(clusterSpec.NetworkPolicy))))
Expect(*managedCluster.Properties.NetworkProfile.LoadBalancerSKU).To(Equal(armcontainerservice.LoadBalancerSKU(String(clusterSpec.LoadBalancerSKU))))
Expect(*managedCluster.Properties.NetworkProfile.NetworkPlugin).To(Equal(armcontainerservice.NetworkPlugin(String(clusterSpec.NetworkPlugin))))
Expand Down Expand Up @@ -537,7 +538,8 @@ func newTestClusterSpec() *aksv1.AKSClusterConfigSpec {
return &aksv1.AKSClusterConfigSpec{
ResourceLocation: "eastus",
Tags: map[string]string{
"test-tag": "test-value",
"test-tag": "test-value",
"empty-tag": "",
},
NetworkPolicy: to.Ptr("azure"),
NetworkPlugin: to.Ptr("azure"),
Expand Down

0 comments on commit 61675fc

Please sign in to comment.