Skip to content

Commit

Permalink
fix flake8 errors in Kubespray CI - tox-inventory-builder (#6910)
Browse files Browse the repository at this point in the history
* fix flake8 errors in Kubespray CI - tox-inventory-builder

* Invalidate CRI-O kubic repo's cache

Signed-off-by: Victor Morales <[email protected]>

* add support to configure pkg install retries

and use in CI job tf-ovh_ubuntu18-calico (due to it failing often)

* Switch Calico, Cilium and MetalLB image repos to Quay.io

Co-authored-by: Victor Morales <[email protected]>
Co-authored-by: Barry Melbourne <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2020
1 parent 0f7341b commit ee23b94
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
22 changes: 11 additions & 11 deletions contrib/inventory_builder/tests/test_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_ensure_required_groups(self):
groups = ['group1', 'group2']
self.inv.ensure_required_groups(groups)
for group in groups:
self.assertTrue(group in self.inv.yaml_config['all']['children'])
self.assertIn(group, self.inv.yaml_config['all']['children'])

def test_get_host_id(self):
hostnames = ['node99', 'no99de01', '01node01', 'node1.domain',
Expand Down Expand Up @@ -209,8 +209,8 @@ def test_purge_invalid_hosts(self):
('doesnotbelong2', {'whateveropts=ilike'})])
self.inv.yaml_config['all']['hosts'] = existing_hosts
self.inv.purge_invalid_hosts(proper_hostnames)
self.assertTrue(
bad_host not in self.inv.yaml_config['all']['hosts'].keys())
self.assertNotIn(
bad_host, self.inv.yaml_config['all']['hosts'].keys())

def test_add_host_to_group(self):
group = 'etcd'
Expand All @@ -227,8 +227,8 @@ def test_set_kube_master(self):
host = 'node1'

self.inv.set_kube_master([host])
self.assertTrue(
host in self.inv.yaml_config['all']['children'][group]['hosts'])
self.assertIn(
host, self.inv.yaml_config['all']['children'][group]['hosts'])

