2022-07-13 08:04:46 -04:00
|
|
|
name: Constellation create
|
2023-10-27 03:37:26 -04:00
|
|
|
description: Create a new Constellation cluster using the latest OS image.
|
2022-10-24 12:47:03 -04:00
|
|
|
|
2022-05-03 05:15:53 -04:00
|
|
|
inputs:
|
|
|
|
workerNodesCount:
|
|
|
|
description: "Number of worker nodes to spawn."
|
|
|
|
required: true
|
|
|
|
controlNodesCount:
|
|
|
|
description: "Number of control-plane nodes to spawn."
|
|
|
|
required: true
|
|
|
|
cloudProvider:
|
2023-08-08 06:02:43 -04:00
|
|
|
description: "Either 'gcp', 'aws' or 'azure'."
|
2022-05-03 05:15:53 -04:00
|
|
|
required: true
|
2024-01-25 09:32:19 -05:00
|
|
|
attestationVariant:
|
|
|
|
description: "Attestation variant to use."
|
|
|
|
required: true
|
2022-05-03 05:15:53 -04:00
|
|
|
machineType:
|
|
|
|
description: "Machine type of VM to spawn."
|
2022-09-02 06:09:45 -04:00
|
|
|
required: false
|
2023-08-07 05:02:00 -04:00
|
|
|
cliVersion:
|
|
|
|
description: "Version of the CLI"
|
|
|
|
required: true
|
2022-10-21 04:16:44 -04:00
|
|
|
osImage:
|
2022-11-23 03:41:42 -05:00
|
|
|
description: "OS image to use."
|
2022-08-09 09:29:39 -04:00
|
|
|
required: true
|
|
|
|
isDebugImage:
|
2022-10-21 04:16:44 -04:00
|
|
|
description: "Is OS img a debug img?"
|
2022-08-09 09:29:39 -04:00
|
|
|
required: true
|
2022-08-09 04:02:15 -04:00
|
|
|
kubernetesVersion:
|
|
|
|
description: "Kubernetes version to create the cluster from."
|
|
|
|
required: false
|
2023-04-13 06:02:19 -04:00
|
|
|
artifactNameSuffix:
|
|
|
|
description: "Suffix for artifact naming."
|
|
|
|
required: true
|
2023-08-04 03:43:32 -04:00
|
|
|
fetchMeasurements:
|
|
|
|
default: "false"
|
|
|
|
description: "Update measurements via the 'constellation config fetch-measurements' command."
|
2023-08-08 06:02:43 -04:00
|
|
|
azureSNPEnforcementPolicy:
|
|
|
|
required: false
|
|
|
|
description: "Azure SNP enforcement policy."
|
2023-08-21 02:01:33 -04:00
|
|
|
test:
|
|
|
|
description: "The e2e test payload."
|
|
|
|
required: true
|
2023-09-27 10:17:31 -04:00
|
|
|
azureClusterCreateCredentials:
|
|
|
|
description: "Azure credentials authorized to create a Constellation cluster."
|
|
|
|
required: true
|
|
|
|
azureIAMCreateCredentials:
|
|
|
|
description: "Azure credentials authorized to create an IAM configuration."
|
|
|
|
required: true
|
|
|
|
refStream:
|
|
|
|
description: "Reference and stream of the image in use"
|
|
|
|
required: false
|
2023-10-17 09:46:15 -04:00
|
|
|
internalLoadBalancer:
|
|
|
|
description: "Whether to use an internal load balancer for the control plane"
|
|
|
|
required: false
|
2023-12-15 04:37:29 -05:00
|
|
|
clusterCreation:
|
2024-02-01 09:05:07 -05:00
|
|
|
description: "How to create infrastructure for the e2e test. One of [cli, terraform]."
|
2023-12-15 04:37:29 -05:00
|
|
|
default: "cli"
|
2023-12-08 08:40:31 -05:00
|
|
|
marketplaceImageVersion:
|
|
|
|
description: "Marketplace OS image version. Used instead of osImage."
|
|
|
|
required: false
|
|
|
|
force:
|
|
|
|
description: "Set the force-flag on apply to ignore version mismatches."
|
|
|
|
required: false
|
2023-12-21 13:28:18 -05:00
|
|
|
encryptionSecret:
|
2023-12-20 09:17:49 -05:00
|
|
|
description: "The secret to use for encrypting the artifact."
|
|
|
|
required: true
|
2022-10-24 12:47:03 -04:00
|
|
|
|
|
|
|
outputs:
|
|
|
|
kubeconfig:
|
|
|
|
description: "The kubeconfig for the cluster."
|
2023-12-15 04:37:29 -05:00
|
|
|
value: ${{ steps.get-kubeconfig.outputs.KUBECONFIG }}
|
2023-04-04 04:47:26 -04:00
|
|
|
osImageUsed:
|
|
|
|
description: "The OS image used in the cluster."
|
|
|
|
value: ${{ steps.setImage.outputs.image }}
|
2022-10-24 12:47:03 -04:00
|
|
|
|
2022-05-03 05:15:53 -04:00
|
|
|
runs:
|
2022-08-09 04:02:15 -04:00
|
|
|
using: "composite"
|
2022-05-03 05:15:53 -04:00
|
|
|
steps:
|
2023-08-09 02:39:22 -04:00
|
|
|
- name: Set constellation name
|
2022-10-24 12:47:03 -04:00
|
|
|
shell: bash
|
2022-08-09 04:02:15 -04:00
|
|
|
run: |
|
2023-02-10 07:27:22 -05:00
|
|
|
yq eval -i "(.name) = \"e2e-test\"" constellation-conf.yaml
|
|
|
|
|
2023-08-08 06:02:43 -04:00
|
|
|
- name: Set Azure SNP enforcement policy
|
|
|
|
if: inputs.azureSNPEnforcementPolicy != ''
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-01-25 09:32:19 -05:00
|
|
|
if [[ ${{ inputs.attestationVariant }} != 'azure-sev-snp' ]]; then
|
2023-08-08 06:02:43 -04:00
|
|
|
echo "SNP enforcement policy is only supported for Azure"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
yq eval -i "(.attestation.azureSEVSNP.firmwareSignerConfig.enforcementPolicy) \
|
|
|
|
= \"${{ inputs.azureSNPEnforcementPolicy }}\"" constellation-conf.yaml
|
|
|
|
|
2022-08-09 09:29:39 -04:00
|
|
|
- name: Set image
|
2023-04-04 04:47:26 -04:00
|
|
|
id: setImage
|
2022-10-24 12:47:03 -04:00
|
|
|
shell: bash
|
|
|
|
env:
|
2023-04-04 04:47:26 -04:00
|
|
|
imageInput: ${{ inputs.osImage }}
|
|
|
|
run: |
|
|
|
|
if [[ -z "${imageInput}" ]]; then
|
|
|
|
echo "No image specified. Using default image from config."
|
|
|
|
image=$(yq eval ".image" constellation-conf.yaml)
|
|
|
|
echo "image=${image}" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
yq eval -i "(.image) = \"${imageInput}\"" constellation-conf.yaml
|
|
|
|
echo "image=${imageInput}" | tee -a "$GITHUB_OUTPUT"
|
2022-08-09 09:29:39 -04:00
|
|
|
|
2024-02-06 06:13:59 -05:00
|
|
|
- name: Set marketplace image flag (AWS)
|
|
|
|
if: inputs.marketplaceImageVersion != '' && inputs.cloudProvider == 'aws'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yq eval -i "(.provider.aws.useMarketplaceImage) = true" constellation-conf.yaml
|
|
|
|
yq eval -i "(.image) = \"${{ inputs.marketplaceImageVersion }}\"" constellation-conf.yaml
|
|
|
|
|
2023-12-08 08:40:31 -05:00
|
|
|
- name: Set marketplace image flag (Azure)
|
|
|
|
if: inputs.marketplaceImageVersion != '' && inputs.cloudProvider == 'azure'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yq eval -i "(.provider.azure.useMarketplaceImage) = true" constellation-conf.yaml
|
|
|
|
yq eval -i "(.image) = \"${{ inputs.marketplaceImageVersion }}\"" constellation-conf.yaml
|
|
|
|
|
2024-01-08 09:51:39 -05:00
|
|
|
- name: Set marketplace image flag (GCP)
|
|
|
|
if: inputs.marketplaceImageVersion != '' && inputs.cloudProvider == 'gcp'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yq eval -i "(.provider.gcp.useMarketplaceImage) = true" constellation-conf.yaml
|
|
|
|
yq eval -i "(.image) = \"${{ inputs.marketplaceImageVersion }}\"" constellation-conf.yaml
|
|
|
|
|
2023-08-04 03:43:32 -04:00
|
|
|
- name: Update measurements for non-stable images
|
|
|
|
if: inputs.fetchMeasurements
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
constellation config fetch-measurements --debug --insecure
|
|
|
|
|
2022-09-02 06:09:45 -04:00
|
|
|
- name: Set instanceType
|
2023-01-17 12:49:00 -05:00
|
|
|
if: inputs.machineType && inputs.machineType != 'default'
|
2022-09-02 06:09:45 -04:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-08-02 04:45:32 -04:00
|
|
|
yq eval -i "(.nodeGroups[] | .instanceType) = \"${{ inputs.machineType }}\"" constellation-conf.yaml
|
|
|
|
|
|
|
|
- name: Set node count
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yq eval -i "(.nodeGroups[] | select(.role == \"control-plane\") | .initialCount) = ${{ inputs.controlNodesCount }}" constellation-conf.yaml
|
|
|
|
yq eval -i "(.nodeGroups[] | select(.role == \"worker\") | .initialCount) = ${{ inputs.workerNodesCount }}" constellation-conf.yaml
|
2022-09-02 06:09:45 -04:00
|
|
|
|
2022-09-06 04:38:14 -04:00
|
|
|
- name: Enable debugCluster flag
|
2023-01-17 12:49:00 -05:00
|
|
|
if: inputs.isDebugImage == 'true'
|
2022-10-24 12:47:03 -04:00
|
|
|
shell: bash
|
2022-08-09 09:29:39 -04:00
|
|
|
run: |
|
2022-09-06 04:38:14 -04:00
|
|
|
yq eval -i '(.debugCluster) = true' constellation-conf.yaml
|
2022-08-09 09:29:39 -04:00
|
|
|
|
2023-10-17 09:46:15 -04:00
|
|
|
- name: Enable internalLoadBalancer flag
|
|
|
|
if: inputs.internalLoadBalancer == 'true'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yq eval -i '(.internalLoadBalancer) = true' constellation-conf.yaml
|
|
|
|
|
2023-10-27 03:37:26 -04:00
|
|
|
- name: Show Cluster Configuration
|
2022-10-24 12:47:03 -04:00
|
|
|
shell: bash
|
2022-08-09 04:02:15 -04:00
|
|
|
run: |
|
|
|
|
echo "Creating cluster using config:"
|
|
|
|
cat constellation-conf.yaml
|
2022-12-13 04:07:09 -05:00
|
|
|
sudo sh -c 'echo "127.0.0.1 license.confidential.cloud" >> /etc/hosts' || true
|
2023-10-27 03:37:26 -04:00
|
|
|
|
|
|
|
- name: Constellation create (CLI)
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-01-25 09:32:19 -05:00
|
|
|
constellation apply --skip-phases=init,attestationconfig,certsans,helm,image,k8s -y --debug --tf-log=DEBUG
|
2022-08-09 04:02:15 -04:00
|
|
|
|
2022-08-09 09:29:39 -04:00
|
|
|
- name: Cdbg deploy
|
2023-01-17 12:49:00 -05:00
|
|
|
if: inputs.isDebugImage == 'true'
|
2023-09-27 10:17:31 -04:00
|
|
|
uses: ./.github/actions/cdbg_deploy
|
|
|
|
with:
|
|
|
|
cloudProvider: ${{ inputs.cloudProvider }}
|
2024-01-25 09:32:19 -05:00
|
|
|
attestationVariant: ${{ inputs.attestationVariant }}
|
2023-09-27 10:17:31 -04:00
|
|
|
test: ${{ inputs.test }}
|
|
|
|
azureClusterCreateCredentials: ${{ inputs.azureClusterCreateCredentials }}
|
|
|
|
azureIAMCreateCredentials: ${{ inputs.azureIAMCreateCredentials }}
|
|
|
|
refStream: ${{ inputs.refStream }}
|
|
|
|
kubernetesVersion: ${{ inputs.kubernetesVersion }}
|
2023-12-15 04:37:29 -05:00
|
|
|
clusterCreation: ${{ inputs.clusterCreation }}
|
2023-11-08 09:27:40 -05:00
|
|
|
|
2023-12-08 08:40:31 -05:00
|
|
|
- name: Set force flag
|
|
|
|
id: set-force-flag
|
|
|
|
if: inputs.force == 'true'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "flag=--force" | tee -a $GITHUB_OUTPUT
|
|
|
|
|
2024-07-25 11:38:17 -04:00
|
|
|
- name: Set conformance flag
|
|
|
|
id: set-conformance-flag
|
|
|
|
if: inputs.test == 'sonobuoy conformance'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "flag=--conformance" | tee -a $GITHUB_OUTPUT
|
|
|
|
|
2023-12-15 04:37:29 -05:00
|
|
|
- name: Constellation apply (Terraform)
|
|
|
|
id: constellation-apply-terraform
|
|
|
|
if: inputs.clusterCreation == 'terraform'
|
|
|
|
uses: ./.github/actions/terraform_apply
|
|
|
|
with:
|
|
|
|
cloudProvider: ${{ inputs.cloudProvider }}
|
|
|
|
|
|
|
|
- name: Constellation apply
|
|
|
|
id: constellation-apply-cli
|
|
|
|
if: inputs.clusterCreation != 'terraform'
|
2022-10-24 12:47:03 -04:00
|
|
|
shell: bash
|
2022-08-09 04:02:15 -04:00
|
|
|
run: |
|
2024-07-25 11:38:17 -04:00
|
|
|
constellation apply --skip-phases=infrastructure --debug ${{ steps.set-force-flag.outputs.flag }} ${{ steps.set-conformance-flag.outputs.flag }}
|
2023-12-15 04:37:29 -05:00
|
|
|
|
|
|
|
- name: Get kubeconfig
|
|
|
|
id: get-kubeconfig
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-08-09 07:00:27 -04:00
|
|
|
echo "KUBECONFIG=$(pwd)/constellation-admin.conf" | tee -a $GITHUB_OUTPUT
|
2022-09-05 12:12:46 -04:00
|
|
|
|
2022-09-09 07:28:53 -04:00
|
|
|
- name: Wait for nodes to join and become ready
|
2022-10-24 12:47:03 -04:00
|
|
|
shell: bash
|
|
|
|
env:
|
2023-12-15 04:37:29 -05:00
|
|
|
KUBECONFIG: "${{ steps.get-kubeconfig.outputs.KUBECONFIG }}"
|
2022-10-24 12:47:03 -04:00
|
|
|
JOINTIMEOUT: "1200" # 20 minutes timeout for all nodes to join
|
ci: make waiting for nodes more robust (#2981)
* ci: make waiting for nodes more robust
After initializing the cluster, a lot of things happen in parallel and
are potentially getting in each others' way: nodes are joining,
daemonsets are proliferating, the network is being set up. During this
period, it's not unusual that the Kubernetes API server is unavailable
for a short time, e.g. due to etcd loosing quorum or load balancing
changes.
This period of instability has the potential to affect all kubectl
commands negatively, leading to problems especially for tests, where
command failures often lead to test failures. On the other hand, we'd
expect everything to be quite stable after the initial dust settles.
Therefore, this commit changes how we wait after initializing a cluster.
Until we have a reasonable expectation of readiness, we ignore command
failures and wait for things to stabilize. The cluster is considered
stable once all configured nodes and all API servers report ready.
2024-03-13 04:42:18 -04:00
|
|
|
CONTROL_NODES_COUNT: "${{ inputs.controlNodesCount }}"
|
|
|
|
WORKER_NODES_COUNT: "${{ inputs.workerNodesCount }}"
|
|
|
|
run: ./.github/actions/constellation_create/wait-for-nodes.sh
|
2022-09-09 07:28:53 -04:00
|
|
|
|
2022-09-05 12:12:46 -04:00
|
|
|
- name: Download boot logs
|
2023-01-17 12:49:00 -05:00
|
|
|
if: always()
|
2022-10-24 12:47:03 -04:00
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
CSP: ${{ inputs.cloudProvider }}
|
2022-09-05 12:12:46 -04:00
|
|
|
run: |
|
|
|
|
echo "::group::Download boot logs"
|
2023-10-09 07:04:29 -04:00
|
|
|
CONSTELL_UID=$(yq '.infrastructure.uid' constellation-state.yaml)
|
2022-09-05 12:12:46 -04:00
|
|
|
case $CSP in
|
|
|
|
azure)
|
|
|
|
AZURE_RESOURCE_GROUP=$(yq eval ".provider.azure.resourceGroup" constellation-conf.yaml)
|
|
|
|
./.github/actions/constellation_create/az-logs.sh ${AZURE_RESOURCE_GROUP}
|
|
|
|
;;
|
|
|
|
gcp)
|
2023-07-13 10:28:33 -04:00
|
|
|
GCP_ZONE=$(yq eval ".provider.gcp.zone" constellation-conf.yaml)
|
|
|
|
./.github/actions/constellation_create/gcp-logs.sh ${GCP_ZONE} ${CONSTELL_UID}
|
2022-09-05 12:12:46 -04:00
|
|
|
;;
|
2022-11-08 10:43:17 -05:00
|
|
|
aws)
|
2023-07-13 10:28:33 -04:00
|
|
|
./.github/actions/constellation_create/aws-logs.sh us-east-2 ${CONSTELL_UID}
|
2022-11-08 10:43:17 -05:00
|
|
|
;;
|
2022-09-05 12:12:46 -04:00
|
|
|
esac
|
|
|
|
echo "::endgroup::"
|
2022-10-24 12:47:03 -04:00
|
|
|
|
2022-09-05 12:12:46 -04:00
|
|
|
- name: Upload boot logs
|
2023-01-17 12:49:00 -05:00
|
|
|
if: always() && !env.ACT
|
2023-04-14 12:50:58 -04:00
|
|
|
continue-on-error: true
|
2023-12-20 09:17:49 -05:00
|
|
|
uses: ./.github/actions/artifact_upload
|
2022-09-05 12:12:46 -04:00
|
|
|
with:
|
2023-04-13 06:02:19 -04:00
|
|
|
name: serial-logs-${{ inputs.artifactNameSuffix }}
|
2023-12-20 09:17:49 -05:00
|
|
|
path: >
|
|
|
|
!(terraform).log
|
2023-12-21 13:28:18 -05:00
|
|
|
encryptionSecret: ${{ inputs.encryptionSecret }}
|
2024-01-31 10:22:05 -05:00
|
|
|
|
|
|
|
- name: Prepare terraform state folders
|
|
|
|
if: always()
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-02-01 03:54:40 -05:00
|
|
|
mkdir to-zip
|
|
|
|
cp -r constellation-terraform to-zip
|
|
|
|
cp -r constellation-iam-terraform to-zip
|
2024-05-07 02:48:38 -04:00
|
|
|
rm -f to-zip/constellation-terraform/plan.zip
|
2024-02-01 03:54:40 -05:00
|
|
|
rm -rf to-zip/constellation-terraform/.terraform to-zip/constellation-iam-terraform/.terraform
|
2024-01-31 10:22:05 -05:00
|
|
|
|
|
|
|
- name: Upload terraform state
|
|
|
|
if: always()
|
|
|
|
uses: ./.github/actions/artifact_upload
|
|
|
|
with:
|
|
|
|
name: terraform-state-${{ inputs.artifactNameSuffix }}
|
|
|
|
path: >
|
2024-02-01 03:54:40 -05:00
|
|
|
to-zip/constellation-terraform
|
|
|
|
to-zip/constellation-iam-terraform
|
2024-01-31 10:22:05 -05:00
|
|
|
encryptionSecret: ${{ inputs.encryptionSecret }}
|