mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-01 09:38:12 -03:30
project: fix var-spacing ansible rule (#10266)
* project: fix var-spacing ansible rule Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix spacing on the beginning/end of jinja template Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix spacing of default filter Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix spacing between filter arguments Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix double space at beginning/end of jinja Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix remaining jinja[spacing] ansible-lint warning Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
This commit is contained in:
committed by
GitHub
parent
f8b93fa88a
commit
5d00b851ce
@@ -49,7 +49,7 @@
|
||||
tasks:
|
||||
- name: replace_test_id
|
||||
set_fact:
|
||||
test_name: "{{ test_id |regex_replace('\\.', '-') }}"
|
||||
test_name: "{{ test_id | regex_replace('\\.', '-') }}"
|
||||
|
||||
- name: show vars
|
||||
debug:
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
- name: set instance names
|
||||
set_fact:
|
||||
# noqa: jinja[spacing]
|
||||
instance_names: >-
|
||||
{%- if mode in ['separate', 'ha'] -%}
|
||||
["k8s-{{ test_name }}-1", "k8s-{{ test_name }}-2", "k8s-{{ test_name }}-3"]
|
||||
@@ -67,7 +68,7 @@
|
||||
- name: Manage DO instances | {{ state }}
|
||||
community.digitalocean.digital_ocean:
|
||||
unique_name: yes
|
||||
api_token: "{{ lookup('env','DO_API_TOKEN') }}"
|
||||
api_token: "{{ lookup('env', 'DO_API_TOKEN') }}"
|
||||
command: "droplet"
|
||||
image_id: "{{ cloud_image }}"
|
||||
name: "{{ item }}"
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
|
||||
- name: replace_test_id
|
||||
set_fact:
|
||||
test_name: "{{ test_id |regex_replace('\\.', '-') }}"
|
||||
test_name: "{{ test_id | regex_replace('\\.', '-') }}"
|
||||
|
||||
- name: set instance names
|
||||
set_fact:
|
||||
# noqa: jinja[spacing]
|
||||
instance_names: >-
|
||||
{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale'] -%}
|
||||
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
|
||||
@@ -39,7 +40,7 @@
|
||||
credentials_file: "{{ gce_credentials_file | default(omit) }}"
|
||||
project_id: "{{ gce_project_id }}"
|
||||
zone: "{{ cloud_region }}"
|
||||
metadata: '{"test_id": "{{ test_id }}", "network": "{{ kube_network_plugin }}", "startup-script": "{{ startup_script|default("") }}"}'
|
||||
metadata: '{"test_id": "{{ test_id }}", "network": "{{ kube_network_plugin }}", "startup-script": "{{ startup_script | default("") }}"}'
|
||||
tags: "build-{{ test_name }},{{ kube_network_plugin }}"
|
||||
ip_forward: yes
|
||||
service_account_permissions: ['compute-rw']
|
||||
@@ -59,7 +60,7 @@
|
||||
|
||||
- name: Make group_vars directory
|
||||
file:
|
||||
path: "{{ inventory_path|dirname }}/group_vars"
|
||||
path: "{{ inventory_path | dirname }}/group_vars"
|
||||
state: directory
|
||||
mode: 0755
|
||||
when: mode in ['scale', 'separate-scale', 'ha-scale']
|
||||
@@ -67,13 +68,13 @@
|
||||
- name: Template fake hosts group vars # noqa no-relative-paths - CI templates are not in role_path
|
||||
template:
|
||||
src: ../templates/fake_hosts.yml.j2
|
||||
dest: "{{ inventory_path|dirname }}/group_vars/fake_hosts.yml"
|
||||
dest: "{{ inventory_path | dirname }}/group_vars/fake_hosts.yml"
|
||||
mode: 0644
|
||||
when: mode in ['scale', 'separate-scale', 'ha-scale']
|
||||
|
||||
- name: Delete group_vars directory
|
||||
file:
|
||||
path: "{{ inventory_path|dirname }}/group_vars"
|
||||
path: "{{ inventory_path | dirname }}/group_vars"
|
||||
state: absent
|
||||
recurse: yes
|
||||
when: delete_group_vars
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
tasks:
|
||||
- name: replace_test_id
|
||||
set_fact:
|
||||
test_name: "{{ test_id |regex_replace('\\.', '-') }}"
|
||||
test_name: "{{ test_id | regex_replace('\\.', '-') }}"
|
||||
|
||||
- name: set instance names
|
||||
set_fact:
|
||||
# noqa: jinja[spacing]
|
||||
instance_names: >-
|
||||
{%- if mode in ['separate', 'ha'] -%}
|
||||
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
vms_files: "{{ vms_files + [lookup('ansible.builtin.template', 'vm.yml.j2') | from_yaml] }}"
|
||||
vars:
|
||||
vms_files: []
|
||||
loop: "{{ range(1, vm_count|int + 1, 1) | list }}"
|
||||
loop: "{{ range(1, vm_count | int + 1, 1) | list }}"
|
||||
loop_control:
|
||||
index_var: vm_id
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
executable: /bin/bash
|
||||
changed_when: false
|
||||
register: vm_ips
|
||||
loop: "{{ range(1, vm_count|int + 1, 1) | list }}"
|
||||
loop: "{{ range(1, vm_count | int + 1, 1) | list }}"
|
||||
loop_control:
|
||||
index_var: vm_id
|
||||
retries: 20
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
- name: Set VM count needed for CI test_id
|
||||
set_fact:
|
||||
vm_count: "{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale', 'ha-recover', 'ha-recover-noquorum'] -%}{{ 3|int }}{%- elif mode == 'aio' -%}{{ 1|int }}{%- else -%}{{ 2|int }}{%- endif -%}"
|
||||
vm_count: "{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale', 'ha-recover', 'ha-recover-noquorum'] -%}{{ 3 | int }}{%- elif mode == 'aio' -%}{{ 1 | int }}{%- else -%}{{ 2 | int }}{%- endif -%}"
|
||||
|
||||
- import_tasks: cleanup-old-vms.yml
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
headers: '{"Content-Encoding": "x-gzip"}'
|
||||
gs_access_key: "{{ gs_key }}"
|
||||
gs_secret_key: "{{ gs_skey }}"
|
||||
expiration: "{{ expire_days * 36000|int }}"
|
||||
expiration: "{{ expire_days * 36000 | int }}"
|
||||
failed_when: false
|
||||
no_log: True
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ netcheck_server_image_repo: "{{ quay_image_repo }}/kubespray/k8s-netchecker-serv
|
||||
|
||||
nginx_image_repo: "{{ quay_image_repo }}/kubespray/nginx"
|
||||
|
||||
flannel_image_repo: "{{ quay_image_repo}}/kubespray/flannel"
|
||||
flannel_init_image_repo: "{{ quay_image_repo}}/kubespray/flannel-cni-plugin"
|
||||
flannel_image_repo: "{{ quay_image_repo }}/kubespray/flannel"
|
||||
flannel_init_image_repo: "{{ quay_image_repo }}/kubespray/flannel-cni-plugin"
|
||||
|
||||
# Kubespray settings for tests
|
||||
deploy_netchecker: true
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
ansible_default_ipv4:
|
||||
address: 255.255.255.255
|
||||
ansible_hostname: "{{ '{{' }}inventory_hostname}}"
|
||||
ansible_hostname: "{{ '{{' }}inventory_hostname }}"
|
||||
|
||||
@@ -168,8 +168,8 @@
|
||||
- name: Set networking facts
|
||||
set_fact:
|
||||
kube_pods_subnet: 10.233.64.0/18
|
||||
pod_names: "{{ (pods.stdout | from_json)['items'] | map(attribute = 'metadata.name') | list }}"
|
||||
pod_ips: "{{ (pods.stdout | from_json)['items'] | selectattr('status.podIP', 'defined') | map(attribute = 'status.podIP') | list }}"
|
||||
pod_names: "{{ (pods.stdout | from_json)['items'] | map(attribute='metadata.name') | list }}"
|
||||
pod_ips: "{{ (pods.stdout | from_json)['items'] | selectattr('status.podIP', 'defined') | map(attribute='status.podIP') | list }}"
|
||||
pods_hostnet: |
|
||||
{% set list = hostnet_pods.stdout.split(" ") %}
|
||||
{{ list }}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
executable: /bin/bash
|
||||
when:
|
||||
- (calico_ipip_mode is defined and calico_ipip_mode != 'Never' or cloud_provider is defined)
|
||||
- kube_network_plugin|default('calico') == 'calico'
|
||||
- kube_network_plugin | default('calico') == 'calico'
|
||||
|
||||
- hosts: k8s_cluster
|
||||
vars:
|
||||
@@ -44,7 +44,7 @@
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: nca_pod
|
||||
until: nca_pod.stdout_lines|length >= groups['k8s_cluster']|intersect(ansible_play_hosts)|length * 2
|
||||
until: nca_pod.stdout_lines | length >= groups['k8s_cluster'] | intersect(ansible_play_hosts) | length * 2
|
||||
retries: 3
|
||||
delay: 10
|
||||
failed_when: false
|
||||
@@ -73,9 +73,9 @@
|
||||
register: agents
|
||||
retries: 18
|
||||
delay: "{{ agent_report_interval }}"
|
||||
until: agents.content|length > 0 and
|
||||
until: agents.content | length > 0 and
|
||||
agents.content[0] == '{' and
|
||||
agents.content|from_json|length >= groups['k8s_cluster']|intersect(ansible_play_hosts)|length * 2
|
||||
agents.content | from_json | length >= groups['k8s_cluster'] | intersect(ansible_play_hosts) | length * 2
|
||||
failed_when: false
|
||||
no_log: false
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
register: connectivity_check
|
||||
retries: 3
|
||||
delay: "{{ agent_report_interval }}"
|
||||
until: connectivity_check.content|length > 0 and
|
||||
until: connectivity_check.content | length > 0 and
|
||||
connectivity_check.content[0] == '{'
|
||||
no_log: false
|
||||
failed_when: false
|
||||
@@ -200,7 +200,7 @@
|
||||
executable: /bin/bash
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- kube_network_plugin_multus|default(false)|bool
|
||||
- kube_network_plugin_multus | default(false) | bool
|
||||
|
||||
- name: Annotate pod with macvlan network
|
||||
# We cannot use only shell: below because Ansible will render the text
|
||||
@@ -226,7 +226,7 @@
|
||||
executable: /bin/bash
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- kube_network_plugin_multus|default(false)|bool
|
||||
- kube_network_plugin_multus | default(false) | bool
|
||||
|
||||
- name: Check secondary macvlan interface
|
||||
command: "{{ bin_dir }}/kubectl exec samplepod -- ip addr show dev net1"
|
||||
@@ -236,4 +236,4 @@
|
||||
changed_when: false
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
- kube_network_plugin_multus|default(false)|bool
|
||||
- kube_network_plugin_multus | default(false) | bool
|
||||
|
||||
Reference in New Issue
Block a user