Skip to content
Open
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
10 changes: 9 additions & 1 deletion pkg/cloudprovider/vsphereparavirtual/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const (
SupervisorServiceAccountNameEnv string = "SUPERVISOR_CLUSTER_SERVICEACCOUNT_SECRET_NAME"
// SupervisorAPIServerFQDN reads supervisor service API server's fully qualified domain name from env
SupervisorAPIServerFQDN string = "supervisor.default.svc"
// InternalSupervisorHostnameOverrideEnv allows overriding the default supervisor hostname
InternalSupervisorHostnameOverrideEnv string = "INTERNAL_SUPERVISOR_HOSTNAME_OVERRIDE"
)

// SupervisorEndpoint is the supervisor cluster endpoint
Expand Down Expand Up @@ -131,8 +133,14 @@ func GetRestConfig(svConfigPath string) (*rest.Config, error) {
return nil, err
}

supervisorHostname := SupervisorAPIServerFQDN
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a back door, I prefer to add hostName and port in CPI Config file. When they are empty, use SupervisorAPIServerFQDN as default.

if override := os.Getenv(InternalSupervisorHostnameOverrideEnv); override != "" {
klog.V(4).Infof("Using supervisor hostname override: %s", override)
supervisorHostname = override
}

return &rest.Config{
Host: "https://" + net.JoinHostPort(SupervisorAPIServerFQDN, svEndpoint.Port),
Host: "https://" + net.JoinHostPort(supervisorHostname, svEndpoint.Port),
TLSClientConfig: rest.TLSClientConfig{
CAData: rootCA,
},
Expand Down