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

View File

@ -1,19 +1,26 @@
- name: Install longhorn chart
kubernetes.core.helm:
name: longhorn
chart_ref: /opt/metacluster/helm-charts/longhorn
release_namespace: longhorn-system
create_namespace: yes
wait: no
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.longhorn.chart_values }}"
- block:
- name: Install longhorn chart
kubernetes.core.helm:
name: longhorn
chart_ref: /opt/metacluster/helm-charts/longhorn
release_namespace: longhorn-system
create_namespace: yes
wait: no
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components.longhorn.chart_values }}"
- name: Ensure longhorn API availability
ansible.builtin.uri:
url: https://storage.{{ vapp['metacluster.fqdn'] }}/v1
method: GET
register: api_readycheck
until:
- api_readycheck is not failed
retries: 5
delay: 30
- name: Ensure longhorn API availability
ansible.builtin.uri:
url: https://storage.{{ vapp['metacluster.fqdn'] }}/v1
method: GET
register: api_readycheck
until:
- api_readycheck is not failed
retries: 5
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:
- [...]
- 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