Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/infrastructure/kubernetes/bootstrap.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ admin:
access_log_path: /dev/null
address:
socket_address:
address: 127.0.0.1
port_value: 19000
address: {{ .AdminServerAddress }}
port_value: {{ .AdminServerPort }}
dynamic_resources:
cds_config:
resource_api_version: V3
Expand Down Expand Up @@ -37,7 +37,7 @@ static_resources:
address:
socket_address:
address: {{ .XdsServerAddress }}
port_value: 18000
port_value: {{ .XdsServerPort }}
http2_protocol_options: {}
name: xds_cluster
type: STRICT_DNS
Expand Down
15 changes: 14 additions & 1 deletion internal/infrastructure/kubernetes/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ var bootstrapTmpl = template.Must(template.New(envoyCfgFileName).Parse(bootstrap
var (
// envoyGatewayService is the name of the Envoy Gateway service.
envoyGatewayService = "envoy-gateway"
// envoyGatewayPort is the port used to expose envoyGatewayService.
envoyGatewayPort = int32(18000)
// envoyGatewayAdminService is the host address of the envoy admin interface.
envoyGatewayAdminService = "127.0.0.1"
// envoyGatewayAdminPort is the port used to expose admin interface.
envoyGatewayAdminPort = int32(19000)
)

// envoyBootstrap defines the envoy Bootstrap configuration.
Expand All @@ -59,6 +65,12 @@ type bootstrapConfig struct {
type bootstrapParameters struct {
// XdsServerAddress is the address of the XDS Server that Envoy is managed by.
XdsServerAddress string
// XdsServerPort is the port of the XDS Server that Envoy is managed by.
XdsServerPort int32
// AdminServerAddress is the address of the Envoy admin interface.
AdminServerAddress string
// AdminServerPort is the port of the Envoy admin interface.
AdminServerPort int32
}

// render the stringified bootstrap config in yaml format.
Expand Down Expand Up @@ -167,7 +179,8 @@ func expectedContainers(infra *ir.Infra) ([]corev1.Container, error) {
},
}

cfg := bootstrapConfig{parameters: bootstrapParameters{XdsServerAddress: envoyGatewayService}}
cfg := bootstrapConfig{parameters: bootstrapParameters{XdsServerAddress: envoyGatewayService, XdsServerPort: envoyGatewayPort,
AdminServerAddress: envoyGatewayAdminService, AdminServerPort: envoyGatewayAdminPort}}
if err := cfg.render(); err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/infrastructure/kubernetes/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ func TestExpectedDeployment(t *testing.T) {
checkLabels(t, deploy, deploy.Labels)

// Create a bootstrap config, render it into an arg, and ensure it's as expected.
cfg := &bootstrapConfig{parameters: bootstrapParameters{XdsServerAddress: envoyGatewayService}}
cfg := &bootstrapConfig{parameters: bootstrapParameters{XdsServerAddress: envoyGatewayService, XdsServerPort: envoyGatewayPort,
AdminServerAddress: envoyGatewayAdminService, AdminServerPort: envoyGatewayAdminPort}}
err = cfg.render()
require.NoError(t, err)
checkContainerHasArg(t, container, fmt.Sprintf("--config-yaml %s", cfg.rendered))
Expand Down