feat: Add version/metadata API endpoint
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2023-07-07 16:48:32 +02:00
parent 740b6b3dc9
commit cbedc9679f
4 changed files with 62 additions and 2 deletions

View File

@ -16,14 +16,16 @@
{ 'components': ( { 'components': (
metacluster_chartvalues | metacluster_chartvalues |
combine({ 'clusterapi': components.clusterapi }) | combine({ 'clusterapi': components.clusterapi }) |
combine({ 'kubevip' : components.kubevip }) ) combine({ 'kubevip' : components.kubevip }) ),
'appliance': {
'version': (applianceversion)
}
} | to_nice_yaml(indent=2, width=4096) } | to_nice_yaml(indent=2, width=4096)
}} }}
- name: Aggregate chart_values into dict - name: Aggregate chart_values into dict
ansible.builtin.set_fact: ansible.builtin.set_fact:
workloadcluster_chartvalues: "{{ workloadcluster_chartvalues | default({}) | combine({ item.key: { 'chart_values': (item.value.chart_values | default('') | from_yaml) } }) }}" workloadcluster_chartvalues: "{{ workloadcluster_chartvalues | default({}) | combine({ item.key: { 'chart_values': (item.value.chart_values | default('') | from_yaml) } }) }}"
# when: item.value.chart_values is defined
loop: "{{ query('ansible.builtin.dict', downstream.helm_charts) }}" loop: "{{ query('ansible.builtin.dict', downstream.helm_charts) }}"
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"

View File

@ -0,0 +1,27 @@
- block:
- name: Install json-server chart
kubernetes.core.helm:
name: json-server
chart_ref: /opt/metacluster/helm-charts/json-server
release_namespace: json-server
create_namespace: true
wait: false
kubeconfig: "{{ kubeconfig.path }}"
values: "{{ components['json-server'].chart_values }}"
- name: Ensure json-server API availability
ansible.builtin.uri:
url: https://version.{{ vapp['metacluster.fqdn'] }}/healthz
method: GET
register: api_readycheck
until:
- api_readycheck.json.status is defined
- api_readycheck.json.status == 'running'
retries: "{{ playbook.retries }}"
delay: "{{ (storage_benchmark | int) * (playbook.delay.long | int) }}"
module_defaults:
ansible.builtin.uri:
validate_certs: no
status_code: [200, 201]
body_format: json

View File

@ -1,5 +1,6 @@
- import_tasks: init.yml - import_tasks: init.yml
- import_tasks: k3s.yml - import_tasks: k3s.yml
- import_tasks: json-server.yml
- import_tasks: assets.yml - import_tasks: assets.yml
- import_tasks: kube-vip.yml - import_tasks: kube-vip.yml
- import_tasks: storage.yml - import_tasks: storage.yml

View File

@ -51,6 +51,8 @@ platform:
url: https://prometheus-community.github.io/helm-charts url: https://prometheus-community.github.io/helm-charts
- name: smallstep - name: smallstep
url: https://smallstep.github.io/helm-charts/ url: https://smallstep.github.io/helm-charts/
- name: spamasaurus
url: https://code.spamasaurus.com/api/packages/djpbessems/helm
components: components:
@ -225,6 +227,34 @@ components:
registry: registry:
size: 25Gi size: 25Gi
json-server:
helm:
version: v0.5.1
chart: spamasaurus/json-server
parse_logic: helm template . | yq --no-doc eval '.. | .image? | select(.)' | sort -u | awk '!/ /'
chart_values: !unsafe |
ingress:
enabled: true
hosts:
- host: version.{{ vapp['metacluster.fqdn'] }}
paths:
- path: /
pathType: Prefix
seedData:
configInline: |
{
"appliance": { "version": "{{ appliance.version }}" },
"components": [
{ "app": "argo-cd", "version": "{{ components[argo-cd].helm.version }}" },
{ "app": "cert-manager", "version": "{{ components[cert-manager].helm.version }}" },
{ "app": "cluster-api",
"management": { "foo": "bar" },
"workload": { "foo": "bar" }
}
],
"healthz": { "status": "running" }
}
# keycloakx: # keycloakx:
# helm: # helm:
# version: 2.1.1 # (= Keycloak 20.0.3) # version: 2.1.1 # (= Keycloak 20.0.3)