From 8e9597493012602478854092e6992e3d3dbd14c5 Mon Sep 17 00:00:00 2001 From: mlushpenko Date: Sat, 1 Sep 2018 18:02:52 +0200 Subject: [PATCH] Fix ports for kubeadm client and master configs for ha setups --- .../kubeadm/templates/kubeadm-client.conf.v1alpha1.j2 | 2 +- .../kubeadm/templates/kubeadm-client.conf.v1alpha2.j2 | 2 +- .../master/templates/kubeadm-config.v1alpha1.yaml.j2 | 10 +++++----- .../master/templates/kubeadm-config.v1alpha2.yaml.j2 | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2 index 9ac076500..fe9f45b2f 100644 --- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2 +++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha1.j2 @@ -4,7 +4,7 @@ caCertPath: {{ kube_config_dir }}/ssl/ca.crt token: {{ kubeadm_token }} discoveryTokenAPIServers: {% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} -- {{ kubeadm_config_api_fqdn }}:6443 +- {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} {% else %} - {{ kubeadm_discovery_address | replace("https://", "")}} {% endif %} diff --git a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2 b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2 index 35ed7a3e6..d53909940 100644 --- a/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2 +++ b/roles/kubernetes/kubeadm/templates/kubeadm-client.conf.v1alpha2.j2 @@ -8,7 +8,7 @@ tlsBootstrapToken: {{ kubeadm_token }} token: {{ kubeadm_token }} discoveryTokenAPIServers: {% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} -- {{ kubeadm_config_api_fqdn }}:6443 +- {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} {% else %} - {{ kubeadm_discovery_address | replace("https://", "")}} {% endif %} diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 index f812e52c1..1a90fbd4c 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 @@ -2,10 +2,10 @@ apiVersion: kubeadm.k8s.io/v1alpha1 kind: MasterConfiguration api: {% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} - controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ kube_apiserver_port }} + controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} {% else %} - advertiseAddress: {{ ip | default(ansible_default_ipv4.address) }} - bindPort: {{ kube_apiserver_port }} + advertiseAddress: {{ ip | default(ansible_default_ipv4.address) }} + bindPort: {{ kube_apiserver_port }} {% endif %} etcd: endpoints: @@ -51,10 +51,10 @@ apiServerExtraArgs: admission-control: {{ kube_apiserver_admission_control | join(',') }} {% else %} {% if kube_apiserver_enable_admission_plugins|length > 0 %} - enable-admission-plugins: {{ kube_apiserver_enable_admission_plugins | join(',') }} + enable-admission-plugins: {{ kube_apiserver_enable_admission_plugins | join(',') }} {% endif %} {% if kube_apiserver_disable_admission_plugins|length > 0 %} - disable-admission-plugins: {{ kube_apiserver_disable_admission_plugins | join(',') }} + disable-admission-plugins: {{ kube_apiserver_disable_admission_plugins | join(',') }} {% endif %} {% endif %} apiserver-count: "{{ kube_apiserver_count }}" diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 index 76f1338ea..08c377872 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 @@ -2,10 +2,10 @@ apiVersion: kubeadm.k8s.io/v1alpha2 kind: MasterConfiguration api: {% if groups['kube-master'] | length > 1 and kubeadm_config_api_fqdn is defined %} - controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ kube_apiserver_port }} + controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }} {% else %} - advertiseAddress: {{ ip | default(ansible_default_ipv4.address) }} - bindPort: {{ kube_apiserver_port }} + advertiseAddress: {{ ip | default(ansible_default_ipv4.address) }} + bindPort: {{ kube_apiserver_port }} {% endif %} etcd: external: @@ -43,10 +43,10 @@ apiServerExtraArgs: admission-control: {{ kube_apiserver_admission_control | join(',') }} {% else %} {% if kube_apiserver_enable_admission_plugins|length > 0 %} - enable-admission-plugins: {{ kube_apiserver_enable_admission_plugins | join(',') }} + enable-admission-plugins: {{ kube_apiserver_enable_admission_plugins | join(',') }} {% endif %} {% if kube_apiserver_disable_admission_plugins|length > 0 %} - disable-admission-plugins: {{ kube_apiserver_disable_admission_plugins | join(',') }} + disable-admission-plugins: {{ kube_apiserver_disable_admission_plugins | join(',') }} {% endif %} {% endif %} apiserver-count: "{{ kube_apiserver_count }}"