diff --git a/.github/tests/lockdown/.env b/.github/tests/lockdown/.env deleted file mode 100644 index 7b6e741..0000000 --- a/.github/tests/lockdown/.env +++ /dev/null @@ -1 +0,0 @@ -export EXTRA_HELM_ARGS="--values=examples/production/values.yaml" diff --git a/.github/tests/lockdown/post-install.sh b/.github/tests/lockdown/post-install.sh deleted file mode 100755 index d93ebd9..0000000 --- a/.github/tests/lockdown/post-install.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -set -x - -SCRIPT=$(readlink -f "$0") -SCRIPTPATH=$(dirname "$SCRIPT") - -k_wait=(kubectl wait --for condition=available --timeout 30s --namespace) -k_rollout_status=(kubectl rollout status --watch --timeout 30s --namespace) - -cat <>"$GITHUB_STEP_SUMMARY" -### spire -| workload | Status | -| -------- | ------ | -| spire-server | $("${k_rollout_status[@]}" spire-server statefulset spire-server) | -| spire-spiffe-csi-driver | $("${k_rollout_status[@]}" spire-system daemonset spire-spiffe-csi-driver) | -| spire-agent | $("${k_rollout_status[@]}" spire-system daemonset spire-agent) | -| spire-spiffe-oidc-discovery-provider | $("${k_wait[@]}" spire-server deployments.apps spire-spiffe-oidc-discovery-provider) | -EOF - -if [ $1 -ne 0 ]; then - echo - echo '```' - echo '==> Events of namespace spire-server' - echo '........................................................................................................................' - echo '>>> kubectl --request-timeout=30s get events --output wide --namespace spire-server' - kubectl --request-timeout=30s get events --output wide --namespace spire-server - echo '........................................................................................................................' - echo '<== Events of namespace spire-server' - echo '........................................................................................................................' - echo '>>> kubectl --request-timeout=30s describe pods --namespace spire-server' - kubectl --request-timeout=30s describe pods --namespace spire-server - echo '========================================================================================================================' - echo '==> Events of namespace spire-system' - echo '........................................................................................................................' - echo '>>> kubectl --request-timeout=30s get events --output wide --namespace spire-system' - kubectl --request-timeout=30s get events --output wide --namespace spire-system - echo '........................................................................................................................' - echo '<== Events of namespace spire-system' - echo '........................................................................................................................' - echo '>>> kubectl --request-timeout=30s describe pods --namespace spire-system' - kubectl --request-timeout=30s describe pods --namespace spire-system - echo '========================================================================================================================' - kubectl get pods -o name -n spire-server | while read line; do echo logs for $line; kubectl logs -n spire-server $line --all-containers=true --ignore-errors=true; done - kubectl get pods -o name -n spire-system | while read line; do echo logs for $line; kubectl logs -n spire-system $line --all-containers=true --ignore-errors=true; done - echo '========================================================================================================================' - echo '```' -fi | cat >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/tests/lockdown/pre-install.sh b/.github/tests/lockdown/pre-install.sh deleted file mode 100755 index 8336be0..0000000 --- a/.github/tests/lockdown/pre-install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -kubectl create namespace "spire-system" -kubectl label namespace "spire-system" pod-security.kubernetes.io/enforce=privileged -kubectl create namespace "spire-server" -kubectl label namespace "spire-server" pod-security.kubernetes.io/enforce=restricted diff --git a/.github/tests/lockdown/values.yaml b/.github/tests/lockdown/values.yaml deleted file mode 100644 index 3260fb5..0000000 --- a/.github/tests/lockdown/values.yaml +++ /dev/null @@ -1,5 +0,0 @@ -spiffe-oidc-discovery-provider: - namespaceOverride: spire-server - -spire-server: - namespaceOverride: spire-server diff --git a/.github/tests/production-example/install.sh b/.github/tests/production-example/install.sh new file mode 100755 index 0000000..c44be6f --- /dev/null +++ b/.github/tests/production-example/install.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -x + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +ct install --debug \ + --namespace spire-server \ + --values "${SCRIPTPATH}/../../../examples/production/values.yaml" \ + spire charts/spire diff --git a/.github/tests/production-example/post-install.sh b/.github/tests/production-example/post-install.sh new file mode 100755 index 0000000..ee0963e --- /dev/null +++ b/.github/tests/production-example/post-install.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +set -x + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +k_wait=(kubectl wait --for condition=available --timeout 30s --namespace) +k_rollout_status=(kubectl rollout status --watch --timeout 30s --namespace) + +function get_namespace_details { +cat <>"$GITHUB_STEP_SUMMARY" +### Namespace $1 + +#### Events + +\`\`\`shell +$(kubectl --request-timeout=30s get events --output wide --namespace "$1") +\`\`\` + +#### Pods + +\`\`\`shell +$(kubectl --request-timeout=30s describe pods --namespace "$1") +\`\`\` + +#### Logs + +\`\`\`shell +$(kubectl get pods -o name -n "$1" | while read -r line; do echo logs for "${line}"; kubectl logs -n "$1" "${line}" --all-containers=true --ignore-errors=true; done) +\`\`\` + +EOF +} + +cat <>"$GITHUB_STEP_SUMMARY" +### spire + +| workload | Status | +| ------------------------------------ | ------ | +| spire-server | "$("${k_rollout_status[@]}" spire-server statefulset spire-server)" | +| spire-controller-manager | "$("${k_rollout_status[@]}" spire-server statefulset spire-controller-manager)" | +| spire-spiffe-oidc-discovery-provider | "$("${k_wait[@]}" spire-server deployments.apps spire-spiffe-oidc-discovery-provider)" | +| spire-spiffe-csi-driver | "$("${k_rollout_status[@]}" spire-system daemonset spire-spiffe-csi-driver)" | +| spire-agent | "$("${k_rollout_status[@]}" spire-system daemonset spire-agent)" | +EOF + +if [ $1 -ne 0 ]; then + get_namespace_details spire-server + get_namespace_details spire-systen +fi diff --git a/.github/tests/production-example/pre-install.sh b/.github/tests/production-example/pre-install.sh new file mode 100755 index 0000000..b33d1ed --- /dev/null +++ b/.github/tests/production-example/pre-install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +kubectl create namespace spire-system +kubectl label namespace spire-system pod-security.kubernetes.io/enforce=privileged +kubectl create namespace spire-server +kubectl label namespace spire-server pod-security.kubernetes.io/enforce=restricted diff --git a/.github/workflows/helm-chart-ci.yaml b/.github/workflows/helm-chart-ci.yaml index f4aa84f..55c5846 100644 --- a/.github/workflows/helm-chart-ci.yaml +++ b/.github/workflows/helm-chart-ci.yaml @@ -10,6 +10,7 @@ on: - '.github/kind/conf/kind-config.yaml' - '.github/tests/**/*.yaml' - '.github/tests/**/*.sh' + - 'examples/**/*.yaml' - 'helm-docs.sh' concurrency: