фикс ошибок линта и молекулы
This commit is contained in:
21
addons/argocd/role/molecule/default/converge.yml
Normal file
21
addons/argocd/role/molecule/default/converge.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Converge — argocd template tests
|
||||
hosts: all
|
||||
become: false
|
||||
gather_facts: false
|
||||
|
||||
vars:
|
||||
argocd_namespace: argocd
|
||||
argocd_ingress_enabled: true
|
||||
argocd_ingress_host: "argocd.home.local"
|
||||
argocd_ingress_class: "nginx"
|
||||
argocd_ingress_tls: false
|
||||
argocd_ingress_cert_issuer: "letsencrypt-prod"
|
||||
argocd_insecure: true
|
||||
|
||||
tasks:
|
||||
- name: Render argocd ingress.yaml.j2
|
||||
ansible.builtin.template:
|
||||
src: "{{ playbook_dir }}/../../templates/ingress.yaml.j2"
|
||||
dest: /tmp/argocd-ingress.yaml
|
||||
mode: "0644"
|
||||
28
addons/argocd/role/molecule/default/molecule.yml
Normal file
28
addons/argocd/role/molecule/default/molecule.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
driver:
|
||||
name: docker
|
||||
|
||||
platforms:
|
||||
- name: master01
|
||||
image: geerlingguy/docker-ubuntu2204-ansible:latest
|
||||
pre_build_image: true
|
||||
groups:
|
||||
- k3s_master
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: converge.yml
|
||||
verify: verify.yml
|
||||
config_options:
|
||||
defaults:
|
||||
interpreter_python: auto_silent
|
||||
|
||||
verifier:
|
||||
name: ansible
|
||||
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint
|
||||
|
||||
45
addons/argocd/role/molecule/default/verify.yml
Normal file
45
addons/argocd/role/molecule/default/verify.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: Verify — argocd templates
|
||||
hosts: all
|
||||
become: false
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Read rendered ingress
|
||||
ansible.builtin.slurp:
|
||||
src: /tmp/argocd-ingress.yaml
|
||||
register: ingress_raw
|
||||
|
||||
- name: Set content fact
|
||||
ansible.builtin.set_fact:
|
||||
content: "{{ ingress_raw.content | b64decode }}"
|
||||
|
||||
- name: Assert kind is Ingress
|
||||
ansible.builtin.assert:
|
||||
that: "'kind: Ingress' in content"
|
||||
fail_msg: "kind: Ingress не найден"
|
||||
|
||||
- name: Assert namespace
|
||||
ansible.builtin.assert:
|
||||
that: "'namespace: argocd' in content"
|
||||
fail_msg: "namespace: argocd не найден"
|
||||
|
||||
- name: Assert ingress host
|
||||
ansible.builtin.assert:
|
||||
that: "'argocd.home.local' in content"
|
||||
fail_msg: "argocd.home.local не найден в Ingress"
|
||||
|
||||
- name: Assert backend-protocol annotation
|
||||
ansible.builtin.assert:
|
||||
that: "'backend-protocol' in content"
|
||||
fail_msg: "nginx backend-protocol аннотация не найдена"
|
||||
|
||||
- name: Assert ingressClass
|
||||
ansible.builtin.assert:
|
||||
that: "'nginx' in content"
|
||||
fail_msg: "ingressClassName nginx не найден"
|
||||
|
||||
- name: Assert TLS section is absent (tls disabled)
|
||||
ansible.builtin.assert:
|
||||
that: "'secretName: argocd-tls' not in content"
|
||||
fail_msg: "TLS секция не должна присутствовать при argocd_ingress_tls: false"
|
||||
Reference in New Issue
Block a user