-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make egctl x translate output struct
Signed-off-by: bitliu <bitliu@tencent.com>
- Loading branch information
Showing
13 changed files
with
1,612 additions
and
380 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
internal/cmd/egctl/testdata/out/from-gateway-api-to-xds.all.json
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 @@ | ||
{"configKey":"default-eg","configs":[{"@type":"type.googleapis.com/envoy.admin.v3.BootstrapConfigDump","bootstrap":{"admin":{"accessLog":[{"name":"envoy.access_loggers.file","typedConfig":{"@type":"type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog","path":"/dev/null"}}],"address":{"socketAddress":{"address":"127.0.0.1","portValue":19000}}},"dynamicResources":{"cdsConfig":{"apiConfigSource":{"apiType":"DELTA_GRPC","grpcServices":[{"envoyGrpc":{"clusterName":"xds_cluster"}}],"setNodeOnFirstMessageOnly":true,"transportApiVersion":"V3"},"resourceApiVersion":"V3"},"ldsConfig":{"apiConfigSource":{"apiType":"DELTA_GRPC","grpcServices":[{"envoyGrpc":{"clusterName":"xds_cluster"}}],"setNodeOnFirstMessageOnly":true,"transportApiVersion":"V3"},"resourceApiVersion":"V3"}},"layeredRuntime":{"layers":[{"name":"runtime-0","rtdsLayer":{"name":"runtime-0","rtdsConfig":{"apiConfigSource":{"apiType":"DELTA_GRPC","grpcServices":[{"envoyGrpc":{"clusterName":"xds_cluster"}}],"transportApiVersion":"V3"},"resourceApiVersion":"V3"}}}]},"staticResources":{"clusters":[{"connectTimeout":"1s","loadAssignment":{"clusterName":"xds_cluster","endpoints":[{"lbEndpoints":[{"endpoint":{"address":{"socketAddress":{"address":"envoy-gateway","portValue":18000}}}}]}]},"name":"xds_cluster","transportSocket":{"name":"envoy.transport_sockets.tls","typedConfig":{"@type":"type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext","commonTlsContext":{"tlsCertificateSdsSecretConfigs":[{"name":"xds_certificate","sdsConfig":{"pathConfigSource":{"path":"/sds/xds-certificate.json"},"resourceApiVersion":"V3"}}],"tlsParams":{"tlsMaximumProtocolVersion":"TLSv1_3"},"validationContextSdsSecretConfig":{"name":"xds_trusted_ca","sdsConfig":{"pathConfigSource":{"path":"/sds/xds-trusted-ca.json"},"resourceApiVersion":"V3"}}}}},"type":"STRICT_DNS","typedExtensionProtocolOptions":{"envoy.extensions.upstreams.http.v3.HttpProtocolOptions":{"@type":"type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions","explicitHttpConfig":{"http2ProtocolOptions":{}}}}}]}}},{"@type":"type.googleapis.com/envoy.admin.v3.ClustersConfigDump","staticClusters":[{"cluster":{"@type":"type.googleapis.com/envoy.config.cluster.v3.Cluster","commonLbConfig":{"localityWeightedLbConfig":{}},"connectTimeout":"5s","dnsLookupFamily":"V4_ONLY","loadAssignment":{"clusterName":"default-backend-rule-0-match-0-www.example.com","endpoints":[{"lbEndpoints":[{"endpoint":{"address":{"socketAddress":{"address":"1.1.1.1","portValue":3000}}},"loadBalancingWeight":1}],"loadBalancingWeight":1,"locality":{}}]},"name":"default-backend-rule-0-match-0-www.example.com","outlierDetection":{},"type":"STATIC"}}]},{"@type":"type.googleapis.com/envoy.admin.v3.ListenersConfigDump","staticListeners":[{"listener":{"@type":"type.googleapis.com/envoy.config.listener.v3.Listener","accessLog":[{"filter":{"responseFlagFilter":{"flags":["NR"]}},"name":"envoy.access_loggers.file","typedConfig":{"@type":"type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog","path":"/dev/stdout"}}],"address":{"socketAddress":{"address":"0.0.0.0","portValue":10080}},"defaultFilterChain":{"filters":[{"name":"envoy.filters.network.http_connection_manager","typedConfig":{"@type":"type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager","accessLog":[{"name":"envoy.access_loggers.file","typedConfig":{"@type":"type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog","path":"/dev/stdout"}}],"httpFilters":[{"name":"envoy.filters.http.router","typedConfig":{"@type":"type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"}}],"rds":{"configSource":{"apiConfigSource":{"apiType":"DELTA_GRPC","grpcServices":[{"envoyGrpc":{"clusterName":"xds_cluster"}}],"setNodeOnFirstMessageOnly":true,"transportApiVersion":"V3"},"resourceApiVersion":"V3"},"routeConfigName":"default-eg-http"},"statPrefix":"http","upgradeConfigs":[{"upgradeType":"websocket"}],"useRemoteAddress":true}}]},"name":"default-eg-http"}}]},{"@type":"type.googleapis.com/envoy.admin.v3.RoutesConfigDump","staticRouteConfigs":[{"routeConfig":{"@type":"type.googleapis.com/envoy.config.route.v3.RouteConfiguration","name":"default-eg-http","virtualHosts":[{"domains":["*"],"name":"default-eg-http","routes":[{"match":{"headers":[{"name":":authority","stringMatch":{"exact":"www.example.com"}}],"prefix":"/"},"route":{"cluster":"default-backend-rule-0-match-0-www.example.com"}}]}]}}]}],"resourceType":"all"} |
173 changes: 173 additions & 0 deletions
173
internal/cmd/egctl/testdata/out/from-gateway-api-to-xds.all.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,173 @@ | ||
configKey: default-eg | ||
configs: | ||
- '@type': type.googleapis.com/envoy.admin.v3.BootstrapConfigDump | ||
bootstrap: | ||
admin: | ||
accessLog: | ||
- name: envoy.access_loggers.file | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/null | ||
address: | ||
socketAddress: | ||
address: 127.0.0.1 | ||
portValue: 19000 | ||
dynamicResources: | ||
cdsConfig: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
setNodeOnFirstMessageOnly: true | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
ldsConfig: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
setNodeOnFirstMessageOnly: true | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
layeredRuntime: | ||
layers: | ||
- name: runtime-0 | ||
rtdsLayer: | ||
name: runtime-0 | ||
rtdsConfig: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
staticResources: | ||
clusters: | ||
- connectTimeout: 1s | ||
loadAssignment: | ||
clusterName: xds_cluster | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: envoy-gateway | ||
portValue: 18000 | ||
name: xds_cluster | ||
transportSocket: | ||
name: envoy.transport_sockets.tls | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext | ||
commonTlsContext: | ||
tlsCertificateSdsSecretConfigs: | ||
- name: xds_certificate | ||
sdsConfig: | ||
pathConfigSource: | ||
path: /sds/xds-certificate.json | ||
resourceApiVersion: V3 | ||
tlsParams: | ||
tlsMaximumProtocolVersion: TLSv1_3 | ||
validationContextSdsSecretConfig: | ||
name: xds_trusted_ca | ||
sdsConfig: | ||
pathConfigSource: | ||
path: /sds/xds-trusted-ca.json | ||
resourceApiVersion: V3 | ||
type: STRICT_DNS | ||
typedExtensionProtocolOptions: | ||
envoy.extensions.upstreams.http.v3.HttpProtocolOptions: | ||
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions | ||
explicitHttpConfig: | ||
http2ProtocolOptions: {} | ||
- '@type': type.googleapis.com/envoy.admin.v3.ClustersConfigDump | ||
staticClusters: | ||
- cluster: | ||
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster | ||
commonLbConfig: | ||
localityWeightedLbConfig: {} | ||
connectTimeout: 5s | ||
dnsLookupFamily: V4_ONLY | ||
loadAssignment: | ||
clusterName: default-backend-rule-0-match-0-www.example.com | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: 1.1.1.1 | ||
portValue: 3000 | ||
loadBalancingWeight: 1 | ||
loadBalancingWeight: 1 | ||
locality: {} | ||
name: default-backend-rule-0-match-0-www.example.com | ||
outlierDetection: {} | ||
type: STATIC | ||
- '@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump | ||
staticListeners: | ||
- listener: | ||
'@type': type.googleapis.com/envoy.config.listener.v3.Listener | ||
accessLog: | ||
- filter: | ||
responseFlagFilter: | ||
flags: | ||
- NR | ||
name: envoy.access_loggers.file | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/stdout | ||
address: | ||
socketAddress: | ||
address: 0.0.0.0 | ||
portValue: 10080 | ||
defaultFilterChain: | ||
filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
accessLog: | ||
- name: envoy.access_loggers.file | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/stdout | ||
httpFilters: | ||
- name: envoy.filters.http.router | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
rds: | ||
configSource: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
setNodeOnFirstMessageOnly: true | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
routeConfigName: default-eg-http | ||
statPrefix: http | ||
upgradeConfigs: | ||
- upgradeType: websocket | ||
useRemoteAddress: true | ||
name: default-eg-http | ||
- '@type': type.googleapis.com/envoy.admin.v3.RoutesConfigDump | ||
staticRouteConfigs: | ||
- routeConfig: | ||
'@type': type.googleapis.com/envoy.config.route.v3.RouteConfiguration | ||
name: default-eg-http | ||
virtualHosts: | ||
- domains: | ||
- '*' | ||
name: default-eg-http | ||
routes: | ||
- match: | ||
headers: | ||
- name: :authority | ||
stringMatch: | ||
exact: www.example.com | ||
prefix: / | ||
route: | ||
cluster: default-backend-rule-0-match-0-www.example.com | ||
resourceType: all |
84 changes: 84 additions & 0 deletions
84
internal/cmd/egctl/testdata/out/from-gateway-api-to-xds.bootstrap.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,84 @@ | ||
'@type': type.googleapis.com/envoy.admin.v3.BootstrapConfigDump | ||
bootstrap: | ||
admin: | ||
accessLog: | ||
- name: envoy.access_loggers.file | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/null | ||
address: | ||
socketAddress: | ||
address: 127.0.0.1 | ||
portValue: 19000 | ||
dynamicResources: | ||
cdsConfig: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
setNodeOnFirstMessageOnly: true | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
ldsConfig: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
setNodeOnFirstMessageOnly: true | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
layeredRuntime: | ||
layers: | ||
- name: runtime-0 | ||
rtdsLayer: | ||
name: runtime-0 | ||
rtdsConfig: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
staticResources: | ||
clusters: | ||
- connectTimeout: 1s | ||
loadAssignment: | ||
clusterName: xds_cluster | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: envoy-gateway | ||
portValue: 18000 | ||
name: xds_cluster | ||
transportSocket: | ||
name: envoy.transport_sockets.tls | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext | ||
commonTlsContext: | ||
tlsCertificateSdsSecretConfigs: | ||
- name: xds_certificate | ||
sdsConfig: | ||
pathConfigSource: | ||
path: /sds/xds-certificate.json | ||
resourceApiVersion: V3 | ||
tlsParams: | ||
tlsMaximumProtocolVersion: TLSv1_3 | ||
validationContextSdsSecretConfig: | ||
name: xds_trusted_ca | ||
sdsConfig: | ||
pathConfigSource: | ||
path: /sds/xds-trusted-ca.json | ||
resourceApiVersion: V3 | ||
type: STRICT_DNS | ||
typedExtensionProtocolOptions: | ||
envoy.extensions.upstreams.http.v3.HttpProtocolOptions: | ||
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions | ||
explicitHttpConfig: | ||
http2ProtocolOptions: {} | ||
configKey: default-eg | ||
resourceType: bootstrap |
25 changes: 25 additions & 0 deletions
25
internal/cmd/egctl/testdata/out/from-gateway-api-to-xds.cluster.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,25 @@ | ||
'@type': type.googleapis.com/envoy.admin.v3.ClustersConfigDump | ||
configKey: default-eg | ||
resourceType: cluster | ||
staticClusters: | ||
- cluster: | ||
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster | ||
commonLbConfig: | ||
localityWeightedLbConfig: {} | ||
connectTimeout: 5s | ||
dnsLookupFamily: V4_ONLY | ||
loadAssignment: | ||
clusterName: default-backend-rule-0-match-0-www.example.com | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: 1.1.1.1 | ||
portValue: 3000 | ||
loadBalancingWeight: 1 | ||
loadBalancingWeight: 1 | ||
locality: {} | ||
name: default-backend-rule-0-match-0-www.example.com | ||
outlierDetection: {} | ||
type: STATIC |
49 changes: 49 additions & 0 deletions
49
internal/cmd/egctl/testdata/out/from-gateway-api-to-xds.listener.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,49 @@ | ||
'@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump | ||
configKey: default-eg | ||
resourceType: listener | ||
staticListeners: | ||
- listener: | ||
'@type': type.googleapis.com/envoy.config.listener.v3.Listener | ||
accessLog: | ||
- filter: | ||
responseFlagFilter: | ||
flags: | ||
- NR | ||
name: envoy.access_loggers.file | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/stdout | ||
address: | ||
socketAddress: | ||
address: 0.0.0.0 | ||
portValue: 10080 | ||
defaultFilterChain: | ||
filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
accessLog: | ||
- name: envoy.access_loggers.file | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog | ||
path: /dev/stdout | ||
httpFilters: | ||
- name: envoy.filters.http.router | ||
typedConfig: | ||
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
rds: | ||
configSource: | ||
apiConfigSource: | ||
apiType: DELTA_GRPC | ||
grpcServices: | ||
- envoyGrpc: | ||
clusterName: xds_cluster | ||
setNodeOnFirstMessageOnly: true | ||
transportApiVersion: V3 | ||
resourceApiVersion: V3 | ||
routeConfigName: default-eg-http | ||
statPrefix: http | ||
upgradeConfigs: | ||
- upgradeType: websocket | ||
useRemoteAddress: true | ||
name: default-eg-http |
Oops, something went wrong.