Skip to content

Commit d99f32f

Browse files
author
zirain
authored
Embed Envoy Bootstrap File (#233)
1 parent 009d125 commit d99f32f

File tree

2 files changed

+61
-58
lines changed

2 files changed

+61
-58
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
admin:
2+
access_log_path: /dev/null
3+
address:
4+
socket_address:
5+
address: 127.0.0.1
6+
port_value: 19000
7+
dynamic_resources:
8+
cds_config:
9+
resource_api_version: V3
10+
api_config_source:
11+
api_type: GRPC
12+
transport_api_version: V3
13+
grpc_services:
14+
- envoy_grpc:
15+
cluster_name: xds_cluster
16+
set_node_on_first_message_only: true
17+
lds_config:
18+
resource_api_version: V3
19+
api_config_source:
20+
api_type: GRPC
21+
transport_api_version: V3
22+
grpc_services:
23+
- envoy_grpc:
24+
cluster_name: xds_cluster
25+
set_node_on_first_message_only: true
26+
node:
27+
cluster: envoy-gateway-system
28+
id: envoy-default
29+
static_resources:
30+
clusters:
31+
- connect_timeout: 1s
32+
load_assignment:
33+
cluster_name: xds_cluster
34+
endpoints:
35+
- lb_endpoints:
36+
- endpoint:
37+
address:
38+
socket_address:
39+
address: {{ .XdsServerAddress }}
40+
port_value: 18000
41+
http2_protocol_options: {}
42+
name: xds_cluster
43+
type: STRICT_DNS
44+
layered_runtime:
45+
layers:
46+
- name: runtime-0
47+
rtds_layer:
48+
rtds_config:
49+
resource_api_version: V3
50+
api_config_source:
51+
transport_api_version: V3
52+
api_type: GRPC
53+
grpc_services:
54+
envoy_grpc:
55+
cluster_name: xds_cluster
56+
name: runtime-0

internal/infrastructure/kubernetes/deployment.go

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package kubernetes
22

33
import (
44
"context"
5+
_ "embed"
56
"fmt"
67
"path/filepath"
78
"strings"
@@ -36,64 +37,10 @@ const (
3637
envoyHTTPSPort = int32(8443)
3738
)
3839

39-
var bootstrapTmpl = template.Must(template.New(envoyCfgFileName).Parse(`
40-
admin:
41-
access_log_path: /dev/null
42-
address:
43-
socket_address:
44-
address: 127.0.0.1
45-
port_value: 19000
46-
dynamic_resources:
47-
cds_config:
48-
resource_api_version: V3
49-
api_config_source:
50-
api_type: GRPC
51-
transport_api_version: V3
52-
grpc_services:
53-
- envoy_grpc:
54-
cluster_name: xds_cluster
55-
set_node_on_first_message_only: true
56-
lds_config:
57-
resource_api_version: V3
58-
api_config_source:
59-
api_type: GRPC
60-
transport_api_version: V3
61-
grpc_services:
62-
- envoy_grpc:
63-
cluster_name: xds_cluster
64-
set_node_on_first_message_only: true
65-
node:
66-
cluster: envoy-gateway-system
67-
id: envoy-default
68-
static_resources:
69-
clusters:
70-
- connect_timeout: 1s
71-
load_assignment:
72-
cluster_name: xds_cluster
73-
endpoints:
74-
- lb_endpoints:
75-
- endpoint:
76-
address:
77-
socket_address:
78-
address: {{ .XdsServerAddress }}
79-
port_value: 18000
80-
http2_protocol_options: {}
81-
name: xds_cluster
82-
type: STRICT_DNS
83-
layered_runtime:
84-
layers:
85-
- name: runtime-0
86-
rtds_layer:
87-
rtds_config:
88-
resource_api_version: V3
89-
api_config_source:
90-
transport_api_version: V3
91-
api_type: GRPC
92-
grpc_services:
93-
envoy_grpc:
94-
cluster_name: xds_cluster
95-
name: runtime-0
96-
`))
40+
//go:embed bootstrap.yaml.tpl
41+
var bootstrapTmplStr string
42+
43+
var bootstrapTmpl = template.Must(template.New(envoyCfgFileName).Parse(bootstrapTmplStr))
9744

9845
var (
9946
// envoyGatewayService is the name of the Envoy Gateway service.

0 commit comments

Comments
 (0)