From 76fe84fe9364ba04a0d94a96c3a34a8fbdfd9c0c Mon Sep 17 00:00:00 2001 From: Rong Zhang Date: Tue, 16 Oct 2018 22:26:04 +0800 Subject: [PATCH] Use imageRepository instead of the unifiedControlPlaneImage (#3484) --- inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml | 3 +++ roles/download/defaults/main.yml | 7 +++++-- .../master/templates/kubeadm-config.v1alpha1.yaml.j2 | 3 ++- .../master/templates/kubeadm-config.v1alpha2.yaml.j2 | 3 ++- .../master/templates/kubeadm-config.v1alpha3.yaml.j2 | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml b/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml index 79e432511..bb9480c84 100644 --- a/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml +++ b/inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml @@ -21,6 +21,9 @@ kube_api_anonymous_auth: true ## Change this to use another Kubernetes version, e.g. a current beta release kube_version: v1.12.1 +# kubernetes image repo define +kube_image_repo: "gcr.io/google-containers" + # Where the binaries will be downloaded. # Note: ensure that you've enough disk space (about 1G) local_release_dir: "/tmp/releases" diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index 918f3eab6..4edf4d229 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -39,6 +39,9 @@ kube_version: v1.12.1 kubeadm_version: "{{ kube_version }}" etcd_version: v3.2.24 +# kubernetes image repo define +kube_image_repo: "gcr.io/google-containers" + # TODO(mattymo): Move calico versions to roles/network_plugins/calico/defaults # after migration to container download calico_version: "v3.1.3" @@ -126,7 +129,7 @@ calico_policy_image_repo: "quay.io/calico/kube-controllers" calico_policy_image_tag: "{{ calico_policy_version }}" calico_rr_image_repo: "quay.io/calico/routereflector" calico_rr_image_tag: "{{ calico_rr_version }}" -hyperkube_image_repo: "gcr.io/google-containers/hyperkube-{{ image_arch }}" +hyperkube_image_repo: "{{ kube_image_repo }}/hyperkube-{{ image_arch }}" hyperkube_image_tag: "{{ kube_version }}" pod_infra_image_repo: "gcr.io/google_containers/pause-{{ image_arch }}" pod_infra_image_tag: "{{ pod_infra_version }}" @@ -257,7 +260,7 @@ downloads: - k8s-cluster hyperkube: - enabled: true + enabled: "{{ kubeadm_enabled == false }}" container: true repo: "{{ hyperkube_image_repo }}" tag: "{{ hyperkube_image_tag }}" diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 index 425b29f27..2a9b8582d 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha1.yaml.j2 @@ -154,7 +154,8 @@ apiServerCertSANs: - {{ san }} {% endfor %} certificatesDir: {{ kube_config_dir }}/ssl -unifiedControlPlaneImage: "{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}" +imageRepository: {{ kube_image_repo }} +unifiedControlPlaneImage: "" {% if kube_override_hostname|default('') %} nodeName: {{ kube_override_hostname }} {% endif %} diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 index 46f77dc1d..61e62a43e 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha2.yaml.j2 @@ -164,7 +164,8 @@ apiServerCertSANs: - {{ san }} {% endfor %} certificatesDir: {{ kube_config_dir }}/ssl -unifiedControlPlaneImage: "{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}" +imageRepository: {{ kube_image_repo }} +unifiedControlPlaneImage: "" nodeRegistration: {% if kube_override_hostname|default('') %} name: {{ kube_override_hostname }} diff --git a/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 index b2f5aee9a..92990a137 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.v1alpha3.yaml.j2 @@ -142,7 +142,8 @@ apiServerCertSANs: - {{ san }} {% endfor %} certificatesDir: {{ kube_config_dir }}/ssl -unifiedControlPlaneImage: "{{ hyperkube_image_repo }}:{{ hyperkube_image_tag }}" +imageRepository: {{ kube_image_repo }} +unifiedControlPlaneImage: "" --- apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration