mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #49430 from dims/set-external-hostname-in-local-up-cluster
Automatic merge from submit-queue (batch tested with PRs 48976, 49474, 40050, 49426, 49430) Set external hostname in local-up-cluster **What this PR does / why we need it**: If we set --external-hostname, then the api server does not look in the CloudProviderOptions.DefaultExternalHost method. While we are at it, let's log an info message, so if there is a failure the operator gets a hint that they can use --external-hostname to bypass the lookup in the cloud provider. This will enable us to set the CLOUD_PROVIDER to openstack for example and not have to really run api server inside a openstack vm. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
427dfd5ce1
@ -200,6 +200,7 @@ API_SECURE_PORT=${API_SECURE_PORT:-6443}
|
||||
API_HOST=${API_HOST:-localhost}
|
||||
API_HOST_IP=${API_HOST_IP:-"127.0.0.1"}
|
||||
API_BIND_ADDR=${API_BIND_ADDR:-"0.0.0.0"}
|
||||
EXTERNAL_HOSTNAME=${EXTERNAL_HOSTNAME:-localhost}
|
||||
|
||||
KUBELET_HOST=${KUBELET_HOST:-"127.0.0.1"}
|
||||
# By default only allow CORS for requests on localhost
|
||||
@ -512,6 +513,7 @@ function start_apiserver {
|
||||
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||
--service-cluster-ip-range="${SERVICE_CLUSTER_IP_RANGE}" \
|
||||
--feature-gates="${FEATURE_GATES}" \
|
||||
--external-hostname="${EXTERNAL_HOSTNAME}" \
|
||||
--cloud-provider="${CLOUD_PROVIDER}" \
|
||||
--cloud-config="${CLOUD_CONFIG}" \
|
||||
--requestheader-username-headers=X-Remote-User \
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/spf13/pflag"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
@ -55,6 +56,8 @@ func (s *CloudProviderOptions) DefaultExternalHost(genericoptions *genericoption
|
||||
}
|
||||
|
||||
if cloudprovider.IsCloudProvider(s.CloudProvider) {
|
||||
glog.Info("--external-hostname was not specified. Trying to get it from the cloud provider.")
|
||||
|
||||
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%q cloud provider could not be initialized: %v", s.CloudProvider, err)
|
||||
|
Loading…
Reference in New Issue
Block a user