-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: making the value optional for JSONPatchOperation (#2522)
* api: making the value optional Signed-off-by: He Jie Xu <[email protected]> * address comments Signed-off-by: He Jie Xu <[email protected]> * update comment Signed-off-by: He Jie Xu <[email protected]> * generates Signed-off-by: He Jie Xu <[email protected]> * address comments Signed-off-by: He Jie Xu <[email protected]> * gen Signed-off-by: He Jie Xu <[email protected]> * fix format Signed-off-by: He Jie Xu <[email protected]> * update Signed-off-by: He Jie Xu <[email protected]> * fix format Signed-off-by: He Jie Xu <[email protected]> * gen again again Signed-off-by: He Jie Xu <[email protected]> * address comments Signed-off-by: He Jie Xu <[email protected]> * gen Signed-off-by: He Jie Xu <[email protected]> * address comment Signed-off-by: He Jie Xu <[email protected]> * fix test Signed-off-by: He Jie Xu <[email protected]> --------- Signed-off-by: He Jie Xu <[email protected]>
- Loading branch information
Showing
20 changed files
with
399 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
62 changes: 62 additions & 0 deletions
62
internal/xds/translator/testdata/in/xds-ir/jsonpatch-add-op-without-value.yaml
This file contains 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,62 @@ | ||
envoyPatchPolicies: | ||
- status: {} | ||
name: "first-policy" | ||
namespace: "default" | ||
jsonPatches: | ||
- type: "type.googleapis.com/envoy.config.listener.v3.Listener" | ||
name: "first-listener" | ||
operation: | ||
op: "add" | ||
path: "/filter_chains/0/filters/0/typed_config/http_filters/0" | ||
value: | ||
name: "envoy.filters.http.ratelimit" | ||
typed_config: | ||
"@type": "type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit" | ||
domain: "eg-ratelimit" | ||
failure_mode_deny: true | ||
timeout: 1s | ||
rate_limit_service: | ||
grpc_service: | ||
envoy_grpc: | ||
cluster_name: rate-limit-cluster | ||
transport_api_version: V3 | ||
- type: "type.googleapis.com/envoy.config.route.v3.RouteConfiguration" | ||
name: "first-listener" | ||
operation: | ||
op: "add" | ||
path: "/virtual_hosts/0/rate_limits" | ||
http: | ||
- name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
path: | ||
mergeSlashes: true | ||
escapedSlashesAction: UnescapeAndRedirect | ||
tls: | ||
alpnProtocols: | ||
- h2 | ||
- http/1.1 | ||
certificates: | ||
- name: secret-1 | ||
# byte slice representation of "key-data" | ||
serverCertificate: [99, 101, 114, 116, 45, 100, 97, 116, 97] | ||
# byte slice representation of "key-data" | ||
privateKey: [107, 101, 121, 45, 100, 97, 116, 97] | ||
- name: secret-2 | ||
serverCertificate: [99, 101, 114, 116, 45, 100, 97, 116, 97] | ||
privateKey: [107, 101, 121, 45, 100, 97, 116, 97] | ||
routes: | ||
- name: "first-route" | ||
hostname: "*" | ||
headerMatches: | ||
- name: user | ||
stringMatch: | ||
exact: "jason" | ||
destination: | ||
name: "first-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 |
65 changes: 65 additions & 0 deletions
65
internal/xds/translator/testdata/in/xds-ir/jsonpatch-move-op-with-value.yaml
This file contains 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,65 @@ | ||
envoyPatchPolicies: | ||
- status: {} | ||
name: "first-policy" | ||
namespace: "default" | ||
jsonPatches: | ||
- type: "type.googleapis.com/envoy.config.listener.v3.Listener" | ||
name: "first-listener" | ||
operation: | ||
op: "add" | ||
path: "/filter_chains/0/filters/0/typed_config/http_filters/0" | ||
value: | ||
name: "envoy.filters.http.ratelimit" | ||
typed_config: | ||
"@type": "type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit" | ||
domain: "eg-ratelimit" | ||
failure_mode_deny: true | ||
timeout: 1s | ||
rate_limit_service: | ||
grpc_service: | ||
envoy_grpc: | ||
cluster_name: rate-limit-cluster | ||
transport_api_version: V3 | ||
- type: "type.googleapis.com/envoy.config.listener.v3.Listener" | ||
name: "first-listener" | ||
operation: | ||
op: "remove" | ||
from: "/filter_chains/0/filters/0/typed_config/http_filters/0" | ||
path: "/filter_chains/0/filters/0/typed_config/http_filters/1" | ||
value: | ||
test: "abc" | ||
http: | ||
- name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
path: | ||
mergeSlashes: true | ||
escapedSlashesAction: UnescapeAndRedirect | ||
tls: | ||
alpnProtocols: | ||
- h2 | ||
- http/1.1 | ||
certificates: | ||
- name: secret-1 | ||
# byte slice representation of "key-data" | ||
serverCertificate: [99, 101, 114, 116, 45, 100, 97, 116, 97] | ||
# byte slice representation of "key-data" | ||
privateKey: [107, 101, 121, 45, 100, 97, 116, 97] | ||
- name: secret-2 | ||
serverCertificate: [99, 101, 114, 116, 45, 100, 97, 116, 97] | ||
privateKey: [107, 101, 121, 45, 100, 97, 116, 97] | ||
routes: | ||
- name: "first-route" | ||
hostname: "*" | ||
headerMatches: | ||
- name: user | ||
stringMatch: | ||
exact: "jason" | ||
destination: | ||
name: "first-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 |
14 changes: 14 additions & 0 deletions
14
internal/xds/translator/testdata/out/xds-ir/jsonpatch-add-op-without-value.clusters.yaml
This file contains 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 @@ | ||
- commonLbConfig: | ||
localityWeightedLbConfig: {} | ||
connectTimeout: 10s | ||
dnsLookupFamily: V4_ONLY | ||
edsClusterConfig: | ||
edsConfig: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
serviceName: first-route-dest | ||
lbPolicy: LEAST_REQUEST | ||
name: first-route-dest | ||
outlierDetection: {} | ||
perConnectionBufferLimitBytes: 32768 | ||
type: EDS |
12 changes: 12 additions & 0 deletions
12
internal/xds/translator/testdata/out/xds-ir/jsonpatch-add-op-without-value.endpoints.yaml
This file contains 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,12 @@ | ||
- clusterName: first-route-dest | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: 1.2.3.4 | ||
portValue: 50000 | ||
loadBalancingWeight: 1 | ||
loadBalancingWeight: 1 | ||
locality: | ||
region: first-route-dest/backend/0 |
9 changes: 9 additions & 0 deletions
9
...xds/translator/testdata/out/xds-ir/jsonpatch-add-op-without-value.envoypatchpolicies.yaml
This file contains 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,9 @@ | ||
- name: first-policy | ||
namespace: default | ||
status: | ||
conditions: | ||
- lastTransitionTime: null | ||
message: The add operation requires a value | ||
reason: Invalid | ||
status: "False" | ||
type: Programmed |
61 changes: 61 additions & 0 deletions
61
internal/xds/translator/testdata/out/xds-ir/jsonpatch-add-op-without-value.listeners.yaml
This file contains 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,61 @@ | ||
- address: | ||
socketAddress: | ||
address: 0.0.0.0 | ||
portValue: 10080 | ||
filterChains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
commonHttpProtocolOptions: | ||
headersWithUnderscoresAction: REJECT_REQUEST | ||
http2ProtocolOptions: | ||
initialConnectionWindowSize: 1048576 | ||
initialStreamWindowSize: 65536 | ||
maxConcurrentStreams: 100 | ||
httpFilters: | ||
- name: envoy.filters.http.ratelimit | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit | ||
domain: eg-ratelimit | ||
failureModeDeny: true | ||
rateLimitService: | ||
grpcService: | ||
envoyGrpc: | ||
clusterName: rate-limit-cluster | ||
transportApiVersion: V3 | ||
timeout: 1s | ||
- name: envoy.filters.http.router | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
mergeSlashes: true | ||
normalizePath: true | ||
pathWithEscapedSlashesAction: UNESCAPE_AND_REDIRECT | ||
rds: | ||
configSource: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
routeConfigName: first-listener | ||
statPrefix: https | ||
upgradeConfigs: | ||
- upgradeType: websocket | ||
useRemoteAddress: true | ||
transportSocket: | ||
name: envoy.transport_sockets.tls | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext | ||
commonTlsContext: | ||
alpnProtocols: | ||
- h2 | ||
- http/1.1 | ||
tlsCertificateSdsSecretConfigs: | ||
- name: secret-1 | ||
sdsConfig: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
- name: secret-2 | ||
sdsConfig: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
name: first-listener | ||
perConnectionBufferLimitBytes: 32768 |
16 changes: 16 additions & 0 deletions
16
internal/xds/translator/testdata/out/xds-ir/jsonpatch-add-op-without-value.routes.yaml
This file contains 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,16 @@ | ||
- ignorePortInHostMatching: true | ||
name: first-listener | ||
virtualHosts: | ||
- domains: | ||
- '*' | ||
name: first-listener/* | ||
routes: | ||
- match: | ||
headers: | ||
- name: user | ||
stringMatch: | ||
exact: jason | ||
prefix: / | ||
name: first-route | ||
route: | ||
cluster: first-route-dest |
14 changes: 14 additions & 0 deletions
14
internal/xds/translator/testdata/out/xds-ir/jsonpatch-move-op-with-value.clusters.yaml
This file contains 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 @@ | ||
- commonLbConfig: | ||
localityWeightedLbConfig: {} | ||
connectTimeout: 10s | ||
dnsLookupFamily: V4_ONLY | ||
edsClusterConfig: | ||
edsConfig: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
serviceName: first-route-dest | ||
lbPolicy: LEAST_REQUEST | ||
name: first-route-dest | ||
outlierDetection: {} | ||
perConnectionBufferLimitBytes: 32768 | ||
type: EDS |
12 changes: 12 additions & 0 deletions
12
internal/xds/translator/testdata/out/xds-ir/jsonpatch-move-op-with-value.endpoints.yaml
This file contains 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,12 @@ | ||
- clusterName: first-route-dest | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: 1.2.3.4 | ||
portValue: 50000 | ||
loadBalancingWeight: 1 | ||
loadBalancingWeight: 1 | ||
locality: | ||
region: first-route-dest/backend/0 |
9 changes: 9 additions & 0 deletions
9
...l/xds/translator/testdata/out/xds-ir/jsonpatch-move-op-with-value.envoypatchpolicies.yaml
This file contains 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,9 @@ | ||
- name: first-policy | ||
namespace: default | ||
status: | ||
conditions: | ||
- lastTransitionTime: null | ||
message: The value field can not be set for the remove operation | ||
reason: Invalid | ||
status: "False" | ||
type: Programmed |
Oops, something went wrong.