Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proxy usage when *_PROXY are present in environment #7309

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- hosts: bastion[0]
gather_facts: False
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
Expand All @@ -12,6 +13,7 @@
strategy: linear
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
gather_facts: false
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: bootstrap-os, tags: bootstrap-os}
Expand All @@ -23,6 +25,7 @@
- hosts: k8s-cluster:etcd
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/preinstall, tags: preinstall }
Expand All @@ -32,6 +35,7 @@
- hosts: etcd
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- role: etcd
Expand All @@ -44,6 +48,7 @@
- hosts: k8s-cluster
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- role: etcd
Expand All @@ -56,13 +61,15 @@
- hosts: k8s-cluster
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/node, tags: node }

- hosts: kube-master
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/control-plane, tags: master }
Expand All @@ -72,6 +79,7 @@
- hosts: k8s-cluster
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/kubeadm, tags: kubeadm}
Expand All @@ -81,13 +89,15 @@
- hosts: calico-rr
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: network_plugin/calico/rr, tags: ['network', 'calico_rr'] }

- hosts: kube-master[0]
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
Expand All @@ -96,6 +106,7 @@
- hosts: kube-master
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller }
Expand All @@ -107,13 +118,15 @@
- hosts: kube-master
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes-apps, tags: apps }

- hosts: k8s-cluster
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }
4 changes: 4 additions & 0 deletions recover-control-plane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@

- hosts: bastion[0]
gather_facts: False
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults}
- { role: bastion-ssh-config, tags: ["localhost", "bastion"]}

- hosts: "{{ groups['etcd'] | first }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults}
- { role: recover_control_plane/etcd }

- hosts: "{{ groups['kube-master'] | first }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: recover_control_plane/control-plane }

- include: cluster.yml

- hosts: "{{ groups['kube-master'] }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults}
- { role: recover_control_plane/post-recover }
4 changes: 4 additions & 0 deletions remove-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- hosts: "{{ node | default('etcd:k8s-cluster:calico-rr') }}"
gather_facts: no
environment: "{{ proxy_disable_env }}"
vars_prompt:
name: "delete_nodes_confirmation"
prompt: "Are you sure you want to delete nodes state? Type 'yes' to delete nodes."
Expand All @@ -18,13 +19,15 @@

- hosts: kube-master[0]
gather_facts: no
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: bootstrap-os, tags: bootstrap-os }
- { role: remove-node/pre-remove, tags: pre-remove }

- hosts: "{{ node | default('kube-node') }}"
gather_facts: no
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
- { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
Expand All @@ -34,6 +37,7 @@
# Currently cannot remove first master or etcd
- hosts: "{{ node | default('kube-master[1:]:etcd[1:]') }}"
gather_facts: no
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults, when: reset_nodes|default(True)|bool }
- { role: bootstrap-os, tags: bootstrap-os, when: reset_nodes|default(True)|bool }
Expand Down
2 changes: 2 additions & 0 deletions reset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- hosts: bastion[0]
gather_facts: False
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults}
- { role: bastion-ssh-config, tags: ["localhost", "bastion"]}
Expand All @@ -25,6 +26,7 @@
msg: "Reset confirmation failed"
when: reset_confirmation != "yes"

environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults}
- { role: reset, tags: reset }
1 change: 0 additions & 1 deletion roles/download/tasks/prep_kubeadm_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
shell: "set -o pipefail && {{ bin_dir }}/kubeadm config images list --config={{ kube_config_dir }}/kubeadm-images.yaml | grep -Ev 'coredns|pause'"
args:
executable: /bin/bash
environment: "{{ proxy_disable_env }}"
register: kubeadm_images_raw
run_once: true
changed_when: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
{{ bin_dir }}/kubeadm init phase kubeconfig all
--config {{ kube_config_dir }}/kubeadm-config.yaml
--kubeconfig-dir {{ kubeconfig_temp_dir.path }}
environment: "{{ proxy_disable_env }}"
when: kubeconfig_correct_apiserver.rc != 0

