Skip to content

Commit

Permalink
fix gen
Browse files Browse the repository at this point in the history
Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com>
  • Loading branch information
zhaohuabing committed Oct 28, 2024
1 parent 44fdb31 commit fa76a94
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions internal/gatewayapi/testdata/custom-filter-order.in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ envoyextensionpolicies:
type: HTTP
http:
url: https://www.example.com/wasm-filter-1.wasm
sha256: 746df05c8f3a0b07a46c0967cfbc5cbe5b9d48d0f79b6177eeedf8be6c8b34b5
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
config:
parameter1:
key1: value1
Expand All @@ -122,7 +122,7 @@ envoyextensionpolicies:
type: HTTP
http:
url: https://www.example.com/wasm-filter-2.wasm
sha256: a1efca12ea51069abb123bf9c77889fcc2a31cc5483fc14d115e44fdf07c7980
sha256: 84274ca23246855cc491b3c6a657a89167e0b109a7ae380f1e64df77c910307e
config:
parameter1: value1
parameter2: value2
4 changes: 2 additions & 2 deletions internal/gatewayapi/testdata/custom-filter-order.out.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ envoyExtensionPolicies:
wasm:
- code:
http:
sha256: 746df05c8f3a0b07a46c0967cfbc5cbe5b9d48d0f79b6177eeedf8be6c8b34b5
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
url: https://www.example.com/wasm-filter-1.wasm
type: HTTP
config:
Expand All @@ -24,7 +24,7 @@ envoyExtensionPolicies:
name: wasm-filter-1
- code:
http:
sha256: a1efca12ea51069abb123bf9c77889fcc2a31cc5483fc14d115e44fdf07c7980
sha256: 84274ca23246855cc491b3c6a657a89167e0b109a7ae380f1e64df77c910307e
url: https://www.example.com/wasm-filter-2.wasm
type: HTTP
config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ envoyextensionpolicies:
type: HTTP
http:
url: https://www.example.com/wasm-filter-1.wasm
sha256: 746df05c8f3a0b07a46c0967cfbc5cbe5b9d48d0f79b6177eeedf8be6c8b34b5
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
config:
parameter1:
key1: value1
Expand All @@ -83,7 +83,7 @@ envoyextensionpolicies:
type: HTTP
http:
url: https://www.example.com/wasm-filter-2.wasm
sha256: a1efca12ea51069abb123bf9c77889fcc2a31cc5483fc14d115e44fdf07c7980
sha256: 84274ca23246855cc491b3c6a657a89167e0b109a7ae380f1e64df77c910307e
config:
parameter1: value1
parameter2: value2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ envoyExtensionPolicies:
wasm:
- code:
http:
sha256: 746df05c8f3a0b07a46c0967cfbc5cbe5b9d48d0f79b6177eeedf8be6c8b34b5
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
url: https://www.example.com/wasm-filter-1.wasm
type: HTTP
config:
Expand All @@ -27,7 +27,7 @@ envoyExtensionPolicies:
name: wasm-filter-1
- code:
http:
sha256: a1efca12ea51069abb123bf9c77889fcc2a31cc5483fc14d115e44fdf07c7980
sha256: 84274ca23246855cc491b3c6a657a89167e0b109a7ae380f1e64df77c910307e
url: https://www.example.com/wasm-filter-2.wasm
type: HTTP
config:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ envoyextensionpolicies:
type: HTTP
http:
url: https://www.example.com/wasm-filter-1.wasm
sha256: 746df05c8f3a0b07a46c0967cfbc5cbe5b9d48d0f79b6177eeedf8be6c8b34b5
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
config:
parameter1:
key1: value1
Expand All @@ -91,7 +91,7 @@ envoyextensionpolicies:
url: oci://www.example.com/wasm-filter-2:v1.0.0
pullSecretRef:
name: my-pull-secret
sha256: a1efca12ea51069abb123bf9c77889fcc2a31cc5483fc14d115e44fdf07c7980
sha256: 314100af781b98a8ca175d5bf90a8bf76576e20a2f397a88223404edc6ebfd46
config:
parameter1: value1
parameter2: value2
Expand All @@ -115,7 +115,7 @@ envoyextensionpolicies:
type: HTTP
http:
url: https://www.test.com/wasm-filter-4.wasm
sha256: a1f0b78b8c1320690327800e3a5de10e7dbba7b6c752e702193a395a52c727b6
sha256: b6922722ab58109abfaa8d9eb16f339b38b2bb1c17076b083b34438b934e7463
config:
parameter1:
key1: value1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ envoyExtensionPolicies:
wasm:
- code:
http:
sha256: a1f0b78b8c1320690327800e3a5de10e7dbba7b6c752e702193a395a52c727b6
sha256: b6922722ab58109abfaa8d9eb16f339b38b2bb1c17076b083b34438b934e7463
url: https://www.test.com/wasm-filter-4.wasm
type: HTTP
config:
Expand Down Expand Up @@ -53,7 +53,7 @@ envoyExtensionPolicies:
wasm:
- code:
http:
sha256: 746df05c8f3a0b07a46c0967cfbc5cbe5b9d48d0f79b6177eeedf8be6c8b34b5
sha256: 2d89c4c6ab2a1c615c7696ed37ade9e50654ac70384b5d45100eb08e62130ff4
url: https://www.example.com/wasm-filter-1.wasm
type: HTTP
config:
Expand All @@ -68,7 +68,7 @@ envoyExtensionPolicies:
group: null
kind: null
name: my-pull-secret
sha256: a1efca12ea51069abb123bf9c77889fcc2a31cc5483fc14d115e44fdf07c7980
sha256: 314100af781b98a8ca175d5bf90a8bf76576e20a2f397a88223404edc6ebfd46
url: oci://www.example.com/wasm-filter-2:v1.0.0
type: Image
config:
Expand Down
5 changes: 4 additions & 1 deletion internal/gatewayapi/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -833,14 +833,17 @@ type mockWasmCache struct{}

func (m *mockWasmCache) Start(_ context.Context) {}

func (m *mockWasmCache) Get(downloadURL string, _ wasm.GetOptions) (url string, checksum string, err error) {
func (m *mockWasmCache) Get(downloadURL string, options wasm.GetOptions) (url string, checksum string, err error) {
// This is a mock implementation of the wasm.Cache.Get method.
sha := sha256.Sum256([]byte(downloadURL))
hashedName := hex.EncodeToString(sha[:])
salt := []byte("salt")
salt = append(salt, hashedName...)
sha = sha256.Sum256(salt)
checksum = hex.EncodeToString(sha[:])
if options.Checksum != "" && checksum != options.Checksum {
return "", "", fmt.Errorf("module downloaded from %v has checksum %v, which does not match: %v", downloadURL, checksum, options.Checksum)
}
return fmt.Sprintf("https://envoy-gateway:18002/%s.wasm", hashedName), checksum, nil
}

Expand Down

0 comments on commit fa76a94

Please sign in to comment.