Make api-server-url configurable (#1880)

This commit is contained in:
YundongYe 2018-12-20 09:45:01 +08:00 коммит произвёл GitHub
Родитель 3bd4a1f6ef
Коммит cb8edfaf5d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -79,8 +79,9 @@ class Kubernetes:
com_kubernetes["cluster-dns"] = k8s_cfg["cluster-dns"]
com_kubernetes["api-servers-ip"] = k8s_cfg["load-balance-ip"]
com_kubernetes["api-servers-port"] = "8080"
com_kubernetes["api-servers-url"] = "http://{0}:8080".format(k8s_cfg["load-balance-ip"])
com_kubernetes["api-servers-port"] = k8s_cfg["api-servers-port"] if ("api-servers-port" in k8s_cfg) else "8080"
com_kubernetes["api-servers-http-schema"] = k8s_cfg["api-servers-http-schema"] if ("api-servers-http-schema" in k8s_cfg) else "http"
com_kubernetes["api-servers-url"] = "{0}://{1}:{2}".format(com_kubernetes["api-servers-http-schema"], k8s_cfg["load-balance-ip"], com_kubernetes["api-servers-port"])
com_kubernetes["docker-registry"] = k8s_cfg["docker-registry"]
com_kubernetes["hyperkube-version"] = k8s_cfg["hyperkube-version"]
com_kubernetes["etcd-version"] = k8s_cfg["etcd-version"]

Просмотреть файл

@ -61,7 +61,7 @@ class kubectl_conf_check:
local_kubectl_conf = common.load_yaml_file("{0}/config".format(self.kube_conf_path))
api_server_address = local_kubectl_conf['clusters'][0]['cluster']['server']
api_server_address_pai_conf = "http://{0}:8080".format(self.cluster_object_model['kubernetes']['api-servers-ip'])
api_server_address_pai_conf = self.cluster_object_model['kubernetes']['api-servers-url']
if api_server_address != api_server_address_pai_conf:
self.logger.warning("CHECKING FAILED: The api_server_address in local configuration is different from the one in pai's configuration.".format(self.kube_conf_path))

Просмотреть файл

@ -28,7 +28,7 @@ spec:
command:
- /usr/local/bin/kube-controller-manager
- --master
- {{ cluster_cfg['kubernetes']['api-servers-ip'] }}:8080
- {{ cluster_cfg['kubernetes']['api-servers-ip'] }}:{{ cluster_cfg['kubernetes']['api-servers-port'] }}
- --service-cluster-ip-range
- {{ cluster_cfg['kubernetes']['service-cluster-ip-range'] }}
- --leader-elect=true

Просмотреть файл

@ -42,7 +42,7 @@ spec:
- name: kubernetes-dashboard
image: {{ cluster_cfg['kubernetes']['docker-registry'] }}/kubernetes-dashboard-amd64:{{ cluster_cfg['kubernetes']['dashboard-version'] }}
args:
- --apiserver-host=http://{{ cluster_cfg['kubernetes']['api-servers-ip'] }}:8080
- --apiserver-host={{ cluster_cfg['kubernetes']['api-servers-url'] }}
resources:
# the ideal cpu setting will be 3.5, according to our experiment. If the server hosting k8s dashboard has enough resource, user can change this setting to a larger value.
requests:

Просмотреть файл

@ -39,7 +39,7 @@ spec:
- /hyperkube
- proxy
- --master
- {{ cluster_cfg['kubernetes']['api-servers-ip'] }}:8080
- {{ cluster_cfg['kubernetes']['api-servers-ip'] }}:{{ cluster_cfg['kubernetes']['api-servers-port'] }}
- --cluster-cidr
- {{ cluster_cfg['kubernetes']['service-cluster-ip-range'] }}
securityContext:

Просмотреть файл

@ -28,7 +28,7 @@ spec:
command:
- /usr/local/bin/kube-scheduler
- --master
- {{ cluster_cfg['kubernetes']['api-servers-ip'] }}:8080
- {{ cluster_cfg['kubernetes']['api-servers-ip'] }}:{{ cluster_cfg['kubernetes']['api-servers-port'] }}
- --leader-elect=true
livenessProbe:
httpGet:

Просмотреть файл

@ -21,6 +21,8 @@ kubernetes:
# To support k8s ha, you should set an lb address here.
# If deploy k8s with single master node, please set master IP address here
load-balance-ip: IP
#api-servers-port: 8080
#api-servers-http-schema: http
# specify an IP range not in the same network segment with the host machine.
service-cluster-ip-range: 169.254.0.0/16