Add serviceaccount token creation;Base delays on storage benchmark
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2023-03-08 17:07:44 +01:00
parent cabf813daa
commit f47777763a
21 changed files with 37 additions and 34 deletions

View File

@ -133,7 +133,7 @@
- api_readycheck.json.status is defined - api_readycheck.json.status is defined
- api_readycheck.json.status == 'ok' - api_readycheck.json.status == 'ok'
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -19,7 +19,7 @@
- api_readycheck.json.status is defined - api_readycheck.json.status is defined
- api_readycheck.json.status == 'pass' - api_readycheck.json.status == 'pass'
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
- name: Configure additional SSH ingress - name: Configure additional SSH ingress
ansible.builtin.template: ansible.builtin.template:

View File

@ -18,7 +18,7 @@
until: until:
- api_readycheck.json.Version is defined - api_readycheck.json.Version is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
- name: Generate argo-cd API token - name: Generate argo-cd API token
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -40,7 +40,7 @@
register: api_readycheck register: api_readycheck
until: api_readycheck.json.apiVersion is defined until: api_readycheck.json.apiVersion is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.medium }}" delay: "{{ (storage_benchmark * playbook.delay.medium) | int }}"
- name: Install kubectl tab-completion - name: Install kubectl tab-completion
ansible.builtin.shell: ansible.builtin.shell:
@ -77,4 +77,4 @@
until: until:
- k8snode_patch.result.metadata.labels['ova.airgappedk8s/moref_id'] is defined - k8snode_patch.result.metadata.labels['ova.airgappedk8s/moref_id'] is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.medium }}" delay: "{{ (storage_benchmark * playbook.delay.medium) | int }}"

View File

@ -19,7 +19,7 @@
- api_readycheck.json.status is defined - api_readycheck.json.status is defined
- api_readycheck.json.status == 'healthy' - api_readycheck.json.status == 'healthy'
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
- name: Push images to registry - name: Push images to registry
ansible.builtin.shell: ansible.builtin.shell:
@ -40,7 +40,7 @@
loop_control: loop_control:
label: "{{ item | basename }}" label: "{{ item | basename }}"
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.short }}" delay: "{{ (storage_benchmark * playbook.delay.short) | int }}"
until: push_result is not failed until: push_result is not failed
module_defaults: module_defaults:

View File

@ -17,7 +17,7 @@
until: until:
- api_readycheck is not failed - api_readycheck is not failed
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -150,7 +150,7 @@
register: certificate_subject register: certificate_subject
until: certificate_subject is not failed until: certificate_subject is not failed
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.medium }}" delay: "{{ (storage_benchmark * playbook.delay.medium) | int }}"
- name: Apply workload cluster manifest - name: Apply workload cluster manifest
kubernetes.core.k8s: kubernetes.core.k8s:
definition: >- definition: >-
@ -168,7 +168,7 @@
register: cluster_readycheck register: cluster_readycheck
until: cluster_readycheck is succeeded until: cluster_readycheck is succeeded
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
- name: Initialize tempfile - name: Initialize tempfile
ansible.builtin.tempfile: ansible.builtin.tempfile:

View File

@ -5,17 +5,10 @@
template: serviceaccount.j2 template: serviceaccount.j2
state: present state: present
- name: Retrieve service account bearer token
kubernetes.core.k8s_info:
kind: ServiceAccount
name: "{{ _template.account.name }}"
namespace: "{{ _template.account.namespace }}"
register: workloadcluster_serviceaccount
- name: Retrieve service account bearer token - name: Retrieve service account bearer token
kubernetes.core.k8s_info: kubernetes.core.k8s_info:
kind: Secret kind: Secret
name: "{{ workloadcluster_serviceaccount.resources | json_query('[].secrets[].name') | first }}" name: "{{ _template.account.name }}-secret"
namespace: "{{ _template.account.namespace }}" namespace: "{{ _template.account.namespace }}"
register: workloadcluster_bearertoken register: workloadcluster_bearertoken

View File

@ -4,6 +4,15 @@ metadata:
name: {{ _template.account.name }} name: {{ _template.account.name }}
namespace: {{ _template.account.namespace }} namespace: {{ _template.account.namespace }}
--- ---
apiVersion: v1
kind: Secret
metadata:
name: {{ _template.account.name }}-secret
namespace: {{ _template.account.namespace }}
annotations:
kubernetes.io/service-account.name: {{ _template.account.name }}
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:

View File

