github.com/DerekStrickland/consul@v1.4.5/command/connect/envoy/bootstrap_tpl.go (about)

     1  package envoy
     2  
     3  type templateArgs struct {
     4  	ProxyCluster, ProxyID string
     5  	AgentAddress          string
     6  	AgentPort             string
     7  	AgentTLS              bool
     8  	AgentCAFile           string
     9  	AdminBindAddress      string
    10  	AdminBindPort         string
    11  	LocalAgentClusterName string
    12  	Token                 string
    13  }
    14  
    15  const bootstrapTemplate = `{
    16    "admin": {
    17      "access_log_path": "/dev/null",
    18      "address": {
    19        "socket_address": {
    20          "address": "{{ .AdminBindAddress }}",
    21          "port_value": {{ .AdminBindPort }}
    22        }
    23      }
    24    },
    25    "node": {
    26      "cluster": "{{ .ProxyCluster }}",
    27      "id": "{{ .ProxyID }}"
    28    },
    29    "static_resources": {
    30      "clusters": [
    31        {
    32          "name": "{{ .LocalAgentClusterName }}",
    33          "connect_timeout": "1s",
    34          "type": "STATIC",
    35          {{- if .AgentTLS -}}
    36          "tls_context": {
    37            "common_tls_context": {
    38              "validation_context": {
    39                "trusted_ca": {
    40                  "filename": "{{ .AgentCAFile }}"
    41                }
    42              }
    43            }
    44          },
    45          {{- end }}
    46          "http2_protocol_options": {},
    47          "hosts": [
    48            {
    49              "socket_address": {
    50                "address": "{{ .AgentAddress }}",
    51                "port_value": {{ .AgentPort }}
    52              }
    53            }
    54          ]
    55        }
    56      ]
    57    },
    58    "dynamic_resources": {
    59      "lds_config": { "ads": {} },
    60      "cds_config": { "ads": {} },
    61      "ads_config": {
    62        "api_type": "GRPC",
    63        "grpc_services": {
    64          "initial_metadata": [
    65            {
    66              "key": "x-consul-token",
    67              "value": "{{ .Token }}"
    68            }
    69          ],
    70          "envoy_grpc": {
    71            "cluster_name": "{{ .LocalAgentClusterName }}"
    72          }
    73        }
    74      }
    75    }
    76  }
    77  `