-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clean up path rules added by agic when using prohibited target (#…
…1610) (#1613) * clean up path rules added by AGIC * fix e2e * remove crd install * fix test * update timelimit
- Loading branch information
1 parent
3f62f1a
commit ba37199
Showing
16 changed files
with
296 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// ------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
// -------------------------------------------------------------------------------------------- | ||
|
||
package appgw | ||
|
||
import ( | ||
n "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-03-01/network" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("Cleanup", func() { | ||
Context("CleanUpPathRules", func() { | ||
var c *appGwConfigBuilder | ||
agicAddedPathRule := generatePathRuleName("test", "test", 0, 0) | ||
userAddedPathRule := "user-added-path-rule" | ||
|
||
BeforeEach(func() { | ||
c = &appGwConfigBuilder{ | ||
appGw: n.ApplicationGateway{ | ||
ApplicationGatewayPropertiesFormat: &n.ApplicationGatewayPropertiesFormat{ | ||
URLPathMaps: &[]n.ApplicationGatewayURLPathMap{ | ||
{ | ||
ApplicationGatewayURLPathMapPropertiesFormat: &n.ApplicationGatewayURLPathMapPropertiesFormat{ | ||
PathRules: &[]n.ApplicationGatewayPathRule{ | ||
{ | ||
Name: &agicAddedPathRule, | ||
}, | ||
{ | ||
Name: &userAddedPathRule, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
}) | ||
|
||
It("should remove path rules that are created by AGIC", func() { | ||
c.CleanUpPathRulesAddedByAGIC() | ||
|
||
Expect(*c.appGw.URLPathMaps).To(HaveLen(1)) | ||
|
||
pathRule := *(*c.appGw.URLPathMaps)[0].PathRules | ||
Expect(pathRule).To(HaveLen(1)) | ||
Expect(*pathRule[0].Name).To(Equal(userAddedPathRule)) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...2e/cmd/runner/testdata/networking-v1/one-namespace-one-ingress/prohibited-target/app.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: aspnet | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: aspnet | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: aspnet | ||
spec: | ||
containers: | ||
- name: aspnet | ||
imagePullPolicy: IfNotPresent | ||
image: mcr.microsoft.com/dotnet/samples:aspnetapp | ||
ports: | ||
- containerPort: 8080 | ||
resources: | ||
requests: | ||
cpu: 10m | ||
memory: 10Mi | ||
limits: | ||
cpu: 100m | ||
memory: 100Mi | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: aspnet | ||
spec: | ||
selector: | ||
app: aspnet | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 8080 | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: aspnet | ||
annotations: | ||
appgw.ingress.kubernetes.io/backend-path-prefix: "/" | ||
|
||
spec: | ||
ingressClassName: "azure-application-gateway" | ||
rules: | ||
- host: www.microsoft.com | ||
http: | ||
paths: | ||
- path: /aspnet | ||
backend: | ||
service: | ||
name: aspnet | ||
port: | ||
number: 80 | ||
pathType: Prefix |
Oops, something went wrong.