mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-01 01:28:11 -03:30
ansible-lint: add spaces around variables [E206] (#4699)
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
560f50d3cd
commit
e67f848abc
@@ -12,14 +12,14 @@
|
||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
- name: Check kubectl output
|
||||
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
|
||||
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
|
||||
register: get_pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{get_pods.stdout.split('\n')}}"
|
||||
- debug: msg="{{ get_pods.stdout.split('\n') }}"
|
||||
|
||||
- name: Check that all pods are running and ready
|
||||
shell: "{{bin_dir}}/kubectl get pods --all-namespaces --no-headers -o yaml"
|
||||
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces --no-headers -o yaml"
|
||||
register: run_pods_log
|
||||
until:
|
||||
# Check that all pods are running
|
||||
@@ -32,9 +32,9 @@
|
||||
no_log: true
|
||||
|
||||
- name: Check kubectl output
|
||||
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
|
||||
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
|
||||
register: get_pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{get_pods.stdout.split('\n')}}"
|
||||
- debug: msg="{{ get_pods.stdout.split('\n') }}"
|
||||
failed_when: not run_pods_log is success
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
- name: Create test namespace
|
||||
shell: "{{bin_dir}}/kubectl create namespace test"
|
||||
shell: "{{ bin_dir }}/kubectl create namespace test"
|
||||
|
||||
- name: Run a replica controller composed of 2 pods in test ns
|
||||
shell: "{{bin_dir}}/kubectl run test --image={{test_image_repo}}:{{test_image_tag}} --namespace test --replicas=2 --command -- tail -f /dev/null"
|
||||
shell: "{{ bin_dir }}/kubectl run test --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --replicas=2 --command -- tail -f /dev/null"
|
||||
|
||||
- name: Check that all pods are running and ready
|
||||
shell: "{{bin_dir}}/kubectl get pods --namespace test --no-headers -o yaml"
|
||||
shell: "{{ bin_dir }}/kubectl get pods --namespace test --no-headers -o yaml"
|
||||
register: run_pods_log
|
||||
until:
|
||||
# Check that all pods are running
|
||||
@@ -34,31 +34,31 @@
|
||||
no_log: true
|
||||
|
||||
- name: Get pod names
|
||||
shell: "{{bin_dir}}/kubectl get pods -n test -o json"
|
||||
shell: "{{ bin_dir }}/kubectl get pods -n test -o json"
|
||||
register: pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{pods.stdout.split('\n')}}"
|
||||
- debug: msg="{{ pods.stdout.split('\n') }}"
|
||||
failed_when: not run_pods_log is success
|
||||
|
||||
- name: Get hostnet pods
|
||||
command: "{{bin_dir}}/kubectl get pods -n test -o
|
||||
command: "{{ bin_dir }}/kubectl get pods -n test -o
|
||||
jsonpath='{range .items[?(.spec.hostNetwork)]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
||||
register: hostnet_pods
|
||||
no_log: true
|
||||
|
||||
- name: Get running pods
|
||||
command: "{{bin_dir}}/kubectl get pods -n test -o
|
||||
command: "{{ bin_dir }}/kubectl get pods -n test -o
|
||||
jsonpath='{range .items[?(.status.phase==\"Running\")]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
||||
register: running_pods
|
||||
no_log: true
|
||||
|
||||
- name: Check kubectl output
|
||||
shell: "{{bin_dir}}/kubectl get pods --all-namespaces -owide"
|
||||
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
|
||||
register: get_pods
|
||||
no_log: true
|
||||
|
||||
- debug: msg="{{get_pods.stdout.split('\n')}}"
|
||||
- debug: msg="{{ get_pods.stdout.split('\n') }}"
|
||||
|
||||
- set_fact:
|
||||
kube_pods_subnet: 10.233.64.0/18
|
||||
@@ -66,30 +66,30 @@
|
||||
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}}
|
||||
{{ list }}
|
||||
pods_running: |
|
||||
{% set list = running_pods.stdout.split(" ") %}
|
||||
{{list}}
|
||||
{{ list }}
|
||||
|
||||
- name: Check pods IP are in correct network
|
||||
assert:
|
||||
that: item | ipaddr(kube_pods_subnet)
|
||||
when: not item in pods_hostnet and item in pods_running
|
||||
with_items: "{{pod_ips}}"
|
||||
with_items: "{{ pod_ips }}"
|
||||
|
||||
- name: Ping between pods is working
|
||||
shell: "{{bin_dir}}/kubectl -n test exec {{item[0]}} -- ping -c 4 {{ item[1] }}"
|
||||
shell: "{{ bin_dir }}/kubectl -n test exec {{ item[0] }} -- ping -c 4 {{ item[1] }}"
|
||||
when: not item[0] in pods_hostnet and not item[1] in pods_hostnet
|
||||
with_nested:
|
||||
- "{{pod_names}}"
|
||||
- "{{pod_ips}}"
|
||||
- "{{ pod_names }}"
|
||||
- "{{ pod_ips }}"
|
||||
|
||||
- name: Ping between hostnet pods is working
|
||||
shell: "{{bin_dir}}/kubectl -n test exec {{item[0]}} -- ping -c 4 {{ item[1] }}"
|
||||
shell: "{{ bin_dir }}/kubectl -n test exec {{ item[0] }} -- ping -c 4 {{ item[1] }}"
|
||||
when: item[0] in pods_hostnet and item[1] in pods_hostnet
|
||||
with_nested:
|
||||
- "{{pod_names}}"
|
||||
- "{{pod_ips}}"
|
||||
- "{{ pod_names }}"
|
||||
- "{{ pod_ips }}"
|
||||
|
||||
- name: Delete test namespace
|
||||
shell: "{{bin_dir}}/kubectl delete namespace test"
|
||||
shell: "{{ bin_dir }}/kubectl delete namespace test"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||
|
||||
- name: Wait for netchecker server
|
||||
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{netcheck_namespace}} | grep ^netchecker-server"
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{ netcheck_namespace }} | grep ^netchecker-server"
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
run_once: true
|
||||
register: ncs_pod
|
||||
until: ncs_pod.stdout.find('Running') != -1
|
||||
@@ -33,18 +33,18 @@
|
||||
delay: 10
|
||||
|
||||
- name: Wait for netchecker agents
|
||||
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{netcheck_namespace}} | grep '^netchecker-agent-.*Running'"
|
||||
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{ netcheck_namespace }} | grep '^netchecker-agent-.*Running'"
|
||||
run_once: true
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
register: nca_pod
|
||||
until: nca_pod.stdout_lines|length >= groups['k8s-cluster']|intersect(ansible_play_hosts)|length * 2
|
||||
retries: 3
|
||||
delay: 10
|
||||
failed_when: false
|
||||
|
||||
- command: "{{ bin_dir }}/kubectl -n {{netcheck_namespace}} describe pod -l app={{ item }}"
|
||||
- command: "{{ bin_dir }}/kubectl -n {{ netcheck_namespace }} describe pod -l app={{ item }}"
|
||||
run_once: true
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
no_log: false
|
||||
with_items:
|
||||
- netchecker-agent
|
||||
@@ -56,9 +56,9 @@
|
||||
run_once: true
|
||||
|
||||
- name: Get netchecker agents
|
||||
uri: url=http://{{ ansible_default_ipv4.address }}:{{netchecker_port}}/api/v1/agents/ return_content=yes
|
||||
uri: url=http://{{ ansible_default_ipv4.address }}:{{ netchecker_port }}/api/v1/agents/ return_content=yes
|
||||
run_once: true
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
register: agents
|
||||
retries: 18
|
||||
delay: "{{ agent_report_interval }}"
|
||||
@@ -77,8 +77,8 @@
|
||||
- agents.content[0] == '{'
|
||||
|
||||
- name: Check netchecker status
|
||||
uri: url=http://{{ ansible_default_ipv4.address }}:{{netchecker_port}}/api/v1/connectivity_check status_code=200 return_content=yes
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
uri: url=http://{{ ansible_default_ipv4.address }}:{{ netchecker_port }}/api/v1/connectivity_check status_code=200 return_content=yes
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
run_once: true
|
||||
register: result
|
||||
retries: 3
|
||||
@@ -97,13 +97,13 @@
|
||||
- command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app=kube-proxy"
|
||||
run_once: true
|
||||
when: not result is success
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
no_log: false
|
||||
|
||||
- command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app={{item}} --all-containers"
|
||||
- command: "{{ bin_dir }}/kubectl -n kube-system logs -l k8s-app={{ item }} --all-containers"
|
||||
run_once: true
|
||||
when: not result is success
|
||||
delegate_to: "{{groups['kube-master'][0]}}"
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
no_log: false
|
||||
with_items:
|
||||
- kube-router
|
||||
|
||||
Reference in New Issue
Block a user