Skip to content

Commit 4008678

Browse files
committed
Adjust field name
Signed-off-by: jukie <[email protected]>
1 parent c4aecc6 commit 4008678

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

internal/infrastructure/host/proxy_infra.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ package host
88
import (
99
"context"
1010
"errors"
11-
"github.com/envoyproxy/gateway/internal/infrastructure/kubernetes/proxy"
11+
"fmt"
12+
"github.com/envoyproxy/gateway/internal/envoygateway/config"
1213
"io"
1314
"os"
1415
"path/filepath"
@@ -70,10 +71,10 @@ func (i *Infra) CreateOrUpdateProxyInfra(ctx context.Context, infra *ir.Infra) e
7071
Certificate: filepath.Join(i.sdsConfigPath, common.SdsCertFilename),
7172
TrustedCA: filepath.Join(i.sdsConfigPath, common.SdsCAFilename),
7273
},
73-
XdsServerHost: ptr.To("0.0.0.0"),
74-
AdminServerPort: ptr.To(int32(0)),
75-
StatsServerPort: ptr.To(int32(0)),
76-
ProxyInfraName: ptr.To(proxy.ExpectedResourceHashedName(proxyInfra.Name)),
74+
XdsServerHost: ptr.To("0.0.0.0"),
75+
AdminServerPort: ptr.To(int32(0)),
76+
StatsServerPort: ptr.To(int32(0)),
77+
LocalClusterName: ptr.To(fmt.Sprintf("%s-%s", config.EnvoyPrefix, proxyName)),
7778
}
7879

7980
args, err := common.BuildProxyArgs(proxyInfra, proxyConfig.Spec.Shutdown, bootstrapConfigOptions, proxyName, false)

internal/infrastructure/kubernetes/proxy/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func expectedProxyContainers(infra *ir.ProxyInfra,
109109
},
110110
MaxHeapSizeBytes: maxHeapSizeBytes,
111111
XdsServerHost: ptr.To(fmt.Sprintf("%s.%s.svc.%s", config.EnvoyGatewayServiceName, controllerNamespace, dnsDomain)),
112-
ProxyInfraName: ptr.To(ExpectedResourceHashedName(infra.Name)),
112+
LocalClusterName: ptr.To(fmt.Sprintf("%s-%s", config.EnvoyPrefix, utils.GetHashedName(infra.Name, 64))),
113113
}
114114

115115
args, err := common.BuildProxyArgs(infra, shutdownConfig, bootstrapConfigOptions, fmt.Sprintf("$(%s)", envoyPodEnvVar), gatewayNamespaceMode)

internal/xds/bootstrap/bootstrap.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ type bootstrapParameters struct {
9797
IPFamily string
9898
// GatewayNamespaceMode defines whether to use the Envoy Gateway namespace mode.
9999
GatewayNamespaceMode bool
100-
// ProxyInfraName is the name of the ProxyInfra and used as the internal local_cluster name.
101-
ProxyInfraName string
100+
// LocalClusterName is the generated name of the Envoy ProxyInfra.
101+
LocalClusterName string
102102
}
103103

104104
type serverParameters struct {
@@ -139,7 +139,7 @@ type RenderBootstrapConfigOptions struct {
139139
IPFamily *egv1a1.IPFamily
140140
ProxyMetrics *egv1a1.ProxyMetrics
141141
SdsConfig SdsConfigPath
142-
ProxyInfraName *string
142+
LocalClusterName *string
143143
XdsServerHost *string
144144
XdsServerPort *int32
145145
AdminServerPort *int32
@@ -259,7 +259,7 @@ func GetRenderedBootstrapConfig(opts *RenderBootstrapConfigOptions) (string, err
259259
EnablePrometheusCompression: enablePrometheusCompression,
260260
PrometheusCompressionLibrary: prometheusCompressionLibrary,
261261
OtelMetricSinks: metricSinks,
262-
ProxyInfraName: defaultLocalClusterName,
262+
LocalClusterName: defaultLocalClusterName,
263263
},
264264
}
265265

@@ -304,8 +304,8 @@ func GetRenderedBootstrapConfig(opts *RenderBootstrapConfigOptions) (string, err
304304
}
305305
cfg.parameters.GatewayNamespaceMode = opts.GatewayNamespaceMode
306306
cfg.parameters.OverloadManager.MaxHeapSizeBytes = opts.MaxHeapSizeBytes
307-
if opts.ProxyInfraName != nil {
308-
cfg.parameters.ProxyInfraName = *opts.ProxyInfraName
307+
if opts.LocalClusterName != nil {
308+
cfg.parameters.LocalClusterName = *opts.LocalClusterName
309309
}
310310
}
311311

internal/xds/bootstrap/bootstrap.yaml.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ admin:
99
address: {{ .AdminServer.Address }}
1010
port_value: {{ .AdminServer.Port }}
1111
cluster_manager:
12-
local_cluster_name: {{ .ProxyInfraName }}
12+
local_cluster_name: {{ .LocalClusterName }}
1313
node:
1414
locality:
1515
zone: $(ENVOY_SERVICE_ZONE)
@@ -174,7 +174,7 @@ static_resources:
174174
- connect_timeout: 10s
175175
lb_policy: ROUND_ROBIN
176176
load_assignment:
177-
cluster_name: {{ .ProxyInfraName }}
177+
cluster_name: {{ .LocalClusterName }}
178178
endpoints:
179179
- lb_endpoints:
180180
- endpoint:
@@ -187,7 +187,7 @@ static_resources:
187187
load_balancing_weight: 1
188188
locality:
189189
zone: $(ENVOY_SERVICE_ZONE)
190-
name: {{ .ProxyInfraName }}
190+
name: {{ .LocalClusterName }}
191191
type: STATIC
192192
- connect_timeout: 10s
193193
load_assignment:

0 commit comments

Comments
 (0)