Skip to content

Commit

Permalink
feat: make egctl x translate output struct
Browse files Browse the repository at this point in the history
Signed-off-by: bitliu <bitliu@tencent.com>
  • Loading branch information
Xunzhuo committed Feb 23, 2023
1 parent b97859d commit 0190c66
Show file tree
Hide file tree
Showing 13 changed files with 1,612 additions and 380 deletions.
1,130 changes: 969 additions & 161 deletions docs/latest/user/egctl.md

Large diffs are not rendered by default.

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 internal/cmd/egctl/testdata/out/from-gateway-api-to-xds.all.yaml
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
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
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
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
Loading

0 comments on commit 0190c66

Please sign in to comment.