Skip to content

Commit

Permalink
Fix policy attachment flakes (#9558)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbohanon committed May 31, 2024
1 parent 0637825 commit f8ea746
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 23 deletions.
6 changes: 6 additions & 0 deletions changelog/v1.17.0-beta34/policy-attachment-flakes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: NON_USER_FACING
issueLink: https://github.com/solo-io/gloo/issues/9494
resolvesIssue: true
description: >-
Addressed some noisy flakes in the new Kubernetes E2E tests for Policy Attachment
10 changes: 2 additions & 8 deletions test/kubernetes/e2e/features/route_options/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,7 @@ func (s *testingSuite) TestConfigureInvalidRouteOptionsWithTargetRef() {
func (s *testingSuite) TestConfigureRouteOptionsWithMultipleTargetRefManualSetup() {
// Manually apply our manifests so we can assert that basic rto exists before applying extra rto.
// This is needed because our solo-kit clients currently do not return creationTimestamp
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
s.NoError(err, "can apply "+setupManifest)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, httproute1Manifest)
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, httproute1Manifest)
s.NoError(err, "can apply "+httproute1Manifest)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, basicRtoTargetRefManifest)
Expand Down Expand Up @@ -188,10 +185,7 @@ func (s *testingSuite) TestConfigureRouteOptionsWithMultipleTargetRefManualSetup
func (s *testingSuite) TestConfigureRouteOptionsWithMultipleFilterExtensionManualSetup() {
// Manually apply our manifests so we can assert that basic rto exists before applying extra rto.
// This is needed because our solo-kit clients currently do not return creationTimestamp
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
s.NoError(err, "can apply "+setupManifest)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, httproute1MultipleExtensionsManifest)
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, httproute1MultipleExtensionsManifest)
s.NoError(err, "can apply "+httproute1MultipleExtensionsManifest)

// here we apply the extra manifest first so that it is older
Expand Down
10 changes: 2 additions & 8 deletions test/kubernetes/e2e/features/virtualhost_options/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ func (s *testingSuite) TestConfigureInvalidVirtualHostOptions() {
func (s *testingSuite) TestConfigureVirtualHostOptionsWithSectionNameManualSetup() {
// Manually apply our manifests so we can assert that basic vho exists before applying extra vho.
// This is needed because our solo-kit clients currently do not return creationTimestamp
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
s.NoError(err, "can apply "+setupManifest)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, basicVhOManifest)
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, basicVhOManifest)
s.NoError(err, "can apply "+basicVhOManifest)
// Check status is accepted before moving on to apply conflicting vho
s.testInstallation.Assertions.EventuallyResourceStatusMatchesState(
Expand Down Expand Up @@ -207,10 +204,7 @@ func (s *testingSuite) TestConfigureVirtualHostOptionsWithSectionNameManualSetup
func (s *testingSuite) TestMultipleVirtualHostOptionsManualSetup() {
// Manually apply our manifests so we can assert that basic vho exists before applying extra vho.
// This is needed because our solo-kit clients currently do not return creationTimestamp
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
s.NoError(err, "can apply "+setupManifest)

err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, basicVhOManifest)
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, basicVhOManifest)
s.NoError(err, "can apply "+basicVhOManifest)
// Check status is accepted before moving on to apply conflicting vho
s.testInstallation.Assertions.EventuallyResourceStatusMatchesState(
Expand Down
11 changes: 8 additions & 3 deletions test/kubernetes/e2e/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,14 @@ func (i *TestInstallation) PreFailHandler(ctx context.Context) {
// This is a work in progress
// The idea here is we want to accumulate ALL information about this TestInstallation into a single directory
// That way we can upload it in CI, or inspect it locally
logFile := filepath.Join(i.GeneratedFiles.FailureDir, "gloo.txt")
logsCmd := i.Actions.Kubectl().Command(ctx, "logs", "-n", i.Metadata.InstallNamespace, "deployments/gloo", ">", logFile)
_ = logsCmd.Run()

glooLogFilePath := filepath.Join(i.GeneratedFiles.FailureDir, "gloo.log")
glooLogFile, err := os.Create(glooLogFilePath)
i.Assertions.Require.NoError(err)
defer glooLogFile.Close()

logsCmd := i.Actions.Kubectl().Command(ctx, "logs", "-n", i.Metadata.InstallNamespace, "deployments/gloo")
_ = logsCmd.WithStdout(glooLogFile).WithStderr(glooLogFile).Run()
}

// GeneratedFiles is a collection of files that are generated during the execution of a set of tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ gateway:
validation:
allowWarnings: true
alwaysAcceptResources: false
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ gateway:
validation:
allowWarnings: true
alwaysAcceptResources: false
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ gateway:
validation:
allowWarnings: true
alwaysAcceptResources: false
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: true
Expand All @@ -40,4 +44,4 @@ gatewayProxies:
healthyPanicThreshold: 0
# Disable discovery, not recommended for production.
discovery:
enabled: false
enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ gateway:
validation:
allowWarnings: true
alwaysAcceptResources: false
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ gateway:
validation:
allowWarnings: true
alwaysAcceptResources: false
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: true
Expand All @@ -40,4 +44,4 @@ gatewayProxies:
healthyPanicThreshold: 0
# Disable discovery, not recommended for production
discovery:
enabled: false
enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ gateway:
allowWarnings: true
# always accept regardless of validation result
alwaysAcceptResources: true
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: true
Expand All @@ -37,4 +41,4 @@ gatewayProxies:
healthyPanicThreshold: 0
# Disable discovery, not recommended for production
discovery:
enabled: false
enabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ gateway:
validation:
allowWarnings: true
alwaysAcceptResources: false
# skipping delete validation due to flakes per https://github.com/solo-io/solo-projects/issues/6272
webhook:
skipDeleteValidationResources:
- upstreams
kubeGateway:
# This is the field that enables the K8s Gateway Integration in Gloo Gateway
enabled: true
Expand All @@ -35,4 +39,4 @@ gatewayProxies:
healthyPanicThreshold: 0
# Disable discovery, not recommended for production
discovery:
enabled: false
enabled: false

0 comments on commit f8ea746

Please sign in to comment.