@ -8,5 +8,5 @@
label: "{{ item | basename }}" label: "{{ item | basename }}"
# Probably should add a task before that ensures K3s node is fully initialized before starting imports; currently K3s goes away briefly during this loop # Probably should add a task before that ensures K3s node is fully initialized before starting imports; currently K3s goes away briefly during this loop
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.short }}" delay: "{{ (storage_benchmark * playbook.delay.short) | int }}"
until: import_result is not failed until: import_result is not failed

View File

@ -5,7 +5,7 @@
schema: vsphere schema: vsphere
register: vcenter_info register: vcenter_info
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.short }}" delay: "{{ (storage_benchmark * playbook.delay.short) | int }}"
until: vcenter_info is not failed until: vcenter_info is not failed
module_defaults: module_defaults:

View File

@ -1,6 +1,7 @@
playbook: playbook:
retries: 5 retries: 5
delay: delay:
long: 60 # These values are multiplied with the value of `storage_benchmark`
medium: 30 long: 2
short: 10 medium: 1
short: 0.5

View File

@ -24,7 +24,7 @@
- nodedrain_results is not failed - nodedrain_results is not failed
- (nodedrain_results.stdout_lines | last) is match('node/.* drained') - (nodedrain_results.stdout_lines | last) is match('node/.* drained')
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.short }}" delay: "{{ (storage_benchmark * playbook.delay.short) | int }}"
- name: Delete node - name: Delete node
kubernetes.core.k8s: kubernetes.core.k8s:

View File

@ -43,7 +43,7 @@
- api_readycheck.json.status is defined - api_readycheck.json.status is defined
- api_readycheck.json.status == 'ok' - api_readycheck.json.status == 'ok'
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -19,7 +19,7 @@
loop_control: loop_control:
label: "{{ item | basename }}" label: "{{ item | basename }}"
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.short }}" delay: "{{ (storage_benchmark * playbook.delay.short) | int }}"
until: push_result is not failed until: push_result is not failed
- name: Get all stored container images (=artifacts) - name: Get all stored container images (=artifacts)

View File

@ -18,7 +18,7 @@
- api_readycheck.json.status is defined - api_readycheck.json.status is defined
- api_readycheck.json.status == 'pass' - api_readycheck.json.status == 'pass'
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -17,7 +17,7 @@
until: until:
- api_readycheck.json.Version is defined - api_readycheck.json.Version is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -40,7 +40,7 @@
register: api_readycheck register: api_readycheck
until: api_readycheck.json.apiVersion is defined until: api_readycheck.json.apiVersion is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.medium }}" delay: "{{ (storage_benchmark * playbook.delay.medium) | int }}"
- name: Install kubectl tab-completion - name: Install kubectl tab-completion
ansible.builtin.shell: ansible.builtin.shell:
@ -77,4 +77,4 @@
until: until:
- k8snode_patch.result.metadata.labels['ova.airgappedk8s/moref_id'] is defined - k8snode_patch.result.metadata.labels['ova.airgappedk8s/moref_id'] is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.medium }}" delay: "{{ (storage_benchmark * playbook.delay.medium) | int }}"

View File

@ -18,7 +18,7 @@
- api_readycheck.json.status is defined - api_readycheck.json.status is defined
- api_readycheck.json.status == 'healthy' - api_readycheck.json.status == 'healthy'
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -25,7 +25,7 @@
- (volume_details.json | json_query('data[? state==`attached`].robustness') | unique | length) == 1 - (volume_details.json | json_query('data[? state==`attached`].robustness') | unique | length) == 1
- (volume_details.json | json_query('data[? state==`attached`].robustness') | first) == "healthy" - (volume_details.json | json_query('data[? state==`attached`].robustness') | first) == "healthy"
retries: "{{ ( playbook.retries * 2) | int }}" retries: "{{ ( playbook.retries * 2) | int }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
- name: Upgrade longhorn chart - name: Upgrade longhorn chart
kubernetes.core.helm: kubernetes.core.helm:
@ -44,7 +44,7 @@
until: until:
- api_readycheck is not failed - api_readycheck is not failed
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.long }}" delay: "{{ (storage_benchmark * playbook.delay.long) | int }}"
module_defaults: module_defaults:
ansible.builtin.uri: ansible.builtin.uri:

View File

@ -8,4 +8,4 @@
until: until:
- api_readycheck.json.apiVersion is defined - api_readycheck.json.apiVersion is defined
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ playbook.delay.medium }}" delay: "{{ (storage_benchmark * playbook.delay.medium) | int }}"