Skip to content

Commit 5598417

Browse files
Nathan Fudenbergryanroldssoloio-bulldozer[bot]
authored
Feat/large validation (#10417)
Co-authored-by: Ryan Old <[email protected]> Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com> Co-authored-by: changelog-bot <changelog-bot>
1 parent 53c1aab commit 5598417

File tree

14 files changed

+1080
-11
lines changed

14 files changed

+1080
-11
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,9 @@ run-hashicorp-e2e-tests: GINKGO_FLAGS += --label-filter="end-to-end && !performa
287287
run-hashicorp-e2e-tests: test
288288

289289
.PHONY: run-kube-e2e-tests
290-
run-kube-e2e-tests: TEST_PKG = ./test/kube2e/$(KUBE2E_TESTS) ## Run the Kubernetes E2E Tests in the {KUBE2E_TESTS} package
290+
run-kube-e2e-tests: TEST_PKG = ./test/kube2e/$(KUBE2E_TESTS) ## Run the legacy Kubernetes E2E Tests in the {KUBE2E_TESTS} package
291291
run-kube-e2e-tests: test
292292

293-
294293
#----------------------------------------------------------------------------------
295294
# Go Tests
296295
#----------------------------------------------------------------------------------
@@ -1080,6 +1079,9 @@ endif # distroless images
10801079
CLUSTER_NAME ?= kind
10811080
INSTALL_NAMESPACE ?= gloo-system
10821081

1082+
kind-setup:
1083+
VERSION=${VERSION} CLUSTER_NAME=${CLUSTER_NAME} ./ci/kind/setup-kind.sh
1084+
10831085
kind-load-%-distroless:
10841086
kind load docker-image $(IMAGE_REGISTRY)/$*:$(VERSION)-distroless --name $(CLUSTER_NAME)
10851087

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
changelog:
2+
- type: FIX
3+
issueLink: https://github.com/solo-io/solo-projects/issues/7089
4+
resolvesIssue: false
5+
description: >-
6+
Fix the validation of large configurations when using envoy validation.
7+
This was rarely seen in practice but occurred more often with the new fullEnvoyConfig validation.
8+
Previously if the configuration grew too large translation would be blocked.
9+

docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/settings.proto.sk.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/envoyinit/pkg/runner/run.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"log"
77
"os"
88
"syscall"
9+
"time"
910

1011
"github.com/rotisserie/eris"
1112
"github.com/solo-io/gloo/pkg/utils/cmdutils"
@@ -30,8 +31,15 @@ const (
3031
func RunEnvoyValidate(ctx context.Context, envoyExecutable, bootstrapConfig string) error {
3132
logger := contextutils.LoggerFrom(ctx)
3233

33-
validateCmd := cmdutils.Command(ctx, envoyExecutable, "--mode", "validate", "--config-yaml", bootstrapConfig, "-l", "critical", "--log-format", "%v")
34-
if err := validateCmd.Run(); err != nil {
34+
validateCmd := cmdutils.Command(ctx, envoyExecutable, "--mode", "validate", "--config-path", "/dev/fd/0",
35+
"-l", "critical", "--log-format", "%v")
36+
validateCmd = validateCmd.WithStdin(bytes.NewBufferString(bootstrapConfig))
37+
38+
start := time.Now()
39+
err := validateCmd.Run()
40+
logger.Debugf("envoy validation of %d size completed in %s", len(bootstrapConfig), time.Since(start))
41+
42+
if err != nil {
3543
if os.IsNotExist(err) {
3644
// log a warning and return nil; will allow users to continue to run Gloo locally without
3745
// relying on the Gloo container with Envoy already published to the expected directory

projects/gloo/api/v1/settings.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,10 @@ message GatewayOptions {
920920
//
921921
// This feature is disabled by default and is not recommended for production deployments unless
922922
// the performance implications are well understood and acceptable.
923+
//
924+
// Large configurations can take more than 10 seconds to validate, causing the validating webhook to timeout.
925+
// When enabling this feature, consider increasing the timeout for the validating webhook
926+
// (`.Values.gateway.validation.webhook.timeoutSeconds`).
923927
google.protobuf.BoolValue full_envoy_validation = 14;
924928
}
925929

projects/gloo/pkg/api/v1/settings.pb.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/kube2e/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
> This directory houses legacy tests. All new tests should instead be added to the `test/kubernetes/e2e` directory.
33
44
# Kubernetes End-to-End tests
5+
6+
> These are our legacy Kubernetes E2E tests. We are migrating them to `../kubernetes/e2e`. Create new E2E tests there
7+
> using the new framework.
8+
59
See the [developer kube-e2e testing guide](/devel/testing/kube-e2e-tests.md) for more information about the philosophy of these tests.
610

711
*Note: All commands should be run from the root directory of the Gloo repository*
@@ -68,7 +72,7 @@ To run the regression tests, your kubeconfig file must point to a running Kubern
6872

6973
Use the same command that CI relies on:
7074
```bash
71-
KUBE2E_TESTS=<test-to-run> make run-kube-e2e-tests
75+
CLUSTER_NAME=solo-test-cluster KUBE2E_TESTS=<test-to-run> make run-kube-e2e-tests
7276
```
7377

7478
#### Test Environment Variables
@@ -81,6 +85,7 @@ The below table contains the environment variables that can be used to configure
8185
| WAIT_ON_FAIL | 0 | Set to 1 to prevent Ginkgo from cleaning up the Gloo Edge installation in case of failure. Useful to exec into inspect resources created by the test. A command to resume the test run (and thus clean up resources) will be logged to the output. |
8286
| TEAR_DOWN | false | Set to true to uninstall Gloo after the test suite completes |
8387
| RELEASED_VERSION | '' | Used by nightlies to tests a specific released version. 'LATEST' will find the latest release |
88+
| CLUSTER_NAME | kind | Used to control which Kind cluster to run the tests inside |
8489

8590
#### Common Test Errors
8691
`getting Helm chart version: expected a single entry with name [gloo], found: 5`\

test/kube2e/gateway/gateway_suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/solo-io/gloo/test/helpers"
2424
"github.com/solo-io/gloo/test/kube2e"
2525
"github.com/solo-io/gloo/test/kube2e/helper"
26+
testruntime "github.com/solo-io/gloo/test/kubernetes/testutils/runtime"
2627
skhelpers "github.com/solo-io/solo-kit/test/helpers"
2728

2829
. "github.com/onsi/ginkgo/v2"
@@ -77,7 +78,8 @@ func StartTestHelper() {
7778
}
7879

7980
// We rely on the "new" kubernetes/e2e setup code, since it incorporates controller-runtime logging setup
80-
clusterContext := cluster.MustKindContext("kind")
81+
runtimeContext := testruntime.NewContext()
82+
clusterContext := cluster.MustKindContext(runtimeContext.ClusterName)
8183

8284
resourceClientset, err = kube2e.NewKubeResourceClientSet(ctx, clusterContext.RestConfig)
8385
Expect(err).NotTo(HaveOccurred(), "can create kube resource client set")

test/kube2e/gloo/gloo_suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/solo-io/gloo/test/helpers"
2424
"github.com/solo-io/gloo/test/kube2e"
2525
"github.com/solo-io/gloo/test/kube2e/helper"
26+
testruntime "github.com/solo-io/gloo/test/kubernetes/testutils/runtime"
2627
glootestutils "github.com/solo-io/gloo/test/testutils"
2728
"github.com/solo-io/go-utils/testutils"
2829

@@ -76,7 +77,8 @@ var _ = BeforeSuite(func() {
7677
}
7778

7879
// We rely on the "new" kubernetes/e2e setup code, since it incorporates controller-runtime logging setup
79-
clusterContext := cluster.MustKindContext("kind")
80+
runtimeContext := testruntime.NewContext()
81+
clusterContext := cluster.MustKindContext(runtimeContext.ClusterName)
8082

8183
resourceClientset, err = kube2e.NewKubeResourceClientSet(ctx, clusterContext.RestConfig)
8284
Expect(err).NotTo(HaveOccurred(), "can create kube resource client set")

test/kubernetes/e2e/features/validation/full_envoy_validation/suite.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package full_envoy_validation
22

33
import (
44
"context"
5+
"fmt"
56

67
"github.com/solo-io/gloo/test/kubernetes/e2e"
78
testdefaults "github.com/solo-io/gloo/test/kubernetes/e2e/defaults"
@@ -77,3 +78,22 @@ func (s *testingSuite) TestRejectInvalidTransformation() {
7778
s.Assert().Contains(output, "Failed to parse response template: Failed to parse "+
7879
"header template ':status': [inja.exception.parser_error] (at 1:92) expected statement close, got '%'")
7980
}
81+
82+
// TestLargeConfiguration checks webhook accepts large configuration when fullEnvoyValidation=true
83+
func (s *testingSuite) TestLargeConfiguration() {
84+
s.T().Cleanup(func() {
85+
err := s.testInstallation.Actions.Kubectl().DeleteFileSafe(s.ctx, validation.LargeConfiguration, "-n",
86+
s.testInstallation.Metadata.InstallNamespace)
87+
s.Assertions.NoError(err, "can delete large configuration")
88+
89+
err = s.testInstallation.Actions.Kubectl().DeleteFileSafe(s.ctx, validation.ExampleUpstream)
90+
s.Assertions.NoError(err, "can delete example upstream")
91+
})
92+
93+
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, validation.ExampleUpstream, "-n", s.testInstallation.Metadata.InstallNamespace)
94+
s.Assert().NoError(err)
95+
96+
err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, validation.LargeConfiguration, "-n",
97+
s.testInstallation.Metadata.InstallNamespace)
98+
fmt.Println(err)
99+
}

0 commit comments

Comments
 (0)