Skip to content

Commit 03c100c

Browse files
silvery1622k8s-infra-cherrypick-robot
authored andcommitted
Update Supervisor API calls to use FQDN
Modifies the Supervisor API server REST calls to use the FQDN supervisor.default.svc instead of the Supervisor Endpoint IP address. The current IP-based approach fails when the Supervisor has Nginx SNI Proxy enabled. Using the FQDN ensures compatibility regardless of whether Nginx SNI Proxy is enabled.
1 parent 49185b9 commit 03c100c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/cloudprovider/vsphereparavirtual/config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ func getRestConfig(svConfigPath string) (*rest.Config, error) {
129129
}
130130

131131
return &rest.Config{
132-
Host: "https://" + net.JoinHostPort(svEndpoint.Endpoint, svEndpoint.Port),
132+
Host: "https://" + net.JoinHostPort(SupervisorAPIServerFQDN, svEndpoint.Port),
133133
TLSClientConfig: rest.TLSClientConfig{
134-
CAData: rootCA,
135-
ServerName: SupervisorAPIServerFQDN,
134+
CAData: rootCA,
136135
},
137136
BearerToken: string(token),
138137
}, nil

pkg/cloudprovider/vsphereparavirtual/config_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,21 +186,24 @@ func TestGetNameSpace(t *testing.T) {
186186
func TestGetRestConfig(t *testing.T) {
187187
tests := []struct {
188188
fileExists bool
189+
fqdn string
189190
endpoint string
190191
port string
191192
token string
192193
ca string
193194
}{
194195
{
195196
fileExists: false,
196-
endpoint: "test.sv.proxy",
197+
fqdn: "supervisor.default.svc",
198+
endpoint: "192.163.1.100",
197199
port: "6443",
198200
token: "test-token",
199201
ca: "test-ca",
200202
},
201203
{
202204
fileExists: true,
203-
endpoint: "test.sv.proxy",
205+
fqdn: "supervisor.default.svc",
206+
endpoint: "192.163.1.200",
204207
port: "6443",
205208
token: "test-token",
206209
ca: "test-ca",
@@ -240,7 +243,7 @@ func TestGetRestConfig(t *testing.T) {
240243
if err != nil {
241244
t.Fatalf("Should succeed when a valid SV endpoint config is provided: %s", err)
242245
}
243-
if cfg.Host != "https://"+net.JoinHostPort(test.endpoint, test.port) {
246+
if cfg.Host != "https://"+net.JoinHostPort(test.fqdn, test.port) {
244247
t.Fatalf("incorrect Host: %s", cfg.Host)
245248
}
246249
if cfg.BearerToken != test.token {

0 commit comments

Comments
 (0)