mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-03-26 21:33:02 +00:00
adding a prepare step to validate that node is ready for schedule (#160)
This commit is contained in:
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -82,8 +82,11 @@ jobs:
|
||||
with:
|
||||
path: ansible_collections/kubernetes/core
|
||||
|
||||
- name: Set up KinD cluster
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
# We are facing some issue with the github action used to spawn k8s cluster
|
||||
# This will be done into a dedicated prepare step for molecule, with the added benefit that
|
||||
# it is no more github dependant
|
||||
# - name: Set up KinD cluster
|
||||
# uses: engineerd/setup-kind@v0.5.0
|
||||
|
||||
- name: Set up Python ${{ matrix.python_version }}
|
||||
uses: actions/setup-python@v1
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -13,3 +13,6 @@ changelogs/.plugin-cache.yaml
|
||||
tests/output
|
||||
tests/integration/cloud-config-*
|
||||
.cache
|
||||
|
||||
# Helm charts
|
||||
molecule/default/*-chart-*.tgz
|
||||
|
||||
@@ -35,6 +35,7 @@ scenario:
|
||||
- dependency
|
||||
- lint
|
||||
- syntax
|
||||
- prepare
|
||||
- converge
|
||||
- verify
|
||||
dependency:
|
||||
|
||||
37
molecule/default/prepare.yml
Normal file
37
molecule/default/prepare.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
- name: Prepare
|
||||
hosts: localhost
|
||||
connection: local
|
||||
|
||||
collections:
|
||||
- kubernetes.core
|
||||
|
||||
vars:
|
||||
node_taints:
|
||||
- "node.kubernetes.io/not-ready"
|
||||
- "node.kubernetes.io/unreachable"
|
||||
- "node.kubernetes.io/unschedulable"
|
||||
|
||||
tasks:
|
||||
# We are spawning k8s cluster using kind executable and we ensure that the cluster is up
|
||||
# and node is ready, if this is not validated we may face issue later on when running tests
|
||||
- name: Download kind
|
||||
get_url:
|
||||
url: https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
|
||||
dest: /tmp/kind
|
||||
|
||||
- name: make kind executable
|
||||
file:
|
||||
path: /tmp/kind
|
||||
mode: '0755'
|
||||
|
||||
- name: Create cluster
|
||||
command: "kind create cluster"
|
||||
|
||||
- name: Assert that nodes are ready
|
||||
k8s_info:
|
||||
kind: Node
|
||||
retries: 10
|
||||
delay: 30
|
||||
register: nodes
|
||||
until: nodes.resources | selectattr("spec.taints", "defined") | map(attribute="spec.taints") | list | length == 0
|
||||
Reference in New Issue
Block a user