- name: Copy new kubeconfigs to kube config dir
Expand Down
4 changes: 2 additions & 2 deletions roles/kubernetes/control-plane/tasks/kubeadm-secondary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
--config {{ kube_config_dir }}/kubeadm-config.yaml
upload-certs
--upload-certs
environment: "{{ proxy_disable_env }}"
register: kubeadm_upload_cert
when:
- inventory_hostname == groups['kube-master']|first
Expand Down Expand Up @@ -58,7 +57,8 @@
{{ bin_dir }}/kubeadm join
--config {{ kube_config_dir }}/kubeadm-controlplane.yaml
--ignore-preflight-errors=all
environment: '{{ proxy_disable_env | combine({"PATH": "{{ bin_dir }}:{{ ansible_env.PATH }}"}) }}'
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
register: kubeadm_join_control_plane
retries: 3
throttle: 1
Expand Down
5 changes: 2 additions & 3 deletions roles/kubernetes/control-plane/tasks/kubeadm-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@
until: kubeadm_init is succeeded or "field is immutable" in kubeadm_init.stderr
when: inventory_hostname == groups['kube-master']|first and not kubeadm_already_run.stat.exists
failed_when: kubeadm_init.rc != 0 and "field is immutable" not in kubeadm_init.stderr
environment: '{{ proxy_disable_env | combine({"PATH": "{{ bin_dir }}:{{ ansible_env.PATH }}"}) }}'
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
notify: Master | restart kubelet

- name: set kubeadm certificate key
Expand All @@ -180,7 +181,6 @@
shell: >-
{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token delete {{ kubeadm_token }} || :;
{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token create {{ kubeadm_token }}
environment: "{{ proxy_disable_env }}"
changed_when: false
when:
- inventory_hostname == groups['kube-master']|first
Expand All @@ -191,7 +191,6 @@

- name: Create kubeadm token for joining nodes with 24h expiration (default)
command: "{{ bin_dir }}/kubeadm --kubeconfig /etc/kubernetes/admin.conf token create"
environment: "{{ proxy_disable_env }}"
changed_when: false
register: temp_token
retries: 5
Expand Down
1 change: 0 additions & 1 deletion roles/kubernetes/control-plane/tasks/kubeadm-version.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- name: Get the kubeadm version
command: "{{ bin_dir }}/kubeadm version -o short"
environment: "{{ proxy_disable_env }}"
register: kubeadm_output
changed_when: false

Expand Down
1 change: 0 additions & 1 deletion roles/kubernetes/kubeadm/tasks/kubeadm_etcd_node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
{{ kubeadm_discovery_address }}
args:
creates: "{{ kube_cert_dir }}/apiserver-etcd-client.key"
environment: "{{ proxy_disable_env }}"

- name: Delete unneeded certificates
file:
Expand Down
5 changes: 2 additions & 3 deletions roles/kubernetes/kubeadm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

- name: Create kubeadm token for joining nodes with 24h expiration (default)
command: "{{ bin_dir }}/kubeadm token create"
environment: "{{ proxy_disable_env }}"
register: temp_token
delegate_to: "{{ groups['kube-master'][0] }}"
when: kubeadm_token is not defined
Expand All @@ -55,7 +54,6 @@

- name: Get the kubeadm version
command: "{{ bin_dir }}/kubeadm version -o short"
environment: "{{ proxy_disable_env }}"
register: kubeadm_output
changed_when: false

Expand All @@ -71,7 +69,8 @@
when: not is_kube_master

- name: Join to cluster if needed
environment: '{{ proxy_disable_env | combine({"PATH": "{{ bin_dir }}:{{ ansible_env.PATH }}:/sbin"}) }}'
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}:/sbin"
when: not is_kube_master and (not kubelet_conf.stat.exists)
block:

Expand Down
1 change: 0 additions & 1 deletion roles/kubernetes/node/tasks/kubelet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

- name: Get the kubeadm version
command: "{{ bin_dir }}/kubeadm version -o short"
environment: "{{ proxy_disable_env }}"
register: kubeadm_output
changed_when: false

Expand Down
8 changes: 8 additions & 0 deletions scale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- hosts: bastion[0]
gather_facts: False
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
Expand All @@ -13,6 +14,7 @@
strategy: linear
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
gather_facts: false
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: bootstrap-os, tags: bootstrap-os }
Expand All @@ -25,6 +27,7 @@
hosts: etcd
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: etcd, tags: etcd, etcd_cluster_setup: false }
Expand All @@ -33,6 +36,7 @@
hosts: kube-master[0]
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults, when: "not skip_downloads and download_run_once and not download_localhost" }
- { role: kubernetes/preinstall, tags: preinstall, when: "not skip_downloads and download_run_once and not download_localhost" }
Expand All @@ -42,6 +46,7 @@
hosts: kube-node
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/preinstall, tags: preinstall }
Expand All @@ -53,12 +58,14 @@
hosts: kube-node
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/node, tags: node }

- name: Upload control plane certs and retrieve encryption key
hosts: kube-master | first
environment: "{{ proxy_disable_env }}"
tags: kubeadm
tasks:
- name: include needed vars
Expand All @@ -81,6 +88,7 @@
hosts: kube-node
gather_facts: False
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- { role: kubernetes/kubeadm, tags: kubeadm }
Expand Down
Loading