def test_set_all(self):
hosts = OrderedDict([
Expand All @@ -246,25 +246,25 @@ def test_set_k8s_cluster(self):

self.inv.set_k8s_cluster()
for host in expected_hosts:
self.assertTrue(
host in
self.assertIn(
host,
self.inv.yaml_config['all']['children'][group]['children'])

def test_set_kube_node(self):
group = 'kube-node'
host = 'node1'

self.inv.set_kube_node([host])
self.assertTrue(
host in self.inv.yaml_config['all']['children'][group]['hosts'])
self.assertIn(
host, self.inv.yaml_config['all']['children'][group]['hosts'])

def test_set_etcd(self):
group = 'etcd'
host = 'node1'

self.inv.set_etcd([host])
self.assertTrue(
host in self.inv.yaml_config['all']['children'][group]['hosts'])
self.assertIn(
host, self.inv.yaml_config['all']['children'][group]['hosts'])

def test_scale_scenario_one(self):
num_nodes = 50
Expand Down
1 change: 1 addition & 0 deletions roles/container-engine/cri-o/tasks/crio_repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
baseurl: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_$releasever/
gpgcheck: yes
gpgkey: http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_$releasever/repodata/repomd.xml.key
keepcache: false
when: ansible_distribution in ["CentOS"]

- name: Add CRI-O kubic yum repo
Expand Down
18 changes: 9 additions & 9 deletions roles/download/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,13 @@ etcd_image_repo: "{{ quay_image_repo }}/coreos/etcd"
etcd_image_tag: "{{ etcd_version }}{%- if image_arch != 'amd64' -%}-{{ image_arch }}{%- endif -%}"
flannel_image_repo: "{{ quay_image_repo }}/coreos/flannel"
flannel_image_tag: "{{ flannel_version }}"
calico_node_image_repo: "{{ docker_image_repo }}/calico/node"
calico_node_image_repo: "{{ quay_image_repo }}/calico/node"
calico_node_image_tag: "{{ calico_version }}"
calico_cni_image_repo: "{{ docker_image_repo }}/calico/cni"
calico_cni_image_repo: "{{ quay_image_repo }}/calico/cni"
calico_cni_image_tag: "{{ calico_cni_version }}"
calico_policy_image_repo: "{{ docker_image_repo }}/calico/kube-controllers"
calico_policy_image_repo: "{{ quay_image_repo }}/calico/kube-controllers"
calico_policy_image_tag: "{{ calico_policy_version }}"
calico_typha_image_repo: "{{ docker_image_repo }}/calico/typha"
calico_typha_image_repo: "{{ quay_image_repo }}/calico/typha"
calico_typha_image_tag: "{{ calico_typha_version }}"
pod_infra_image_repo: "{{ kube_image_repo }}/pause"
pod_infra_image_tag: "{{ pod_infra_version }}"
Expand All @@ -451,11 +451,11 @@ contiv_etcd_init_image_repo: "{{ docker_image_repo }}/ferest/etcd-initer"
contiv_etcd_init_image_tag: latest
contiv_ovs_image_repo: "{{ docker_image_repo }}/contiv/ovs"
contiv_ovs_image_tag: "latest"
cilium_image_repo: "{{ docker_image_repo }}/cilium/cilium"
cilium_image_repo: "{{ quay_image_repo }}/cilium/cilium"
cilium_image_tag: "{{ cilium_version }}"
cilium_init_image_repo: "{{ docker_image_repo }}/cilium/cilium-init"
cilium_init_image_repo: "{{ quay_image_repo }}/cilium/cilium-init"
cilium_init_image_tag: "2019-04-05"
cilium_operator_image_repo: "{{ docker_image_repo }}/cilium/operator"
cilium_operator_image_repo: "{{ quay_image_repo }}/cilium/operator"
cilium_operator_image_tag: "{{ cilium_version }}"
kube_ovn_container_image_repo: "{{ docker_image_repo }}/kubeovn/kube-ovn"
kube_ovn_container_image_tag: "{{ kube_ovn_version }}"
Expand Down Expand Up @@ -581,8 +581,8 @@ image_pull_command_on_localhost: "{{ docker_bin_dir }}/docker pull"
image_save_command_on_localhost: "{{ docker_bin_dir }}/docker save {{ image_reponame }} | gzip -{{ download_compress }} > {{ image_path_cached }}"
image_info_command_on_localhost: "{{ docker_bin_dir }}/docker images"

metallb_speaker_image_repo: "{{ docker_image_repo }}/metallb/speaker"
metallb_controller_image_repo: "{{ docker_image_repo }}/metallb/controller"
metallb_speaker_image_repo: "{{ quay_image_repo }}/metallb/speaker"
metallb_controller_image_repo: "{{ quay_image_repo }}/metallb/controller"

downloads:
netcheck_server:
Expand Down
3 changes: 3 additions & 0 deletions roles/kubernetes/preinstall/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ minimal_node_memory_mb: 1024
minimal_master_memory_mb: 1500

yum_repo_dir: /etc/yum.repos.d

# number of times package install task should be retried
pkg_install_retries: 4
2 changes: 1 addition & 1 deletion roles/kubernetes/preinstall/tasks/0070-system-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
state: latest
register: pkgs_task_result
until: pkgs_task_result is succeeded
retries: 4
retries: "{{ pkg_install_retries }}"
delay: "{{ retry_stagger | random + 3 }}"
when: not (ansible_os_family in ["Flatcar Container Linux by Kinvolk", "ClearLinux"] or is_fedora_coreos)
tags:
Expand Down
2 changes: 2 additions & 0 deletions tests/files/tf-ovh_ubuntu18-calico.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
dns_min_replicas: 1
deploy_netchecker: true
sonobuoy_enabled: true
pkg_install_retries: 10
retry_stagger: 10

# Ignore ping errors
ignore_assert_errors: true

0 comments on commit ee23b94

Please sign in to comment.