diff --git a/agent/config/config.go b/agent/config/config.go index 540a3f4159..f1d39b3dfc 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -430,10 +430,10 @@ type CheckDefinition struct { ID *string `json:"id,omitempty" hcl:"id" mapstructure:"id"` Name *string `json:"name,omitempty" hcl:"name" mapstructure:"name"` Notes *string `json:"notes,omitempty" hcl:"notes" mapstructure:"notes"` - ServiceID *string `json:"service_id,omitempty" hcl:"service_id" mapstructure:"service_id"` + ServiceID *string `json:"service_id,omitempty" hcl:"service_id" mapstructure:"service_id" alias:"serviceid"` Token *string `json:"token,omitempty" hcl:"token" mapstructure:"token"` Status *string `json:"status,omitempty" hcl:"status" mapstructure:"status"` - ScriptArgs []string `json:"args,omitempty" hcl:"args" mapstructure:"args"` + ScriptArgs []string `json:"args,omitempty" hcl:"args" mapstructure:"args" alias:"scriptargs"` HTTP *string `json:"http,omitempty" hcl:"http" mapstructure:"http"` Header map[string][]string `json:"header,omitempty" hcl:"header" mapstructure:"header"` Method *string `json:"method,omitempty" hcl:"method" mapstructure:"method"` @@ -441,18 +441,18 @@ type CheckDefinition struct { OutputMaxSize *int `json:"output_max_size,omitempty" hcl:"output_max_size" mapstructure:"output_max_size"` TCP *string `json:"tcp,omitempty" hcl:"tcp" mapstructure:"tcp"` Interval *string `json:"interval,omitempty" hcl:"interval" mapstructure:"interval"` - DockerContainerID *string `json:"docker_container_id,omitempty" hcl:"docker_container_id" mapstructure:"docker_container_id"` + DockerContainerID *string `json:"docker_container_id,omitempty" hcl:"docker_container_id" mapstructure:"docker_container_id" alias:"dockercontainerid"` Shell *string `json:"shell,omitempty" hcl:"shell" mapstructure:"shell"` GRPC *string `json:"grpc,omitempty" hcl:"grpc" mapstructure:"grpc"` GRPCUseTLS *bool `json:"grpc_use_tls,omitempty" hcl:"grpc_use_tls" mapstructure:"grpc_use_tls"` - TLSSkipVerify *bool `json:"tls_skip_verify,omitempty" hcl:"tls_skip_verify" mapstructure:"tls_skip_verify"` + TLSSkipVerify *bool `json:"tls_skip_verify,omitempty" hcl:"tls_skip_verify" mapstructure:"tls_skip_verify" alias:"tlsskipverify"` AliasNode *string `json:"alias_node,omitempty" hcl:"alias_node" mapstructure:"alias_node"` AliasService *string `json:"alias_service,omitempty" hcl:"alias_service" mapstructure:"alias_service"` Timeout *string `json:"timeout,omitempty" hcl:"timeout" mapstructure:"timeout"` TTL *string `json:"ttl,omitempty" hcl:"ttl" mapstructure:"ttl"` SuccessBeforePassing *int `json:"success_before_passing,omitempty" hcl:"success_before_passing" mapstructure:"success_before_passing"` FailuresBeforeCritical *int `json:"failures_before_critical,omitempty" hcl:"failures_before_critical" mapstructure:"failures_before_critical"` - DeregisterCriticalServiceAfter *string `json:"deregister_critical_service_after,omitempty" hcl:"deregister_critical_service_after" mapstructure:"deregister_critical_service_after"` + DeregisterCriticalServiceAfter *string `json:"deregister_critical_service_after,omitempty" hcl:"deregister_critical_service_after" mapstructure:"deregister_critical_service_after" alias:"deregistercriticalserviceafter"` EnterpriseMeta `hcl:",squash" mapstructure:",squash"` } diff --git a/agent/discovery_chain_endpoint.go b/agent/discovery_chain_endpoint.go index c6dddd64e8..6765fed579 100644 --- a/agent/discovery_chain_endpoint.go +++ b/agent/discovery_chain_endpoint.go @@ -90,9 +90,9 @@ func (s *HTTPServer) DiscoveryChainRead(resp http.ResponseWriter, req *http.Requ // discoveryChainReadRequest is the API variation of structs.DiscoveryChainRequest type discoveryChainReadRequest struct { - OverrideMeshGateway structs.MeshGatewayConfig - OverrideProtocol string - OverrideConnectTimeout time.Duration + OverrideMeshGateway structs.MeshGatewayConfig `alias:"override_mesh_gateway"` + OverrideProtocol string `alias:"override_protocol"` + OverrideConnectTimeout time.Duration `alias:"override_connect_timeout"` } // discoveryChainReadResponse is the API variation of structs.DiscoveryChainResponse diff --git a/agent/structs/config_entry.go b/agent/structs/config_entry.go index 8ec7d43271..f57517dbf2 100644 --- a/agent/structs/config_entry.go +++ b/agent/structs/config_entry.go @@ -53,10 +53,10 @@ type ServiceConfigEntry struct { Kind string Name string Protocol string - MeshGateway MeshGatewayConfig `json:",omitempty"` + MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` Expose ExposeConfig `json:",omitempty"` - ExternalSNI string `json:",omitempty"` + ExternalSNI string `json:",omitempty" alias:"external_sni"` // TODO(banks): enable this once we have upstreams supported too. Enabling // sidecars actually makes no sense and adds complications when you don't @@ -134,7 +134,7 @@ type ProxyConfigEntry struct { Kind string Name string Config map[string]interface{} - MeshGateway MeshGatewayConfig `json:",omitempty"` + MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` Expose ExposeConfig `json:",omitempty"` EnterpriseMeta `hcl:",squash" mapstructure:",squash"` diff --git a/agent/structs/config_entry_discoverychain.go b/agent/structs/config_entry_discoverychain.go index 82e233c35e..a0249a71d6 100644 --- a/agent/structs/config_entry_discoverychain.go +++ b/agent/structs/config_entry_discoverychain.go @@ -260,12 +260,12 @@ func (m *ServiceRouteMatch) IsEmpty() bool { // ServiceRouteHTTPMatch is a set of http-specific match criteria. type ServiceRouteHTTPMatch struct { - PathExact string `json:",omitempty"` - PathPrefix string `json:",omitempty"` - PathRegex string `json:",omitempty"` + PathExact string `json:",omitempty" alias:"path_exact"` + PathPrefix string `json:",omitempty" alias:"path_prefix"` + PathRegex string `json:",omitempty" alias:"path_regex"` Header []ServiceRouteHTTPMatchHeader `json:",omitempty"` - QueryParam []ServiceRouteHTTPMatchQueryParam `json:",omitempty"` + QueryParam []ServiceRouteHTTPMatchQueryParam `json:",omitempty" alias:"query_param"` Methods []string `json:",omitempty"` } @@ -308,7 +308,7 @@ type ServiceRouteDestination struct { // // If this field is specified then this route is ineligible for further // splitting. - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` // Namespace is the namespace to resolve the service from instead of the // current namespace. If empty the current namespace is assumed. @@ -320,24 +320,24 @@ type ServiceRouteDestination struct { // PrefixRewrite allows for the proxied request to have its matching path // prefix modified before being sent to the destination. Described more // below in the envoy implementation section. - PrefixRewrite string `json:",omitempty"` + PrefixRewrite string `json:",omitempty" alias:"prefix_rewrite"` // RequestTimeout is the total amount of time permitted for the entire // downstream request (and retries) to be processed. - RequestTimeout time.Duration `json:",omitempty"` + RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` // NumRetries is the number of times to retry the request when a retryable // result occurs. This seems fairly proxy agnostic. - NumRetries uint32 `json:",omitempty"` + NumRetries uint32 `json:",omitempty" alias:"num_retries"` // RetryOnConnectFailure allows for connection failure errors to trigger a // retry. This should be expressible in other proxies as it's just a layer // 4 failure bubbling up to layer 7. - RetryOnConnectFailure bool `json:",omitempty"` + RetryOnConnectFailure bool `json:",omitempty" alias:"retry_on_connect_failure"` // RetryOnStatusCodes is a flat list of http response status codes that are // eligible for retry. This again should be feasible in any sane proxy. - RetryOnStatusCodes []uint32 `json:",omitempty"` + RetryOnStatusCodes []uint32 `json:",omitempty" alias:"retry_on_status_codes"` } func (e *ServiceRouteDestination) MarshalJSON() ([]byte, error) { @@ -576,7 +576,7 @@ type ServiceSplit struct { // // If this field is specified then this route is ineligible for further // splitting. - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` // Namespace is the namespace to resolve the service from instead of the // current namespace. If empty the current namespace is assumed (optional). @@ -604,7 +604,7 @@ type ServiceResolverConfigEntry struct { // DefaultSubset is the subset to use when no explicit subset is // requested. If empty the unnamed subset is used. - DefaultSubset string `json:",omitempty"` + DefaultSubset string `json:",omitempty" alias:"default_subset"` // Subsets is a map of subset name to subset definition for all // usable named subsets of this service. The map key is the name @@ -637,7 +637,7 @@ type ServiceResolverConfigEntry struct { // ConnectTimeout is the timeout for establishing new network connections // to this service. - ConnectTimeout time.Duration `json:",omitempty"` + ConnectTimeout time.Duration `json:",omitempty" alias:"connect_timeout"` EnterpriseMeta `hcl:",squash" mapstructure:",squash"` RaftIndex @@ -884,7 +884,7 @@ type ServiceResolverSubset struct { // to true, only instances with checks in the passing state will be // returned. (behaves identically to the similarly named field on prepared // queries). - OnlyPassing bool `json:",omitempty"` + OnlyPassing bool `json:",omitempty" alias:"only_passing"` } type ServiceResolverRedirect struct { @@ -898,7 +898,7 @@ type ServiceResolverRedirect struct { // // If this is specified at least one of Service, Datacenter, or Namespace // should be configured. - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` // Namespace is the namespace to resolve the service from instead of the // current one (optional). @@ -926,7 +926,7 @@ type ServiceResolverFailover struct { // requested service is used (optional). // // This is a DESTINATION during failover. - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` // Namespace is the namespace to resolve the requested service from to form // the failover group of instances. If empty the current namespace is used diff --git a/agent/structs/config_entry_gateways.go b/agent/structs/config_entry_gateways.go index a49a1f0bb8..67031c2112 100644 --- a/agent/structs/config_entry_gateways.go +++ b/agent/structs/config_entry_gateways.go @@ -248,15 +248,15 @@ type LinkedService struct { // CAFile is the optional path to a CA certificate to use for TLS connections // from the gateway to the linked service - CAFile string `json:",omitempty"` + CAFile string `json:",omitempty" alias:"ca_file"` // CertFile is the optional path to a client certificate to use for TLS connections // from the gateway to the linked service - CertFile string `json:",omitempty"` + CertFile string `json:",omitempty" alias:"cert_file"` // KeyFile is the optional path to a private key to use for TLS connections // from the gateway to the linked service - KeyFile string `json:",omitempty"` + KeyFile string `json:",omitempty" alias:"key_file"` // SNI is the optional name to specify during the TLS handshake with a linked service SNI string `json:",omitempty"` diff --git a/agent/structs/connect_proxy_config.go b/agent/structs/connect_proxy_config.go index 780b5fcbb8..bad538781c 100644 --- a/agent/structs/connect_proxy_config.go +++ b/agent/structs/connect_proxy_config.go @@ -114,7 +114,7 @@ type ConnectProxyConfig struct { Upstreams Upstreams `json:",omitempty"` // MeshGateway defines the mesh gateway configuration for this upstream - MeshGateway MeshGatewayConfig `json:",omitempty"` + MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` // Expose defines whether checks or paths are exposed through the proxy Expose ExposeConfig `json:",omitempty"` @@ -410,13 +410,13 @@ type ExposeConfig struct { type ExposePath struct { // ListenerPort defines the port of the proxy's listener for exposed paths. - ListenerPort int `json:",omitempty"` + ListenerPort int `json:",omitempty" alias:"listener_port"` // ExposePath is the path to expose through the proxy, ie. "/metrics." Path string `json:",omitempty"` // LocalPathPort is the port that the service is listening on for the given path. - LocalPathPort int `json:",omitempty"` + LocalPathPort int `json:",omitempty" alias:"local_path_port"` // Protocol describes the upstream's service protocol. // Valid values are "http" and "http2", defaults to "http" diff --git a/agent/xds/config.go b/agent/xds/config.go index 756ca51f44..2e2c236c9a 100644 --- a/agent/xds/config.go +++ b/agent/xds/config.go @@ -79,14 +79,14 @@ type GatewayConfig struct { // for those addresses or where an external entity maps that IP to the Envoy // (like AWS EC2 mapping a public IP to the private interface) then this // cannot be used. See the BindAddresses config instead - BindTaggedAddresses bool `mapstructure:"envoy_gateway_bind_tagged_addresses"` + BindTaggedAddresses bool `mapstructure:"envoy_gateway_bind_tagged_addresses" alias:"envoy_mesh_gateway_bind_tagged_addresses"` // BindAddresses additional bind addresses to configure listeners for - BindAddresses map[string]structs.ServiceAddress `mapstructure:"envoy_gateway_bind_addresses"` + BindAddresses map[string]structs.ServiceAddress `mapstructure:"envoy_gateway_bind_addresses" alias:"envoy_mesh_gateway_bind_addresses"` // NoDefaultBind indicates that we should not bind to the default address of the // gateway service - NoDefaultBind bool `mapstructure:"envoy_gateway_no_default_bind"` + NoDefaultBind bool `mapstructure:"envoy_gateway_no_default_bind" alias:"envoy_mesh_gateway_no_default_bind"` // ConnectTimeoutMs is the number of milliseconds to timeout making a new // connection to this upstream. Defaults to 5000 (5 seconds) if not set. diff --git a/api/config_entry.go b/api/config_entry.go index 6279a7c5a2..dc31d6110f 100644 --- a/api/config_entry.go +++ b/api/config_entry.go @@ -71,13 +71,13 @@ type ExposeConfig struct { type ExposePath struct { // ListenerPort defines the port of the proxy's listener for exposed paths. - ListenerPort int `json:",omitempty"` + ListenerPort int `json:",omitempty" alias:"listener_port"` // Path is the path to expose through the proxy, ie. "/metrics." Path string `json:",omitempty"` // LocalPathPort is the port that the service is listening on for the given path. - LocalPathPort int `json:",omitempty"` + LocalPathPort int `json:",omitempty" alias:"local_path_port"` // Protocol describes the upstream's service protocol. // Valid values are "http" and "http2", defaults to "http" @@ -92,9 +92,9 @@ type ServiceConfigEntry struct { Name string Namespace string `json:",omitempty"` Protocol string `json:",omitempty"` - MeshGateway MeshGatewayConfig `json:",omitempty"` + MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` Expose ExposeConfig `json:",omitempty"` - ExternalSNI string `json:",omitempty"` + ExternalSNI string `json:",omitempty" alias:"external_sni"` CreateIndex uint64 ModifyIndex uint64 } @@ -120,7 +120,7 @@ type ProxyConfigEntry struct { Name string Namespace string `json:",omitempty"` Config map[string]interface{} `json:",omitempty"` - MeshGateway MeshGatewayConfig `json:",omitempty"` + MeshGateway MeshGatewayConfig `json:",omitempty" alias:"mesh_gateway"` Expose ExposeConfig `json:",omitempty"` CreateIndex uint64 ModifyIndex uint64 diff --git a/api/config_entry_discoverychain.go b/api/config_entry_discoverychain.go index 885b78dc91..f3994f0dd9 100644 --- a/api/config_entry_discoverychain.go +++ b/api/config_entry_discoverychain.go @@ -31,12 +31,12 @@ type ServiceRouteMatch struct { } type ServiceRouteHTTPMatch struct { - PathExact string `json:",omitempty"` - PathPrefix string `json:",omitempty"` - PathRegex string `json:",omitempty"` + PathExact string `json:",omitempty" alias:"path_exact"` + PathPrefix string `json:",omitempty" alias:"path_prefix"` + PathRegex string `json:",omitempty" alias:"path_regex"` Header []ServiceRouteHTTPMatchHeader `json:",omitempty"` - QueryParam []ServiceRouteHTTPMatchQueryParam `json:",omitempty"` + QueryParam []ServiceRouteHTTPMatchQueryParam `json:",omitempty" alias:"query_param"` Methods []string `json:",omitempty"` } @@ -59,13 +59,13 @@ type ServiceRouteHTTPMatchQueryParam struct { type ServiceRouteDestination struct { Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` Namespace string `json:",omitempty"` - PrefixRewrite string `json:",omitempty"` - RequestTimeout time.Duration `json:",omitempty"` - NumRetries uint32 `json:",omitempty"` - RetryOnConnectFailure bool `json:",omitempty"` - RetryOnStatusCodes []uint32 `json:",omitempty"` + PrefixRewrite string `json:",omitempty" alias:"prefix_rewrite"` + RequestTimeout time.Duration `json:",omitempty" alias:"request_timeout"` + NumRetries uint32 `json:",omitempty" alias:"num_retries"` + RetryOnConnectFailure bool `json:",omitempty" alias:"retry_on_connect_failure"` + RetryOnStatusCodes []uint32 `json:",omitempty" alias:"retry_on_status_codes"` } func (e *ServiceRouteDestination) MarshalJSON() ([]byte, error) { @@ -123,7 +123,7 @@ func (e *ServiceSplitterConfigEntry) GetModifyIndex() uint64 { return e.ModifyIn type ServiceSplit struct { Weight float32 Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` Namespace string `json:",omitempty"` } @@ -132,11 +132,11 @@ type ServiceResolverConfigEntry struct { Name string Namespace string `json:",omitempty"` - DefaultSubset string `json:",omitempty"` + DefaultSubset string `json:",omitempty" alias:"default_subset"` Subsets map[string]ServiceResolverSubset `json:",omitempty"` Redirect *ServiceResolverRedirect `json:",omitempty"` Failover map[string]ServiceResolverFailover `json:",omitempty"` - ConnectTimeout time.Duration `json:",omitempty"` + ConnectTimeout time.Duration `json:",omitempty" alias:"connect_timeout"` CreateIndex uint64 ModifyIndex uint64 @@ -185,19 +185,19 @@ func (e *ServiceResolverConfigEntry) GetModifyIndex() uint64 { return e.ModifyIn type ServiceResolverSubset struct { Filter string `json:",omitempty"` - OnlyPassing bool `json:",omitempty"` + OnlyPassing bool `json:",omitempty" alias:"only_passing"` } type ServiceResolverRedirect struct { Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` Namespace string `json:",omitempty"` Datacenter string `json:",omitempty"` } type ServiceResolverFailover struct { Service string `json:",omitempty"` - ServiceSubset string `json:",omitempty"` + ServiceSubset string `json:",omitempty" alias:"service_subset"` Namespace string `json:",omitempty"` Datacenters []string `json:",omitempty"` } diff --git a/api/config_entry_gateways.go b/api/config_entry_gateways.go index d77164b5de..13a5ec7072 100644 --- a/api/config_entry_gateways.go +++ b/api/config_entry_gateways.go @@ -139,15 +139,15 @@ type LinkedService struct { // CAFile is the optional path to a CA certificate to use for TLS connections // from the gateway to the linked service - CAFile string `json:",omitempty"` + CAFile string `json:",omitempty" alias:"ca_file"` // CertFile is the optional path to a client certificate to use for TLS connections // from the gateway to the linked service - CertFile string `json:",omitempty"` + CertFile string `json:",omitempty" alias:"cert_file"` // KeyFile is the optional path to a private key to use for TLS connections // from the gateway to the linked service - KeyFile string `json:",omitempty"` + KeyFile string `json:",omitempty" alias:"key_file"` // SNI is the optional name to specify during the TLS handshake with a linked service SNI string `json:",omitempty"`