-
Notifications
You must be signed in to change notification settings - Fork 700
Update the bundle version for VAP and add it as a release step. #4759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
cb140bf
dc159d1
59943fe
09a07be
14ccc26
3179215
a16cb74
64a4bfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,25 +172,43 @@ xmeshes.gateway.networking.x-k8s.io: experimental | |
| }) | ||
|
|
||
| t.Run("should not be able to install CRDs with an older version", func(t *testing.T) { | ||
| t.Cleanup(func() { | ||
| _, _ = executeKubectlCommand(t, kubectlLocation, kubeconfigLocation, | ||
| []string{"delete", "--wait", "-f", filepath.Join("..", "..", "config", "crd", "standard", "gateway.networking.k8s.io_httproutes.yaml")}) | ||
| }) | ||
|
|
||
| // Read test crd into []byte | ||
| httpCrd, err := os.ReadFile(filepath.Join("..", "..", "config", "crd", "standard", "gateway.networking.k8s.io_httproutes.yaml")) | ||
| require.NoError(t, err) | ||
|
|
||
| // do replace on gateway.networking.k8s.io/bundle-version: v1.x.0 | ||
| re := regexp.MustCompile(`gateway\.networking\.k8s\.io\/bundle-version: \S*`) | ||
| sub := []byte("gateway.networking.k8s.io/bundle-version: v1.3.0") | ||
| oldCrd := re.ReplaceAll(httpCrd, sub) | ||
|
|
||
| // supply crd to stdin of cmd and kubectl apply -f - | ||
| output, err := executeKubectlCommandStdin(t, kubectlLocation, kubeconfigLocation, bytes.NewReader(oldCrd), []string{"apply", "-f", "-"}) | ||
|
|
||
| require.Error(t, err) | ||
| assert.Contains(t, output, "ValidatingAdmissionPolicy 'safe-upgrades.gateway.networking.k8s.io' with binding 'safe-upgrades.gateway.networking.k8s.io' denied request") | ||
| versions := []struct { | ||
| version string | ||
| fail bool | ||
| }{ | ||
| {"v1.0.0", true}, | ||
| {"v1.1.0", true}, | ||
| {"v1.3.0", true}, | ||
| {"v0.0.0-dev", false}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise I feel like this should be channel-dependent...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated tests to test for each channel separately. |
||
| } | ||
|
|
||
| for _, v := range versions { | ||
| t.Run(v.version, func(t *testing.T) { | ||
| t.Cleanup(func() { | ||
| _, _ = executeKubectlCommand(t, kubectlLocation, kubeconfigLocation, | ||
| []string{"delete", "--wait", "--ignore-not-found", "-f", filepath.Join("..", "..", "config", "crd", "standard", "gateway.networking.k8s.io_httproutes.yaml")}) | ||
| }) | ||
|
|
||
| // Read test crd into []byte | ||
| httpCrd, err := os.ReadFile(filepath.Join("..", "..", "config", "crd", "standard", "gateway.networking.k8s.io_httproutes.yaml")) | ||
| require.NoError(t, err) | ||
|
|
||
| // do replace on gateway.networking.k8s.io/bundle-version: v1.x.0 | ||
| re := regexp.MustCompile(`gateway\.networking\.k8s\.io\/bundle-version: \S*`) | ||
| sub := []byte(fmt.Sprintf("gateway.networking.k8s.io/bundle-version: %s", v.version)) | ||
| oldCrd := re.ReplaceAll(httpCrd, sub) | ||
|
|
||
| // supply crd to stdin of cmd and kubectl apply -f - | ||
| output, err := executeKubectlCommandStdin(t, kubectlLocation, kubeconfigLocation, bytes.NewReader(oldCrd), []string{"apply", "-f", "-"}) | ||
|
|
||
| if v.fail { | ||
| require.Error(t, err, "version %s should be blocked", v.version) | ||
| assert.Contains(t, output, "ValidatingAdmissionPolicy 'safe-upgrades.gateway.networking.k8s.io' with binding 'safe-upgrades.gateway.networking.k8s.io' denied request") | ||
| } else { | ||
| require.NoError(t, err, "output", output) | ||
| } | ||
| }) | ||
| } | ||
| }) | ||
| default: | ||
| t.Fatalf("invalid CRD channel: %s", crdChannel) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.