
* Add a Helm chart for a cronjob for doing etcd defrag * Add HelmRelease to deploy etcd defrag cronjob onto clusters * Use charts from the repository in tests * Clarify comment in values * Reinstate pull_request_target
164 lines
5.0 KiB
YAML
164 lines
5.0 KiB
YAML
name: Upgrade and test cluster
|
||
|
||
description: >-
|
||
Run a Helm upgrade using the specified chart version and values, wait for
|
||
the cluster to become ready and run Sonobuoy against it
|
||
|
||
inputs:
|
||
name:
|
||
description: The name of the cluster
|
||
required: true
|
||
os-client-config-file:
|
||
description: The path of the OpenStack clouds file
|
||
required: true
|
||
default: ./clouds.yaml
|
||
os-cloud:
|
||
description: The name of the cloud within the OpenStack clouds file
|
||
required: true
|
||
default: openstack
|
||
chart-repo:
|
||
description: The repository to fetch the charts from
|
||
required: true
|
||
default: https://stackhpc.github.io/capi-helm-charts
|
||
chart-name:
|
||
description: The name of the chart to use
|
||
required: true
|
||
default: openstack-cluster
|
||
chart-version:
|
||
description: The version of the charts to use
|
||
required: true
|
||
values-path:
|
||
description: The path to a file containing Helm values
|
||
required: true
|
||
default: ./values.yaml
|
||
kubernetes-version:
|
||
description: The Kubernetes version in the image
|
||
required: true
|
||
image-id:
|
||
description: The ID of the image to use
|
||
required: true
|
||
sonobuoy-mode:
|
||
description: |
|
||
The mode for the Sonobuoy run.
|
||
One of certified-conformance, conformance-lite, non-disruptive-conformance, quick.
|
||
required: true
|
||
default: quick
|
||
sonobuoy-upload:
|
||
description: Specify "yes" to upload the Sonobuoy run as an artifact
|
||
required: true
|
||
default: "no"
|
||
skip-workload-status:
|
||
description: Specify "yes" to skip the workload status check
|
||
required: true
|
||
default: "no"
|
||
|
||
runs:
|
||
using: "composite"
|
||
steps:
|
||
- name: Install or upgrade cluster from directory
|
||
shell: bash
|
||
run: |-
|
||
helm upgrade ${{ inputs.name }} ${{ inputs.chart-name }} \
|
||
--repo ${{ inputs.chart-repo }} \
|
||
--version ${{ inputs.chart-version }} \
|
||
--install \
|
||
--values ${{ inputs.os-client-config-file }} \
|
||
--values ${{ inputs.values-path }} \
|
||
--set cloudName=${{ inputs.os-cloud }} \
|
||
--set kubernetesVersion=${{ inputs.kubernetes-version }} \
|
||
--set machineImageId=${{ inputs.image-id }}
|
||
|
||
# Wait for any upgrade to start before checking if it is complete
|
||
# This is to make sure the controller has actioned the update before
|
||
# progressing to wait for ready
|
||
# However, in some cases the cluster will never become unready, e.g.
|
||
# in the chart upgrade tests if there are no changes to templates
|
||
# In this case, we time out after 2m which should be enough time for
|
||
# the controllers to react
|
||
- name: Wait for cluster not ready
|
||
shell: bash
|
||
run: |-
|
||
kubectl wait clusters/${{ inputs.name }} \
|
||
--for=condition=ready=false \
|
||
--timeout 2m
|
||
continue-on-error: true
|
||
|
||
- name: Wait for cluster ready
|
||
shell: bash
|
||
run: |-
|
||
kubectl wait clusters/${{ inputs.name }} \
|
||
--for=condition=ready \
|
||
--timeout 30m
|
||
|
||
- name: Wait for machine deployments to be running
|
||
shell: bash
|
||
run: |-
|
||
kubectl wait machinedeployments \
|
||
--all \
|
||
--for=jsonpath='{.status.phase}'=Running \
|
||
--timeout 30m
|
||
|
||
- name: Wait for addons to deploy
|
||
shell: bash
|
||
run: |-
|
||
kubectl wait manifests \
|
||
--all \
|
||
--for=jsonpath='{.status.phase}'=Deployed \
|
||
--timeout 20m \
|
||
&& \
|
||
kubectl wait helmreleases \
|
||
--all \
|
||
--for=jsonpath='{.status.phase}'=Deployed \
|
||
--timeout 20m
|
||
|
||
- name: Write kubeconfig
|
||
shell: bash
|
||
run: |-
|
||
kubectl get secret ${{ inputs.name }}-kubeconfig \
|
||
-o go-template='{{ .data.value | base64decode }}' \
|
||
> kubeconfig
|
||
|
||
- name: Wait for all workloads rollouts to complete
|
||
shell: bash
|
||
run: |-
|
||
set -e
|
||
NAMESPACES=$(kubectl get ns --no-headers --output jsonpath='{.items[*].metadata.name}')
|
||
for ns in $NAMESPACES; do
|
||
echo "namespace: $ns"
|
||
kubectl rollout status \
|
||
--namespace "$ns" \
|
||
--watch \
|
||
--timeout 20m \
|
||
deployments,statefulsets,daemonsets
|
||
done
|
||
env:
|
||
KUBECONFIG: ./kubeconfig
|
||
if: "${{ inputs.skip-workload-status != 'yes' }}"
|
||
|
||
- name: Run sonobuoy
|
||
shell: bash
|
||
run: sonobuoy run --mode ${{ inputs.sonobuoy-mode }} --wait
|
||
env:
|
||
KUBECONFIG: ./kubeconfig
|
||
|
||
- name: Retrieve sonobuoy results
|
||
shell: bash
|
||
run: ./scripts/sonobuoy-retrieve.sh --filename ./sonobuoy-results-${{ inputs.name }}.tar.gz
|
||
env:
|
||
KUBECONFIG: ./kubeconfig
|
||
if: "${{ inputs.sonobuoy-upload == 'yes' }}"
|
||
|
||
- name: Upload sonobuoy results artifact
|
||
uses: actions/upload-artifact@v3
|
||
with:
|
||
name: sonobuoy-results-${{ inputs.name }}
|
||
path: ./sonobuoy-results-${{ inputs.name }}.tar.gz
|
||
if: "${{ inputs.sonobuoy-upload == 'yes' }}"
|
||
|
||
- name: Remove sonobuoy artifacts from cluster
|
||
shell: bash
|
||
run: sonobuoy delete --wait --all
|
||
env:
|
||
KUBECONFIG: ./kubeconfig
|
||
if: ${{ always() }}
|