-
Notifications
You must be signed in to change notification settings - Fork 828
chore: fix wasm file cache directory permission #6173
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
Merged
zhaohuabing
merged 15 commits into
envoyproxy:main
from
zhaohuabing:fix-cache-permission
Jun 6, 2025
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
605ab47
fix wasm file cache directory permission
zhaohuabing 854d4bc
Update tools/docker/envoy-gateway/Dockerfile
zhaohuabing c8b4bbd
we need execute permission to create files inside the cache dir
zhaohuabing 4877e6c
change permision
zhaohuabing c052579
change permision
zhaohuabing 903e1ee
address comment
zhaohuabing d0cab2b
fix lint
zhaohuabing a227953
address comment
zhaohuabing d1ad5c3
Merge branch 'main' into fix-cache-permission
zhaohuabing 9d20113
Merge branch 'main' into fix-cache-permission
zhaohuabing 606940b
fix the test
zhaohuabing bc443ec
fix test
zhaohuabing 73cd33c
disable dump
zhaohuabing 4775dea
Merge branch 'main' into fix-cache-permission
zhaohuabing 8df558d
Revert "disable dump"
zhaohuabing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
test/e2e/testdata/custom-container-security-contex-userid.yaml
This file contains hidden or 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,14 @@ | ||
| # This test is to verify that the basic http route works with EG having custom security context user id | ||
| # The custom security context user id is set to 65534 in the test go code | ||
| apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: HTTPRoute | ||
| metadata: | ||
| name: custom-eg-security-context-userid | ||
| namespace: gateway-conformance-infra | ||
| spec: | ||
| parentRefs: | ||
| - name: same-namespace | ||
| rules: | ||
| - backendRefs: | ||
| - name: infra-backend-v1 | ||
| port: 8080 |
88 changes: 88 additions & 0 deletions
88
test/e2e/tests/httproute_with_custom_security_context_userid.go
This file contains hidden or 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,88 @@ | ||
| // Copyright Envoy Gateway Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // The full text of the Apache license is available in the LICENSE file at | ||
| // the root of the repo. | ||
|
|
||
| //go:build e2e | ||
|
|
||
| package tests | ||
|
|
||
| import ( | ||
| "context" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| appsv1 "k8s.io/api/apps/v1" | ||
| corev1 "k8s.io/api/core/v1" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| "k8s.io/utils/ptr" | ||
| "sigs.k8s.io/gateway-api/conformance/utils/http" | ||
| "sigs.k8s.io/gateway-api/conformance/utils/kubernetes" | ||
| "sigs.k8s.io/gateway-api/conformance/utils/suite" | ||
| ) | ||
|
|
||
| func init() { | ||
| ConformanceTests = append(ConformanceTests, EnvoyGatewayCustomSecurityContextUseridTest) | ||
| } | ||
|
|
||
| var EnvoyGatewayCustomSecurityContextUseridTest = suite.ConformanceTest{ | ||
| ShortName: "EnvoyGatewayCustomSecurityContextUserid", | ||
| Description: "Envoy Gateway container with custom security context user id", | ||
| Manifests: []string{ | ||
| "testdata/custom-container-security-contex-userid.yaml", | ||
| }, | ||
| Test: func(t *testing.T, suite *suite.ConformanceTestSuite) { | ||
| t.Run("route with custom security context user id", func(t *testing.T) { | ||
| // set envoy-gateway deployment security context user id to 65534 to test custom user has the necessary permissions | ||
| // to run the envoy-gateway container | ||
| setEGSecurityContextUserID(t, suite, 65534) | ||
|
|
||
| ns := "gateway-conformance-infra" | ||
| routeNN := types.NamespacedName{Name: "custom-eg-security-context-userid", Namespace: ns} | ||
| gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns} | ||
| gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN) | ||
|
|
||
| expectedResponse := http.ExpectedResponse{ | ||
| Request: http.Request{ | ||
| Path: "/", | ||
| }, | ||
| Response: http.Response{ | ||
| StatusCode: 200, | ||
| }, | ||
| Namespace: ns, | ||
| } | ||
|
|
||
| http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse) | ||
|
|
||
| // we don't set the envoy-gateway deployment security context user id back to default because this will | ||
| // cause the envoy proxies failed to be deleted after the Gateway resources in the base are deleted. | ||
| // This is acceptable because this won't affect the later tests in the same suite. | ||
| }) | ||
| }, | ||
| } | ||
|
|
||
| func setEGSecurityContextUserID(t *testing.T, suite *suite.ConformanceTestSuite, uid int64) { | ||
| // update envoy-gateway deployment with custom security context user id | ||
| egDeployment := &appsv1.Deployment{} | ||
| err := suite.Client.Get( | ||
| context.Background(), | ||
| types.NamespacedName{Name: "envoy-gateway", Namespace: "envoy-gateway-system"}, | ||
| egDeployment) | ||
| require.NoError(t, err) | ||
| egDeployment.Spec.Template.Spec.Containers[0].SecurityContext.RunAsUser = ptr.To(uid) | ||
| egDeployment.Spec.Template.Spec.Containers[0].SecurityContext.RunAsGroup = ptr.To(uid) | ||
| err = suite.Client.Update(context.Background(), egDeployment) | ||
| require.NoError(t, err) | ||
| // test that envoy-gateway pod is running with custom security context user id | ||
| WaitForPods(t, suite.Client, "envoy-gateway-system", map[string]string{"control-plane": "envoy-gateway"}, corev1.PodRunning, PodReady) | ||
|
|
||
| // test that envoy-gateway deployment is updated with custom security context user id | ||
| egDeployment = &appsv1.Deployment{} | ||
| err = suite.Client.Get( | ||
| context.Background(), | ||
| types.NamespacedName{Name: "envoy-gateway", Namespace: "envoy-gateway-system"}, | ||
| egDeployment) | ||
| require.NoError(t, err) | ||
| require.Equal(t, uid, *egDeployment.Spec.Template.Spec.Containers[0].SecurityContext.RunAsUser, "envoy-gateway deployment is not updated with custom security context user id") | ||
| require.Equal(t, uid, *egDeployment.Spec.Template.Spec.Containers[0].SecurityContext.RunAsGroup, "envoy-gateway deployment is not updated with custom security context group id") | ||
| } | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens because the Envoy Gateway may lose the deletion message of Gateways while rollout restart, and the left Envoy proxies cause failure of the upgrade test.This is an edge case found in this test - should EG proactively delete the Envoy proxies that are orphaned after Gateways are removed?Manually delete the Envoy proxies after the test.
Related issue: #3051
https://github.com/envoyproxy/gateway/actions/runs/15431221218/job/43429760632?pr=6173