Add debugging;Fix readiness check;Create kubeadm registry project
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-12-31 17:15:13 +01:00
parent 0fd4cbb92f
commit 08a543e27f
4 changed files with 84 additions and 20 deletions

View File

@ -18,18 +18,25 @@
ansible.builtin.shell: ansible.builtin.shell:
cmd: "{{ item.value.helm.parse_logic }}" cmd: "{{ item.value.helm.parse_logic }}"
chdir: /opt/metacluster/helm-charts/{{ item.key }} chdir: /opt/metacluster/helm-charts/{{ item.key }}
register: containerimages register: chartimages
when: item.value.helm is defined when: item.value.helm is defined
loop: "{{ lookup('ansible.builtin.dict', components) }}" loop: "{{ lookup('ansible.builtin.dict', components) }}"
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"
- debug:
var: chartimages
- debug:
var: kubeadmimages
- debug:
var: parsedmanifests
- name: Store container images in dicts - name: Store container images in dicts
ansible.builtin.set_fact: ansible.builtin.set_fact:
containerimages_{{ item.source }}: "{{ item.results }}" containerimages_{{ item.source }}: "{{ item.results }}"
loop: loop:
- source: charts - source: charts
results: "{{ containerimages | json_query('results[*].stdout_lines') | select() | flatten | list }}" results: "{{ chartimages | json_query('results[*].stdout_lines') | select() | flatten | list }}"
- source: kubeadm - source: kubeadm
results: "{{ kubeadmimages | json_query('results[*].stdout_lines') | select() | flatten | list }}" results: "{{ kubeadmimages | json_query('results[*].stdout_lines') | select() | flatten | list }}"
- source: manifests - source: manifests
@ -37,6 +44,13 @@
loop_control: loop_control:
label: "{{ item.source }}" label: "{{ item.source }}"
- debug:
var: containerimages_charts
- debug:
var: containerimages_kubeadm
- debug:
var: containerimages_manifests
- name: Pull and store containerimages - name: Pull and store containerimages
ansible.builtin.shell: ansible.builtin.shell:
cmd: >- cmd: >-

View File

@ -1,4 +1,5 @@
- name: Install longhorn chart - block:
- name: Install longhorn chart
kubernetes.core.helm: kubernetes.core.helm:
name: longhorn name: longhorn
chart_ref: /opt/metacluster/helm-charts/longhorn chart_ref: /opt/metacluster/helm-charts/longhorn
@ -8,7 +9,7 @@
kubeconfig: "{{ kubeconfig.path }}" kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.longhorn.chart_values }}" values: "{{ components.longhorn.chart_values }}"
- name: Ensure longhorn API availability - name: Ensure longhorn API availability
ansible.builtin.uri: ansible.builtin.uri:
url: https://storage.{{ vapp['metacluster.fqdn'] }}/v1 url: https://storage.{{ vapp['metacluster.fqdn'] }}/v1
method: GET method: GET
@ -17,3 +18,9 @@
- api_readycheck is not failed - api_readycheck is not failed
retries: 5 retries: 5
delay: 30 delay: 30
module_defaults:
ansible.builtin.uri:
validate_certs: no
status_code: [200, 201]
body_format: json

View File

@ -1,3 +1,6 @@
clusterConfiguration:
imageRepository: registry.<fqdn>/library
files: files:
- [...] - [...]
- encoding: base64 - encoding: base64

View File

@ -0,0 +1,40 @@
- block:
- name: Create dedicated kubeadm project within container registry
ansible.builtin.uri:
url: https://registry.{{ vapp['metacluster.fqdn'] }}/api/v2.0/projects
method: POST
headers:
Authorization: "Basic {{ ('admin:' + vapp['metacluster.password']) | b64encode }}"
body:
project_name: kubeadm
public: true
storage_limit: 0
metadata:
enable_content_trust: 'false'
enable_content_trust_cosign: 'false'
auto_scan: 'true'
severity: none
prevent_vul: 'false'
public: 'true'
reuse_sys_cve_allowlist: 'true'
- name: Lookup kubeadm container images
ansible.builtin.set_fact:
kubeadm_images: "{{ lookup('ansible.builtin.file', '/opt/metacluster/cluster-api/imagelist').splitlines() }}"
# - name: Copy all stored rancher container images to dedicated project
# ansible.builtin.uri:
# url: https://registry.{{ vapp['metacluster.fqdn'] }}/api/v2.0/projects/kubeadm/repositories/{{ ( item | regex_findall('([^:/]+)') )[-2] }}/artifacts?from={{ item | replace('/', '%2F') | replace(':', '%3A') }}
# method: POST
# headers:
# Authorization: "Basic {{ ('admin:' + vapp['metacluster.password']) | b64encode }}"
# body:
# from: "{{ item }}"
# loop: "{{ kubeadm_images }}"
module_defaults:
ansible.builtin.uri:
validate_certs: no
status_code: [200, 201, 409]
body_format: json