feat: add resource readiness check to cluster-installation playbook (#547)

This commit is contained in:
Devin Buhl authored and GitHub committed 2022-12-09 11:58:51 -05:00
1 parent 579ce037fc
commit 88decb875f
4 files changed
+65 -7

No files matched your search

@@ -57,6 +57,47 @@
regexp: "https://127.0.0.1:6443"
replace: "https://{{ k3s_registration_address }}:6443"
- name: Resource Readiness Check
run_once: true
kubernetes.core.k8s_info:
kubeconfig: /etc/rancher/k3s/k3s.yaml
kind: "{{ item.kind }}"
name: "{{ item.name }}"
namespace: "{{ item.namespace | default('') }}"
wait: true
wait_sleep: 10
wait_timeout: 360
loop:
- kind: Deployment
name: tigera-operator
namespace: tigera-operator
- kind: DaemonSet
name: kube-vip
namespace: kube-system
- kind: Installation
name: default
- kind: CustomResourceDefinition
name: alertmanagerconfigs.monitoring.coreos.com
- kind: CustomResourceDefinition
name: alertmanagers.monitoring.coreos.com
- kind: CustomResourceDefinition
name: podmonitors.monitoring.coreos.com
- kind: CustomResourceDefinition
name: probes.monitoring.coreos.com
- kind: CustomResourceDefinition
name: prometheuses.monitoring.coreos.com
- kind: CustomResourceDefinition
name: prometheusrules.monitoring.coreos.com
- kind: CustomResourceDefinition
name: servicemonitors.monitoring.coreos.com
- kind: CustomResourceDefinition
name: thanosrulers.monitoring.coreos.com
when:
- k3s_server_manifests_templates | length > 0
or k3s_server_manifests_urls | length > 0
- k3s_control_node is defined
- k3s_control_node
# Cleaning up the manifests from the /var/lib/rancher/k3s/server/manifests
# directory is needed because k3s has an awesome "feature" to always deploy
# these on restarting the k3s systemd service. Removing them does NOT
@@ -65,13 +106,6 @@
# Removing them means we can manage the lifecycle of these components
# outside of the /var/lib/rancher/k3s/server/manifests directory
# FIXME(ansible): Check for deployments to be happy rather than waiting
- name: Wait for k3s to finish installing the deployed manifests
ansible.builtin.wait_for:
timeout: 15
when: k3s_server_manifests_templates | length > 0
or k3s_server_manifests_dir | length > 0
- name: Remove deployed manifest templates
ansible.builtin.file:
path: "{{ k3s_server_manifests_dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"