mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 13:54:37 +03:00
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
@@ -16,7 +16,6 @@ skip_list:
|
|||||||
# In Kubespray we use variables that use camelCase to match their k8s counterparts
|
# In Kubespray we use variables that use camelCase to match their k8s counterparts
|
||||||
# (Disabled in June 2021)
|
# (Disabled in June 2021)
|
||||||
- 'var-naming'
|
- 'var-naming'
|
||||||
- 'var-spacing'
|
|
||||||
|
|
||||||
# [fqcn-builtins]
|
# [fqcn-builtins]
|
||||||
# Roles in kubespray don't need fully qualified collection names
|
# Roles in kubespray don't need fully qualified collection names
|
||||||
|
|||||||
8
.ansible-lint-ignore
Normal file
8
.ansible-lint-ignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# This file contains ignores rule violations for ansible-lint
|
||||||
|
inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml jinja[spacing]
|
||||||
|
roles/kubernetes/control-plane/defaults/main/kube-proxy.yml jinja[spacing]
|
||||||
|
roles/kubernetes/control-plane/defaults/main/main.yml jinja[spacing]
|
||||||
|
roles/kubernetes/kubeadm/defaults/main.yml jinja[spacing]
|
||||||
|
roles/kubernetes/node/defaults/main.yml jinja[spacing]
|
||||||
|
roles/kubernetes/preinstall/defaults/main.yml jinja[spacing]
|
||||||
|
roles/kubespray-defaults/defaults/main.yaml jinja[spacing]
|
||||||
@@ -90,6 +90,7 @@
|
|||||||
|
|
||||||
- name: "Check_certs | Set 'gen_master_certs' object to track whether member and admin certs exist on first etcd node"
|
- name: "Check_certs | Set 'gen_master_certs' object to track whether member and admin certs exist on first etcd node"
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
gen_master_certs: |-
|
gen_master_certs: |-
|
||||||
{
|
{
|
||||||
{% set etcd_members = groups['etcd'] -%}
|
{% set etcd_members = groups['etcd'] -%}
|
||||||
@@ -112,6 +113,7 @@
|
|||||||
|
|
||||||
- name: "Check_certs | Set 'gen_node_certs' object to track whether node certs exist on first etcd node"
|
- name: "Check_certs | Set 'gen_node_certs' object to track whether node certs exist on first etcd node"
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
gen_node_certs: |-
|
gen_node_certs: |-
|
||||||
{
|
{
|
||||||
{% set k8s_nodes = groups['k8s_cluster'] -%}
|
{% set k8s_nodes = groups['k8s_cluster'] -%}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
- include_tasks: refresh_config.yml
|
- include_tasks: refresh_config.yml
|
||||||
vars:
|
vars:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
etcd_events_peer_addresses: >-
|
etcd_events_peer_addresses: >-
|
||||||
{% for host in groups['etcd'] -%}
|
{% for host in groups['etcd'] -%}
|
||||||
{%- if hostvars[host]['etcd_events_member_in_cluster'].rc == 0 -%}
|
{%- if hostvars[host]['etcd_events_member_in_cluster'].rc == 0 -%}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
- include_tasks: refresh_config.yml
|
- include_tasks: refresh_config.yml
|
||||||
vars:
|
vars:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
etcd_peer_addresses: >-
|
etcd_peer_addresses: >-
|
||||||
{% for host in groups['etcd'] -%}
|
{% for host in groups['etcd'] -%}
|
||||||
{%- if hostvars[host]['etcd_member_in_cluster'].rc == 0 -%}
|
{%- if hostvars[host]['etcd_member_in_cluster'].rc == 0 -%}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Kubernetes Apps | set up necessary nodelocaldns parameters
|
- name: Kubernetes Apps | set up necessary nodelocaldns parameters
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
primaryClusterIP: >-
|
primaryClusterIP: >-
|
||||||
{%- if dns_mode in ['coredns', 'coredns_dual'] -%}
|
{%- if dns_mode in ['coredns', 'coredns_dual'] -%}
|
||||||
{{ skydns_server }}
|
{{ skydns_server }}
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
- { name: nodelocaldns, file: nodelocaldns-daemonset.yml, type: daemonset }
|
- { name: nodelocaldns, file: nodelocaldns-daemonset.yml, type: daemonset }
|
||||||
register: nodelocaldns_manifests
|
register: nodelocaldns_manifests
|
||||||
vars:
|
vars:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
forwardTarget: >-
|
forwardTarget: >-
|
||||||
{%- if secondaryclusterIP is defined and dns_mode == 'coredns_dual' -%}
|
{%- if secondaryclusterIP is defined and dns_mode == 'coredns_dual' -%}
|
||||||
{{ primaryClusterIP }} {{ secondaryclusterIP }}
|
{{ primaryClusterIP }} {{ secondaryclusterIP }}
|
||||||
@@ -54,12 +56,14 @@
|
|||||||
- { name: nodelocaldns, file: nodelocaldns-second-daemonset.yml, type: daemonset }
|
- { name: nodelocaldns, file: nodelocaldns-second-daemonset.yml, type: daemonset }
|
||||||
register: nodelocaldns_second_manifests
|
register: nodelocaldns_second_manifests
|
||||||
vars:
|
vars:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
forwardTarget: >-
|
forwardTarget: >-
|
||||||
{%- if secondaryclusterIP is defined and dns_mode == 'coredns_dual' -%}
|
{%- if secondaryclusterIP is defined and dns_mode == 'coredns_dual' -%}
|
||||||
{{ primaryClusterIP }} {{ secondaryclusterIP }}
|
{{ primaryClusterIP }} {{ secondaryclusterIP }}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ primaryClusterIP }}
|
{{ primaryClusterIP }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
# noqa: jinja[spacing]
|
||||||
upstreamForwardTarget: >-
|
upstreamForwardTarget: >-
|
||||||
{%- if upstream_dns_servers is defined and upstream_dns_servers | length > 0 -%}
|
{%- if upstream_dns_servers is defined and upstream_dns_servers | length > 0 -%}
|
||||||
{{ upstream_dns_servers | join(' ') }}
|
{{ upstream_dns_servers | join(' ') }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Set external kube-apiserver endpoint
|
- name: Set external kube-apiserver endpoint
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
external_apiserver_address: >-
|
external_apiserver_address: >-
|
||||||
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined -%}
|
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined -%}
|
||||||
{{ loadbalancer_apiserver.address }}
|
{{ loadbalancer_apiserver.address }}
|
||||||
@@ -9,6 +10,7 @@
|
|||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ kube_apiserver_access_address }}
|
{{ kube_apiserver_access_address }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
# noqa: jinja[spacing]
|
||||||
external_apiserver_port: >-
|
external_apiserver_port: >-
|
||||||
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined and loadbalancer_apiserver.port is defined -%}
|
{%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined and loadbalancer_apiserver.port is defined -%}
|
||||||
{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
|
{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Set kubeadm_discovery_address
|
- name: Set kubeadm_discovery_address
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
kubeadm_discovery_address: >-
|
kubeadm_discovery_address: >-
|
||||||
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
||||||
{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Set kubeadm_discovery_address
|
- name: Set kubeadm_discovery_address
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
kubeadm_discovery_address: >-
|
kubeadm_discovery_address: >-
|
||||||
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
{%- if "127.0.0.1" in kube_apiserver_endpoint or "localhost" in kube_apiserver_endpoint -%}
|
||||||
{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@
|
|||||||
|
|
||||||
- name: Ensure ping package
|
- name: Ensure ping package
|
||||||
package:
|
package:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
name: >-
|
name: >-
|
||||||
{%- if ansible_os_family == 'Debian' -%}
|
{%- if ansible_os_family == 'Debian' -%}
|
||||||
iputils-ping
|
iputils-ping
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
- name: Set fact NTP settings
|
- name: Set fact NTP settings
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
ntp_config_file: >-
|
ntp_config_file: >-
|
||||||
{% if ntp_package == "ntp" -%}
|
{% if ntp_package == "ntp" -%}
|
||||||
/etc/ntp.conf
|
/etc/ntp.conf
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
{%- else -%}
|
{%- else -%}
|
||||||
/etc/chrony/chrony.conf
|
/etc/chrony/chrony.conf
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
# noqa: jinja[spacing]
|
||||||
ntp_service_name: >-
|
ntp_service_name: >-
|
||||||
{% if ntp_package == "chrony" -%}
|
{% if ntp_package == "chrony" -%}
|
||||||
chronyd
|
chronyd
|
||||||
@@ -51,6 +53,7 @@
|
|||||||
- ntp_force_sync_immediately
|
- ntp_force_sync_immediately
|
||||||
|
|
||||||
- name: Force Sync NTP Immediately
|
- name: Force Sync NTP Immediately
|
||||||
|
# noqa: jinja[spacing]
|
||||||
command: >-
|
command: >-
|
||||||
timeout -k 60s 60s
|
timeout -k 60s 60s
|
||||||
{% if ntp_package == "ntp" -%}
|
{% if ntp_package == "ntp" -%}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Set no_proxy to all assigned cluster IPs and hostnames
|
- name: Set no_proxy to all assigned cluster IPs and hostnames
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
no_proxy_prepare: >-
|
no_proxy_prepare: >-
|
||||||
{%- if loadbalancer_apiserver is defined -%}
|
{%- if loadbalancer_apiserver is defined -%}
|
||||||
{{ apiserver_loadbalancer_domain_name | default('') }},
|
{{ apiserver_loadbalancer_domain_name | default('') }},
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
- name: Populates no_proxy to all hosts
|
- name: Populates no_proxy to all hosts
|
||||||
set_fact:
|
set_fact:
|
||||||
no_proxy: "{{ hostvars.localhost.no_proxy_prepare }}"
|
no_proxy: "{{ hostvars.localhost.no_proxy_prepare }}"
|
||||||
|
# noqa: jinja[spacing]
|
||||||
proxy_env: "{{ proxy_env | combine({
|
proxy_env: "{{ proxy_env | combine({
|
||||||
'no_proxy': hostvars.localhost.no_proxy_prepare,
|
'no_proxy': hostvars.localhost.no_proxy_prepare,
|
||||||
'NO_PROXY': hostvars.localhost.no_proxy_prepare
|
'NO_PROXY': hostvars.localhost.no_proxy_prepare
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
- name: Calico-rr | Set route reflector cluster ID
|
- name: Calico-rr | Set route reflector cluster ID
|
||||||
|
# noqa: jinja[spacing]
|
||||||
set_fact:
|
set_fact:
|
||||||
calico_rr_node_patched: >-
|
calico_rr_node_patched: >-
|
||||||
{{ calico_rr_node.stdout | from_json | combine({ 'spec': { 'bgp':
|
{{ calico_rr_node.stdout | from_json | combine({ 'spec': { 'bgp':
|
||||||
|
|||||||
@@ -309,6 +309,7 @@
|
|||||||
|
|
||||||
- name: Calico | Set kubespray BGP Configuration
|
- name: Calico | Set kubespray BGP Configuration
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
_bgp_config: >
|
_bgp_config: >
|
||||||
{
|
{
|
||||||
"kind": "BGPConfiguration",
|
"kind": "BGPConfiguration",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
- name: Macvlan | reload network
|
- name: Macvlan | reload network
|
||||||
service:
|
service:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
name: >-
|
name: >-
|
||||||
{% if ansible_os_family == "RedHat" -%}
|
{% if ansible_os_family == "RedHat" -%}
|
||||||
network
|
network
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# TODO: Figure out why kubeadm does not fix this
|
# TODO: Figure out why kubeadm does not fix this
|
||||||
- name: Set etcd-servers fact
|
- name: Set etcd-servers fact
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
etcd_servers: >-
|
etcd_servers: >-
|
||||||
{% for host in groups['etcd'] -%}
|
{% for host in groups['etcd'] -%}
|
||||||
{% if not loop.last -%}
|
{% if not loop.last -%}
|
||||||
|
|||||||
@@ -428,6 +428,7 @@
|
|||||||
|
|
||||||
- name: reset | Restart network
|
- name: reset | Restart network
|
||||||
service:
|
service:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
name: >-
|
name: >-
|
||||||
{% if ansible_os_family == "RedHat" -%}
|
{% if ansible_os_family == "RedHat" -%}
|
||||||
{%- if ansible_distribution_major_version | int >= 8 or is_fedora_coreos or ansible_distribution == "Fedora" -%}
|
{%- if ansible_distribution_major_version | int >= 8 or is_fedora_coreos or ansible_distribution == "Fedora" -%}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
- name: Set if node needs cordoning
|
- name: Set if node needs cordoning
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
needs_cordoning: >-
|
needs_cordoning: >-
|
||||||
{% if (kubectl_node_ready.stdout == "True" and not kubectl_node_schedulable.stdout) or upgrade_node_always_cordon -%}
|
{% if (kubectl_node_ready.stdout == "True" and not kubectl_node_schedulable.stdout) or upgrade_node_always_cordon -%}
|
||||||
true
|
true
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
- name: set instance names
|
- name: set instance names
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
instance_names: >-
|
instance_names: >-
|
||||||
{%- if mode in ['separate', 'ha'] -%}
|
{%- if mode in ['separate', 'ha'] -%}
|
||||||
["k8s-{{ test_name }}-1", "k8s-{{ test_name }}-2", "k8s-{{ test_name }}-3"]
|
["k8s-{{ test_name }}-1", "k8s-{{ test_name }}-2", "k8s-{{ test_name }}-3"]
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
- name: set instance names
|
- name: set instance names
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
instance_names: >-
|
instance_names: >-
|
||||||
{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale'] -%}
|
{%- if mode in ['separate', 'separate-scale', 'ha', 'ha-scale'] -%}
|
||||||
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
|
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
- name: set instance names
|
- name: set instance names
|
||||||
set_fact:
|
set_fact:
|
||||||
|
# noqa: jinja[spacing]
|
||||||
instance_names: >-
|
instance_names: >-
|
||||||
{%- if mode in ['separate', 'ha'] -%}
|
{%- if mode in ['separate', 'ha'] -%}
|
||||||
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
|
k8s-{{ test_name }}-1,k8s-{{ test_name }}-2,k8s-{{ test_name }}-3
|
||||||
|
|||||||
Reference in New Issue
Block a user