Fix non-rbac deployment of resources as a list (#1613)
* Use kubectl apply instead of create/replace Disable checks for existing resources to speed up execution. * Fix non-rbac deployment of resources as a list * Fix autoscaler tolerations field * set all kube resources to state=latest * Update netchecker and weave
This commit is contained in:
parent
fc7905653e
commit
d279d145d5
12 changed files with 22 additions and 27 deletions
|
@ -270,7 +270,6 @@ def main():
|
||||||
|
|
||||||
manager = KubeManager(module)
|
manager = KubeManager(module)
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
result = manager.create()
|
result = manager.create()
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ manifests.results }}"
|
with_items: "{{ manifests.results }}"
|
||||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
|
@ -51,10 +51,12 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ manifests.results }}"
|
with_items: "{{ manifests.results }}"
|
||||||
failed_when: manifests|failed and "Error from server (AlreadyExists)" not in manifests.msg
|
when:
|
||||||
when: dns_mode != 'none' and inventory_hostname == groups['kube-master'][0]
|
- dns_mode != 'none'
|
||||||
|
- inventory_hostname == groups['kube-master'][0]
|
||||||
|
- not item|skipped
|
||||||
tags: dnsmasq
|
tags: dnsmasq
|
||||||
|
|
||||||
- name: Kubernetes Apps | Netchecker
|
- name: Kubernetes Apps | Netchecker
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ manifests.results }}"
|
with_items: "{{ manifests.results }}"
|
||||||
failed_when: manifests|failed and "Error from server (AlreadyExists)" not in manifests.msg
|
when: inventory_hostname == groups['kube-master'][0] and not item|skipped
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
|
||||||
|
|
|
@ -27,17 +27,13 @@ spec:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
k8s-app: kubedns-autoscaler
|
k8s-app: kubedns-autoscaler
|
||||||
annotations:
|
|
||||||
scheduler.alpha.kubernetes.io/critical-pod: ''
|
|
||||||
spec:
|
spec:
|
||||||
containers:
|
|
||||||
- name: autoscaler
|
|
||||||
image: "{{ kubednsautoscaler_image_repo }}:{{ kubednsautoscaler_image_tag }}"
|
|
||||||
tolerations:
|
tolerations:
|
||||||
- effect: NoSchedule
|
- effect: NoSchedule
|
||||||
operator: Exists
|
operator: Exists
|
||||||
- effect: CriticalAddonsOnly
|
containers:
|
||||||
operator: exists
|
- name: autoscaler
|
||||||
|
image: "{{ kubednsautoscaler_image_repo }}:{{ kubednsautoscaler_image_tag }}"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: "20m"
|
cpu: "20m"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
name: "kibana-logging"
|
name: "kibana-logging"
|
||||||
namespace: "{{system_namespace}}"
|
namespace: "{{system_namespace}}"
|
||||||
resource: "deployment"
|
resource: "deployment"
|
||||||
state: "{{ item | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ kibana_deployment_manifest.changed }}"
|
with_items: "{{ kibana_deployment_manifest.changed }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
|
@ -29,6 +29,6 @@
|
||||||
name: "kibana-logging"
|
name: "kibana-logging"
|
||||||
namespace: "{{system_namespace}}"
|
namespace: "{{system_namespace}}"
|
||||||
resource: "svc"
|
resource: "svc"
|
||||||
state: "{{ item | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ kibana_service_manifest.changed }}"
|
with_items: "{{ kibana_service_manifest.changed }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
|
@ -27,9 +27,8 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ manifests.results }}"
|
with_items: "{{ manifests.results }}"
|
||||||
failed_when: manifests|failed and "Error from server (AlreadyExists)" not in manifests.msg
|
|
||||||
when: dns_mode != 'none' and inventory_hostname == groups['kube-master'][0] and rbac_enabled
|
when: dns_mode != 'none' and inventory_hostname == groups['kube-master'][0] and rbac_enabled
|
||||||
|
|
||||||
- name: Helm | Install/upgrade helm
|
- name: Helm | Install/upgrade helm
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ calico_node_manifests.results }}"
|
with_items: "{{ calico_node_manifests.results }}"
|
||||||
|
when: inventory_hostname == groups['kube-master'][0] and not item|skipped
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ canal_manifests.results }}"
|
with_items: "{{ canal_manifests.results }}"
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
when: inventory_hostname == groups['kube-master'][0]
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
filename: "{{ kube_config_dir }}/cni-flannel.yml"
|
filename: "{{ kube_config_dir }}/cni-flannel.yml"
|
||||||
resource: "ds"
|
resource: "ds"
|
||||||
namespace: "{{system_namespace}}"
|
namespace: "{{system_namespace}}"
|
||||||
state: "{{ item | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ flannel_manifest.changed }}"
|
with_items: "{{ flannel_manifest.changed }}"
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
when: inventory_hostname == groups['kube-master'][0]
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,7 @@
|
||||||
filename: "{{ kube_config_dir }}/weave-net.yml"
|
filename: "{{ kube_config_dir }}/weave-net.yml"
|
||||||
resource: "ds"
|
resource: "ds"
|
||||||
namespace: "{{system_namespace}}"
|
namespace: "{{system_namespace}}"
|
||||||
state: "{{ item | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ weave_manifest.changed }}"
|
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
when: inventory_hostname == groups['kube-master'][0]
|
||||||
|
|
||||||
- name: "Weave | wait for weave to become available"
|
- name: "Weave | wait for weave to become available"
|
||||||
|
|
|
@ -44,6 +44,6 @@
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: "{{item.item.type}}"
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||||
state: "{{item.changed | ternary('latest','present') }}"
|
state: "latest"
|
||||||
with_items: "{{ calico_policy_manifests.results }}"
|
with_items: "{{ calico_policy_manifests.results }}"
|
||||||
when: inventory_hostname == groups['kube-master'][0]
|
when: inventory_hostname == groups['kube-master'][0] and not item|skipped
|
||||||
|
|
Loading…
Reference in a new issue