Skip to content

Commit

Permalink
config: remove tag LastUpdatedByK8sIngress as this causes diff in gen…
Browse files Browse the repository at this point in the history
…erated config (#1123)

* remove tag LastUpdatedByK8sIngress as this causes diff in generated config

* remove from test

* fix functional test
  • Loading branch information
akshaysngupta committed Feb 3, 2021
1 parent 7c479aa commit 16937d9
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 22 deletions.
1 change: 0 additions & 1 deletion functional_tests/duplicate_ports.json
Expand Up @@ -240,7 +240,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
Expand Up @@ -313,7 +313,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/one_ingress_https_backend.json
Expand Up @@ -282,7 +282,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
Expand Up @@ -206,7 +206,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/one_ingress_slash_nothing.json
Expand Up @@ -176,7 +176,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/one_ingress_slash_slashnothing.json
Expand Up @@ -249,7 +249,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/one_ingress_with_multiple_path_rules.json
Expand Up @@ -325,7 +325,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/three_ingresses.json
Expand Up @@ -405,7 +405,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/two_ingresses_same_domain_tls_notls.json
Expand Up @@ -313,7 +313,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
Expand Up @@ -234,7 +234,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/two_ingresses_slash_slashsomething.json
Expand Up @@ -249,7 +249,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
Expand Up @@ -309,7 +309,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
1 change: 0 additions & 1 deletion functional_tests/waf_annotation.json
Expand Up @@ -255,7 +255,6 @@
},
"tags": {
"ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
"last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
"managed-by-k8s-ingress": "a/b/c"
}
}
7 changes: 3 additions & 4 deletions pkg/appgw/appgw_test.go
Expand Up @@ -386,11 +386,10 @@ var _ = Describe("Tests `appgw.ConfigBuilder`", func() {
}

// Check tags
Expect(len(appGW.Tags)).To(Equal(3))
Expect(len(appGW.Tags)).To(Equal(2))
expected := map[string]*string{
tags.ManagedByK8sIngress: to.StringPtr("a/b/c"),
tags.IngressForAKSClusterID: to.StringPtr("/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname"),
tags.LastUpdatedByK8sIngress: to.StringPtr("2009-11-17 20:34:58.651387237 +0000 UTC"),
tags.ManagedByK8sIngress: to.StringPtr("a/b/c"),
tags.IngressForAKSClusterID: to.StringPtr("/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname"),
}
Expect(appGW.Tags).To(Equal(expected))
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/appgw/configbuilder.go
Expand Up @@ -11,10 +11,10 @@ import (

n "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-05-01/network"
"github.com/Azure/go-autorest/autorest/to"
"k8s.io/klog/v2"
v1 "k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"

"github.com/Azure/application-gateway-kubernetes-ingress/pkg/annotations"
"github.com/Azure/application-gateway-kubernetes-ingress/pkg/azure"
Expand Down Expand Up @@ -255,7 +255,6 @@ func (c *appGwConfigBuilder) addTags() {
} else {
klog.V(5).Infof("Error while parsing cluster resource ID for tagging: %s", err)
}
c.appGw.Tags[tags.LastUpdatedByK8sIngress] = to.StringPtr(c.clock.Now().String())
}

// GetVersion returns a string representing the version of AGIC.
Expand Down
3 changes: 0 additions & 3 deletions pkg/appgw/configbuilder_test.go
Expand Up @@ -422,7 +422,6 @@ var _ = Describe("Tests `appgw.ConfigBuilder`", func() {
-- },
-- "tags": {
-- "ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
-- "last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
-- "managed-by-k8s-ingress": "a/b/c"
-- }
--}`
Expand Down Expand Up @@ -655,7 +654,6 @@ var _ = Describe("Tests `appgw.ConfigBuilder`", func() {
-- },
-- "tags": {
-- "ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
-- "last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
-- "managed-by-k8s-ingress": "a/b/c"
-- }
--}`
Expand Down Expand Up @@ -935,7 +933,6 @@ var _ = Describe("Tests `appgw.ConfigBuilder`", func() {
-- },
-- "tags": {
-- "ingress-for-aks-cluster-id": "/subscriptions/subid/resourcegroups/aksresgp/providers/Microsoft.ContainerService/managedClusters/aksname",
-- "last-updated-by-k8s-ingress": "2009-11-17 20:34:58.651387237 +0000 UTC",
-- "managed-by-k8s-ingress": "a/b/c"
-- }
--}`
Expand Down

0 comments on commit 16937d9

Please sign in to comment.