Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix CI flakes #45

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@
hosts: localhost
connection: local
gather_facts: no
collections:
- community.kubernetes

tasks:
- name: Confirm things are populated
debug:
var: debug_things
vars:
debug_things:
namespace: '{{ namespace }}'
KUBECONFIG: '{{ lookup("env", "KUBECONFIG") }}'
KUBECONFIG_CONTENT: '{{ lookup("file", lookup("env", "KUBECONFIG")) }}'

- name: Create Namespace
k8s:
community.kubernetes.k8s:
api_version: v1
kind: Namespace
name: '{{ namespace }}'

- name: Create alternate namespace
k8s:
community.kubernetes.k8s:
api_version: v1
kind: Namespace
name: '{{ namespace }}-alt'
Expand Down
5 changes: 1 addition & 4 deletions molecule/default/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
hosts: localhost
connection: local
gather_facts: false
collections:
- community.kubernetes

tasks:
- import_tasks: kustomize.yml
vars:
state: absent

- name: Destroy Namespace
k8s:
community.kubernetes.k8s:
api_version: v1
kind: Namespace
name: '{{ namespace }}'
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/kustomize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
changed_when: false

- name: Set resources to {{ state }}
k8s:
community.kubernetes.k8s:
definition: '{{ item }}'
state: '{{ state }}'
wait: yes
Expand Down
14 changes: 7 additions & 7 deletions molecule/default/tasks/gitea_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Create the redhatgov.io/v1alpha1.Gitea
k8s:
community.kubernetes.k8s:
state: present
namespace: '{{ namespace }}'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
Expand All @@ -22,31 +22,31 @@
delay: 5

- name: Create the redhatgov.io/v1alpha1.GiteaUser
k8s:
community.kubernetes.k8s:
state: present
namespace: '{{ namespace }}'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
vars:
cr_file: 'redhatgov_v1alpha1_gitea_user_molecule.yaml'

- name: Remove the redhatgov.io/v1alpha1.GiteaUser
k8s:
community.kubernetes.k8s:
state: absent
namespace: '{{ namespace }}'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
vars:
cr_file: 'redhatgov_v1alpha1_gitea_user_molecule.yaml'

- name: Remove the redhatgov.io/v1alpha1.Gitea
k8s:
community.kubernetes.k8s:
state: absent
namespace: '{{ namespace }}'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml }}"
vars:
cr_file: 'redhatgov_v1alpha1_gitea_molecule.yaml'

- name: Attempt to apply an invalid configurations for Gitea
k8s:
community.kubernetes.k8s:
state: present
namespace: '{{ namespace }}'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml | combine(cr_fault) }}"
Expand Down Expand Up @@ -84,7 +84,7 @@
that: False not in (faulty_crs | json_query('results[].failed') | list)

- name: Apply the Gitea CR in an alternate namespace
k8s:
community.kubernetes.k8s:
state: present
namespace: '{{ namespace }}-alt'
definition: "{{ lookup('template', '/'.join([samples_dir, cr_file])) | from_yaml | combine(namespace_mod) }}"
Expand All @@ -96,7 +96,7 @@
name: gitea-sample-alt

- name: Wait for CR to be Reconciled
k8s_info:
community.kubernetes.k8s_info:
api_version: v1alpha1
kind: Gitea
namespace: '{{ namespace }}-alt'
Expand Down
9 changes: 3 additions & 6 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
hosts: localhost
connection: local
gather_facts: no
collections:
- community.kubernetes

vars:
ctrl_label: control-plane=controller-manager

Expand All @@ -17,7 +14,7 @@
- tasks/*_test.yml
rescue:
- name: Retrieve relevant resources
k8s_info:
community.kubernetes.k8s_info:
api_version: '{{ item.api_version }}'
kind: '{{ item.kind }}'
namespace: '{{ namespace }}'
Expand All @@ -34,7 +31,7 @@
ignore_errors: true

- name: Retrieve controller Pod logs
k8s_log:
community.kubernetes.k8s_log:
namespace: '{{ namespace }}'
label_selectors:
- '{{ ctrl_label }}'
Expand All @@ -43,7 +40,7 @@
ignore_errors: true

- name: Retrieve application Pod logs
k8s_log:
community.kubernetes.k8s_log:
namespace: '{{ namespace }}'
label_selectors:
- app=gitea-testing
Expand Down
6 changes: 6 additions & 0 deletions molecule/kind/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
connection: local
gather_facts: false
tasks:
- name: Gather useful debugging info
setup:
- name: Output useful debugging info
debug:
var: ansible_facts

- name: Install nginx Ingress onto kind
command: >
helm install kind-ingress ingress-nginx/ingress-nginx
Expand Down