From 916e5d6b552b6616cd8f6a850efe9c32e3b718bf Mon Sep 17 00:00:00 2001 From: katexochen <49727155+katexochen@users.noreply.github.com> Date: Wed, 29 Jun 2022 15:26:29 +0200 Subject: [PATCH] Rename coordinator to bootstrapper and rename roles --- .dockerignore | 2 +- .../actions/constellation_measure/action.yml | 8 +- .github/workflows/build-coordinator.yml | 28 +- .github/workflows/build-coreos-debug.yml | 2 +- .github/workflows/build-coreos.yml | 8 +- .../workflows/test-integration-etcdStore.yml | 27 - .github/workflows/test-integration.yml | 6 - .gitignore | 4 +- CMakeLists.txt | 20 +- Dockerfile.build | 10 +- README.md | 8 +- activation/kubernetesca/kubernetesca.go | 2 +- bootstrapper/README.md | 19 + .../cloudprovider/azure/api.go | 0 .../cloudprovider/azure/api_test.go | 0 .../cloudprovider/azure/autoscaler.go | 2 +- .../cloudprovider/azure/autoscaler_test.go | 2 +- .../cloudprovider/azure/ccm.go | 4 +- .../cloudprovider/azure/ccm_test.go | 2 +- .../cloudprovider/azure/cloudnodemanager.go | 2 +- .../azure/cloudnodemanager_test.go | 0 .../cloudprovider/azure/imds.go | 0 .../cloudprovider/azure/imds_test.go | 0 .../cloudprovider/azure/logger.go | 0 .../cloudprovider/azure/metadata.go | 0 .../cloudprovider/azure/metadata_test.go | 0 .../cloudprovider/azure/network.go | 0 .../cloudprovider/azure/network_test.go | 0 .../cloudprovider/azure/scaleset.go | 14 +- .../cloudprovider/azure/scaleset_test.go | 10 +- .../cloudprovider/azure/securityGroup.go | 0 .../cloudprovider/azure/virtualnetwork.go | 0 .../cloudprovider/azure/wrappers.go | 0 .../cloudprovider/gcp/api.go | 0 .../cloudprovider/gcp/autoscaler.go | 2 +- .../cloudprovider/gcp/autoscaler_test.go | 0 .../cloudprovider/gcp/ccm.go | 4 +- .../cloudprovider/gcp/ccm_test.go | 2 +- .../cloudprovider/gcp/client.go | 0 .../cloudprovider/gcp/client_test.go | 14 +- .../cloudprovider/gcp/cloudnodemanager.go | 0 .../gcp/cloudnodemanager_test.go | 0 .../cloudprovider/gcp/logger.go | 0 .../cloudprovider/gcp/metadata.go | 0 .../cloudprovider/gcp/metadata_test.go | 0 .../cloudprovider/gcp/role.go | 10 +- .../cloudprovider/gcp/role_test.go | 12 +- .../cloudprovider/gcp/wrappers.go | 0 .../cloudprovider/gcp/writer.go | 0 .../cloudprovider/gcp/writer_test.go | 0 .../cloudprovider/images.go | 0 .../cloudprovider/qemu/autoscaler.go | 2 +- .../cloudprovider/qemu/ccm.go | 2 +- .../cloudprovider/qemu/cloudnodemanager.go | 0 .../cloudprovider/qemu/metadata.go | 0 .../cmd/bootstrapper}/main.go | 16 +- .../cmd/bootstrapper}/run.go | 12 +- .../cmd/bootstrapper}/test.go | 4 +- .../initproto/init.pb.go | 8 +- .../initproto/init.proto | 2 +- .../initproto/init_grpc.pb.go | 0 .../internal/diskencryption/diskencryption.go | 0 .../diskencryption/diskencryption_test.go | 0 .../internal/initserver/initserver.go | 16 +- .../internal/initserver/initserver_test.go | 6 +- .../internal/joinclient/client.go | 22 +- .../internal/joinclient/client_test.go | 34 +- .../internal/kubernetes/cloud_provider.go | 2 +- .../internal/kubernetes/k8sapi/install.go | 0 .../kubernetes/k8sapi/install_test.go | 0 .../internal/kubernetes/k8sapi/joinargs.go | 0 .../kubernetes/k8sapi/joinargs_test.go | 0 .../kubernetes/k8sapi/kubeadm_config.go | 2 +- .../kubernetes/k8sapi/kubeadm_config_test.go | 0 .../k8sapi/kubectl/client/client.go | 4 +- .../k8sapi/kubectl/client/client_test.go | 4 +- .../k8sapi/kubectl/client/restclient.go | 0 .../k8sapi/kubectl/client/restclient_test.go | 0 .../kubernetes/k8sapi/kubectl/generator.go | 2 +- .../kubernetes/k8sapi/kubectl/kubectl.go | 2 +- .../kubernetes/k8sapi/kubectl/kubectl_test.go | 2 +- .../k8sapi/resources/access_manager.go | 0 .../k8sapi/resources/access_manager_test.go | 0 .../kubernetes/k8sapi/resources/activation.go | 0 .../k8sapi/resources/activation_test.go | 0 .../k8sapi/resources/auditpolicy.go | 0 .../k8sapi/resources/auditpolicy_test.go | 0 .../resources/cloud_controller_manager.go | 0 .../cloud_controller_manager_test.go | 0 .../k8sapi/resources/cloudnodemanager.go | 0 .../k8sapi/resources/cloudnodemanager_test.go | 0 .../k8sapi/resources/cluster_autoscaler.go | 0 .../resources/cluster_autoscaler_test.go | 0 .../kubernetes/k8sapi/resources/configmaps.go | 0 .../k8sapi/resources/configmaps_test.go | 0 .../k8sapi/resources/image_pull_secret.go | 0 .../resources/image_pull_secret_test.go | 0 .../kubernetes/k8sapi/resources/images.go | 0 .../kubernetes/k8sapi/resources/kms.go | 0 .../kubernetes/k8sapi/resources/kms_test.go | 0 .../kubernetes/k8sapi/resources/marshal.go | 0 .../k8sapi/resources/marshal_test.go | 0 .../kubernetes/k8sapi/resources/secrets.go | 0 .../k8sapi/resources/secrets_test.go | 0 .../k8sapi/resources/verification.go | 0 .../k8sapi/resources/verification_test.go | 0 .../internal/kubernetes/k8sapi/systemd.go | 0 .../internal/kubernetes/k8sapi/util.go | 2 +- .../internal/kubernetes/k8sapi/versions.go | 0 .../internal/kubernetes/k8sutil.go | 4 +- .../internal/kubernetes/kubeconfig.go | 0 .../internal/kubernetes/kubeconfig_test.go | 0 .../internal/kubernetes/kubernetes.go | 12 +- .../internal/kubernetes/kubernetes_test.go | 22 +- .../internal/logging/logger.go | 0 .../internal/nodelock/nodelock.go | 0 .../nodestate/nodestate.go | 2 +- .../nodestate/nodestate_test.go | 10 +- {coordinator => bootstrapper}/role/role.go | 12 +- .../role/role_string.go | 8 +- .../role/role_test.go | 34 +- {coordinator => bootstrapper}/util/util.go | 0 .../util/util_test.go | 0 cli/internal/azure/client/client.go | 60 +- cli/internal/azure/client/client_test.go | 370 ++++----- cli/internal/azure/client/compute.go | 66 +- cli/internal/azure/client/compute_test.go | 114 +-- cli/internal/azure/client/network_test.go | 20 +- cli/internal/azure/loadbalancer.go | 6 +- cli/internal/cloudcmd/clients_test.go | 188 ++--- cli/internal/cloudcmd/create.go | 26 +- cli/internal/cloudcmd/create_test.go | 38 +- cli/internal/cloudcmd/serviceaccount_test.go | 20 +- cli/internal/cloudcmd/terminate_test.go | 22 +- cli/internal/cmd/init.go | 89 +- cli/internal/cmd/init_test.go | 16 +- cli/internal/cmd/recover.go | 4 +- cli/internal/cmd/verify.go | 2 +- cli/internal/gcp/client/client.go | 108 +-- cli/internal/gcp/client/client_test.go | 768 +++++++++--------- cli/internal/gcp/client/instances.go | 92 +-- cli/internal/gcp/client/instances_test.go | 100 +-- cli/internal/gcp/client/network.go | 2 +- cli/internal/gcp/client/network_test.go | 4 +- coordinator/README.md | 66 -- .../k8sapi/resources/verification.go | 153 ---- .../kubernetes/k8sapi/resources/images.go | 12 - .../k8sapi/resources/verification_test.go | 18 - debugd/README.md | 2 +- .../{coordinator => bootstrapper}/streamer.go | 6 +- .../streamer_test.go | 2 +- debugd/cdbg/cmd/deploy.go | 70 +- debugd/cdbg/cmd/root.go | 2 +- debugd/cdbg/config/config.go | 6 +- debugd/cdbg/state/state.go | 60 +- debugd/debugd/cmd/debugd/debugd.go | 4 +- debugd/debugd/constants.go | 24 +- debugd/debugd/deploy/download.go | 32 +- debugd/debugd/deploy/download_test.go | 24 +- debugd/debugd/deploy/service.go | 16 +- .../metadata/cloudprovider/cloudprovider.go | 6 +- debugd/debugd/metadata/scheduler.go | 18 +- debugd/debugd/metadata/scheduler_test.go | 2 +- debugd/debugd/server/server.go | 50 +- debugd/debugd/server/server_test.go | 42 +- debugd/service/debugd.pb.go | 290 +++---- debugd/service/debugd.proto | 20 +- debugd/service/debugd_grpc.pb.go | 80 +- docs/upgrade-kubernetes.md | 6 +- hack/pcr-reader/README.md | 6 +- hack/pcr-reader/main.go | 16 +- hack/terraform-to-state/create-state.go | 8 +- image/Makefile | 34 +- image/README.md | 4 +- image/assembler/README.md | 4 +- internal/atls/atls.go | 2 +- internal/cloud/metadata/metadata.go | 7 +- internal/config/config.go | 6 +- internal/constants/constants.go | 12 +- internal/deploy/ssh/proto.go | 2 +- .../atlscredentials/atlscredentials_test.go | 2 +- internal/state/state.go | 58 +- kms/kms/cluster/cluster.go | 2 +- proto/Dockerfile.gen-proto | 4 +- state/cmd/main.go | 4 +- state/keyservice/keyservice.go | 4 +- state/keyservice/keyservice_test.go | 10 +- state/setup/setup.go | 2 +- state/setup/setup_test.go | 2 +- state/test/integration_test.go | 2 +- test/Dockerfile | 4 +- 191 files changed, 1763 insertions(+), 2030 deletions(-) delete mode 100644 .github/workflows/test-integration-etcdStore.yml create mode 100644 bootstrapper/README.md rename {coordinator => bootstrapper}/cloudprovider/azure/api.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/api_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/autoscaler.go (97%) rename {coordinator => bootstrapper}/cloudprovider/azure/autoscaler_test.go (96%) rename {coordinator => bootstrapper}/cloudprovider/azure/ccm.go (97%) rename {coordinator => bootstrapper}/cloudprovider/azure/ccm_test.go (98%) rename {coordinator => bootstrapper}/cloudprovider/azure/cloudnodemanager.go (92%) rename {coordinator => bootstrapper}/cloudprovider/azure/cloudnodemanager_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/imds.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/imds_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/logger.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/metadata.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/metadata_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/network.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/network_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/scaleset.go (90%) rename {coordinator => bootstrapper}/cloudprovider/azure/scaleset_test.go (98%) rename {coordinator => bootstrapper}/cloudprovider/azure/securityGroup.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/virtualnetwork.go (100%) rename {coordinator => bootstrapper}/cloudprovider/azure/wrappers.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/api.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/autoscaler.go (94%) rename {coordinator => bootstrapper}/cloudprovider/gcp/autoscaler_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/ccm.go (96%) rename {coordinator => bootstrapper}/cloudprovider/gcp/ccm_test.go (97%) rename {coordinator => bootstrapper}/cloudprovider/gcp/client.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/client_test.go (98%) rename {coordinator => bootstrapper}/cloudprovider/gcp/cloudnodemanager.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/cloudnodemanager_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/logger.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/metadata.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/metadata_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/role.go (60%) rename {coordinator => bootstrapper}/cloudprovider/gcp/role_test.go (79%) rename {coordinator => bootstrapper}/cloudprovider/gcp/wrappers.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/writer.go (100%) rename {coordinator => bootstrapper}/cloudprovider/gcp/writer_test.go (100%) rename {coordinator => bootstrapper}/cloudprovider/images.go (100%) rename {coordinator => bootstrapper}/cloudprovider/qemu/autoscaler.go (92%) rename {coordinator => bootstrapper}/cloudprovider/qemu/ccm.go (96%) rename {coordinator => bootstrapper}/cloudprovider/qemu/cloudnodemanager.go (100%) rename {coordinator => bootstrapper}/cloudprovider/qemu/metadata.go (100%) rename {coordinator/cmd/coordinator => bootstrapper/cmd/bootstrapper}/main.go (88%) rename {coordinator/cmd/coordinator => bootstrapper/cmd/bootstrapper}/run.go (79%) rename {coordinator/cmd/coordinator => bootstrapper/cmd/bootstrapper}/test.go (93%) rename {coordinator => bootstrapper}/initproto/init.pb.go (97%) rename {coordinator => bootstrapper}/initproto/init.proto (87%) rename {coordinator => bootstrapper}/initproto/init_grpc.pb.go (100%) rename {coordinator => bootstrapper}/internal/diskencryption/diskencryption.go (100%) rename {coordinator => bootstrapper}/internal/diskencryption/diskencryption_test.go (100%) rename {coordinator => bootstrapper}/internal/initserver/initserver.go (92%) rename {coordinator => bootstrapper}/internal/initserver/initserver_test.go (96%) rename {coordinator => bootstrapper}/internal/joinclient/client.go (94%) rename {coordinator => bootstrapper}/internal/joinclient/client_test.go (90%) rename {coordinator => bootstrapper}/internal/kubernetes/cloud_provider.go (98%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/install.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/install_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/joinargs.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/joinargs_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubeadm_config.go (99%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubeadm_config_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/client/client.go (95%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/client/client_test.go (97%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/client/restclient.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/client/restclient_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/generator.go (72%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/kubectl.go (95%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/kubectl/kubectl_test.go (96%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/access_manager.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/access_manager_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/activation.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/activation_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/auditpolicy.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/auditpolicy_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/cloud_controller_manager.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/cloud_controller_manager_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/cloudnodemanager.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/cloudnodemanager_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/configmaps.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/configmaps_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/image_pull_secret.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/image_pull_secret_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/images.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/kms.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/kms_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/marshal.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/marshal_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/secrets.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/secrets_test.go (100%) rename {coordinator => bootstrapper/internal}/kubernetes/k8sapi/resources/verification.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/resources/verification_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/systemd.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/util.go (99%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sapi/versions.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/k8sutil.go (89%) rename {coordinator => bootstrapper}/internal/kubernetes/kubeconfig.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/kubeconfig_test.go (100%) rename {coordinator => bootstrapper}/internal/kubernetes/kubernetes.go (97%) rename {coordinator => bootstrapper}/internal/kubernetes/kubernetes_test.go (97%) rename {coordinator => bootstrapper}/internal/logging/logger.go (100%) rename {coordinator => bootstrapper}/internal/nodelock/nodelock.go (100%) rename {coordinator => bootstrapper}/nodestate/nodestate.go (93%) rename {coordinator => bootstrapper}/nodestate/nodestate_test.go (89%) rename {coordinator => bootstrapper}/role/role.go (86%) rename {coordinator => bootstrapper}/role/role_string.go (77%) rename {coordinator => bootstrapper}/role/role_test.go (76%) rename {coordinator => bootstrapper}/util/util.go (100%) rename {coordinator => bootstrapper}/util/util_test.go (100%) delete mode 100644 coordinator/README.md delete mode 100644 coordinator/internal/kubernetes/k8sapi/resources/verification.go delete mode 100644 coordinator/kubernetes/k8sapi/resources/images.go delete mode 100644 coordinator/kubernetes/k8sapi/resources/verification_test.go rename debugd/{coordinator => bootstrapper}/streamer.go (95%) rename debugd/{coordinator => bootstrapper}/streamer_test.go (99%) diff --git a/.dockerignore b/.dockerignore index 3fffed19b..9298d05e4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,7 +14,7 @@ #ignore build files /build admin.conf -coordinator-* +bootstrapper-* go.work go.work.sum diff --git a/.github/actions/constellation_measure/action.yml b/.github/actions/constellation_measure/action.yml index 857de4044..84f058985 100644 --- a/.github/actions/constellation_measure/action.yml +++ b/.github/actions/constellation_measure/action.yml @@ -43,14 +43,14 @@ runs: run: | case $CSP in azure) - FIRST_NODE=$(jq -r ".azurecoordinators | keys | first" constellation-state.json) - CONSTELL_IP=$(jq -r ".azurecoordinators.\"${FIRST_NODE}\".PublicIP" constellation-state.json) + FIRST_NODE=$(jq -r ".azurebootstrappers | keys | first" constellation-state.json) + CONSTELL_IP=$(jq -r ".azurebootstrappers.\"${FIRST_NODE}\".PublicIP" constellation-state.json) pcr-reader --constell-ip ${CONSTELL_IP} -format yaml > measurements.yaml yq e 'del(.[0,6,10,11,12,13,14,15,16,17,18,19,20,21,22,23])' -i measurements.yaml ;; gcp) - FIRST_NODE=$(jq -r ".gcpcoordinators | keys | first" constellation-state.json) - CONSTELL_IP=$(jq -r ".gcpcoordinators.\"${FIRST_NODE}\".PublicIP" constellation-state.json) + FIRST_NODE=$(jq -r ".gcpbootstrappers | keys | first" constellation-state.json) + CONSTELL_IP=$(jq -r ".gcpbootstrappers.\"${FIRST_NODE}\".PublicIP" constellation-state.json) pcr-reader --constell-ip ${CONSTELL_IP} -format yaml > measurements.yaml yq e 'del(.[11,12,13,14,15,16,17,18,19,20,21,22,23])' -i measurements.yaml ;; diff --git a/.github/workflows/build-coordinator.yml b/.github/workflows/build-coordinator.yml index 84a1a9259..bec908ee7 100644 --- a/.github/workflows/build-coordinator.yml +++ b/.github/workflows/build-coordinator.yml @@ -1,5 +1,5 @@ # We build the coordinator as part of each PR to see that the build still works. An image is only created once merged to main (see condition on call-coreos). -name: Build and Upload the Coordinator +name: Build and Upload the bootstrapper on: workflow_dispatch: @@ -14,15 +14,15 @@ concurrency: cancel-in-progress: true jobs: - build-coordinator: - name: "Build the Coordinator" + build-bootstrapper: + name: "Build the bootstrapper" runs-on: ubuntu-latest env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} outputs: - coordinator-name: ${{ steps.copy.outputs.coordinator-name }} + bootstrapper-name: ${{ steps.copy.outputs.bootstrapper-name }} steps: - name: Checkout id: checkout @@ -35,32 +35,32 @@ jobs: id: prepare run: sudo apt-get update && sudo apt-get -y install awscli cmake make - - name: Build and tag the Coordinator + - name: Build and tag the bootstrapper id: build run: | mkdir build && cd build cmake .. - make coordinator - mv coordinator coordinator-$(sha512sum coordinator | cut -d " " -f 1) + make bootstrapper + mv bootstrapper bootstrapper-$(sha512sum bootstrapper | cut -d " " -f 1) - - name: Copy Coordinator to S3 if not exists + - name: Copy bootstrapper to S3 if not exists id: copy # Only upload the Coordinator if this action is triggered from main branch if: ${{ github.ref == 'refs/heads/main' }} run: > - aws s3api head-object --bucket ${{ secrets.PUBLIC_BUCKET_NAME }} --key coordinator/$(ls | grep "coordinator-") + aws s3api head-object --bucket ${{ secrets.PUBLIC_BUCKET_NAME }} --key bootstrapper/$(ls | grep "bootstrapper-") || ( - echo "::set-output name=coordinator-name::$(ls | grep "coordinator-")" - && aws s3 cp ${{ github.workspace }}/build/ s3://${{ secrets.PUBLIC_BUCKET_NAME }}/coordinator/ --exclude "*" --include "coordinator-*" --include "constellation" --recursive --quiet) + echo "::set-output name=bootstrapper-name::$(ls | grep "bootstrapper-")" + && aws s3 cp ${{ github.workspace }}/build/ s3://${{ secrets.PUBLIC_BUCKET_NAME }}/bootstrapper/ --exclude "*" --include "bootstrapper-*" --include "constellation" --recursive --quiet) shell: bash {0} working-directory: ${{ github.workspace }}/build/ call-coreos: - needs: build-coordinator - if: ${{ (github.ref == 'refs/heads/main') && startsWith(needs.build-coordinator.outputs.coordinator-name, 'coordinator-') }} + needs: build-bootstrapper + if: ${{ (github.ref == 'refs/heads/main') && startsWith(needs.build-bootstrapper.outputs.bootstrapper-name, 'bootstrapper-') uses: ./.github/workflows/build-coreos.yml with: - coordinator-name: ${{ needs.build-coordinator.outputs.coordinator-name }} + bootstrapper-name: ${{ needs.build-bootstrapper.outputs.bootstrapper-name }} secrets: CI_GITHUB_REPOSITORY: ${{ secrets.CI_GITHUB_REPOSITORY }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} diff --git a/.github/workflows/build-coreos-debug.yml b/.github/workflows/build-coreos-debug.yml index 5082830b6..005856475 100644 --- a/.github/workflows/build-coreos-debug.yml +++ b/.github/workflows/build-coreos-debug.yml @@ -80,6 +80,6 @@ jobs: - name: "Build and Upload" run: > make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc GCP_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" GCP_IMAGE_FAMILY="constellation-debug" AZURE_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" - AZURE_IMAGE_DEFINITION="constellation-coreos-debugd" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_COORDINATOR=n COORDINATOR_BINARY="${{ github.workspace }}/debugd/debugd/cmd/debugd/constellation-debugd" + AZURE_IMAGE_DEFINITION="constellation-coreos-debugd" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_BOOTSTRAPPER=n BOOTSTRAPPER_BINARY="${{ github.workspace }}/debugd/debugd/cmd/debugd/constellation-debugd" image-gcp image-azure upload-gcp upload-azure working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/build-coreos.yml b/.github/workflows/build-coreos.yml index 1e0c33a98..c53a8b76c 100644 --- a/.github/workflows/build-coreos.yml +++ b/.github/workflows/build-coreos.yml @@ -5,14 +5,14 @@ env: on: workflow_dispatch: inputs: - coordinator-name: - description: Coordinator name + bootstrapper-name: + description: bootstrapper name required: true type: string workflow_call: inputs: - coordinator-name: + bootstrapper-name: required: true type: string @@ -101,6 +101,6 @@ jobs: - name: "Build and Upload" run: > make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc GCP_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" AZURE_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" - AZURE_IMAGE_DEFINITION="constellation-coreos" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_COORDINATOR=y COORDINATOR_URL="https://${{ secrets.PUBLIC_BUCKET_NAME }}.s3.us-east-2.amazonaws.com/coordinator/${{ inputs.coordinator-name }}" + AZURE_IMAGE_DEFINITION="constellation-coreos" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_BOOTSTRAPPER=y BOOTSTRAPPER_URL="https://${{ secrets.PUBLIC_BUCKET_NAME }}.s3.us-east-2.amazonaws.com/bootstrapper/${{ inputs.bootstrapper-name }}" image-gcp image-azure upload-gcp upload-azure working-directory: ${{ env.working-directory }} diff --git a/.github/workflows/test-integration-etcdStore.yml b/.github/workflows/test-integration-etcdStore.yml deleted file mode 100644 index ed43b6410..000000000 --- a/.github/workflows/test-integration-etcdStore.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Etcd Integration Test - -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - -# Abort runs of *this* workflow, if a new commit with the same ref is pushed. -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - integration-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Go environment - uses: actions/setup-go@v2.1.4 - with: - go-version: "1.18" - - - name: Test Constellation etcd integration - run: go test -v --race -cover -count=3 -tags integration - working-directory: coordinator/store diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 68d0c396f..0c8d0c5b4 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -34,9 +34,3 @@ jobs: # Runs all test targets starting with "integration-" - name: Integration Tests run: ctest -R integration- - - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: coordinator-integrationtest-logs - path: /tmp/coordinator/logs/ diff --git a/.gitignore b/.gitignore index b7391dc0e..ffdc808f1 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ go.work.sum build admin.conf -coordinator-* +bootstrapper-* # VS Code configuration folder .vscode @@ -30,7 +30,7 @@ debug/ # Image image/*.ign image/build/* -image/dependencies/coordinator +image/dependencies/bootstrapper image/dependencies/cilium image/images/* image/cosa.lock diff --git a/CMakeLists.txt b/CMakeLists.txt index da415c0b5..9a99a37c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.11) -project(coordinator LANGUAGES C VERSION 0.1.0) +project(constellation LANGUAGES C VERSION 0.1.0) set(CLI_VERSION "v0.1.0" CACHE STRING "Version of CLI binary.") @@ -15,13 +15,13 @@ add_custom_target(disk-mapper ALL ) # -# coordinator +# bootstrapper # -add_custom_target(coordinator ALL - DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} --build-arg PROJECT_VERSION=${PROJECT_VERSION} -f Dockerfile.build --target coordinator . +add_custom_target(bootstrapper ALL + DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} --build-arg PROJECT_VERSION=${PROJECT_VERSION} -f Dockerfile.build --target bootstrapper . WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - BYPRODUCTS coordinator + BYPRODUCTS bootstrapper ) @@ -39,10 +39,10 @@ add_custom_target(cli ALL # testing / debugging # -add_custom_target(debug_coordinator - go build -o ${CMAKE_BINARY_DIR}/debug_coordinator -buildvcs=false -ldflags "-buildid='' -X main.version=${PROJECT_VERSION}" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coordinator/cmd/coordinator - BYPRODUCTS debug_coordinator +add_custom_target(debug_bootstrapper + go build -o ${CMAKE_BINARY_DIR}/debug_bootstrapper -buildvcs=false -ldflags "-buildid='' -X main.version=${PROJECT_VERSION}" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bootstrapper/cmd/bootstrapper + BYPRODUCTS debug_bootstrapper ) # @@ -67,7 +67,5 @@ add_custom_target(cdbg ALL add_test(NAME unit-main COMMAND go test -race -count=3 ./... WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_test(NAME unit-hack COMMAND go test -race -count=3 ./... WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/hack) -add_test(NAME integration-coord COMMAND go test -v -tags integration ./test/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_test(NAME integration-mount COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v -v 9" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/mount) add_test(NAME integration-dm COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/state) -add_test(NAME integration-etcd COMMAND go test -v --race -cover -count=3 -tags integration WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coordinator/store/) diff --git a/Dockerfile.build b/Dockerfile.build index dea91c75a..563e617e3 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -21,19 +21,19 @@ RUN go mod download all COPY . /constellation RUN rm -rf ./hack/ -FROM build AS build-coordinator -WORKDIR /constellation/coordinator/ +FROM build AS build-bootstrapper +WORKDIR /constellation/bootstrapper/ ARG PROJECT_VERSION -RUN go build -o coordinator -tags=gcp,disable_tpm_simulator -buildvcs=false -ldflags "-s -w -buildid='' -X main.version=${PROJECT_VERSION}" ./cmd/coordinator/ +RUN go build -o bootstrapper -tags=gcp,disable_tpm_simulator -buildvcs=false -ldflags "-s -w -buildid='' -X main.version=${PROJECT_VERSION}" ./cmd/bootstrapper/ FROM build AS build-disk-mapper WORKDIR /constellation/state/ RUN go build -o disk-mapper -ldflags "-s -w" ./cmd/ -FROM scratch AS coordinator -COPY --from=build-coordinator /constellation/coordinator/coordinator / +FROM scratch AS bootstrapper +COPY --from=build-bootstrapper /constellation/bootstrapper/bootstrapper / FROM scratch AS disk-mapper COPY --from=build-disk-mapper /constellation/state/disk-mapper / diff --git a/README.md b/README.md index ae0226241..12b29e885 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Core components: * [access_manager](access_manager): Contains the access-manager pod used to persist SSH users based on a K8s ConfigMap * [cli](cli): The CLI is used to manage a Constellation cluster -* [coordinator](coordinator): The Coordinator is a node agent whose most important task is to bootstrap a node +* [bootstrapper](bootstrapper): The bootstrapper is a node agent whose most important task is to bootstrap a node * [image](image): Build files for the Constellation disk image * [kms](kms): Constellation's key management client and server * [mount](mount): Package used by CSI plugins to create and mount encrypted block devices @@ -67,10 +67,10 @@ ctest -j `nproc` Using the CLI requires the user to make authorized API calls to the CSP API. See the [docs](https://constellation-docs.edgeless.systems/6c320851-bdd2-41d5-bf10-e27427398692/#/getting-started/install?id=cloud-credentials) for configuration. -## Deploying a locally compiled coordinator binary +## Deploying a locally compiled bootstrapper binary -By default, `constellation create ...` will spawn cloud provider instances with a pre-baked coordinator binary. -For testing, you can use the constellation debug daemon (debugd) to upload your local coordinator binary to running instances and to obtain SSH access. +By default, `constellation create ...` will spawn cloud provider instances with a pre-baked bootstrapper binary. +For testing, you can use the constellation debug daemon (debugd) to upload your local bootstrapper binary to running instances and to obtain SSH access. [Follow this introduction on how to install and setup `cdbg`](debugd/README.md) ## Development Guides diff --git a/activation/kubernetesca/kubernetesca.go b/activation/kubernetesca/kubernetesca.go index dcc8c1abc..bbbfecb70 100644 --- a/activation/kubernetesca/kubernetesca.go +++ b/activation/kubernetesca/kubernetesca.go @@ -10,7 +10,7 @@ import ( "fmt" "time" - "github.com/edgelesssys/constellation/coordinator/util" + "github.com/edgelesssys/constellation/bootstrapper/util" "github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/logger" ) diff --git a/bootstrapper/README.md b/bootstrapper/README.md new file mode 100644 index 000000000..536a6a71a --- /dev/null +++ b/bootstrapper/README.md @@ -0,0 +1,19 @@ +# Bootstrapper + +## Naming convention + +### Network + +IP addresses: + +* ip: numeric IP address +* host: either IP address or hostname +* endpoint: host+port + +### Keys + +Kinds: + +* key: symmetric key +* pubKey: public key +* privKey: private key diff --git a/coordinator/cloudprovider/azure/api.go b/bootstrapper/cloudprovider/azure/api.go similarity index 100% rename from coordinator/cloudprovider/azure/api.go rename to bootstrapper/cloudprovider/azure/api.go diff --git a/coordinator/cloudprovider/azure/api_test.go b/bootstrapper/cloudprovider/azure/api_test.go similarity index 100% rename from coordinator/cloudprovider/azure/api_test.go rename to bootstrapper/cloudprovider/azure/api_test.go diff --git a/coordinator/cloudprovider/azure/autoscaler.go b/bootstrapper/cloudprovider/azure/autoscaler.go similarity index 97% rename from coordinator/cloudprovider/azure/autoscaler.go rename to bootstrapper/cloudprovider/azure/autoscaler.go index 246ca6cd9..47e7b67d3 100644 --- a/coordinator/cloudprovider/azure/autoscaler.go +++ b/bootstrapper/cloudprovider/azure/autoscaler.go @@ -1,7 +1,7 @@ package azure import ( - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/azureshared" k8s "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/coordinator/cloudprovider/azure/autoscaler_test.go b/bootstrapper/cloudprovider/azure/autoscaler_test.go similarity index 96% rename from coordinator/cloudprovider/azure/autoscaler_test.go rename to bootstrapper/cloudprovider/azure/autoscaler_test.go index ce27c6761..71e7f4a5e 100644 --- a/coordinator/cloudprovider/azure/autoscaler_test.go +++ b/bootstrapper/cloudprovider/azure/autoscaler_test.go @@ -3,7 +3,7 @@ package azure import ( "testing" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" k8s "k8s.io/api/core/v1" diff --git a/coordinator/cloudprovider/azure/ccm.go b/bootstrapper/cloudprovider/azure/ccm.go similarity index 97% rename from coordinator/cloudprovider/azure/ccm.go rename to bootstrapper/cloudprovider/azure/ccm.go index cec1f2870..2353fcb10 100644 --- a/coordinator/cloudprovider/azure/ccm.go +++ b/bootstrapper/cloudprovider/azure/ccm.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" - "github.com/edgelesssys/constellation/coordinator/cloudprovider" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/cloudprovider" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/azureshared" "github.com/edgelesssys/constellation/internal/cloud/metadata" k8s "k8s.io/api/core/v1" diff --git a/coordinator/cloudprovider/azure/ccm_test.go b/bootstrapper/cloudprovider/azure/ccm_test.go similarity index 98% rename from coordinator/cloudprovider/azure/ccm_test.go rename to bootstrapper/cloudprovider/azure/ccm_test.go index a6c7cef85..285f97a01 100644 --- a/coordinator/cloudprovider/azure/ccm_test.go +++ b/bootstrapper/cloudprovider/azure/ccm_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/coordinator/cloudprovider/azure/cloudnodemanager.go b/bootstrapper/cloudprovider/azure/cloudnodemanager.go similarity index 92% rename from coordinator/cloudprovider/azure/cloudnodemanager.go rename to bootstrapper/cloudprovider/azure/cloudnodemanager.go index 3bf21d5d8..5b6837824 100644 --- a/coordinator/cloudprovider/azure/cloudnodemanager.go +++ b/bootstrapper/cloudprovider/azure/cloudnodemanager.go @@ -1,6 +1,6 @@ package azure -import "github.com/edgelesssys/constellation/coordinator/cloudprovider" +import "github.com/edgelesssys/constellation/bootstrapper/cloudprovider" // CloudNodeManager holds the Azure cloud-node-manager configuration. // reference: https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/examples/out-of-tree/cloud-node-manager.yaml . diff --git a/coordinator/cloudprovider/azure/cloudnodemanager_test.go b/bootstrapper/cloudprovider/azure/cloudnodemanager_test.go similarity index 100% rename from coordinator/cloudprovider/azure/cloudnodemanager_test.go rename to bootstrapper/cloudprovider/azure/cloudnodemanager_test.go diff --git a/coordinator/cloudprovider/azure/imds.go b/bootstrapper/cloudprovider/azure/imds.go similarity index 100% rename from coordinator/cloudprovider/azure/imds.go rename to bootstrapper/cloudprovider/azure/imds.go diff --git a/coordinator/cloudprovider/azure/imds_test.go b/bootstrapper/cloudprovider/azure/imds_test.go similarity index 100% rename from coordinator/cloudprovider/azure/imds_test.go rename to bootstrapper/cloudprovider/azure/imds_test.go diff --git a/coordinator/cloudprovider/azure/logger.go b/bootstrapper/cloudprovider/azure/logger.go similarity index 100% rename from coordinator/cloudprovider/azure/logger.go rename to bootstrapper/cloudprovider/azure/logger.go diff --git a/coordinator/cloudprovider/azure/metadata.go b/bootstrapper/cloudprovider/azure/metadata.go similarity index 100% rename from coordinator/cloudprovider/azure/metadata.go rename to bootstrapper/cloudprovider/azure/metadata.go diff --git a/coordinator/cloudprovider/azure/metadata_test.go b/bootstrapper/cloudprovider/azure/metadata_test.go similarity index 100% rename from coordinator/cloudprovider/azure/metadata_test.go rename to bootstrapper/cloudprovider/azure/metadata_test.go diff --git a/coordinator/cloudprovider/azure/network.go b/bootstrapper/cloudprovider/azure/network.go similarity index 100% rename from coordinator/cloudprovider/azure/network.go rename to bootstrapper/cloudprovider/azure/network.go diff --git a/coordinator/cloudprovider/azure/network_test.go b/bootstrapper/cloudprovider/azure/network_test.go similarity index 100% rename from coordinator/cloudprovider/azure/network_test.go rename to bootstrapper/cloudprovider/azure/network_test.go diff --git a/coordinator/cloudprovider/azure/scaleset.go b/bootstrapper/cloudprovider/azure/scaleset.go similarity index 90% rename from coordinator/cloudprovider/azure/scaleset.go rename to bootstrapper/cloudprovider/azure/scaleset.go index e0a6978d2..a3c86c165 100644 --- a/coordinator/cloudprovider/azure/scaleset.go +++ b/bootstrapper/cloudprovider/azure/scaleset.go @@ -7,14 +7,14 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/azureshared" "github.com/edgelesssys/constellation/internal/cloud/metadata" ) var ( - coordinatorScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-coordinators-[0-9a-zA-Z]+$`) - nodeScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-nodes-[0-9a-zA-Z]+$`) + controlPlaneScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-controlplanes-[0-9a-zA-Z]+$`) + workerScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-workers-[0-9a-zA-Z]+$`) ) // getScaleSetVM tries to get an azure vm belonging to a scale set. @@ -96,11 +96,11 @@ func convertScaleSetVMToCoreInstance(scaleSet string, vm armcompute.VirtualMachi // extractScaleSetVMRole extracts the constellation role of a scale set using its name. func extractScaleSetVMRole(scaleSet string) role.Role { - if coordinatorScaleSetRegexp.MatchString(scaleSet) { - return role.Coordinator + if controlPlaneScaleSetRegexp.MatchString(scaleSet) { + return role.ControlPlane } - if nodeScaleSetRegexp.MatchString(scaleSet) { - return role.Node + if workerScaleSetRegexp.MatchString(scaleSet) { + return role.Worker } return role.Unknown } diff --git a/coordinator/cloudprovider/azure/scaleset_test.go b/bootstrapper/cloudprovider/azure/scaleset_test.go similarity index 98% rename from coordinator/cloudprovider/azure/scaleset_test.go rename to bootstrapper/cloudprovider/azure/scaleset_test.go index 8d95d7d77..7d2d938c4 100644 --- a/coordinator/cloudprovider/azure/scaleset_test.go +++ b/bootstrapper/cloudprovider/azure/scaleset_test.go @@ -8,7 +8,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -220,13 +220,13 @@ func TestExtractScaleSetVMRole(t *testing.T) { scaleSet string wantRole role.Role }{ - "coordinator role": { - scaleSet: "constellation-scale-set-coordinators-abcd123", - wantRole: role.Coordinator, + "bootstrapper role": { + scaleSet: "constellation-scale-set-bootstrappers-abcd123", + wantRole: role.ControlPlane, }, "node role": { scaleSet: "constellation-scale-set-nodes-abcd123", - wantRole: role.Node, + wantRole: role.Worker, }, "unknown role": { scaleSet: "unknown", diff --git a/coordinator/cloudprovider/azure/securityGroup.go b/bootstrapper/cloudprovider/azure/securityGroup.go similarity index 100% rename from coordinator/cloudprovider/azure/securityGroup.go rename to bootstrapper/cloudprovider/azure/securityGroup.go diff --git a/coordinator/cloudprovider/azure/virtualnetwork.go b/bootstrapper/cloudprovider/azure/virtualnetwork.go similarity index 100% rename from coordinator/cloudprovider/azure/virtualnetwork.go rename to bootstrapper/cloudprovider/azure/virtualnetwork.go diff --git a/coordinator/cloudprovider/azure/wrappers.go b/bootstrapper/cloudprovider/azure/wrappers.go similarity index 100% rename from coordinator/cloudprovider/azure/wrappers.go rename to bootstrapper/cloudprovider/azure/wrappers.go diff --git a/coordinator/cloudprovider/gcp/api.go b/bootstrapper/cloudprovider/gcp/api.go similarity index 100% rename from coordinator/cloudprovider/gcp/api.go rename to bootstrapper/cloudprovider/gcp/api.go diff --git a/coordinator/cloudprovider/gcp/autoscaler.go b/bootstrapper/cloudprovider/gcp/autoscaler.go similarity index 94% rename from coordinator/cloudprovider/gcp/autoscaler.go rename to bootstrapper/cloudprovider/gcp/autoscaler.go index 84198d715..3490961f9 100644 --- a/coordinator/cloudprovider/gcp/autoscaler.go +++ b/bootstrapper/cloudprovider/gcp/autoscaler.go @@ -1,7 +1,7 @@ package gcp import ( - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" k8s "k8s.io/api/core/v1" ) diff --git a/coordinator/cloudprovider/gcp/autoscaler_test.go b/bootstrapper/cloudprovider/gcp/autoscaler_test.go similarity index 100% rename from coordinator/cloudprovider/gcp/autoscaler_test.go rename to bootstrapper/cloudprovider/gcp/autoscaler_test.go diff --git a/coordinator/cloudprovider/gcp/ccm.go b/bootstrapper/cloudprovider/gcp/ccm.go similarity index 96% rename from coordinator/cloudprovider/gcp/ccm.go rename to bootstrapper/cloudprovider/gcp/ccm.go index 061333b25..fdb38ca19 100644 --- a/coordinator/cloudprovider/gcp/ccm.go +++ b/bootstrapper/cloudprovider/gcp/ccm.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/edgelesssys/constellation/coordinator/cloudprovider" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/cloudprovider" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/gcpshared" k8s "k8s.io/api/core/v1" diff --git a/coordinator/cloudprovider/gcp/ccm_test.go b/bootstrapper/cloudprovider/gcp/ccm_test.go similarity index 97% rename from coordinator/cloudprovider/gcp/ccm_test.go rename to bootstrapper/cloudprovider/gcp/ccm_test.go index 95363284f..d515dd684 100644 --- a/coordinator/cloudprovider/gcp/ccm_test.go +++ b/bootstrapper/cloudprovider/gcp/ccm_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "testing" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/gcpshared" "github.com/stretchr/testify/assert" diff --git a/coordinator/cloudprovider/gcp/client.go b/bootstrapper/cloudprovider/gcp/client.go similarity index 100% rename from coordinator/cloudprovider/gcp/client.go rename to bootstrapper/cloudprovider/gcp/client.go diff --git a/coordinator/cloudprovider/gcp/client_test.go b/bootstrapper/cloudprovider/gcp/client_test.go similarity index 98% rename from coordinator/cloudprovider/gcp/client_test.go rename to bootstrapper/cloudprovider/gcp/client_test.go index ff4864a26..713bd532c 100644 --- a/coordinator/cloudprovider/gcp/client_test.go +++ b/bootstrapper/cloudprovider/gcp/client_test.go @@ -6,7 +6,7 @@ import ( "testing" compute "cloud.google.com/go/compute/apiv1" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/cloud/metadata" gax "github.com/googleapis/gax-go/v2" "github.com/stretchr/testify/assert" @@ -48,7 +48,7 @@ func TestRetrieveInstances(t *testing.T) { }, { Key: proto.String(roleMetadataKey), - Value: proto.String(role.Coordinator.String()), + Value: proto.String(role.ControlPlane.String()), }, }, }, @@ -80,7 +80,7 @@ func TestRetrieveInstances(t *testing.T) { { Name: "someInstance", ProviderID: "gce://someProject/someZone/someInstance", - Role: role.Coordinator, + Role: role.ControlPlane, AliasIPRanges: []string{"192.0.2.0/16"}, PublicIPs: []string{"192.0.2.1"}, PrivateIPs: []string{"192.0.2.0"}, @@ -104,7 +104,7 @@ func TestRetrieveInstances(t *testing.T) { { Name: "someInstance", ProviderID: "gce://someProject/someZone/someInstance", - Role: role.Coordinator, + Role: role.ControlPlane, AliasIPRanges: []string{}, PublicIPs: []string{}, PrivateIPs: []string{}, @@ -121,7 +121,7 @@ func TestRetrieveInstances(t *testing.T) { { Name: "someInstance", ProviderID: "gce://someProject/someZone/someInstance", - Role: role.Coordinator, + Role: role.ControlPlane, AliasIPRanges: []string{"192.0.2.0/16"}, PublicIPs: []string{"192.0.2.1"}, PrivateIPs: []string{}, @@ -259,14 +259,14 @@ func TestRetrieveInstance(t *testing.T) { clientInstance: newTestInstance(), clientInstanceMutator: func(i *computepb.Instance) { i.Metadata.Items[0].Key = proto.String(roleMetadataKey) - i.Metadata.Items[0].Value = proto.String(role.Coordinator.String()) + i.Metadata.Items[0].Value = proto.String(role.ControlPlane.String()) }, wantInstance: metadata.InstanceMetadata{ Name: "someInstance", ProviderID: "gce://someProject/someZone/someInstance", AliasIPRanges: []string{"192.0.2.0/16"}, PublicIPs: []string{"192.0.2.1"}, - Role: role.Coordinator, + Role: role.ControlPlane, PrivateIPs: []string{"192.0.2.0"}, SSHKeys: map[string][]string{}, }, diff --git a/coordinator/cloudprovider/gcp/cloudnodemanager.go b/bootstrapper/cloudprovider/gcp/cloudnodemanager.go similarity index 100% rename from coordinator/cloudprovider/gcp/cloudnodemanager.go rename to bootstrapper/cloudprovider/gcp/cloudnodemanager.go diff --git a/coordinator/cloudprovider/gcp/cloudnodemanager_test.go b/bootstrapper/cloudprovider/gcp/cloudnodemanager_test.go similarity index 100% rename from coordinator/cloudprovider/gcp/cloudnodemanager_test.go rename to bootstrapper/cloudprovider/gcp/cloudnodemanager_test.go diff --git a/coordinator/cloudprovider/gcp/logger.go b/bootstrapper/cloudprovider/gcp/logger.go similarity index 100% rename from coordinator/cloudprovider/gcp/logger.go rename to bootstrapper/cloudprovider/gcp/logger.go diff --git a/coordinator/cloudprovider/gcp/metadata.go b/bootstrapper/cloudprovider/gcp/metadata.go similarity index 100% rename from coordinator/cloudprovider/gcp/metadata.go rename to bootstrapper/cloudprovider/gcp/metadata.go diff --git a/coordinator/cloudprovider/gcp/metadata_test.go b/bootstrapper/cloudprovider/gcp/metadata_test.go similarity index 100% rename from coordinator/cloudprovider/gcp/metadata_test.go rename to bootstrapper/cloudprovider/gcp/metadata_test.go diff --git a/coordinator/cloudprovider/gcp/role.go b/bootstrapper/cloudprovider/gcp/role.go similarity index 60% rename from coordinator/cloudprovider/gcp/role.go rename to bootstrapper/cloudprovider/gcp/role.go index 48724a950..1c020c38f 100644 --- a/coordinator/cloudprovider/gcp/role.go +++ b/bootstrapper/cloudprovider/gcp/role.go @@ -1,7 +1,7 @@ package gcp import ( - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" ) const roleMetadataKey = "constellation-role" @@ -9,10 +9,10 @@ const roleMetadataKey = "constellation-role" // extractRole extracts role from cloud provider metadata. func extractRole(metadata map[string]string) role.Role { switch metadata[roleMetadataKey] { - case role.Coordinator.String(): - return role.Coordinator - case role.Node.String(): - return role.Node + case role.ControlPlane.String(): + return role.ControlPlane + case role.Worker.String(): + return role.Worker default: return role.Unknown } diff --git a/coordinator/cloudprovider/gcp/role_test.go b/bootstrapper/cloudprovider/gcp/role_test.go similarity index 79% rename from coordinator/cloudprovider/gcp/role_test.go rename to bootstrapper/cloudprovider/gcp/role_test.go index e5c7c1f34..e17fffbba 100644 --- a/coordinator/cloudprovider/gcp/role_test.go +++ b/bootstrapper/cloudprovider/gcp/role_test.go @@ -3,7 +3,7 @@ package gcp import ( "testing" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/stretchr/testify/assert" "go.uber.org/goleak" ) @@ -20,17 +20,17 @@ func TestExtractRole(t *testing.T) { metadata map[string]string wantRole role.Role }{ - "coordinator role": { + "bootstrapper role": { metadata: map[string]string{ - roleMetadataKey: role.Coordinator.String(), + roleMetadataKey: role.ControlPlane.String(), }, - wantRole: role.Coordinator, + wantRole: role.ControlPlane, }, "node role": { metadata: map[string]string{ - roleMetadataKey: role.Node.String(), + roleMetadataKey: role.Worker.String(), }, - wantRole: role.Node, + wantRole: role.Worker, }, "unknown role": { metadata: map[string]string{ diff --git a/coordinator/cloudprovider/gcp/wrappers.go b/bootstrapper/cloudprovider/gcp/wrappers.go similarity index 100% rename from coordinator/cloudprovider/gcp/wrappers.go rename to bootstrapper/cloudprovider/gcp/wrappers.go diff --git a/coordinator/cloudprovider/gcp/writer.go b/bootstrapper/cloudprovider/gcp/writer.go similarity index 100% rename from coordinator/cloudprovider/gcp/writer.go rename to bootstrapper/cloudprovider/gcp/writer.go diff --git a/coordinator/cloudprovider/gcp/writer_test.go b/bootstrapper/cloudprovider/gcp/writer_test.go similarity index 100% rename from coordinator/cloudprovider/gcp/writer_test.go rename to bootstrapper/cloudprovider/gcp/writer_test.go diff --git a/coordinator/cloudprovider/images.go b/bootstrapper/cloudprovider/images.go similarity index 100% rename from coordinator/cloudprovider/images.go rename to bootstrapper/cloudprovider/images.go diff --git a/coordinator/cloudprovider/qemu/autoscaler.go b/bootstrapper/cloudprovider/qemu/autoscaler.go similarity index 92% rename from coordinator/cloudprovider/qemu/autoscaler.go rename to bootstrapper/cloudprovider/qemu/autoscaler.go index e8a7cc375..26a40b45f 100644 --- a/coordinator/cloudprovider/qemu/autoscaler.go +++ b/bootstrapper/cloudprovider/qemu/autoscaler.go @@ -1,7 +1,7 @@ package qemu import ( - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" k8s "k8s.io/api/core/v1" ) diff --git a/coordinator/cloudprovider/qemu/ccm.go b/bootstrapper/cloudprovider/qemu/ccm.go similarity index 96% rename from coordinator/cloudprovider/qemu/ccm.go rename to bootstrapper/cloudprovider/qemu/ccm.go index e7f3b82cd..444a78094 100644 --- a/coordinator/cloudprovider/qemu/ccm.go +++ b/bootstrapper/cloudprovider/qemu/ccm.go @@ -3,7 +3,7 @@ package qemu import ( "context" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/cloud/metadata" k8s "k8s.io/api/core/v1" ) diff --git a/coordinator/cloudprovider/qemu/cloudnodemanager.go b/bootstrapper/cloudprovider/qemu/cloudnodemanager.go similarity index 100% rename from coordinator/cloudprovider/qemu/cloudnodemanager.go rename to bootstrapper/cloudprovider/qemu/cloudnodemanager.go diff --git a/coordinator/cloudprovider/qemu/metadata.go b/bootstrapper/cloudprovider/qemu/metadata.go similarity index 100% rename from coordinator/cloudprovider/qemu/metadata.go rename to bootstrapper/cloudprovider/qemu/metadata.go diff --git a/coordinator/cmd/coordinator/main.go b/bootstrapper/cmd/bootstrapper/main.go similarity index 88% rename from coordinator/cmd/coordinator/main.go rename to bootstrapper/cmd/bootstrapper/main.go index b1e2d4bd0..23e4f9026 100644 --- a/coordinator/cmd/coordinator/main.go +++ b/bootstrapper/cmd/bootstrapper/main.go @@ -9,14 +9,14 @@ import ( "os" "strings" - azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure" - gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp" - qemucloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/qemu" - "github.com/edgelesssys/constellation/coordinator/internal/joinclient" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/kubectl" - "github.com/edgelesssys/constellation/coordinator/internal/logging" + azurecloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/azure" + gcpcloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/gcp" + qemucloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/qemu" + "github.com/edgelesssys/constellation/bootstrapper/internal/joinclient" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/kubectl" + "github.com/edgelesssys/constellation/bootstrapper/internal/logging" "github.com/edgelesssys/constellation/internal/atls" "github.com/edgelesssys/constellation/internal/attestation/azure" "github.com/edgelesssys/constellation/internal/attestation/gcp" diff --git a/coordinator/cmd/coordinator/run.go b/bootstrapper/cmd/bootstrapper/run.go similarity index 79% rename from coordinator/cmd/coordinator/run.go rename to bootstrapper/cmd/bootstrapper/run.go index b60cf7cd2..fa59eb41f 100644 --- a/coordinator/cmd/coordinator/run.go +++ b/bootstrapper/cmd/bootstrapper/run.go @@ -3,10 +3,10 @@ package main import ( "net" - "github.com/edgelesssys/constellation/coordinator/internal/initserver" - "github.com/edgelesssys/constellation/coordinator/internal/joinclient" - "github.com/edgelesssys/constellation/coordinator/internal/logging" - "github.com/edgelesssys/constellation/coordinator/internal/nodelock" + "github.com/edgelesssys/constellation/bootstrapper/internal/initserver" + "github.com/edgelesssys/constellation/bootstrapper/internal/joinclient" + "github.com/edgelesssys/constellation/bootstrapper/internal/logging" + "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock" "github.com/edgelesssys/constellation/internal/attestation/vtpm" "github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/grpc/dialer" @@ -23,10 +23,10 @@ func run(issuer quoteIssuer, tpm vtpm.TPMOpenFunc, fileHandler file.Handler, cloudLogger logging.CloudLogger, fs afero.Fs, ) { defer logger.Sync() - logger.Info("starting coordinator", zap.String("version", version)) + logger.Info("starting bootstrapper", zap.String("version", version)) defer cloudLogger.Close() - cloudLogger.Disclose("Coordinator started running...") + cloudLogger.Disclose("bootstrapper started running...") nodeActivated, err := vtpm.IsNodeInitialized(tpm) if err != nil { diff --git a/coordinator/cmd/coordinator/test.go b/bootstrapper/cmd/bootstrapper/test.go similarity index 93% rename from coordinator/cmd/coordinator/test.go rename to bootstrapper/cmd/bootstrapper/test.go index b05f66155..131852312 100644 --- a/coordinator/cmd/coordinator/test.go +++ b/bootstrapper/cmd/bootstrapper/test.go @@ -3,8 +3,8 @@ package main import ( "context" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes" + "github.com/edgelesssys/constellation/bootstrapper/role" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" "github.com/edgelesssys/constellation/internal/cloud/metadata" kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" diff --git a/coordinator/initproto/init.pb.go b/bootstrapper/initproto/init.pb.go similarity index 97% rename from coordinator/initproto/init.pb.go rename to bootstrapper/initproto/init.pb.go index 91ed041f1..ff7443203 100644 --- a/coordinator/initproto/init.pb.go +++ b/bootstrapper/initproto/init.pb.go @@ -294,11 +294,11 @@ var file_init_proto_rawDesc = []byte{ 0x12, 0x2d, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x64, + 0x3d, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x64, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x73, 0x79, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, - 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, - 0x74, 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/coordinator/initproto/init.proto b/bootstrapper/initproto/init.proto similarity index 87% rename from coordinator/initproto/init.proto rename to bootstrapper/initproto/init.proto index 36a6c8ffd..f13d4236a 100644 --- a/coordinator/initproto/init.proto +++ b/bootstrapper/initproto/init.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package init; -option go_package = "github.com/edgelesssys/constellation/coordinator/initproto"; +option go_package = "github.com/edgelesssys/constellation/bootstrapper/initproto"; service API { rpc Init(InitRequest) returns (InitResponse); diff --git a/coordinator/initproto/init_grpc.pb.go b/bootstrapper/initproto/init_grpc.pb.go similarity index 100% rename from coordinator/initproto/init_grpc.pb.go rename to bootstrapper/initproto/init_grpc.pb.go diff --git a/coordinator/internal/diskencryption/diskencryption.go b/bootstrapper/internal/diskencryption/diskencryption.go similarity index 100% rename from coordinator/internal/diskencryption/diskencryption.go rename to bootstrapper/internal/diskencryption/diskencryption.go diff --git a/coordinator/internal/diskencryption/diskencryption_test.go b/bootstrapper/internal/diskencryption/diskencryption_test.go similarity index 100% rename from coordinator/internal/diskencryption/diskencryption_test.go rename to bootstrapper/internal/diskencryption/diskencryption_test.go diff --git a/coordinator/internal/initserver/initserver.go b/bootstrapper/internal/initserver/initserver.go similarity index 92% rename from coordinator/internal/initserver/initserver.go rename to bootstrapper/internal/initserver/initserver.go index 4b71ae4d7..8d9bb7534 100644 --- a/coordinator/internal/initserver/initserver.go +++ b/bootstrapper/internal/initserver/initserver.go @@ -6,13 +6,13 @@ import ( "net" "strings" - "github.com/edgelesssys/constellation/coordinator/initproto" - "github.com/edgelesssys/constellation/coordinator/internal/diskencryption" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes" - "github.com/edgelesssys/constellation/coordinator/internal/nodelock" - "github.com/edgelesssys/constellation/coordinator/nodestate" - "github.com/edgelesssys/constellation/coordinator/role" - "github.com/edgelesssys/constellation/coordinator/util" + "github.com/edgelesssys/constellation/bootstrapper/initproto" + "github.com/edgelesssys/constellation/bootstrapper/internal/diskencryption" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes" + "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock" + "github.com/edgelesssys/constellation/bootstrapper/nodestate" + "github.com/edgelesssys/constellation/bootstrapper/role" + "github.com/edgelesssys/constellation/bootstrapper/util" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" @@ -99,7 +99,7 @@ func (s *Server) Init(ctx context.Context, req *initproto.InitRequest) (*initpro } state := nodestate.NodeState{ - Role: role.Coordinator, + Role: role.ControlPlane, OwnerID: id.Owner, ClusterID: id.Cluster, } diff --git a/coordinator/internal/initserver/initserver_test.go b/bootstrapper/internal/initserver/initserver_test.go similarity index 96% rename from coordinator/internal/initserver/initserver_test.go rename to bootstrapper/internal/initserver/initserver_test.go index 28e495e16..236124047 100644 --- a/coordinator/internal/initserver/initserver_test.go +++ b/bootstrapper/internal/initserver/initserver_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/edgelesssys/constellation/coordinator/initproto" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes" - "github.com/edgelesssys/constellation/coordinator/internal/nodelock" + "github.com/edgelesssys/constellation/bootstrapper/initproto" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes" + "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" "github.com/edgelesssys/constellation/internal/file" "github.com/spf13/afero" diff --git a/coordinator/internal/joinclient/client.go b/bootstrapper/internal/joinclient/client.go similarity index 94% rename from coordinator/internal/joinclient/client.go rename to bootstrapper/internal/joinclient/client.go index d47192e20..bd0b2c5d5 100644 --- a/coordinator/internal/joinclient/client.go +++ b/bootstrapper/internal/joinclient/client.go @@ -10,10 +10,10 @@ import ( "time" "github.com/edgelesssys/constellation/activation/activationproto" - "github.com/edgelesssys/constellation/coordinator/internal/diskencryption" - "github.com/edgelesssys/constellation/coordinator/internal/nodelock" - "github.com/edgelesssys/constellation/coordinator/nodestate" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/internal/diskencryption" + "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock" + "github.com/edgelesssys/constellation/bootstrapper/nodestate" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" @@ -155,13 +155,13 @@ func (c *JoinClient) Stop() { } func (c *JoinClient) tryJoinAtAvailableServices() error { - ips, err := c.getCoordinatorIPs() + ips, err := c.getControlPlaneIPs() if err != nil { return err } if len(ips) == 0 { - return errors.New("no coordinator IPs found") + return errors.New("no control plane IPs found") } for _, ip := range ips { @@ -188,9 +188,9 @@ func (c *JoinClient) join(serviceEndpoint string) error { protoClient := activationproto.NewAPIClient(conn) switch c.role { - case role.Node: + case role.Worker: return c.joinAsWorkerNode(ctx, protoClient) - case role.Coordinator: + case role.ControlPlane: return c.joinAsControlPlaneNode(ctx, protoClient) default: return fmt.Errorf("cannot activate as %s", role.Unknown) @@ -332,7 +332,7 @@ func (c *JoinClient) getDiskUUID() (string, error) { return c.disk.UUID() } -func (c *JoinClient) getCoordinatorIPs() ([]string, error) { +func (c *JoinClient) getControlPlaneIPs() ([]string, error) { ctx, cancel := c.timeoutCtx() defer cancel() @@ -344,12 +344,12 @@ func (c *JoinClient) getCoordinatorIPs() ([]string, error) { ips := []string{} for _, instance := range instances { - if instance.Role == role.Coordinator { + if instance.Role == role.ControlPlane { ips = append(ips, instance.PrivateIPs...) } } - c.log.Info("Received Coordinator endpoints", zap.Strings("IPs", ips)) + c.log.Info("Received control plane endpoints", zap.Strings("IPs", ips)) return ips, nil } diff --git a/coordinator/internal/joinclient/client_test.go b/bootstrapper/internal/joinclient/client_test.go similarity index 90% rename from coordinator/internal/joinclient/client_test.go rename to bootstrapper/internal/joinclient/client_test.go index 7589bb14d..0de43a3cf 100644 --- a/coordinator/internal/joinclient/client_test.go +++ b/bootstrapper/internal/joinclient/client_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/edgelesssys/constellation/activation/activationproto" - "github.com/edgelesssys/constellation/coordinator/internal/nodelock" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" @@ -34,11 +34,11 @@ func TestMain(m *testing.M) { func TestClient(t *testing.T) { someErr := errors.New("failed") - self := metadata.InstanceMetadata{Role: role.Node, Name: "node-1"} + self := metadata.InstanceMetadata{Role: role.Worker, Name: "node-1"} peers := []metadata.InstanceMetadata{ - {Role: role.Node, Name: "node-2", PrivateIPs: []string{"192.0.2.8"}}, - {Role: role.Coordinator, Name: "node-3", PrivateIPs: []string{"192.0.2.1"}}, - {Role: role.Coordinator, Name: "node-4", PrivateIPs: []string{"192.0.2.2", "192.0.2.3"}}, + {Role: role.Worker, Name: "node-2", PrivateIPs: []string{"192.0.2.8"}}, + {Role: role.ControlPlane, Name: "node-3", PrivateIPs: []string{"192.0.2.1"}}, + {Role: role.ControlPlane, Name: "node-4", PrivateIPs: []string{"192.0.2.2", "192.0.2.3"}}, } testCases := map[string]struct { @@ -48,8 +48,8 @@ func TestClient(t *testing.T) { nodeLock *nodelock.Lock apiAnswers []any }{ - "on node: metadata self: errors occur": { - role: role.Node, + "on worker: metadata self: errors occur": { + role: role.Worker, apiAnswers: []any{ selfAnswer{err: someErr}, selfAnswer{err: someErr}, @@ -62,11 +62,11 @@ func TestClient(t *testing.T) { nodeLock: nodelock.New(), disk: &stubDisk{}, }, - "on node: metadata self: invalid answer": { - role: role.Node, + "on worker: metadata self: invalid answer": { + role: role.Worker, apiAnswers: []any{ selfAnswer{}, - selfAnswer{instance: metadata.InstanceMetadata{Role: role.Node}}, + selfAnswer{instance: metadata.InstanceMetadata{Role: role.Worker}}, selfAnswer{instance: metadata.InstanceMetadata{Name: "node-1"}}, selfAnswer{instance: self}, listAnswer{instances: peers}, @@ -76,8 +76,8 @@ func TestClient(t *testing.T) { nodeLock: nodelock.New(), disk: &stubDisk{}, }, - "on node: metadata list: errors occur": { - role: role.Node, + "on worker: metadata list: errors occur": { + role: role.Worker, apiAnswers: []any{ selfAnswer{instance: self}, listAnswer{err: someErr}, @@ -90,8 +90,8 @@ func TestClient(t *testing.T) { nodeLock: nodelock.New(), disk: &stubDisk{}, }, - "on node: metadata list: no coordinators in answer": { - role: role.Node, + "on worker: metadata list: no control plane nodes in answer": { + role: role.Worker, apiAnswers: []any{ selfAnswer{instance: self}, listAnswer{}, @@ -104,8 +104,8 @@ func TestClient(t *testing.T) { nodeLock: nodelock.New(), disk: &stubDisk{}, }, - "on node: aaas ActivateNode: errors": { - role: role.Node, + "on worker: aaas ActivateNode: errors": { + role: role.Worker, apiAnswers: []any{ selfAnswer{instance: self}, listAnswer{instances: peers}, diff --git a/coordinator/internal/kubernetes/cloud_provider.go b/bootstrapper/internal/kubernetes/cloud_provider.go similarity index 98% rename from coordinator/internal/kubernetes/cloud_provider.go rename to bootstrapper/internal/kubernetes/cloud_provider.go index 3bf8a947b..78b7727d2 100644 --- a/coordinator/internal/kubernetes/cloud_provider.go +++ b/bootstrapper/internal/kubernetes/cloud_provider.go @@ -3,7 +3,7 @@ package kubernetes import ( "context" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/cloud/metadata" k8s "k8s.io/api/core/v1" ) diff --git a/coordinator/internal/kubernetes/k8sapi/install.go b/bootstrapper/internal/kubernetes/k8sapi/install.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/install.go rename to bootstrapper/internal/kubernetes/k8sapi/install.go diff --git a/coordinator/internal/kubernetes/k8sapi/install_test.go b/bootstrapper/internal/kubernetes/k8sapi/install_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/install_test.go rename to bootstrapper/internal/kubernetes/k8sapi/install_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/joinargs.go b/bootstrapper/internal/kubernetes/k8sapi/joinargs.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/joinargs.go rename to bootstrapper/internal/kubernetes/k8sapi/joinargs.go diff --git a/coordinator/internal/kubernetes/k8sapi/joinargs_test.go b/bootstrapper/internal/kubernetes/k8sapi/joinargs_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/joinargs_test.go rename to bootstrapper/internal/kubernetes/k8sapi/joinargs_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/kubeadm_config.go b/bootstrapper/internal/kubernetes/k8sapi/kubeadm_config.go similarity index 99% rename from coordinator/internal/kubernetes/k8sapi/kubeadm_config.go rename to bootstrapper/internal/kubernetes/k8sapi/kubeadm_config.go index e4f1b0e1d..5b2e966da 100644 --- a/coordinator/internal/kubernetes/k8sapi/kubeadm_config.go +++ b/bootstrapper/internal/kubernetes/k8sapi/kubeadm_config.go @@ -3,7 +3,7 @@ package k8sapi import ( "path/filepath" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/internal/constants" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/coordinator/internal/kubernetes/k8sapi/kubeadm_config_test.go b/bootstrapper/internal/kubernetes/k8sapi/kubeadm_config_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/kubeadm_config_test.go rename to bootstrapper/internal/kubernetes/k8sapi/kubeadm_config_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/client/client.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/client/client.go similarity index 95% rename from coordinator/internal/kubernetes/k8sapi/kubectl/client/client.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/client/client.go index b981e08d6..4b3e80e93 100644 --- a/coordinator/internal/kubernetes/k8sapi/kubectl/client/client.go +++ b/bootstrapper/internal/kubernetes/k8sapi/kubectl/client/client.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" @@ -14,7 +14,7 @@ import ( "k8s.io/client-go/tools/clientcmd" ) -const fieldManager = "constellation-coordinator" +const fieldManager = "constellation-bootstrapper" // Client implements k8sapi.Client interface and talks to the Kubernetes API. type Client struct { diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/client/client_test.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/client/client_test.go similarity index 97% rename from coordinator/internal/kubernetes/k8sapi/kubectl/client/client_test.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/client/client_test.go index 6ddf74bf7..c77e570cb 100644 --- a/coordinator/internal/kubernetes/k8sapi/kubectl/client/client_test.go +++ b/bootstrapper/internal/kubernetes/k8sapi/kubectl/client/client_test.go @@ -7,7 +7,7 @@ import ( "net/http" "testing" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/goleak" @@ -188,7 +188,7 @@ func TestApplyOneObject(t *testing.T) { }{ "apply works": { httpResponseData: map[string]string{ - "/deployments/my-nginx?fieldManager=constellation-coordinator&force=true": string(nginxDeplJSON), + "/deployments/my-nginx?fieldManager=constellation-bootstrapper&force=true": string(nginxDeplJSON), }, wantObj: nginxDeployment, resourcesYAML: string(nginxDeplYAML), diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/client/restclient.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/client/restclient.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/kubectl/client/restclient.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/client/restclient.go diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/client/restclient_test.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/client/restclient_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/kubectl/client/restclient_test.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/client/restclient_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/generator.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/generator.go similarity index 72% rename from coordinator/internal/kubernetes/k8sapi/kubectl/generator.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/generator.go index c42d65e00..31f8d8272 100644 --- a/coordinator/internal/kubernetes/k8sapi/kubectl/generator.go +++ b/bootstrapper/internal/kubernetes/k8sapi/kubectl/generator.go @@ -1,6 +1,6 @@ package kubectl -import "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/kubectl/client" +import "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/kubectl/client" // generator implements clientGenerator interface. type generator struct{} diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/kubectl.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/kubectl.go similarity index 95% rename from coordinator/internal/kubernetes/k8sapi/kubectl/kubectl.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/kubectl.go index 8d967b529..3a5b97c9c 100644 --- a/coordinator/internal/kubernetes/k8sapi/kubectl/kubectl.go +++ b/bootstrapper/internal/kubernetes/k8sapi/kubectl/kubectl.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "k8s.io/cli-runtime/pkg/resource" ) diff --git a/coordinator/internal/kubernetes/k8sapi/kubectl/kubectl_test.go b/bootstrapper/internal/kubernetes/k8sapi/kubectl/kubectl_test.go similarity index 96% rename from coordinator/internal/kubernetes/k8sapi/kubectl/kubectl_test.go rename to bootstrapper/internal/kubernetes/k8sapi/kubectl/kubectl_test.go index 03018bb75..52d9530c7 100644 --- a/coordinator/internal/kubernetes/k8sapi/kubectl/kubectl_test.go +++ b/bootstrapper/internal/kubernetes/k8sapi/kubectl/kubectl_test.go @@ -4,7 +4,7 @@ import ( "errors" "testing" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" "github.com/stretchr/testify/assert" "go.uber.org/goleak" "k8s.io/cli-runtime/pkg/resource" diff --git a/coordinator/internal/kubernetes/k8sapi/resources/access_manager.go b/bootstrapper/internal/kubernetes/k8sapi/resources/access_manager.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/access_manager.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/access_manager.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/access_manager_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/access_manager_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/access_manager_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/access_manager_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/activation.go b/bootstrapper/internal/kubernetes/k8sapi/resources/activation.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/activation.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/activation.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/activation_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/activation_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/activation_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/activation_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/auditpolicy.go b/bootstrapper/internal/kubernetes/k8sapi/resources/auditpolicy.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/auditpolicy.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/auditpolicy.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/auditpolicy_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/auditpolicy_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/auditpolicy_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/auditpolicy_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/cloud_controller_manager.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cloud_controller_manager.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/cloud_controller_manager.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/cloud_controller_manager.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/cloud_controller_manager_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cloud_controller_manager_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/cloud_controller_manager_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/cloud_controller_manager_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/cloudnodemanager.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cloudnodemanager.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/cloudnodemanager.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/cloudnodemanager.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/cloudnodemanager_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cloudnodemanager_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/cloudnodemanager_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/cloudnodemanager_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/cluster_autoscaler_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/configmaps.go b/bootstrapper/internal/kubernetes/k8sapi/resources/configmaps.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/configmaps.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/configmaps.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/configmaps_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/configmaps_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/configmaps_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/configmaps_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/image_pull_secret.go b/bootstrapper/internal/kubernetes/k8sapi/resources/image_pull_secret.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/image_pull_secret.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/image_pull_secret.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/image_pull_secret_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/image_pull_secret_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/image_pull_secret_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/image_pull_secret_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/images.go b/bootstrapper/internal/kubernetes/k8sapi/resources/images.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/images.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/images.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/kms.go b/bootstrapper/internal/kubernetes/k8sapi/resources/kms.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/kms.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/kms.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/kms_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/kms_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/kms_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/kms_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/marshal.go b/bootstrapper/internal/kubernetes/k8sapi/resources/marshal.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/marshal.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/marshal.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/marshal_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/marshal_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/marshal_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/marshal_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/secrets.go b/bootstrapper/internal/kubernetes/k8sapi/resources/secrets.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/secrets.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/secrets.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/secrets_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/secrets_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/secrets_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/secrets_test.go diff --git a/coordinator/kubernetes/k8sapi/resources/verification.go b/bootstrapper/internal/kubernetes/k8sapi/resources/verification.go similarity index 100% rename from coordinator/kubernetes/k8sapi/resources/verification.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/verification.go diff --git a/coordinator/internal/kubernetes/k8sapi/resources/verification_test.go b/bootstrapper/internal/kubernetes/k8sapi/resources/verification_test.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/resources/verification_test.go rename to bootstrapper/internal/kubernetes/k8sapi/resources/verification_test.go diff --git a/coordinator/internal/kubernetes/k8sapi/systemd.go b/bootstrapper/internal/kubernetes/k8sapi/systemd.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/systemd.go rename to bootstrapper/internal/kubernetes/k8sapi/systemd.go diff --git a/coordinator/internal/kubernetes/k8sapi/util.go b/bootstrapper/internal/kubernetes/k8sapi/util.go similarity index 99% rename from coordinator/internal/kubernetes/k8sapi/util.go rename to bootstrapper/internal/kubernetes/k8sapi/util.go index 9ee483a01..2fac94ce0 100644 --- a/coordinator/internal/kubernetes/k8sapi/util.go +++ b/bootstrapper/internal/kubernetes/k8sapi/util.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" ) diff --git a/coordinator/internal/kubernetes/k8sapi/versions.go b/bootstrapper/internal/kubernetes/k8sapi/versions.go similarity index 100% rename from coordinator/internal/kubernetes/k8sapi/versions.go rename to bootstrapper/internal/kubernetes/k8sapi/versions.go diff --git a/coordinator/internal/kubernetes/k8sutil.go b/bootstrapper/internal/kubernetes/k8sutil.go similarity index 89% rename from coordinator/internal/kubernetes/k8sutil.go rename to bootstrapper/internal/kubernetes/k8sutil.go index 71b139d17..08724ce8b 100644 --- a/coordinator/internal/kubernetes/k8sutil.go +++ b/bootstrapper/internal/kubernetes/k8sutil.go @@ -4,8 +4,8 @@ import ( "context" "time" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" ) diff --git a/coordinator/internal/kubernetes/kubeconfig.go b/bootstrapper/internal/kubernetes/kubeconfig.go similarity index 100% rename from coordinator/internal/kubernetes/kubeconfig.go rename to bootstrapper/internal/kubernetes/kubeconfig.go diff --git a/coordinator/internal/kubernetes/kubeconfig_test.go b/bootstrapper/internal/kubernetes/kubeconfig_test.go similarity index 100% rename from coordinator/internal/kubernetes/kubeconfig_test.go rename to bootstrapper/internal/kubernetes/kubeconfig_test.go diff --git a/coordinator/internal/kubernetes/kubernetes.go b/bootstrapper/internal/kubernetes/kubernetes.go similarity index 97% rename from coordinator/internal/kubernetes/kubernetes.go rename to bootstrapper/internal/kubernetes/kubernetes.go index 422111e17..d3a3c55f8 100644 --- a/coordinator/internal/kubernetes/kubernetes.go +++ b/bootstrapper/internal/kubernetes/kubernetes.go @@ -7,10 +7,10 @@ import ( "strings" "time" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" - "github.com/edgelesssys/constellation/coordinator/role" - "github.com/edgelesssys/constellation/coordinator/util" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/role" + "github.com/edgelesssys/constellation/bootstrapper/util" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/spf13/afero" @@ -229,7 +229,7 @@ func (k *KubeWrapper) JoinCluster(ctx context.Context, args *kubeadm.BootstrapTo joinConfig.SetNodeIP(nodeInternalIP) joinConfig.SetNodeName(nodeName) joinConfig.SetProviderID(providerID) - if peerRole == role.Coordinator { + if peerRole == role.ControlPlane { joinConfig.SetControlPlane(nodeInternalIP, certKey) } joinConfigYAML, err := joinConfig.Marshal() @@ -251,7 +251,7 @@ func (k *KubeWrapper) GetKubeconfig() ([]byte, error) { if err != nil { return nil, err } - // replace the cluster.Server endpoint (127.0.0.1:16443) in admin.conf with the first coordinator endpoint (10.118.0.1:6443) + // replace the cluster.Server endpoint (127.0.0.1:16443) in admin.conf with the first bootstrapper endpoint (10.118.0.1:6443) // kube-api server listens on 10.118.0.1:6443 // 127.0.0.1:16443 is the high availability balancer nginx endpoint, runnining localy on all nodes // alternatively one could also start a local high availability balancer. diff --git a/coordinator/internal/kubernetes/kubernetes_test.go b/bootstrapper/internal/kubernetes/kubernetes_test.go similarity index 97% rename from coordinator/internal/kubernetes/kubernetes_test.go rename to bootstrapper/internal/kubernetes/kubernetes_test.go index b2b999ce9..17deaa3b1 100644 --- a/coordinator/internal/kubernetes/kubernetes_test.go +++ b/bootstrapper/internal/kubernetes/kubernetes_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi" - "github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi" + "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources" + "github.com/edgelesssys/constellation/bootstrapper/role" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/stretchr/testify/assert" @@ -307,7 +307,7 @@ func TestJoinCluster(t *testing.T) { clusterUtil: stubClusterUtil{}, providerMetadata: &stubProviderMetadata{}, CloudControllerManager: &stubCloudControllerManager{}, - role: role.Node, + role: role.Worker, wantConfig: kubeadm.JoinConfiguration{ Discovery: kubeadm.Discovery{ BootstrapToken: joinCommand, @@ -329,7 +329,7 @@ func TestJoinCluster(t *testing.T) { }, }, CloudControllerManager: &stubCloudControllerManager{}, - role: role.Node, + role: role.Worker, wantConfig: kubeadm.JoinConfiguration{ Discovery: kubeadm.Discovery{ BootstrapToken: joinCommand, @@ -353,7 +353,7 @@ func TestJoinCluster(t *testing.T) { CloudControllerManager: &stubCloudControllerManager{ SupportedResp: true, }, - role: role.Node, + role: role.Worker, wantConfig: kubeadm.JoinConfiguration{ Discovery: kubeadm.Discovery{ BootstrapToken: joinCommand, @@ -375,7 +375,7 @@ func TestJoinCluster(t *testing.T) { }, }, CloudControllerManager: &stubCloudControllerManager{}, - role: role.Coordinator, + role: role.ControlPlane, wantConfig: kubeadm.JoinConfiguration{ Discovery: kubeadm.Discovery{ BootstrapToken: joinCommand, @@ -400,14 +400,14 @@ func TestJoinCluster(t *testing.T) { SelfErr: someErr, }, CloudControllerManager: &stubCloudControllerManager{}, - role: role.Node, + role: role.Worker, wantErr: true, }, "kubeadm join worker fails when applying the join config": { clusterUtil: stubClusterUtil{joinClusterErr: someErr}, providerMetadata: &stubProviderMetadata{}, CloudControllerManager: &stubCloudControllerManager{}, - role: role.Node, + role: role.Worker, wantErr: true, }, } @@ -476,8 +476,8 @@ func TestK8sCompliantHostname(t *testing.T) { wantHostname string }{ "azure scale set names work": { - hostname: "constellation-scale-set-coordinators-name_0", - wantHostname: "constellation-scale-set-coordinators-name-0", + hostname: "constellation-scale-set-bootstrappers-name_0", + wantHostname: "constellation-scale-set-bootstrappers-name-0", }, "compliant hostname is not modified": { hostname: "abcd-123", diff --git a/coordinator/internal/logging/logger.go b/bootstrapper/internal/logging/logger.go similarity index 100% rename from coordinator/internal/logging/logger.go rename to bootstrapper/internal/logging/logger.go diff --git a/coordinator/internal/nodelock/nodelock.go b/bootstrapper/internal/nodelock/nodelock.go similarity index 100% rename from coordinator/internal/nodelock/nodelock.go rename to bootstrapper/internal/nodelock/nodelock.go diff --git a/coordinator/nodestate/nodestate.go b/bootstrapper/nodestate/nodestate.go similarity index 93% rename from coordinator/nodestate/nodestate.go rename to bootstrapper/nodestate/nodestate.go index 423808bd2..c9679c355 100644 --- a/coordinator/nodestate/nodestate.go +++ b/bootstrapper/nodestate/nodestate.go @@ -3,7 +3,7 @@ package nodestate import ( "fmt" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/file" ) diff --git a/coordinator/nodestate/nodestate_test.go b/bootstrapper/nodestate/nodestate_test.go similarity index 89% rename from coordinator/nodestate/nodestate_test.go rename to bootstrapper/nodestate/nodestate_test.go index 430d9ea97..cddc55878 100644 --- a/coordinator/nodestate/nodestate_test.go +++ b/bootstrapper/nodestate/nodestate_test.go @@ -4,7 +4,7 @@ import ( "path/filepath" "testing" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/file" "github.com/spf13/afero" "github.com/stretchr/testify/assert" @@ -23,9 +23,9 @@ func TestFromFile(t *testing.T) { wantErr bool }{ "nodestate exists": { - fileContents: `{ "Role": "Coordinator", "OwnerID": "T3duZXJJRA==", "ClusterID": "Q2x1c3RlcklE" }`, + fileContents: `{ "Role": "ControlPlane", "OwnerID": "T3duZXJJRA==", "ClusterID": "Q2x1c3RlcklE" }`, wantState: &NodeState{ - Role: role.Coordinator, + Role: role.ControlPlane, OwnerID: []byte("OwnerID"), ClusterID: []byte("ClusterID"), }, @@ -66,12 +66,12 @@ func TestToFile(t *testing.T) { }{ "writing works": { state: &NodeState{ - Role: role.Coordinator, + Role: role.ControlPlane, OwnerID: []byte("OwnerID"), ClusterID: []byte("ClusterID"), }, wantFile: `{ - "Role": "Coordinator", + "Role": "ControlPlane", "OwnerID": "T3duZXJJRA==", "ClusterID": "Q2x1c3RlcklE" }`, diff --git a/coordinator/role/role.go b/bootstrapper/role/role.go similarity index 86% rename from coordinator/role/role.go rename to bootstrapper/role/role.go index 56a28addf..3af0b040a 100644 --- a/coordinator/role/role.go +++ b/bootstrapper/role/role.go @@ -12,8 +12,8 @@ type Role uint const ( Unknown Role = iota - Coordinator - Node + ControlPlane + Worker Admin ) @@ -29,10 +29,10 @@ func (r *Role) UnmarshalJSON(b []byte) error { return err } switch strings.ToLower(roleString) { - case "coordinator": - *r = Coordinator - case "node": - *r = Node + case "controlplane": + *r = ControlPlane + case "worker": + *r = Worker case "admin": *r = Admin default: diff --git a/coordinator/role/role_string.go b/bootstrapper/role/role_string.go similarity index 77% rename from coordinator/role/role_string.go rename to bootstrapper/role/role_string.go index 3c93846eb..dd3c90a37 100644 --- a/coordinator/role/role_string.go +++ b/bootstrapper/role/role_string.go @@ -9,14 +9,14 @@ func _() { // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[Unknown-0] - _ = x[Coordinator-1] - _ = x[Node-2] + _ = x[ControlPlane-1] + _ = x[Worker-2] _ = x[Admin-3] } -const _Role_name = "UnknownCoordinatorNodeAdmin" +const _Role_name = "UnknownControlPlaneWorkerAdmin" -var _Role_index = [...]uint8{0, 7, 18, 22, 27} +var _Role_index = [...]uint8{0, 7, 19, 25, 30} func (i Role) String() string { if i >= Role(len(_Role_index)-1) { diff --git a/coordinator/role/role_test.go b/bootstrapper/role/role_test.go similarity index 76% rename from coordinator/role/role_test.go rename to bootstrapper/role/role_test.go index e4ae08f06..4ab99b056 100644 --- a/coordinator/role/role_test.go +++ b/bootstrapper/role/role_test.go @@ -18,13 +18,13 @@ func TestMarshal(t *testing.T) { wantJson string wantErr bool }{ - "coordinator role": { - role: Coordinator, - wantJson: `"Coordinator"`, + "controlePlane role": { + role: ControlPlane, + wantJson: `"ControlPlane"`, }, "node role": { - role: Node, - wantJson: `"Node"`, + role: Worker, + wantJson: `"Worker"`, }, "admin role": { role: Admin, @@ -59,21 +59,21 @@ func TestUnmarshal(t *testing.T) { wantRole Role wantErr bool }{ - "Coordinator can be unmarshaled": { - json: `"Coordinator"`, - wantRole: Coordinator, + "ControlPlane can be unmarshaled": { + json: `"ControlPlane"`, + wantRole: ControlPlane, }, - "lowercase coordinator can be unmarshaled": { - json: `"coordinator"`, - wantRole: Coordinator, + "lowercase controlPlane can be unmarshaled": { + json: `"controlPlane"`, + wantRole: ControlPlane, }, - "Node can be unmarshaled": { - json: `"Node"`, - wantRole: Node, + "Worker can be unmarshaled": { + json: `"Worker"`, + wantRole: Worker, }, - "lowercase node can be unmarshaled": { - json: `"node"`, - wantRole: Node, + "lowercase worker can be unmarshaled": { + json: `"worker"`, + wantRole: Worker, }, "Admin can be unmarshaled": { json: `"Admin"`, diff --git a/coordinator/util/util.go b/bootstrapper/util/util.go similarity index 100% rename from coordinator/util/util.go rename to bootstrapper/util/util.go diff --git a/coordinator/util/util_test.go b/bootstrapper/util/util_test.go similarity index 100% rename from coordinator/util/util_test.go rename to bootstrapper/util/util_test.go diff --git a/cli/internal/azure/client/client.go b/cli/internal/azure/client/client.go index 3c918d961..6f2436165 100644 --- a/cli/internal/azure/client/client.go +++ b/cli/internal/azure/client/client.go @@ -44,8 +44,8 @@ type Client struct { adReplicationLagCheckInterval time.Duration adReplicationLagCheckMaxRetries int - nodes cloudtypes.Instances - coordinators cloudtypes.Instances + workers cloudtypes.Instances + controlPlanes cloudtypes.Instances name string uid string @@ -54,8 +54,8 @@ type Client struct { subscriptionID string tenantID string subnetID string - coordinatorsScaleSet string - nodesScaleSet string + controlPlaneScaleSet string + workerScaleSet string loadBalancerName string loadBalancerPubIP string networkSecurityGroup string @@ -107,8 +107,8 @@ func NewFromDefault(subscriptionID, tenantID string) (*Client, error) { applicationInsightsAPI: applicationInsightsAPI, subscriptionID: subscriptionID, tenantID: tenantID, - nodes: cloudtypes.Instances{}, - coordinators: cloudtypes.Instances{}, + workers: cloudtypes.Instances{}, + controlPlanes: cloudtypes.Instances{}, adReplicationLagCheckInterval: adReplicationLagCheckInterval, adReplicationLagCheckMaxRetries: adReplicationLagCheckMaxRetries, }, nil @@ -174,22 +174,22 @@ func (c *Client) GetState() (state.ConstellationState, error) { return state.ConstellationState{}, errors.New("client has no network security group") } stat.AzureNetworkSecurityGroup = c.networkSecurityGroup - if len(c.nodesScaleSet) == 0 { - return state.ConstellationState{}, errors.New("client has no nodes scale set") + if len(c.workerScaleSet) == 0 { + return state.ConstellationState{}, errors.New("client has no worker scale set") } - stat.AzureNodesScaleSet = c.nodesScaleSet - if len(c.coordinatorsScaleSet) == 0 { - return state.ConstellationState{}, errors.New("client has no coordinators scale set") + stat.AzureWorkersScaleSet = c.workerScaleSet + if len(c.controlPlaneScaleSet) == 0 { + return state.ConstellationState{}, errors.New("client has no control plane scale set") } - stat.AzureCoordinatorsScaleSet = c.coordinatorsScaleSet - if len(c.nodes) == 0 { - return state.ConstellationState{}, errors.New("client has no nodes") + stat.AzureControlPlanesScaleSet = c.controlPlaneScaleSet + if len(c.workers) == 0 { + return state.ConstellationState{}, errors.New("client has no workers") } - stat.AzureNodes = c.nodes - if len(c.coordinators) == 0 { - return state.ConstellationState{}, errors.New("client has no coordinators") + stat.AzureWorkers = c.workers + if len(c.controlPlanes) == 0 { + return state.ConstellationState{}, errors.New("client has no control planes") } - stat.AzureCoordinators = c.coordinators + stat.AzureControlPlane = c.controlPlanes // AD App Object ID does not have to be set at all times stat.AzureADAppObjectID = c.adAppObjectID @@ -233,22 +233,22 @@ func (c *Client) SetState(stat state.ConstellationState) error { return errors.New("state has no subnet") } c.networkSecurityGroup = stat.AzureNetworkSecurityGroup - if len(stat.AzureNodesScaleSet) == 0 { - return errors.New("state has no nodes scale set") + if len(stat.AzureWorkersScaleSet) == 0 { + return errors.New("state has no worker scale set") } - c.nodesScaleSet = stat.AzureNodesScaleSet - if len(stat.AzureCoordinatorsScaleSet) == 0 { - return errors.New("state has no nodes scale set") + c.workerScaleSet = stat.AzureWorkersScaleSet + if len(stat.AzureControlPlanesScaleSet) == 0 { + return errors.New("state has no worker scale set") } - c.coordinatorsScaleSet = stat.AzureCoordinatorsScaleSet - if len(stat.AzureNodes) == 0 { - return errors.New("state has no nodes") + c.controlPlaneScaleSet = stat.AzureControlPlanesScaleSet + if len(stat.AzureWorkers) == 0 { + return errors.New("state has no workers") } - c.nodes = stat.AzureNodes - if len(stat.AzureCoordinators) == 0 { - return errors.New("state has no coordinators") + c.workers = stat.AzureWorkers + if len(stat.AzureControlPlane) == 0 { + return errors.New("state has no control planes") } - c.coordinators = stat.AzureCoordinators + c.controlPlanes = stat.AzureControlPlane // AD App Object ID does not have to be set at all times c.adAppObjectID = stat.AzureADAppObjectID diff --git a/cli/internal/azure/client/client_test.go b/cli/internal/azure/client/client_test.go index 59bf3eb36..c24b4db18 100644 --- a/cli/internal/azure/client/client_test.go +++ b/cli/internal/azure/client/client_test.go @@ -23,300 +23,327 @@ func TestSetGetState(t *testing.T) { "valid state": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, }, - "missing nodes": { + "missing workers": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, - "missing coordinator": { + "missing controlplane": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing name": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing uid": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing resource group": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing location": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing subscription": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureTenant: "tenant", - AzureLocation: "location", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureTenant: "tenant", + AzureLocation: "location", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing tenant": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureSubscription: "subscription", - AzureLocation: "location", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureSubscription: "subscription", + AzureLocation: "location", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing subnet": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, "missing network security group": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", }, wantErr: true, }, - "missing node scale set": { + "missing worker scale set": { state: state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ + "0": { + PublicIP: "ip3", + PrivateIP: "ip4", + }, + }, + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureTenant: "tenant", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureControlPlanesScaleSet: "controlplane-scale-set", + }, + wantErr: true, + }, + "missing controlplane scale set": { + state: state.ConstellationState{ + CloudProvider: cloudprovider.Azure.String(), + AzureWorkers: cloudtypes.Instances{ + "0": { + PublicIP: "ip1", + PrivateIP: "ip2", + }, + }, + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", @@ -330,34 +357,7 @@ func TestSetGetState(t *testing.T) { AzureTenant: "tenant", AzureSubnet: "azure-subnet", AzureNetworkSecurityGroup: "network-security-group", - AzureCoordinatorsScaleSet: "coordinator-scale-set", - }, - wantErr: true, - }, - "missing coordinator scale set": { - state: state.ConstellationState{ - CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ - "0": { - PublicIP: "ip1", - PrivateIP: "ip2", - }, - }, - AzureCoordinators: cloudtypes.Instances{ - "0": { - PublicIP: "ip3", - PrivateIP: "ip4", - }, - }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureTenant: "tenant", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", + AzureWorkersScaleSet: "worker-scale-set", }, wantErr: true, }, @@ -373,8 +373,8 @@ func TestSetGetState(t *testing.T) { assert.Error(client.SetState(tc.state)) } else { assert.NoError(client.SetState(tc.state)) - assert.Equal(tc.state.AzureNodes, client.nodes) - assert.Equal(tc.state.AzureCoordinators, client.coordinators) + assert.Equal(tc.state.AzureWorkers, client.workers) + assert.Equal(tc.state.AzureControlPlane, client.controlPlanes) assert.Equal(tc.state.Name, client.name) assert.Equal(tc.state.UID, client.uid) assert.Equal(tc.state.AzureResourceGroup, client.resourceGroup) @@ -383,8 +383,8 @@ func TestSetGetState(t *testing.T) { assert.Equal(tc.state.AzureTenant, client.tenantID) assert.Equal(tc.state.AzureSubnet, client.subnetID) assert.Equal(tc.state.AzureNetworkSecurityGroup, client.networkSecurityGroup) - assert.Equal(tc.state.AzureNodesScaleSet, client.nodesScaleSet) - assert.Equal(tc.state.AzureCoordinatorsScaleSet, client.coordinatorsScaleSet) + assert.Equal(tc.state.AzureWorkersScaleSet, client.workerScaleSet) + assert.Equal(tc.state.AzureControlPlanesScaleSet, client.controlPlaneScaleSet) } }) } @@ -396,8 +396,8 @@ func TestSetGetState(t *testing.T) { assert := assert.New(t) client := Client{ - nodes: tc.state.AzureNodes, - coordinators: tc.state.AzureCoordinators, + workers: tc.state.AzureWorkers, + controlPlanes: tc.state.AzureControlPlane, name: tc.state.Name, uid: tc.state.UID, resourceGroup: tc.state.AzureResourceGroup, @@ -406,8 +406,8 @@ func TestSetGetState(t *testing.T) { tenantID: tc.state.AzureTenant, subnetID: tc.state.AzureSubnet, networkSecurityGroup: tc.state.AzureNetworkSecurityGroup, - nodesScaleSet: tc.state.AzureNodesScaleSet, - coordinatorsScaleSet: tc.state.AzureCoordinatorsScaleSet, + workerScaleSet: tc.state.AzureWorkersScaleSet, + controlPlaneScaleSet: tc.state.AzureControlPlanesScaleSet, } if tc.wantErr { _, err := client.GetState() @@ -427,52 +427,52 @@ func TestSetStateCloudProvider(t *testing.T) { client := Client{} stateMissingCloudProvider := state.ConstellationState{ - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", } assert.Error(client.SetState(stateMissingCloudProvider)) stateIncorrectCloudProvider := state.ConstellationState{ CloudProvider: "incorrect", - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "0": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "0": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - Name: "name", - UID: "uid", - AzureResourceGroup: "resource-group", - AzureLocation: "location", - AzureSubscription: "subscription", - AzureSubnet: "azure-subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "node-scale-set", - AzureCoordinatorsScaleSet: "coordinator-scale-set", + Name: "name", + UID: "uid", + AzureResourceGroup: "resource-group", + AzureLocation: "location", + AzureSubscription: "subscription", + AzureSubnet: "azure-subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "worker-scale-set", + AzureControlPlanesScaleSet: "controlplane-scale-set", } assert.Error(client.SetState(stateIncorrectCloudProvider)) } diff --git a/cli/internal/azure/client/compute.go b/cli/internal/azure/client/compute.go index e085774d4..0c5e014fd 100644 --- a/cli/internal/azure/client/compute.go +++ b/cli/internal/azure/client/compute.go @@ -12,11 +12,11 @@ import ( ) func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput) error { - // Create nodes scale set - createNodesInput := CreateScaleSetInput{ - Name: "constellation-scale-set-nodes-" + c.uid, + // Create worker scale set + createWorkerInput := CreateScaleSetInput{ + Name: "constellation-scale-set-workers-" + c.uid, NamePrefix: c.name + "-worker-" + c.uid + "-", - Count: input.CountNodes, + Count: input.CountWorkers, InstanceType: input.InstanceType, StateDiskSizeGB: int32(input.StateDiskSizeGB), Image: input.Image, @@ -24,17 +24,17 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput LoadBalancerBackendAddressPool: azure.BackendAddressPoolWorkerName + "-" + c.uid, } - if err := c.createScaleSet(ctx, createNodesInput); err != nil { + if err := c.createScaleSet(ctx, createWorkerInput); err != nil { return err } - c.nodesScaleSet = createNodesInput.Name + c.workerScaleSet = createWorkerInput.Name - // Create coordinator scale set - createCoordinatorsInput := CreateScaleSetInput{ - Name: "constellation-scale-set-coordinators-" + c.uid, + // Create control plane scale set + createControlPlaneInput := CreateScaleSetInput{ + Name: "constellation-scale-set-controlpalens-" + c.uid, NamePrefix: c.name + "-control-plane-" + c.uid + "-", - Count: input.CountCoordinators, + Count: input.CountControlPlanes, InstanceType: input.InstanceType, StateDiskSizeGB: int32(input.StateDiskSizeGB), Image: input.Image, @@ -42,40 +42,40 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput LoadBalancerBackendAddressPool: azure.BackendAddressPoolControlPlaneName + "-" + c.uid, } - if err := c.createScaleSet(ctx, createCoordinatorsInput); err != nil { + if err := c.createScaleSet(ctx, createControlPlaneInput); err != nil { return err } - // Get nodes IPs - instances, err := c.getInstanceIPs(ctx, createNodesInput.Name, createNodesInput.Count) + // Get worker IPs + instances, err := c.getInstanceIPs(ctx, createWorkerInput.Name, createWorkerInput.Count) if err != nil { return err } - c.nodes = instances + c.workers = instances - // Get coordinators IPs - c.coordinatorsScaleSet = createCoordinatorsInput.Name - instances, err = c.getInstanceIPs(ctx, createCoordinatorsInput.Name, createCoordinatorsInput.Count) + // Get control plane IPs + c.controlPlaneScaleSet = createControlPlaneInput.Name + instances, err = c.getInstanceIPs(ctx, createControlPlaneInput.Name, createControlPlaneInput.Count) if err != nil { return err } - c.coordinators = instances + c.controlPlanes = instances - // Set the load balancer public IP in the first coordinator - coord, ok := c.coordinators["0"] + // Set the load balancer public IP in the first control plane + coord, ok := c.controlPlanes["0"] if !ok { - return errors.New("coordinator 0 not found") + return errors.New("control plane 0 not found") } coord.PublicIP = c.loadBalancerPubIP - c.coordinators["0"] = coord + c.controlPlanes["0"] = coord return nil } // CreateInstancesInput is the input for a CreateInstances operation. type CreateInstancesInput struct { - CountNodes int - CountCoordinators int + CountWorkers int + CountControlPlanes int InstanceType string StateDiskSizeGB int Image string @@ -90,7 +90,7 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn return err } - for i := 0; i < input.CountCoordinators; i++ { + for i := 0; i < input.CountControlPlanes; i++ { vm := azure.VMInstance{ Name: c.name + "-control-plane-" + c.uid + "-" + strconv.Itoa(i), Username: "constell", @@ -103,12 +103,12 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn if err != nil { return err } - c.coordinators[strconv.Itoa(i)] = instance + c.controlPlanes[strconv.Itoa(i)] = instance } - for i := 0; i < input.CountNodes; i++ { + for i := 0; i < input.CountWorkers; i++ { vm := azure.VMInstance{ - Name: c.name + "-node-" + c.uid + "-" + strconv.Itoa(i), + Name: c.name + "-worker-" + c.uid + "-" + strconv.Itoa(i), Username: "constell", Password: pw, Location: c.location, @@ -119,7 +119,7 @@ func (c *Client) CreateInstancesVMs(ctx context.Context, input CreateInstancesIn if err != nil { return err } - c.nodes[strconv.Itoa(i)] = instance + c.workers[strconv.Itoa(i)] = instance } return nil @@ -294,12 +294,12 @@ func (c *Client) TerminateResourceGroup(ctx context.Context) error { if _, err = poller.PollUntilDone(ctx, 30*time.Second); err != nil { return err } - c.nodes = nil - c.coordinators = nil + c.workers = nil + c.controlPlanes = nil c.resourceGroup = "" c.subnetID = "" c.networkSecurityGroup = "" - c.nodesScaleSet = "" - c.coordinatorsScaleSet = "" + c.workerScaleSet = "" + c.controlPlaneScaleSet = "" return nil } diff --git a/cli/internal/azure/client/compute_test.go b/cli/internal/azure/client/compute_test.go index b6b83e3bf..1cbea2085 100644 --- a/cli/internal/azure/client/compute_test.go +++ b/cli/internal/azure/client/compute_test.go @@ -38,8 +38,8 @@ func TestCreateResourceGroup(t *testing.T) { name: "name", uid: "uid", resourceGroupAPI: tc.resourceGroupAPI, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), } if tc.wantErr { @@ -60,14 +60,14 @@ func TestTerminateResourceGroup(t *testing.T) { name: "name", uid: "uid", subnetID: "subnet", - nodesScaleSet: "node-scale-set", - coordinatorsScaleSet: "coordinator-scale-set", - nodes: cloudtypes.Instances{ + workerScaleSet: "node-scale-set", + controlPlaneScaleSet: "controlplane-scale-set", + workers: cloudtypes.Instances{ "0": { PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1", }, }, - coordinators: cloudtypes.Instances{ + controlPlanes: cloudtypes.Instances{ "0": { PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1", }, @@ -112,10 +112,10 @@ func TestTerminateResourceGroup(t *testing.T) { assert.NoError(tc.client.TerminateResourceGroup(ctx)) assert.Empty(tc.client.resourceGroup) assert.Empty(tc.client.subnetID) - assert.Empty(tc.client.nodes) - assert.Empty(tc.client.coordinators) - assert.Empty(tc.client.nodesScaleSet) - assert.Empty(tc.client.coordinatorsScaleSet) + assert.Empty(tc.client.workers) + assert.Empty(tc.client.controlPlanes) + assert.Empty(tc.client.workerScaleSet) + assert.Empty(tc.client.controlPlaneScaleSet) }) } } @@ -146,8 +146,8 @@ func TestCreateInstances(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, + CountControlPlanes: 3, + CountWorkers: 3, InstanceType: "type", Image: "image", UserAssingedIdentity: "identity", @@ -160,8 +160,8 @@ func TestCreateInstances(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, + CountControlPlanes: 3, + CountWorkers: 3, InstanceType: "type", Image: "image", UserAssingedIdentity: "identity", @@ -175,8 +175,8 @@ func TestCreateInstances(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, + CountControlPlanes: 3, + CountWorkers: 3, InstanceType: "type", Image: "image", UserAssingedIdentity: "identity", @@ -190,7 +190,7 @@ func TestCreateInstances(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountNodes: 3, + CountWorkers: 3, InstanceType: "type", Image: "image", UserAssingedIdentity: "identity", @@ -214,8 +214,8 @@ func TestCreateInstances(t *testing.T) { scaleSetsAPI: tc.scaleSetsAPI, resourceGroupAPI: tc.resourceGroupAPI, roleAssignmentsAPI: tc.roleAssignmentsAPI, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), loadBalancerPubIP: "lbip", } @@ -223,12 +223,12 @@ func TestCreateInstances(t *testing.T) { assert.Error(client.CreateInstances(ctx, tc.createInstancesInput)) } else { assert.NoError(client.CreateInstances(ctx, tc.createInstancesInput)) - assert.Equal(tc.createInstancesInput.CountCoordinators, len(client.coordinators)) - assert.Equal(tc.createInstancesInput.CountNodes, len(client.nodes)) - assert.NotEmpty(client.nodes["0"].PrivateIP) - assert.NotEmpty(client.nodes["0"].PublicIP) - assert.NotEmpty(client.coordinators["0"].PrivateIP) - assert.Equal("lbip", client.coordinators["0"].PublicIP) + assert.Equal(tc.createInstancesInput.CountControlPlanes, len(client.controlPlanes)) + assert.Equal(tc.createInstancesInput.CountWorkers, len(client.workers)) + assert.NotEmpty(client.workers["0"].PrivateIP) + assert.NotEmpty(client.workers["0"].PublicIP) + assert.NotEmpty(client.controlPlanes["0"].PrivateIP) + assert.Equal("lbip", client.controlPlanes["0"].PublicIP) } }) } @@ -261,10 +261,10 @@ func TestCreateInstancesVMs(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, - InstanceType: "type", - Image: "image", + CountControlPlanes: 3, + CountWorkers: 3, + InstanceType: "type", + Image: "image", }, }, "error when creating scale set": { @@ -274,10 +274,10 @@ func TestCreateInstancesVMs(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, - InstanceType: "type", - Image: "image", + CountControlPlanes: 3, + CountWorkers: 3, + InstanceType: "type", + Image: "image", }, wantErr: true, }, @@ -288,10 +288,10 @@ func TestCreateInstancesVMs(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, - InstanceType: "type", - Image: "image", + CountControlPlanes: 3, + CountWorkers: 3, + InstanceType: "type", + Image: "image", }, wantErr: true, }, @@ -302,10 +302,10 @@ func TestCreateInstancesVMs(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, - InstanceType: "type", - Image: "image", + CountControlPlanes: 3, + CountWorkers: 3, + InstanceType: "type", + Image: "image", }, wantErr: true, }, @@ -316,10 +316,10 @@ func TestCreateInstancesVMs(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, - InstanceType: "type", - Image: "image", + CountControlPlanes: 3, + CountWorkers: 3, + InstanceType: "type", + Image: "image", }, wantErr: true, }, @@ -330,10 +330,10 @@ func TestCreateInstancesVMs(t *testing.T) { resourceGroupAPI: newSuccessfulResourceGroupStub(), roleAssignmentsAPI: &stubRoleAssignmentsAPI{}, createInstancesInput: CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 3, - InstanceType: "type", - Image: "image", + CountControlPlanes: 3, + CountWorkers: 3, + InstanceType: "type", + Image: "image", }, wantErr: true, }, @@ -355,8 +355,8 @@ func TestCreateInstancesVMs(t *testing.T) { virtualMachinesAPI: tc.virtualMachinesAPI, resourceGroupAPI: tc.resourceGroupAPI, roleAssignmentsAPI: tc.roleAssignmentsAPI, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), } if tc.wantErr { @@ -365,12 +365,12 @@ func TestCreateInstancesVMs(t *testing.T) { } require.NoError(client.CreateInstancesVMs(ctx, tc.createInstancesInput)) - assert.Equal(tc.createInstancesInput.CountCoordinators, len(client.coordinators)) - assert.Equal(tc.createInstancesInput.CountNodes, len(client.nodes)) - assert.NotEmpty(client.nodes["0"].PrivateIP) - assert.NotEmpty(client.nodes["0"].PublicIP) - assert.NotEmpty(client.coordinators["0"].PrivateIP) - assert.NotEmpty(client.coordinators["0"].PublicIP) + assert.Equal(tc.createInstancesInput.CountControlPlanes, len(client.controlPlanes)) + assert.Equal(tc.createInstancesInput.CountWorkers, len(client.workers)) + assert.NotEmpty(client.workers["0"].PrivateIP) + assert.NotEmpty(client.workers["0"].PublicIP) + assert.NotEmpty(client.controlPlanes["0"].PrivateIP) + assert.NotEmpty(client.controlPlanes["0"].PublicIP) }) } } diff --git a/cli/internal/azure/client/network_test.go b/cli/internal/azure/client/network_test.go index 38d6c6c78..d5f5f27ae 100644 --- a/cli/internal/azure/client/network_test.go +++ b/cli/internal/azure/client/network_test.go @@ -39,8 +39,8 @@ func TestCreateVirtualNetwork(t *testing.T) { name: "name", uid: "uid", networksAPI: tc.networksAPI, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), } if tc.wantErr { @@ -102,8 +102,8 @@ func TestCreateSecurityGroup(t *testing.T) { location: "location", name: "name", uid: "uid", - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), networkSecurityGroupsAPI: tc.networkSecurityGroupsAPI, } @@ -152,8 +152,8 @@ func TestCreateNIC(t *testing.T) { location: "location", name: "name", uid: "uid", - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), networkInterfacesAPI: tc.networkInterfacesAPI, } @@ -201,8 +201,8 @@ func TestCreatePublicIPAddress(t *testing.T) { location: "location", name: "name", uid: "uid", - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), publicIPAddressesAPI: tc.publicIPAddressesAPI, } @@ -256,8 +256,8 @@ func TestCreateExternalLoadBalancer(t *testing.T) { location: "location", name: "name", uid: "uid", - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), loadBalancersAPI: tc.loadBalancersAPI, publicIPAddressesAPI: tc.publicIPAddressesAPI, } diff --git a/cli/internal/azure/loadbalancer.go b/cli/internal/azure/loadbalancer.go index 588a717b2..0914ace5a 100644 --- a/cli/internal/azure/loadbalancer.go +++ b/cli/internal/azure/loadbalancer.go @@ -76,7 +76,7 @@ func (l LoadBalancer) Azure() armnetwork.LoadBalancer { Name: to.StringPtr(coordHealthProbeName), Properties: &armnetwork.ProbePropertiesFormat{ Protocol: armnetwork.ProbeProtocolTCP.ToPtr(), - Port: to.Int32Ptr(int32(constants.CoordinatorPort)), + Port: to.Int32Ptr(int32(constants.BootstrapperPort)), }, }, { @@ -134,8 +134,8 @@ func (l LoadBalancer) Azure() armnetwork.LoadBalancer { FrontendIPConfiguration: &armnetwork.SubResource{ ID: to.StringPtr("/subscriptions/" + l.Subscription + "/resourceGroups/" + l.ResourceGroup + "/providers/Microsoft.Network/loadBalancers/" + l.Name + "/frontendIPConfigurations/" + frontEndIPConfigName), }, - FrontendPort: to.Int32Ptr(int32(constants.CoordinatorPort)), - BackendPort: to.Int32Ptr(int32(constants.CoordinatorPort)), + FrontendPort: to.Int32Ptr(int32(constants.BootstrapperPort)), + BackendPort: to.Int32Ptr(int32(constants.BootstrapperPort)), Protocol: armnetwork.TransportProtocolTCP.ToPtr(), Probe: &armnetwork.SubResource{ ID: to.StringPtr("/subscriptions/" + l.Subscription + "/resourceGroups/" + l.ResourceGroup + "/providers/Microsoft.Network/loadBalancers/" + l.Name + "/probes/" + coordHealthProbeName), diff --git a/cli/internal/cloudcmd/clients_test.go b/cli/internal/cloudcmd/clients_test.go index 130284488..5662d2bac 100644 --- a/cli/internal/cloudcmd/clients_test.go +++ b/cli/internal/cloudcmd/clients_test.go @@ -24,8 +24,8 @@ func TestMain(m *testing.M) { } type fakeAzureClient struct { - nodes cloudtypes.Instances - coordinators cloudtypes.Instances + workers cloudtypes.Instances + controlPlanes cloudtypes.Instances resourceGroup string name string @@ -35,35 +35,35 @@ type fakeAzureClient struct { tenantID string subnetID string loadBalancerName string - coordinatorsScaleSet string - nodesScaleSet string + controlPlaneScaleSet string + workerScaleSet string networkSecurityGroup string adAppObjectID string } func (c *fakeAzureClient) GetState() (state.ConstellationState, error) { stat := state.ConstellationState{ - CloudProvider: cloudprovider.Azure.String(), - AzureNodes: c.nodes, - AzureCoordinators: c.coordinators, - Name: c.name, - UID: c.uid, - AzureResourceGroup: c.resourceGroup, - AzureLocation: c.location, - AzureSubscription: c.subscriptionID, - AzureTenant: c.tenantID, - AzureSubnet: c.subnetID, - AzureNetworkSecurityGroup: c.networkSecurityGroup, - AzureNodesScaleSet: c.nodesScaleSet, - AzureCoordinatorsScaleSet: c.coordinatorsScaleSet, - AzureADAppObjectID: c.adAppObjectID, + CloudProvider: cloudprovider.Azure.String(), + AzureWorkers: c.workers, + AzureControlPlane: c.controlPlanes, + Name: c.name, + UID: c.uid, + AzureResourceGroup: c.resourceGroup, + AzureLocation: c.location, + AzureSubscription: c.subscriptionID, + AzureTenant: c.tenantID, + AzureSubnet: c.subnetID, + AzureNetworkSecurityGroup: c.networkSecurityGroup, + AzureWorkersScaleSet: c.workerScaleSet, + AzureControlPlanesScaleSet: c.controlPlaneScaleSet, + AzureADAppObjectID: c.adAppObjectID, } return stat, nil } func (c *fakeAzureClient) SetState(stat state.ConstellationState) error { - c.nodes = stat.AzureNodes - c.coordinators = stat.AzureCoordinators + c.workers = stat.AzureWorkers + c.controlPlanes = stat.AzureControlPlane c.name = stat.Name c.uid = stat.UID c.resourceGroup = stat.AzureResourceGroup @@ -72,8 +72,8 @@ func (c *fakeAzureClient) SetState(stat state.ConstellationState) error { c.tenantID = stat.AzureTenant c.subnetID = stat.AzureSubnet c.networkSecurityGroup = stat.AzureNetworkSecurityGroup - c.nodesScaleSet = stat.AzureNodesScaleSet - c.coordinatorsScaleSet = stat.AzureCoordinatorsScaleSet + c.workerScaleSet = stat.AzureWorkersScaleSet + c.controlPlaneScaleSet = stat.AzureControlPlanesScaleSet c.adAppObjectID = stat.AzureADAppObjectID return nil } @@ -103,32 +103,32 @@ func (c *fakeAzureClient) CreateSecurityGroup(ctx context.Context, input azurecl } func (c *fakeAzureClient) CreateInstances(ctx context.Context, input azurecl.CreateInstancesInput) error { - c.coordinatorsScaleSet = "coordinators-scale-set" - c.nodesScaleSet = "nodes-scale-set" - c.nodes = make(cloudtypes.Instances) - for i := 0; i < input.CountNodes; i++ { + c.controlPlaneScaleSet = "controlplanes-scale-set" + c.workerScaleSet = "workers-scale-set" + c.workers = make(cloudtypes.Instances) + for i := 0; i < input.CountWorkers; i++ { id := "id-" + strconv.Itoa(i) - c.nodes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} + c.workers[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} } - c.coordinators = make(cloudtypes.Instances) - for i := 0; i < input.CountCoordinators; i++ { + c.controlPlanes = make(cloudtypes.Instances) + for i := 0; i < input.CountControlPlanes; i++ { id := "id-" + strconv.Itoa(i) - c.coordinators[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} + c.controlPlanes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} } return nil } // TODO: deprecate as soon as scale sets are available. func (c *fakeAzureClient) CreateInstancesVMs(ctx context.Context, input azurecl.CreateInstancesInput) error { - c.nodes = make(cloudtypes.Instances) - for i := 0; i < input.CountNodes; i++ { + c.workers = make(cloudtypes.Instances) + for i := 0; i < input.CountWorkers; i++ { id := "id-" + strconv.Itoa(i) - c.nodes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} + c.workers[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} } - c.coordinators = make(cloudtypes.Instances) - for i := 0; i < input.CountCoordinators; i++ { + c.controlPlanes = make(cloudtypes.Instances) + for i := 0; i < input.CountControlPlanes; i++ { id := "id-" + strconv.Itoa(i) - c.coordinators[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} + c.controlPlanes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} } return nil } @@ -145,13 +145,13 @@ func (c *fakeAzureClient) TerminateResourceGroup(ctx context.Context) error { if c.resourceGroup == "" { return nil } - c.nodes = nil - c.coordinators = nil + c.workers = nil + c.controlPlanes = nil c.resourceGroup = "" c.subnetID = "" c.networkSecurityGroup = "" - c.nodesScaleSet = "" - c.coordinatorsScaleSet = "" + c.workerScaleSet = "" + c.controlPlaneScaleSet = "" return nil } @@ -235,21 +235,21 @@ func (c *stubAzureClient) TerminateServicePrincipal(ctx context.Context) error { } type fakeGcpClient struct { - nodes cloudtypes.Instances - coordinators cloudtypes.Instances + workers cloudtypes.Instances + controlPlanes cloudtypes.Instances - nodesInstanceGroup string - coordinatorInstanceGroup string - coordinatorTemplate string - nodeTemplate string - network string - subnetwork string - firewalls []string - project string - uid string - name string - zone string - serviceAccount string + workerInstanceGroup string + controlPlaneInstanceGroup string + controlPlaneTemplate string + workerTemplate string + network string + subnetwork string + firewalls []string + project string + uid string + name string + zone string + serviceAccount string // loadbalancer healthCheck string @@ -259,35 +259,35 @@ type fakeGcpClient struct { func (c *fakeGcpClient) GetState() (state.ConstellationState, error) { stat := state.ConstellationState{ - CloudProvider: cloudprovider.GCP.String(), - GCPNodes: c.nodes, - GCPCoordinators: c.coordinators, - GCPNodeInstanceGroup: c.nodesInstanceGroup, - GCPCoordinatorInstanceGroup: c.coordinatorInstanceGroup, - GCPNodeInstanceTemplate: c.nodeTemplate, - GCPCoordinatorInstanceTemplate: c.coordinatorTemplate, - GCPNetwork: c.network, - GCPSubnetwork: c.subnetwork, - GCPFirewalls: c.firewalls, - GCPBackendService: c.backendService, - GCPHealthCheck: c.healthCheck, - GCPForwardingRule: c.forwardingRule, - GCPProject: c.project, - Name: c.name, - UID: c.uid, - GCPZone: c.zone, - GCPServiceAccount: c.serviceAccount, + CloudProvider: cloudprovider.GCP.String(), + GCPWorkers: c.workers, + GCPControlPlanes: c.controlPlanes, + GCPWorkerInstanceGroup: c.workerInstanceGroup, + GCPControlPlaneInstanceGroup: c.controlPlaneInstanceGroup, + GCPWorkerInstanceTemplate: c.workerTemplate, + GCPControlPlaneInstanceTemplate: c.controlPlaneTemplate, + GCPNetwork: c.network, + GCPSubnetwork: c.subnetwork, + GCPFirewalls: c.firewalls, + GCPBackendService: c.backendService, + GCPHealthCheck: c.healthCheck, + GCPForwardingRule: c.forwardingRule, + GCPProject: c.project, + Name: c.name, + UID: c.uid, + GCPZone: c.zone, + GCPServiceAccount: c.serviceAccount, } return stat, nil } func (c *fakeGcpClient) SetState(stat state.ConstellationState) error { - c.nodes = stat.GCPNodes - c.coordinators = stat.GCPCoordinators - c.nodesInstanceGroup = stat.GCPNodeInstanceGroup - c.coordinatorInstanceGroup = stat.GCPCoordinatorInstanceGroup - c.nodeTemplate = stat.GCPNodeInstanceTemplate - c.coordinatorTemplate = stat.GCPCoordinatorInstanceTemplate + c.workers = stat.GCPWorkers + c.controlPlanes = stat.GCPControlPlanes + c.workerInstanceGroup = stat.GCPWorkerInstanceGroup + c.controlPlaneInstanceGroup = stat.GCPControlPlaneInstanceGroup + c.workerTemplate = stat.GCPWorkerInstanceTemplate + c.controlPlaneTemplate = stat.GCPControlPlaneInstanceTemplate c.network = stat.GCPNetwork c.subnetwork = stat.GCPSubnetwork c.firewalls = stat.GCPFirewalls @@ -319,19 +319,19 @@ func (c *fakeGcpClient) CreateFirewall(ctx context.Context, input gcpcl.Firewall } func (c *fakeGcpClient) CreateInstances(ctx context.Context, input gcpcl.CreateInstancesInput) error { - c.coordinatorInstanceGroup = "coordinator-group" - c.nodesInstanceGroup = "nodes-group" - c.nodeTemplate = "node-template" - c.coordinatorTemplate = "coordinator-template" - c.nodes = make(cloudtypes.Instances) - for i := 0; i < input.CountNodes; i++ { + c.controlPlaneInstanceGroup = "controlplane-group" + c.workerInstanceGroup = "workers-group" + c.workerTemplate = "worker-template" + c.controlPlaneTemplate = "controlplane-template" + c.workers = make(cloudtypes.Instances) + for i := 0; i < input.CountWorkers; i++ { id := "id-" + strconv.Itoa(i) - c.nodes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} + c.workers[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} } - c.coordinators = make(cloudtypes.Instances) - for i := 0; i < input.CountCoordinators; i++ { + c.controlPlanes = make(cloudtypes.Instances) + for i := 0; i < input.CountControlPlanes; i++ { id := "id-" + strconv.Itoa(i) - c.coordinators[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} + c.controlPlanes[id] = cloudtypes.Instance{PublicIP: "192.0.2.1", PrivateIP: "192.0.2.1"} } return nil } @@ -377,12 +377,12 @@ func (c *fakeGcpClient) TerminateVPCs(context.Context) error { } func (c *fakeGcpClient) TerminateInstances(context.Context) error { - c.nodeTemplate = "" - c.coordinatorTemplate = "" - c.nodesInstanceGroup = "" - c.coordinatorInstanceGroup = "" - c.nodes = nil - c.coordinators = nil + c.workerTemplate = "" + c.controlPlaneTemplate = "" + c.workerInstanceGroup = "" + c.controlPlaneInstanceGroup = "" + c.workers = nil + c.controlPlanes = nil return nil } diff --git a/cli/internal/cloudcmd/create.go b/cli/internal/cloudcmd/create.go index 96af4d645..2c679c913 100644 --- a/cli/internal/cloudcmd/create.go +++ b/cli/internal/cloudcmd/create.go @@ -35,7 +35,7 @@ func NewCreator(out io.Writer) *Creator { } // Create creates the handed amount of instances and all the needed resources. -func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, config *config.Config, name, insType string, coordCount, nodeCount int, +func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, config *config.Config, name, insType string, controlPlaneCount, workerCount int, ) (state.ConstellationState, error) { switch provider { case cloudprovider.GCP: @@ -50,7 +50,7 @@ func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, c return state.ConstellationState{}, err } defer cl.Close() - return c.createGCP(ctx, cl, config, insType, coordCount, nodeCount) + return c.createGCP(ctx, cl, config, insType, controlPlaneCount, workerCount) case cloudprovider.Azure: cl, err := c.newAzureClient( config.Provider.Azure.SubscriptionID, @@ -61,13 +61,13 @@ func (c *Creator) Create(ctx context.Context, provider cloudprovider.Provider, c if err != nil { return state.ConstellationState{}, err } - return c.createAzure(ctx, cl, config, insType, coordCount, nodeCount) + return c.createAzure(ctx, cl, config, insType, controlPlaneCount, workerCount) default: return state.ConstellationState{}, fmt.Errorf("unsupported cloud provider: %s", provider) } } -func (c *Creator) createGCP(ctx context.Context, cl gcpclient, config *config.Config, insType string, coordCount, nodeCount int, +func (c *Creator) createGCP(ctx context.Context, cl gcpclient, config *config.Config, insType string, controlPlaneCount, workerCount int, ) (stat state.ConstellationState, retErr error) { defer rollbackOnError(context.Background(), c.out, &retErr, &rollbackerGCP{client: cl}) @@ -121,12 +121,12 @@ func (c *Creator) createGCP(ctx context.Context, cl gcpclient, config *config.Co } createInput := gcpcl.CreateInstancesInput{ - CountCoordinators: coordCount, - CountNodes: nodeCount, - ImageId: config.Provider.GCP.Image, - InstanceType: insType, - StateDiskSizeGB: config.StateDiskSizeGB, - KubeEnv: gcp.KubeEnv, + CountControlPlanes: controlPlaneCount, + CountWorkers: workerCount, + ImageId: config.Provider.GCP.Image, + InstanceType: insType, + StateDiskSizeGB: config.StateDiskSizeGB, + KubeEnv: gcp.KubeEnv, } if err := cl.CreateInstances(ctx, createInput); err != nil { return state.ConstellationState{}, err @@ -139,7 +139,7 @@ func (c *Creator) createGCP(ctx context.Context, cl gcpclient, config *config.Co return cl.GetState() } -func (c *Creator) createAzure(ctx context.Context, cl azureclient, config *config.Config, insType string, coordCount, nodeCount int, +func (c *Creator) createAzure(ctx context.Context, cl azureclient, config *config.Config, insType string, controlPlaneCount, workerCount int, ) (stat state.ConstellationState, retErr error) { defer rollbackOnError(context.Background(), c.out, &retErr, &rollbackerAzure{client: cl}) @@ -163,8 +163,8 @@ func (c *Creator) createAzure(ctx context.Context, cl azureclient, config *confi return state.ConstellationState{}, err } createInput := azurecl.CreateInstancesInput{ - CountCoordinators: coordCount, - CountNodes: nodeCount, + CountControlPlanes: controlPlaneCount, + CountWorkers: workerCount, InstanceType: insType, StateDiskSizeGB: config.StateDiskSizeGB, Image: config.Provider.Azure.Image, diff --git a/cli/internal/cloudcmd/create_test.go b/cli/internal/cloudcmd/create_test.go index b32bbde07..87fd37543 100644 --- a/cli/internal/cloudcmd/create_test.go +++ b/cli/internal/cloudcmd/create_test.go @@ -17,26 +17,26 @@ func TestCreator(t *testing.T) { wantGCPState := state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), GCPProject: "project", - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-2": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - GCPNodeInstanceGroup: "nodes-group", - GCPCoordinatorInstanceGroup: "coordinator-group", - GCPNodeInstanceTemplate: "node-template", - GCPCoordinatorInstanceTemplate: "coordinator-template", - GCPNetwork: "network", - GCPSubnetwork: "subnetwork", - GCPBackendService: "backend-service", - GCPHealthCheck: "health-check", - GCPForwardingRule: "forwarding-rule", + GCPWorkerInstanceGroup: "workers-group", + GCPControlPlaneInstanceGroup: "controlplane-group", + GCPWorkerInstanceTemplate: "worker-template", + GCPControlPlaneInstanceTemplate: "controlplane-template", + GCPNetwork: "network", + GCPSubnetwork: "subnetwork", + GCPBackendService: "backend-service", + GCPHealthCheck: "health-check", + GCPForwardingRule: "forwarding-rule", GCPFirewalls: []string{ - "coordinator", "wireguard", "ssh", "nodeport", "kubernetes", + "controlplane", "wireguard", "ssh", "nodeport", "kubernetes", "allow-cluster-internal-tcp", "allow-cluster-internal-udp", "allow-cluster-internal-icmp", "allow-node-internal-tcp", "allow-node-internal-udp", "allow-node-internal-icmp", }, @@ -44,20 +44,20 @@ func TestCreator(t *testing.T) { wantAzureState := state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-2": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - AzureResourceGroup: "resource-group", - AzureSubnet: "subnet", - AzureNetworkSecurityGroup: "network-security-group", - AzureNodesScaleSet: "nodes-scale-set", - AzureCoordinatorsScaleSet: "coordinators-scale-set", + AzureResourceGroup: "resource-group", + AzureSubnet: "subnet", + AzureNetworkSecurityGroup: "network-security-group", + AzureWorkersScaleSet: "workers-scale-set", + AzureControlPlanesScaleSet: "controlplanes-scale-set", } someErr := errors.New("failed") diff --git a/cli/internal/cloudcmd/serviceaccount_test.go b/cli/internal/cloudcmd/serviceaccount_test.go index a23fc16cc..5ffe9fd2a 100644 --- a/cli/internal/cloudcmd/serviceaccount_test.go +++ b/cli/internal/cloudcmd/serviceaccount_test.go @@ -15,16 +15,16 @@ import ( func TestServiceAccountCreator(t *testing.T) { someGCPState := func() state.ConstellationState { return state.ConstellationState{ - CloudProvider: cloudprovider.GCP.String(), - GCPProject: "project", - GCPNodes: cloudtypes.Instances{}, - GCPCoordinators: cloudtypes.Instances{}, - GCPNodeInstanceGroup: "nodes-group", - GCPCoordinatorInstanceGroup: "coord-group", - GCPNodeInstanceTemplate: "template", - GCPCoordinatorInstanceTemplate: "template", - GCPNetwork: "network", - GCPFirewalls: []string{}, + CloudProvider: cloudprovider.GCP.String(), + GCPProject: "project", + GCPWorkers: cloudtypes.Instances{}, + GCPControlPlanes: cloudtypes.Instances{}, + GCPWorkerInstanceGroup: "workers-group", + GCPControlPlaneInstanceGroup: "controlplane-group", + GCPWorkerInstanceTemplate: "template", + GCPControlPlaneInstanceTemplate: "template", + GCPNetwork: "network", + GCPFirewalls: []string{}, } } someAzureState := func() state.ConstellationState { diff --git a/cli/internal/cloudcmd/terminate_test.go b/cli/internal/cloudcmd/terminate_test.go index 683e44a0d..fa270b923 100644 --- a/cli/internal/cloudcmd/terminate_test.go +++ b/cli/internal/cloudcmd/terminate_test.go @@ -16,30 +16,30 @@ func TestTerminator(t *testing.T) { return state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), GCPProject: "project", - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - GCPNodeInstanceGroup: "nodes-group", - GCPCoordinatorInstanceGroup: "coord-group", - GCPNodeInstanceTemplate: "template", - GCPCoordinatorInstanceTemplate: "template", - GCPNetwork: "network", - GCPFirewalls: []string{"a", "b", "c"}, - GCPServiceAccount: "service-account@project.iam.gserviceaccount.com", + GCPWorkerInstanceGroup: "worker-group", + GCPControlPlaneInstanceGroup: "controlplane-group", + GCPWorkerInstanceTemplate: "template", + GCPControlPlaneInstanceTemplate: "template", + GCPNetwork: "network", + GCPFirewalls: []string{"a", "b", "c"}, + GCPServiceAccount: "service-account@project.iam.gserviceaccount.com", } } someAzureState := func() state.ConstellationState { return state.ConstellationState{ CloudProvider: cloudprovider.Azure.String(), - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, AzureResourceGroup: "group", diff --git a/cli/internal/cmd/init.go b/cli/internal/cmd/init.go index d03d17287..0ea021956 100644 --- a/cli/internal/cmd/init.go +++ b/cli/internal/cmd/init.go @@ -12,12 +12,12 @@ import ( "text/tabwriter" "time" + "github.com/edgelesssys/constellation/bootstrapper/initproto" + "github.com/edgelesssys/constellation/bootstrapper/kms" + "github.com/edgelesssys/constellation/bootstrapper/util" "github.com/edgelesssys/constellation/cli/internal/azure" "github.com/edgelesssys/constellation/cli/internal/cloudcmd" "github.com/edgelesssys/constellation/cli/internal/gcp" - "github.com/edgelesssys/constellation/coordinator/initproto" - "github.com/edgelesssys/constellation/coordinator/kms" - "github.com/edgelesssys/constellation/coordinator/util" "github.com/edgelesssys/constellation/internal/cloud/cloudprovider" "github.com/edgelesssys/constellation/internal/cloud/cloudtypes" "github.com/edgelesssys/constellation/internal/config" @@ -55,8 +55,7 @@ func runInitialize(cmd *cobra.Command, args []string) error { return initialize(cmd, dialer, serviceAccountCreator, fileHandler) } -// initialize initializes a Constellation. Coordinator instances are activated as contole-plane nodes and will -// themself activate the other peers as workers. +// initialize initializes a Constellation. func initialize(cmd *cobra.Command, dialer grpcDialer, serviceAccCreator serviceAccountCreator, fileHandler file.Handler, ) error { @@ -103,14 +102,14 @@ func initialize(cmd *cobra.Command, dialer grpcDialer, serviceAccCreator service return err } - coordinators, nodes, err := getScalingGroupsFromConfig(stat, config) + controlPlanes, workers, err := getScalingGroupsFromConfig(stat, config) if err != nil { return err } var autoscalingNodeGroups []string if flags.autoscale { - autoscalingNodeGroups = append(autoscalingNodeGroups, nodes.GroupID) + autoscalingNodeGroups = append(autoscalingNodeGroups, workers.GroupID) } req := &initproto.InitRequest{ @@ -124,7 +123,7 @@ func initialize(cmd *cobra.Command, dialer grpcDialer, serviceAccCreator service KubernetesVersion: "1.23.6", SshUserKeys: ssh.ToProtoSlice(sshUsers), } - resp, err := initCall(cmd.Context(), dialer, coordinators.PublicIPs()[0], req) + resp, err := initCall(cmd.Context(), dialer, controlPlanes.PublicIPs()[0], req) if err != nil { return err } @@ -139,7 +138,7 @@ func initialize(cmd *cobra.Command, dialer grpcDialer, serviceAccCreator service func initCall(ctx context.Context, dialer grpcDialer, ip string, req *initproto.InitRequest) (*initproto.InitResponse, error) { doer := &initDoer{ dialer: dialer, - endpoint: net.JoinHostPort(ip, strconv.Itoa(constants.CoordinatorPort)), + endpoint: net.JoinHostPort(ip, strconv.Itoa(constants.BootstrapperPort)), req: req, } retrier := retry.NewIntervalRetrier(doer, 30*time.Second) @@ -262,85 +261,85 @@ func readOrGenerateMasterSecret(writer io.Writer, fileHandler file.Handler, file return masterSecret, nil } -func getScalingGroupsFromConfig(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { +func getScalingGroupsFromConfig(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { switch { - case len(stat.GCPCoordinators) != 0: + case len(stat.GCPControlPlanes) != 0: return getGCPInstances(stat, config) - case len(stat.AzureCoordinators) != 0: + case len(stat.AzureControlPlane) != 0: return getAzureInstances(stat, config) - case len(stat.QEMUCoordinators) != 0: + case len(stat.QEMUControlPlane) != 0: return getQEMUInstances(stat, config) default: return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no instances to initialize") } } -func getGCPInstances(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { - if len(stat.GCPCoordinators) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane nodes available, can't create Constellation without any instance") +func getGCPInstances(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { + if len(stat.GCPControlPlanes) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane workers available, can't create Constellation without any instance") } - // GroupID of coordinators is empty, since they currently do not scale. - coordinators = cloudtypes.ScalingGroup{ - Instances: stat.GCPCoordinators, + // GroupID of controlPlanes is empty, since they currently do not scale. + controlPlanes = cloudtypes.ScalingGroup{ + Instances: stat.GCPControlPlanes, GroupID: "", } - if len(stat.GCPNodes) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker nodes available, can't create Constellation with one instance") + if len(stat.GCPWorkers) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker workers available, can't create Constellation with one instance") } // TODO: make min / max configurable and abstract autoscaling for different cloud providers - nodes = cloudtypes.ScalingGroup{ - Instances: stat.GCPNodes, - GroupID: gcp.AutoscalingNodeGroup(stat.GCPProject, stat.GCPZone, stat.GCPNodeInstanceGroup, config.AutoscalingNodeGroupMin, config.AutoscalingNodeGroupMax), + workers = cloudtypes.ScalingGroup{ + Instances: stat.GCPWorkers, + GroupID: gcp.AutoscalingNodeGroup(stat.GCPProject, stat.GCPZone, stat.GCPWorkerInstanceGroup, config.AutoscalingNodeGroupMin, config.AutoscalingNodeGroupMax), } return } -func getAzureInstances(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { - if len(stat.AzureCoordinators) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane nodes available, can't create Constellation cluster without any instance") +func getAzureInstances(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { + if len(stat.AzureControlPlane) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane workers available, can't create Constellation cluster without any instance") } - // GroupID of coordinators is empty, since they currently do not scale. - coordinators = cloudtypes.ScalingGroup{ - Instances: stat.AzureCoordinators, + // GroupID of controlPlanes is empty, since they currently do not scale. + controlPlanes = cloudtypes.ScalingGroup{ + Instances: stat.AzureControlPlane, GroupID: "", } - if len(stat.AzureNodes) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker nodes available, can't create Constellation cluster with one instance") + if len(stat.AzureWorkers) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker workers available, can't create Constellation cluster with one instance") } // TODO: make min / max configurable and abstract autoscaling for different cloud providers - nodes = cloudtypes.ScalingGroup{ - Instances: stat.AzureNodes, - GroupID: azure.AutoscalingNodeGroup(stat.AzureNodesScaleSet, config.AutoscalingNodeGroupMin, config.AutoscalingNodeGroupMax), + workers = cloudtypes.ScalingGroup{ + Instances: stat.AzureWorkers, + GroupID: azure.AutoscalingNodeGroup(stat.AzureWorkersScaleSet, config.AutoscalingNodeGroupMin, config.AutoscalingNodeGroupMax), } return } -func getQEMUInstances(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { - coordinatorMap := stat.QEMUCoordinators - if len(coordinatorMap) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no coordinators available, can't create Constellation without any instance") +func getQEMUInstances(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { + controlPlanesMap := stat.QEMUControlPlane + if len(controlPlanesMap) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no controlPlanes available, can't create Constellation without any instance") } // QEMU does not support autoscaling - coordinators = cloudtypes.ScalingGroup{ - Instances: stat.QEMUCoordinators, + controlPlanes = cloudtypes.ScalingGroup{ + Instances: stat.QEMUControlPlane, GroupID: "", } - if len(stat.QEMUNodes) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no nodes available, can't create Constellation with one instance") + if len(stat.QEMUWorkers) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no workers available, can't create Constellation with one instance") } // QEMU does not support autoscaling - nodes = cloudtypes.ScalingGroup{ - Instances: stat.QEMUNodes, + workers = cloudtypes.ScalingGroup{ + Instances: stat.QEMUWorkers, GroupID: "", } return diff --git a/cli/internal/cmd/init_test.go b/cli/internal/cmd/init_test.go index 7d6468656..fef0a2648 100644 --- a/cli/internal/cmd/init_test.go +++ b/cli/internal/cmd/init_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/edgelesssys/constellation/coordinator/initproto" + "github.com/edgelesssys/constellation/bootstrapper/initproto" "github.com/edgelesssys/constellation/internal/cloud/cloudtypes" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" @@ -38,32 +38,32 @@ func TestInitArgumentValidation(t *testing.T) { func TestInitialize(t *testing.T) { testGcpState := state.ConstellationState{ CloudProvider: "GCP", - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, } testAzureState := state.ConstellationState{ CloudProvider: "Azure", - AzureNodes: cloudtypes.Instances{ + AzureWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - AzureCoordinators: cloudtypes.Instances{ + AzureControlPlane: cloudtypes.Instances{ "id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, AzureResourceGroup: "test", } testQemuState := state.ConstellationState{ CloudProvider: "QEMU", - QEMUNodes: cloudtypes.Instances{ + QEMUWorkers: cloudtypes.Instances{ "id-0": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, "id-1": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, - QEMUCoordinators: cloudtypes.Instances{ + QEMUControlPlane: cloudtypes.Instances{ "id-c": {PrivateIP: "192.0.2.1", PublicIP: "192.0.2.1"}, }, } @@ -146,7 +146,7 @@ func TestInitialize(t *testing.T) { serverCreds := atlscredentials.New(nil, nil) initServer := grpc.NewServer(grpc.Creds(serverCreds)) initproto.RegisterAPIServer(initServer, tc.initServerAPI) - port := strconv.Itoa(constants.CoordinatorPort) + port := strconv.Itoa(constants.BootstrapperPort) listener := netDialer.GetListener(net.JoinHostPort("192.0.2.1", port)) go initServer.Serve(listener) defer initServer.GracefulStop() diff --git a/cli/internal/cmd/recover.go b/cli/internal/cmd/recover.go index 2d7738ab0..ed0e531de 100644 --- a/cli/internal/cmd/recover.go +++ b/cli/internal/cmd/recover.go @@ -7,9 +7,9 @@ import ( "regexp" "strings" + "github.com/edgelesssys/constellation/bootstrapper/util" "github.com/edgelesssys/constellation/cli/internal/cloudcmd" "github.com/edgelesssys/constellation/cli/internal/proto" - "github.com/edgelesssys/constellation/coordinator/util" "github.com/edgelesssys/constellation/internal/cloud/cloudprovider" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" @@ -91,7 +91,7 @@ func parseRecoverFlags(cmd *cobra.Command, fileHandler file.Handler) (recoverFla if err != nil { return recoverFlags{}, fmt.Errorf("parsing endpoint argument: %w", err) } - endpoint, err = validateEndpoint(endpoint, constants.CoordinatorPort) + endpoint, err = validateEndpoint(endpoint, constants.BootstrapperPort) if err != nil { return recoverFlags{}, fmt.Errorf("validating endpoint argument: %w", err) } diff --git a/cli/internal/cmd/verify.go b/cli/internal/cmd/verify.go index b45cb812a..8d2a71fb3 100644 --- a/cli/internal/cmd/verify.go +++ b/cli/internal/cmd/verify.go @@ -8,8 +8,8 @@ import ( "io/fs" "net" + "github.com/edgelesssys/constellation/bootstrapper/util" "github.com/edgelesssys/constellation/cli/internal/cloudcmd" - "github.com/edgelesssys/constellation/coordinator/util" "github.com/edgelesssys/constellation/internal/atls" "github.com/edgelesssys/constellation/internal/cloud/cloudprovider" "github.com/edgelesssys/constellation/internal/constants" diff --git a/cli/internal/gcp/client/client.go b/cli/internal/gcp/client/client.go index 62ce50306..db53f6ab1 100644 --- a/cli/internal/gcp/client/client.go +++ b/cli/internal/gcp/client/client.go @@ -33,23 +33,23 @@ type Client struct { iamAPI projectsAPI - nodes cloudtypes.Instances - coordinators cloudtypes.Instances + workers cloudtypes.Instances + controlPlanes cloudtypes.Instances - nodesInstanceGroup string - coordinatorInstanceGroup string - coordinatorTemplate string - nodeTemplate string - network string - subnetwork string - secondarySubnetworkRange string - firewalls []string - name string - project string - uid string - zone string - region string - serviceAccount string + workerInstanceGroup string + controlPlaneInstanceGroup string + controlPlaneTemplate string + workerTemplate string + network string + subnetwork string + secondarySubnetworkRange string + firewalls []string + name string + project string + uid string + zone string + region string + serviceAccount string // loadbalancer healthCheck string @@ -163,8 +163,8 @@ func NewFromDefault(ctx context.Context) (*Client, error) { instanceGroupManagersAPI: &instanceGroupManagersClient{groupAPI}, iamAPI: &iamClient{iamAPI}, projectsAPI: &projectsClient{projectsAPI}, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), }, nil } @@ -218,25 +218,25 @@ func (c *Client) init(project, zone, region, name string) error { func (c *Client) GetState() (state.ConstellationState, error) { var stat state.ConstellationState stat.CloudProvider = cloudprovider.GCP.String() - if len(c.nodes) == 0 { - return state.ConstellationState{}, errors.New("client has no nodes") + if len(c.workers) == 0 { + return state.ConstellationState{}, errors.New("client has no workers") } - stat.GCPNodes = c.nodes + stat.GCPWorkers = c.workers - if len(c.coordinators) == 0 { - return state.ConstellationState{}, errors.New("client has no coordinators") + if len(c.controlPlanes) == 0 { + return state.ConstellationState{}, errors.New("client has no controlPlanes") } - stat.GCPCoordinators = c.coordinators + stat.GCPControlPlanes = c.controlPlanes - if c.nodesInstanceGroup == "" { - return state.ConstellationState{}, errors.New("client has no nodeInstanceGroup") + if c.workerInstanceGroup == "" { + return state.ConstellationState{}, errors.New("client has no workerInstanceGroup") } - stat.GCPNodeInstanceGroup = c.nodesInstanceGroup + stat.GCPWorkerInstanceGroup = c.workerInstanceGroup - if c.coordinatorInstanceGroup == "" { - return state.ConstellationState{}, errors.New("client has no coordinatorInstanceGroup") + if c.controlPlaneInstanceGroup == "" { + return state.ConstellationState{}, errors.New("client has no controlPlaneInstanceGroup") } - stat.GCPCoordinatorInstanceGroup = c.coordinatorInstanceGroup + stat.GCPControlPlaneInstanceGroup = c.controlPlaneInstanceGroup if c.project == "" { return state.ConstellationState{}, errors.New("client has no project") @@ -278,15 +278,15 @@ func (c *Client) GetState() (state.ConstellationState, error) { } stat.GCPSubnetwork = c.subnetwork - if c.nodeTemplate == "" { - return state.ConstellationState{}, errors.New("client has no node instance template") + if c.workerTemplate == "" { + return state.ConstellationState{}, errors.New("client has no worker instance template") } - stat.GCPNodeInstanceTemplate = c.nodeTemplate + stat.GCPWorkerInstanceTemplate = c.workerTemplate - if c.coordinatorTemplate == "" { - return state.ConstellationState{}, errors.New("client has no coordinator instance template") + if c.controlPlaneTemplate == "" { + return state.ConstellationState{}, errors.New("client has no controlPlane instance template") } - stat.GCPCoordinatorInstanceTemplate = c.coordinatorTemplate + stat.GCPControlPlaneInstanceTemplate = c.controlPlaneTemplate if c.healthCheck == "" { return state.ConstellationState{}, errors.New("client has no health check") @@ -314,25 +314,25 @@ func (c *Client) SetState(stat state.ConstellationState) error { if stat.CloudProvider != cloudprovider.GCP.String() { return errors.New("state is not gcp state") } - if len(stat.GCPNodes) == 0 { - return errors.New("state has no nodes") + if len(stat.GCPWorkers) == 0 { + return errors.New("state has no workers") } - c.nodes = stat.GCPNodes + c.workers = stat.GCPWorkers - if len(stat.GCPCoordinators) == 0 { - return errors.New("state has no coordinator") + if len(stat.GCPControlPlanes) == 0 { + return errors.New("state has no controlPlane") } - c.coordinators = stat.GCPCoordinators + c.controlPlanes = stat.GCPControlPlanes - if stat.GCPNodeInstanceGroup == "" { - return errors.New("state has no nodeInstanceGroup") + if stat.GCPWorkerInstanceGroup == "" { + return errors.New("state has no workerInstanceGroup") } - c.nodesInstanceGroup = stat.GCPNodeInstanceGroup + c.workerInstanceGroup = stat.GCPWorkerInstanceGroup - if stat.GCPCoordinatorInstanceGroup == "" { - return errors.New("state has no coordinatorInstanceGroup") + if stat.GCPControlPlaneInstanceGroup == "" { + return errors.New("state has no controlPlaneInstanceGroup") } - c.coordinatorInstanceGroup = stat.GCPCoordinatorInstanceGroup + c.controlPlaneInstanceGroup = stat.GCPControlPlaneInstanceGroup if stat.GCPProject == "" { return errors.New("state has no project") @@ -374,15 +374,15 @@ func (c *Client) SetState(stat state.ConstellationState) error { } c.subnetwork = stat.GCPSubnetwork - if stat.GCPNodeInstanceTemplate == "" { - return errors.New("state has no node instance template") + if stat.GCPWorkerInstanceTemplate == "" { + return errors.New("state has no worker instance template") } - c.nodeTemplate = stat.GCPNodeInstanceTemplate + c.workerTemplate = stat.GCPWorkerInstanceTemplate - if stat.GCPCoordinatorInstanceTemplate == "" { - return errors.New("state has no coordinator instance template") + if stat.GCPControlPlaneInstanceTemplate == "" { + return errors.New("state has no controlPlane instance template") } - c.coordinatorTemplate = stat.GCPCoordinatorInstanceTemplate + c.controlPlaneTemplate = stat.GCPControlPlaneInstanceTemplate if stat.GCPHealthCheck == "" { return errors.New("state has no health check") diff --git a/cli/internal/gcp/client/client_test.go b/cli/internal/gcp/client/client_test.go index 67bf298c0..cd3f1b923 100644 --- a/cli/internal/gcp/client/client_test.go +++ b/cli/internal/gcp/client/client_test.go @@ -27,629 +27,629 @@ func TestSetGetState(t *testing.T) { "valid state": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPServiceAccount: "service-account", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPServiceAccount: "service-account", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, }, - "missing nodes": { + "missing workers": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, - "missing coordinator": { + "missing control plane": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, - "missing node group": { + "missing worker group": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, - "missing coordinator group": { + "missing control plane group": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing project id": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing zone": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing region": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing name": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - UID: "uid", - GCPRegion: "region-id", - GCPNetwork: "net-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + UID: "uid", + GCPRegion: "region-id", + GCPNetwork: "net-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing uid": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - Name: "name", - GCPRegion: "region-id", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + Name: "name", + GCPRegion: "region-id", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing firewalls": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing network": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing external network": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing subnetwork": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing external subnetwork": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, - "missing node template": { + "missing worker template": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, - "missing coordinator template": { + "missing control plane template": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing backend service": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing health check": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPForwardingRule: "forwarding-rule-id", }, wantErr: true, }, "missing forwarding rule": { state: state.ConstellationState{ CloudProvider: cloudprovider.GCP.String(), - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", }, wantErr: true, }, @@ -665,18 +665,18 @@ func TestSetGetState(t *testing.T) { assert.Error(client.SetState(tc.state)) } else { assert.NoError(client.SetState(tc.state)) - assert.Equal(tc.state.GCPNodes, client.nodes) - assert.Equal(tc.state.GCPCoordinators, client.coordinators) - assert.Equal(tc.state.GCPNodeInstanceGroup, client.nodesInstanceGroup) - assert.Equal(tc.state.GCPCoordinatorInstanceGroup, client.coordinatorInstanceGroup) + assert.Equal(tc.state.GCPWorkers, client.workers) + assert.Equal(tc.state.GCPControlPlanes, client.controlPlanes) + assert.Equal(tc.state.GCPWorkerInstanceGroup, client.workerInstanceGroup) + assert.Equal(tc.state.GCPControlPlaneInstanceGroup, client.controlPlaneInstanceGroup) assert.Equal(tc.state.GCPProject, client.project) assert.Equal(tc.state.GCPZone, client.zone) assert.Equal(tc.state.Name, client.name) assert.Equal(tc.state.UID, client.uid) assert.Equal(tc.state.GCPNetwork, client.network) assert.Equal(tc.state.GCPFirewalls, client.firewalls) - assert.Equal(tc.state.GCPCoordinatorInstanceTemplate, client.coordinatorTemplate) - assert.Equal(tc.state.GCPNodeInstanceTemplate, client.nodeTemplate) + assert.Equal(tc.state.GCPControlPlaneInstanceTemplate, client.controlPlaneTemplate) + assert.Equal(tc.state.GCPWorkerInstanceTemplate, client.workerTemplate) assert.Equal(tc.state.GCPServiceAccount, client.serviceAccount) } }) @@ -689,24 +689,24 @@ func TestSetGetState(t *testing.T) { assert := assert.New(t) client := Client{ - nodes: tc.state.GCPNodes, - coordinators: tc.state.GCPCoordinators, - nodesInstanceGroup: tc.state.GCPNodeInstanceGroup, - coordinatorInstanceGroup: tc.state.GCPCoordinatorInstanceGroup, - project: tc.state.GCPProject, - zone: tc.state.GCPZone, - region: tc.state.GCPRegion, - name: tc.state.Name, - uid: tc.state.UID, - network: tc.state.GCPNetwork, - subnetwork: tc.state.GCPSubnetwork, - firewalls: tc.state.GCPFirewalls, - nodeTemplate: tc.state.GCPNodeInstanceTemplate, - coordinatorTemplate: tc.state.GCPCoordinatorInstanceTemplate, - serviceAccount: tc.state.GCPServiceAccount, - healthCheck: tc.state.GCPHealthCheck, - backendService: tc.state.GCPBackendService, - forwardingRule: tc.state.GCPForwardingRule, + workers: tc.state.GCPWorkers, + controlPlanes: tc.state.GCPControlPlanes, + workerInstanceGroup: tc.state.GCPWorkerInstanceGroup, + controlPlaneInstanceGroup: tc.state.GCPControlPlaneInstanceGroup, + project: tc.state.GCPProject, + zone: tc.state.GCPZone, + region: tc.state.GCPRegion, + name: tc.state.Name, + uid: tc.state.UID, + network: tc.state.GCPNetwork, + subnetwork: tc.state.GCPSubnetwork, + firewalls: tc.state.GCPFirewalls, + workerTemplate: tc.state.GCPWorkerInstanceTemplate, + controlPlaneTemplate: tc.state.GCPControlPlaneInstanceTemplate, + serviceAccount: tc.state.GCPServiceAccount, + healthCheck: tc.state.GCPHealthCheck, + backendService: tc.state.GCPBackendService, + forwardingRule: tc.state.GCPForwardingRule, } if tc.wantErr { _, err := client.GetState() @@ -726,64 +726,64 @@ func TestSetStateCloudProvider(t *testing.T) { client := Client{} stateMissingCloudProvider := state.ConstellationState{ - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", } assert.Error(client.SetState(stateMissingCloudProvider)) stateIncorrectCloudProvider := state.ConstellationState{ CloudProvider: "incorrect", - GCPNodes: cloudtypes.Instances{ + GCPWorkers: cloudtypes.Instances{ "id-1": { PublicIP: "ip1", PrivateIP: "ip2", }, }, - GCPCoordinators: cloudtypes.Instances{ + GCPControlPlanes: cloudtypes.Instances{ "id-1": { PublicIP: "ip3", PrivateIP: "ip4", }, }, - GCPNodeInstanceGroup: "group-id", - GCPCoordinatorInstanceGroup: "group-id", - GCPProject: "proj-id", - GCPZone: "zone-id", - GCPRegion: "region-id", - Name: "name", - UID: "uid", - GCPNetwork: "net-id", - GCPSubnetwork: "subnet-id", - GCPFirewalls: []string{"fw-1", "fw-2"}, - GCPNodeInstanceTemplate: "temp-id", - GCPCoordinatorInstanceTemplate: "temp-id", - GCPBackendService: "backend-service-id", - GCPHealthCheck: "health-check-id", - GCPForwardingRule: "forwarding-rule-id", + GCPWorkerInstanceGroup: "group-id", + GCPControlPlaneInstanceGroup: "group-id", + GCPProject: "proj-id", + GCPZone: "zone-id", + GCPRegion: "region-id", + Name: "name", + UID: "uid", + GCPNetwork: "net-id", + GCPSubnetwork: "subnet-id", + GCPFirewalls: []string{"fw-1", "fw-2"}, + GCPWorkerInstanceTemplate: "temp-id", + GCPControlPlaneInstanceTemplate: "temp-id", + GCPBackendService: "backend-service-id", + GCPHealthCheck: "health-check-id", + GCPForwardingRule: "forwarding-rule-id", } assert.Error(client.SetState(stateIncorrectCloudProvider)) } diff --git a/cli/internal/gcp/client/instances.go b/cli/internal/gcp/client/instances.go index 1b18bf15b..4d515c3cb 100644 --- a/cli/internal/gcp/client/instances.go +++ b/cli/internal/gcp/client/instances.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/cloud/cloudtypes" "google.golang.org/api/iterator" computepb "google.golang.org/genproto/googleapis/cloud/compute/v1" @@ -16,7 +16,7 @@ import ( // CreateInstances creates instances (virtual machines) on Google Compute Engine. // -// A separate managed instance group is created for coordinators and nodes, the function +// A separate managed instance group is created for control planes and workers, the function // waits until the instances are up and stores the public and private IPs of the instances // in the client. If the client's network must be set before instances can be created. func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput) error { @@ -25,7 +25,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput } ops := []Operation{} - nodeTemplateInput := insertInstanceTemplateInput{ + workerTemplateInput := insertInstanceTemplateInput{ Name: c.name + "-worker-" + c.uid, Network: c.network, SecondarySubnetworkRangeName: c.secondarySubnetworkRange, @@ -33,21 +33,21 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput ImageId: input.ImageId, InstanceType: input.InstanceType, StateDiskSizeGB: int64(input.StateDiskSizeGB), - Role: role.Node.String(), + Role: role.Worker.String(), KubeEnv: input.KubeEnv, Project: c.project, Zone: c.zone, Region: c.region, UID: c.uid, } - op, err := c.insertInstanceTemplate(ctx, nodeTemplateInput) + op, err := c.insertInstanceTemplate(ctx, workerTemplateInput) if err != nil { return fmt.Errorf("inserting instanceTemplate: %w", err) } ops = append(ops, op) - c.nodeTemplate = nodeTemplateInput.Name + c.workerTemplate = workerTemplateInput.Name - coordinatorTemplateInput := insertInstanceTemplateInput{ + controlPlaneTemplateInput := insertInstanceTemplateInput{ Name: c.name + "-control-plane-" + c.uid, Network: c.network, Subnetwork: c.subnetwork, @@ -55,70 +55,70 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput ImageId: input.ImageId, InstanceType: input.InstanceType, StateDiskSizeGB: int64(input.StateDiskSizeGB), - Role: role.Coordinator.String(), + Role: role.ControlPlane.String(), KubeEnv: input.KubeEnv, Project: c.project, Zone: c.zone, Region: c.region, UID: c.uid, } - op, err = c.insertInstanceTemplate(ctx, coordinatorTemplateInput) + op, err = c.insertInstanceTemplate(ctx, controlPlaneTemplateInput) if err != nil { return fmt.Errorf("inserting instanceTemplate: %w", err) } ops = append(ops, op) - c.coordinatorTemplate = coordinatorTemplateInput.Name + c.controlPlaneTemplate = controlPlaneTemplateInput.Name if err := c.waitForOperations(ctx, ops); err != nil { return err } ops = []Operation{} - coordinatorGroupInput := instanceGroupManagerInput{ - Count: input.CountCoordinators, + controlPlaneGroupInput := instanceGroupManagerInput{ + Count: input.CountControlPlanes, Name: strings.Join([]string{c.name, "control-plane", c.uid}, "-"), - Template: c.coordinatorTemplate, + Template: c.controlPlaneTemplate, UID: c.uid, Project: c.project, Zone: c.zone, } - op, err = c.insertInstanceGroupManger(ctx, coordinatorGroupInput) + op, err = c.insertInstanceGroupManger(ctx, controlPlaneGroupInput) if err != nil { return fmt.Errorf("inserting instanceGroupManager: %w", err) } ops = append(ops, op) - c.coordinatorInstanceGroup = coordinatorGroupInput.Name + c.controlPlaneInstanceGroup = controlPlaneGroupInput.Name - nodeGroupInput := instanceGroupManagerInput{ - Count: input.CountNodes, + workerGroupInput := instanceGroupManagerInput{ + Count: input.CountWorkers, Name: strings.Join([]string{c.name, "worker", c.uid}, "-"), - Template: c.nodeTemplate, + Template: c.workerTemplate, UID: c.uid, Project: c.project, Zone: c.zone, } - op, err = c.insertInstanceGroupManger(ctx, nodeGroupInput) + op, err = c.insertInstanceGroupManger(ctx, workerGroupInput) if err != nil { return fmt.Errorf("inserting instanceGroupManager: %w", err) } ops = append(ops, op) - c.nodesInstanceGroup = nodeGroupInput.Name + c.workerInstanceGroup = workerGroupInput.Name if err := c.waitForOperations(ctx, ops); err != nil { return err } - if err := c.waitForInstanceGroupScaling(ctx, c.nodesInstanceGroup); err != nil { + if err := c.waitForInstanceGroupScaling(ctx, c.workerInstanceGroup); err != nil { return fmt.Errorf("waiting for instanceGroupScaling: %w", err) } - if err := c.waitForInstanceGroupScaling(ctx, c.coordinatorInstanceGroup); err != nil { + if err := c.waitForInstanceGroupScaling(ctx, c.controlPlaneInstanceGroup); err != nil { return fmt.Errorf("waiting for instanceGroupScaling: %w", err) } - if err := c.getInstanceIPs(ctx, c.nodesInstanceGroup, c.nodes); err != nil { + if err := c.getInstanceIPs(ctx, c.workerInstanceGroup, c.workers); err != nil { return fmt.Errorf("getting instanceIPs: %w", err) } - if err := c.getInstanceIPs(ctx, c.coordinatorInstanceGroup, c.coordinators); err != nil { + if err := c.getInstanceIPs(ctx, c.controlPlaneInstanceGroup, c.controlPlanes); err != nil { return fmt.Errorf("getting instanceIPs: %w", err) } return nil @@ -127,45 +127,45 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput // TerminateInstances terminates the clients instances. func (c *Client) TerminateInstances(ctx context.Context) error { ops := []Operation{} - if c.nodesInstanceGroup != "" { - op, err := c.deleteInstanceGroupManager(ctx, c.nodesInstanceGroup) + if c.workerInstanceGroup != "" { + op, err := c.deleteInstanceGroupManager(ctx, c.workerInstanceGroup) if err != nil { - return fmt.Errorf("deleting instanceGroupManager '%s': %w", c.nodesInstanceGroup, err) + return fmt.Errorf("deleting instanceGroupManager '%s': %w", c.workerInstanceGroup, err) } ops = append(ops, op) - c.nodesInstanceGroup = "" - c.nodes = make(cloudtypes.Instances) + c.workerInstanceGroup = "" + c.workers = make(cloudtypes.Instances) } - if c.coordinatorInstanceGroup != "" { - op, err := c.deleteInstanceGroupManager(ctx, c.coordinatorInstanceGroup) + if c.controlPlaneInstanceGroup != "" { + op, err := c.deleteInstanceGroupManager(ctx, c.controlPlaneInstanceGroup) if err != nil { - return fmt.Errorf("deleting instanceGroupManager '%s': %w", c.coordinatorInstanceGroup, err) + return fmt.Errorf("deleting instanceGroupManager '%s': %w", c.controlPlaneInstanceGroup, err) } ops = append(ops, op) - c.coordinatorInstanceGroup = "" - c.coordinators = make(cloudtypes.Instances) + c.controlPlaneInstanceGroup = "" + c.controlPlanes = make(cloudtypes.Instances) } if err := c.waitForOperations(ctx, ops); err != nil { return err } ops = []Operation{} - if c.nodeTemplate != "" { - op, err := c.deleteInstanceTemplate(ctx, c.nodeTemplate) + if c.workerTemplate != "" { + op, err := c.deleteInstanceTemplate(ctx, c.workerTemplate) if err != nil { return fmt.Errorf("deleting instanceTemplate: %w", err) } ops = append(ops, op) - c.nodeTemplate = "" + c.workerTemplate = "" } - if c.coordinatorTemplate != "" { - op, err := c.deleteInstanceTemplate(ctx, c.coordinatorTemplate) + if c.controlPlaneTemplate != "" { + op, err := c.deleteInstanceTemplate(ctx, c.controlPlaneTemplate) if err != nil { return fmt.Errorf("deleting instanceTemplate: %w", err) } ops = append(ops, op) - c.coordinatorTemplate = "" + c.controlPlaneTemplate = "" } return c.waitForOperations(ctx, ops) } @@ -290,12 +290,12 @@ func (i *instanceGroupManagerInput) InsertInstanceGroupManagerRequest() computep // CreateInstancesInput is the input for a CreatInstances operation. type CreateInstancesInput struct { - CountNodes int - CountCoordinators int - ImageId string - InstanceType string - StateDiskSizeGB int - KubeEnv string + CountWorkers int + CountControlPlanes int + ImageId string + InstanceType string + StateDiskSizeGB int + KubeEnv string } type insertInstanceTemplateInput struct { diff --git a/cli/internal/gcp/client/instances_test.go b/cli/internal/gcp/client/instances_test.go index c38250a3a..da7879b28 100644 --- a/cli/internal/gcp/client/instances_test.go +++ b/cli/internal/gcp/client/instances_test.go @@ -41,11 +41,11 @@ func TestCreateInstances(t *testing.T) { {CurrentAction: proto.String(computepb.ManagedInstance_NONE.String())}, } testInput := CreateInstancesInput{ - CountCoordinators: 3, - CountNodes: 4, - ImageId: "img", - InstanceType: "n2d-standard-2", - KubeEnv: "kube-env", + CountControlPlanes: 3, + CountWorkers: 4, + ImageId: "img", + InstanceType: "n2d-standard-2", + KubeEnv: "kube-env", } someErr := errors.New("failed") @@ -157,22 +157,22 @@ func TestCreateInstances(t *testing.T) { operationGlobalAPI: tc.operationGlobalAPI, instanceTemplateAPI: tc.instanceTemplateAPI, instanceGroupManagersAPI: tc.instanceGroupManagersAPI, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), } if tc.wantErr { assert.Error(client.CreateInstances(ctx, tc.input)) } else { assert.NoError(client.CreateInstances(ctx, tc.input)) - assert.Equal([]string{"public-ip", "public-ip"}, client.nodes.PublicIPs()) - assert.Equal([]string{"private-ip", "private-ip"}, client.nodes.PrivateIPs()) - assert.Equal([]string{"public-ip", "public-ip"}, client.coordinators.PublicIPs()) - assert.Equal([]string{"private-ip", "private-ip"}, client.coordinators.PrivateIPs()) - assert.NotNil(client.nodesInstanceGroup) - assert.NotNil(client.coordinatorInstanceGroup) - assert.NotNil(client.coordinatorTemplate) - assert.NotNil(client.nodeTemplate) + assert.Equal([]string{"public-ip", "public-ip"}, client.workers.PublicIPs()) + assert.Equal([]string{"private-ip", "private-ip"}, client.workers.PrivateIPs()) + assert.Equal([]string{"public-ip", "public-ip"}, client.controlPlanes.PublicIPs()) + assert.Equal([]string{"private-ip", "private-ip"}, client.controlPlanes.PrivateIPs()) + assert.NotNil(client.workerInstanceGroup) + assert.NotNil(client.controlPlaneInstanceGroup) + assert.NotNil(client.controlPlaneTemplate) + assert.NotNil(client.workerTemplate) } }) } @@ -186,8 +186,8 @@ func TestTerminateInstances(t *testing.T) { instanceTemplateAPI instanceTemplateAPI instanceGroupManagersAPI instanceGroupManagersAPI - missingNodeInstanceGroup bool - wantErr bool + missingWorkerInstanceGroup bool + wantErr bool }{ "successful terminate": { operationZoneAPI: stubOperationZoneAPI{}, @@ -195,12 +195,12 @@ func TestTerminateInstances(t *testing.T) { instanceTemplateAPI: stubInstanceTemplateAPI{}, instanceGroupManagersAPI: stubInstanceGroupManagersAPI{}, }, - "successful terminate with missing node instance group": { - operationZoneAPI: stubOperationZoneAPI{}, - operationGlobalAPI: stubOperationGlobalAPI{}, - instanceTemplateAPI: stubInstanceTemplateAPI{}, - instanceGroupManagersAPI: stubInstanceGroupManagersAPI{}, - missingNodeInstanceGroup: true, + "successful terminate with missing worker instance group": { + operationZoneAPI: stubOperationZoneAPI{}, + operationGlobalAPI: stubOperationGlobalAPI{}, + instanceTemplateAPI: stubInstanceTemplateAPI{}, + instanceGroupManagersAPI: stubInstanceGroupManagersAPI{}, + missingWorkerInstanceGroup: true, }, "fail delete instanceGroupManager": { operationZoneAPI: stubOperationZoneAPI{}, @@ -223,40 +223,40 @@ func TestTerminateInstances(t *testing.T) { ctx := context.Background() client := Client{ - project: "project", - zone: "zone", - name: "name", - uid: "uid", - operationZoneAPI: tc.operationZoneAPI, - operationGlobalAPI: tc.operationGlobalAPI, - instanceTemplateAPI: tc.instanceTemplateAPI, - instanceGroupManagersAPI: tc.instanceGroupManagersAPI, - nodes: cloudtypes.Instances{"node-id-1": cloudtypes.Instance{}, "node-id-2": cloudtypes.Instance{}}, - coordinators: cloudtypes.Instances{"coordinator-id-1": cloudtypes.Instance{}}, - firewalls: []string{"firewall-1", "firewall-2"}, - network: "network-id-1", - nodesInstanceGroup: "nodeInstanceGroup-id-1", - coordinatorInstanceGroup: "coordinatorInstanceGroup-id-1", - nodeTemplate: "template-id-1", - coordinatorTemplate: "template-id-1", + project: "project", + zone: "zone", + name: "name", + uid: "uid", + operationZoneAPI: tc.operationZoneAPI, + operationGlobalAPI: tc.operationGlobalAPI, + instanceTemplateAPI: tc.instanceTemplateAPI, + instanceGroupManagersAPI: tc.instanceGroupManagersAPI, + workers: cloudtypes.Instances{"worker-id-1": cloudtypes.Instance{}, "worker-id-2": cloudtypes.Instance{}}, + controlPlanes: cloudtypes.Instances{"controlplane-id-1": cloudtypes.Instance{}}, + firewalls: []string{"firewall-1", "firewall-2"}, + network: "network-id-1", + workerInstanceGroup: "workerInstanceGroup-id-1", + controlPlaneInstanceGroup: "controlplaneInstanceGroup-id-1", + workerTemplate: "template-id-1", + controlPlaneTemplate: "template-id-1", } - if tc.missingNodeInstanceGroup { - client.nodesInstanceGroup = "" - client.nodes = cloudtypes.Instances{} + if tc.missingWorkerInstanceGroup { + client.workerInstanceGroup = "" + client.workers = cloudtypes.Instances{} } if tc.wantErr { assert.Error(client.TerminateInstances(ctx)) } else { assert.NoError(client.TerminateInstances(ctx)) - assert.Nil(client.nodes.PublicIPs()) - assert.Nil(client.nodes.PrivateIPs()) - assert.Nil(client.coordinators.PublicIPs()) - assert.Nil(client.coordinators.PrivateIPs()) - assert.Empty(client.nodesInstanceGroup) - assert.Empty(client.coordinatorInstanceGroup) - assert.Empty(client.coordinatorTemplate) - assert.Empty(client.nodeTemplate) + assert.Nil(client.workers.PublicIPs()) + assert.Nil(client.workers.PrivateIPs()) + assert.Nil(client.controlPlanes.PublicIPs()) + assert.Nil(client.controlPlanes.PrivateIPs()) + assert.Empty(client.workerInstanceGroup) + assert.Empty(client.controlPlaneInstanceGroup) + assert.Empty(client.controlPlaneTemplate) + assert.Empty(client.workerTemplate) } }) } diff --git a/cli/internal/gcp/client/network.go b/cli/internal/gcp/client/network.go index a64e36a44..5e9675d2f 100644 --- a/cli/internal/gcp/client/network.go +++ b/cli/internal/gcp/client/network.go @@ -236,7 +236,7 @@ func (c *Client) CreateLoadBalancer(ctx context.Context) error { Backends: []*computepb.Backend{ { BalancingMode: proto.String(computepb.Backend_BalancingMode_name[int32(compute.Backend_CONNECTION)]), - Group: proto.String("https://www.googleapis.com/compute/v1/projects/" + c.project + "/zones/" + c.zone + "/instanceGroups/" + c.coordinatorInstanceGroup), + Group: proto.String("https://www.googleapis.com/compute/v1/projects/" + c.project + "/zones/" + c.zone + "/instanceGroups/" + c.controlPlaneInstanceGroup), }, }, }, diff --git a/cli/internal/gcp/client/network_test.go b/cli/internal/gcp/client/network_test.go index 3e2979926..4b85bfccf 100644 --- a/cli/internal/gcp/client/network_test.go +++ b/cli/internal/gcp/client/network_test.go @@ -71,8 +71,8 @@ func TestCreateVPCs(t *testing.T) { operationRegionAPI: tc.operationRegionAPI, networksAPI: tc.networksAPI, subnetworksAPI: tc.subnetworksAPI, - nodes: make(cloudtypes.Instances), - coordinators: make(cloudtypes.Instances), + workers: make(cloudtypes.Instances), + controlPlanes: make(cloudtypes.Instances), } if tc.wantErr { diff --git a/coordinator/README.md b/coordinator/README.md deleted file mode 100644 index 1d829f4b3..000000000 --- a/coordinator/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Coordinator -The Coordinator/Node architecture is inspired by K8s. The Coordinator resembles kube-apiserver, while the Nodes resemble kubelets. - -All peers serve the *pubapi*, which is exposed publicly. Once initialized, a Coordinator additionally serves the *vpnapi*, which is exposed inside the VPN. - -## pubapi -The pubapi provides APIs that are either required from outside the cluster or inside the cluster before the VPN is established. - -pubapi connections are protected by attested TLS (atls): the client verifies the server. The server does *not* verify the client. The APIs must be designed to form a chain of trust, so that no additional verification is needed. - -For example, to activate all peers in a new cluster, there's a chain of trust from the CLI via the Coordinator to the Nodes: -* CLI calls ActivateAsCoordinator -* Coordinator calls ActivateAsNode - -If new Nodes shall be added to the cluster later, they must not activate themselves by the Coordinator, but have to ask it to activate them (using ActivateAdditionalNodes). This way, the chain of trust is preserved. - -Try to keep the pubapi small. Prefer adding new functionality to the vpnapi instead. - -## vpnapi -The vpnapi is served by the Coordinator and can be used by the Nodes after they joined the VPN. Most importantly, the Nodes use it to get updates about added/removed/changed peers. - -A Node regularly requests an update from a Coordinator. This is required for fault tolerance: if a Node cannot be provided with updated peer infos at one time, e.g., because of a network issue, it will continue to try and will eventually converge towards the desired state. (Note that this may not be fully implemented yet.) - -Peer updates are versioned. The Node sends its last known version number and the Coordinator responds with the current version number and with the updated peers if needed. Currently, updates contain full peer info, but may be changed to incremental in the future. - -## Core -Both APIs use the Core to fulfill the requests. The Core implements the core logic of a peer. It doesn't know the APIs and should be kept free of any gRPC or other client/server code. - -## Naming convention -We have defined additional naming conventions for the coordinator. - -### Entities -* Coordinator: the thing activated by ActivateAsCoordinator -* Node: the things activated by ActivateAsNode -* peer: either Coordinator or Node -* admin: the user who calls ActivateAsCoordinator - -### Network -IP addresses: -* ip: numeric IP address -* host: either IP address or hostname -* endpoint: host+port - -Interfaces using the addresses: -* public -* vpn - -Usage: variable namings should then be entityInterfaceKind, e.g. -* coordinatorPublicEndpoint -* nodeVPNIP - -Entity and/or interface are omitted if not relevant for function contract. - -### Keys -Kinds: -* key: symmetric key -* pubKey: public key -* privKey: private key - -Purpose: -* *entity* -* vpn -* *entity*VPN - -Example: -* nodeVPNPubKey diff --git a/coordinator/internal/kubernetes/k8sapi/resources/verification.go b/coordinator/internal/kubernetes/k8sapi/resources/verification.go deleted file mode 100644 index 77e8bf55d..000000000 --- a/coordinator/internal/kubernetes/k8sapi/resources/verification.go +++ /dev/null @@ -1,153 +0,0 @@ -package resources - -import ( - "fmt" - - "github.com/edgelesssys/constellation/internal/constants" - "github.com/edgelesssys/constellation/internal/secrets" - apps "k8s.io/api/apps/v1" - k8s "k8s.io/api/core/v1" - meta "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -type verificationDaemonset struct { - DaemonSet apps.DaemonSet - Service k8s.Service -} - -func NewVerificationDaemonSet(csp string) *verificationDaemonset { - return &verificationDaemonset{ - DaemonSet: apps.DaemonSet{ - TypeMeta: meta.TypeMeta{ - APIVersion: "apps/v1", - Kind: "DaemonSet", - }, - ObjectMeta: meta.ObjectMeta{ - Name: "verification-service", - Namespace: "kube-system", - Labels: map[string]string{ - "k8s-app": "verification-service", - "component": "verification-service", - }, - }, - Spec: apps.DaemonSetSpec{ - Selector: &meta.LabelSelector{ - MatchLabels: map[string]string{ - "k8s-app": "verification-service", - }, - }, - Template: k8s.PodTemplateSpec{ - ObjectMeta: meta.ObjectMeta{ - Labels: map[string]string{ - "k8s-app": "verification-service", - }, - }, - Spec: k8s.PodSpec{ - Tolerations: []k8s.Toleration{ - { - Key: "node-role.kubernetes.io/master", - Operator: k8s.TolerationOpEqual, - Value: "true", - Effect: k8s.TaintEffectNoSchedule, - }, - { - Key: "node-role.kubernetes.io/control-plane", - Operator: k8s.TolerationOpExists, - Effect: k8s.TaintEffectNoSchedule, - }, - { - Operator: k8s.TolerationOpExists, - Effect: k8s.TaintEffectNoExecute, - }, - { - Operator: k8s.TolerationOpExists, - Effect: k8s.TaintEffectNoSchedule, - }, - }, - ImagePullSecrets: []k8s.LocalObjectReference{ - { - Name: secrets.PullSecretName, - }, - }, - Containers: []k8s.Container{ - { - Name: "verification-service", - Image: verificationImage, - Ports: []k8s.ContainerPort{ - { - Name: "http", - ContainerPort: constants.VerifyServicePortHTTP, - }, - { - Name: "grpc", - ContainerPort: constants.VerifyServicePortGRPC, - }, - }, - SecurityContext: &k8s.SecurityContext{ - Privileged: func(b bool) *bool { return &b }(true), - }, - Args: []string{ - fmt.Sprintf("--cloud-provider=%s", csp), - }, - VolumeMounts: []k8s.VolumeMount{ - { - Name: "event-log", - ReadOnly: true, - MountPath: "/sys/kernel/security/", - }, - }, - }, - }, - Volumes: []k8s.Volume{ - { - Name: "event-log", - VolumeSource: k8s.VolumeSource{ - HostPath: &k8s.HostPathVolumeSource{ - Path: "/sys/kernel/security/", - }, - }, - }, - }, - }, - }, - }, - }, - Service: k8s.Service{ - TypeMeta: meta.TypeMeta{ - APIVersion: "v1", - Kind: "Service", - }, - ObjectMeta: meta.ObjectMeta{ - Name: "activation-service", - Namespace: "kube-system", - }, - Spec: k8s.ServiceSpec{ - Type: k8s.ServiceTypeNodePort, - Ports: []k8s.ServicePort{ - { - Name: "http", - Protocol: k8s.ProtocolTCP, - Port: constants.VerifyServicePortHTTP, - TargetPort: intstr.FromInt(constants.VerifyServicePortHTTP), - NodePort: constants.VerifyServiceNodePortHTTP, - }, - { - Name: "grpc", - Protocol: k8s.ProtocolTCP, - Port: constants.VerifyServicePortGRPC, - TargetPort: intstr.FromInt(constants.VerifyServicePortGRPC), - NodePort: constants.VerifyServiceNodePortGRPC, - }, - }, - Selector: map[string]string{ - "k8s-app": "verification-service", - }, - }, - }, - } -} - -func (v *verificationDaemonset) Marshal() ([]byte, error) { - return MarshalK8SResources(v) -} diff --git a/coordinator/kubernetes/k8sapi/resources/images.go b/coordinator/kubernetes/k8sapi/resources/images.go deleted file mode 100644 index 28a76d9d3..000000000 --- a/coordinator/kubernetes/k8sapi/resources/images.go +++ /dev/null @@ -1,12 +0,0 @@ -package resources - -const ( - // Constellation images. - activationImage = "ghcr.io/edgelesssys/constellation/activation-service:v1.3" - accessManagerImage = "ghcr.io/edgelesssys/constellation/access-manager:v1.3" - kmsImage = "ghcr.io/edgelesssys/constellation/kmsserver:v1.3" - verificationImage = "ghcr.io/edgelesssys/constellation/verification-service:v1.3" - - // external images. - clusterAutoscalerImage = "k8s.gcr.io/autoscaling/cluster-autoscaler:v1.23.0" -) diff --git a/coordinator/kubernetes/k8sapi/resources/verification_test.go b/coordinator/kubernetes/k8sapi/resources/verification_test.go deleted file mode 100644 index 8c15f7ed7..000000000 --- a/coordinator/kubernetes/k8sapi/resources/verification_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package resources - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestNewVerificationDaemonset(t *testing.T) { - deployment := NewVerificationDaemonSet("csp") - deploymentYAML, err := deployment.Marshal() - require.NoError(t, err) - - var recreated verificationDaemonset - require.NoError(t, UnmarshalK8SResources(deploymentYAML, &recreated)) - assert.Equal(t, deployment, &recreated) -} diff --git a/debugd/README.md b/debugd/README.md index b2975ccb0..a61c7510d 100644 --- a/debugd/README.md +++ b/debugd/README.md @@ -19,7 +19,7 @@ With `cdbg` and `yq` installed in your path: authorizedKeys: - username: my-username publicKey: ssh-rsa AAAAB…LJuM= - coordinatorPath: "./coordinator" + bootstrapperPath: "./bootstrapper" systemdUnits: - name: some-custom.service contents: |- diff --git a/debugd/coordinator/streamer.go b/debugd/bootstrapper/streamer.go similarity index 95% rename from debugd/coordinator/streamer.go rename to debugd/bootstrapper/streamer.go index 6a1704404..51726b435 100644 --- a/debugd/coordinator/streamer.go +++ b/debugd/bootstrapper/streamer.go @@ -1,4 +1,4 @@ -package coordinator +package bootstrapper import ( "errors" @@ -56,7 +56,7 @@ func (f *FileStreamer) WriteStream(filename string, stream ReadChunkStream, show if showProgress { bar = progressbar.NewOptions64( -1, - progressbar.OptionSetDescription("receiving coordinator"), + progressbar.OptionSetDescription("receiving bootstrapper"), progressbar.OptionShowBytes(true), progressbar.OptionClearOnFinish(), ) @@ -111,7 +111,7 @@ func (f *FileStreamer) ReadStream(filename string, stream WriteChunkStream, chun } bar = progressbar.NewOptions64( stat.Size(), - progressbar.OptionSetDescription("uploading coordinator"), + progressbar.OptionSetDescription("uploading bootstrapper"), progressbar.OptionShowBytes(true), progressbar.OptionClearOnFinish(), ) diff --git a/debugd/coordinator/streamer_test.go b/debugd/bootstrapper/streamer_test.go similarity index 99% rename from debugd/coordinator/streamer_test.go rename to debugd/bootstrapper/streamer_test.go index ca3f434dd..7cf7d7cd6 100644 --- a/debugd/coordinator/streamer_test.go +++ b/debugd/bootstrapper/streamer_test.go @@ -1,4 +1,4 @@ -package coordinator +package bootstrapper import ( "errors" diff --git a/debugd/cdbg/cmd/deploy.go b/debugd/cdbg/cmd/deploy.go index 211f6169f..304327fde 100644 --- a/debugd/cdbg/cmd/deploy.go +++ b/debugd/cdbg/cmd/deploy.go @@ -8,9 +8,9 @@ import ( "log" "net" + "github.com/edgelesssys/constellation/debugd/bootstrapper" "github.com/edgelesssys/constellation/debugd/cdbg/config" "github.com/edgelesssys/constellation/debugd/cdbg/state" - "github.com/edgelesssys/constellation/debugd/coordinator" "github.com/edgelesssys/constellation/debugd/debugd" depl "github.com/edgelesssys/constellation/debugd/debugd/deploy" pb "github.com/edgelesssys/constellation/debugd/service" @@ -26,13 +26,13 @@ import ( var deployCmd = &cobra.Command{ Use: "deploy", - Short: "Deploys a self-compiled coordinator binary and SSH keys on the current constellation", - Long: `Deploys a self-compiled coordinator binary and SSH keys on the current constellation. + Short: "Deploys a self-compiled bootstrapper binary and SSH keys on the current constellation", + Long: `Deploys a self-compiled bootstrapper binary and SSH keys on the current constellation. Uses config provided by --config and reads constellation config from its default location. If required, you can override the IP addresses that are used for a deployment by specifying "--ips" and a list of IP addresses. -Specifying --coordinator will upload the coordinator from the specified path.`, +Specifying --bootstrapper will upload the bootstrapper from the specified path.`, RunE: runDeploy, - Example: "cdbg deploy\ncdbg deploy --config /path/to/config\ncdbg deploy --coordinator /path/to/coordinator --ips 192.0.2.1,192.0.2.2,192.0.2.3 --config /path/to/config", + Example: "cdbg deploy\ncdbg deploy --config /path/to/config\ncdbg deploy --bootstrapper /path/to/bootstrapper --ips 192.0.2.1,192.0.2.2,192.0.2.3 --config /path/to/config", } func runDeploy(cmd *cobra.Command, args []string) error { @@ -54,16 +54,16 @@ func runDeploy(cmd *cobra.Command, args []string) error { return err } - return deploy(cmd, fileHandler, constellationConfig, debugConfig, coordinator.NewFileStreamer(afero.NewOsFs())) + return deploy(cmd, fileHandler, constellationConfig, debugConfig, bootstrapper.NewFileStreamer(afero.NewOsFs())) } func deploy(cmd *cobra.Command, fileHandler file.Handler, constellationConfig *configc.Config, debugConfig *config.CDBGConfig, reader fileToStreamReader) error { - overrideCoordinatorPath, err := cmd.Flags().GetString("coordinator") + overrideBootstrapperPath, err := cmd.Flags().GetString("bootstrapper") if err != nil { return err } - if len(overrideCoordinatorPath) > 0 { - debugConfig.ConstellationDebugConfig.CoordinatorPath = overrideCoordinatorPath + if len(overrideBootstrapperPath) > 0 { + debugConfig.ConstellationDebugConfig.BootstrapperPath = overrideBootstrapperPath } overrideIPs, err := cmd.Flags().GetStringSlice("ips") @@ -90,11 +90,11 @@ func deploy(cmd *cobra.Command, fileHandler file.Handler, constellationConfig *c for _, ip := range ips { input := deployOnEndpointInput{ - debugdEndpoint: net.JoinHostPort(ip, debugd.DebugdPort), - coordinatorPath: debugConfig.ConstellationDebugConfig.CoordinatorPath, - reader: reader, - authorizedKeys: debugConfig.ConstellationDebugConfig.AuthorizedKeys, - systemdUnits: debugConfig.ConstellationDebugConfig.SystemdUnits, + debugdEndpoint: net.JoinHostPort(ip, debugd.DebugdPort), + bootstrapperPath: debugConfig.ConstellationDebugConfig.BootstrapperPath, + reader: reader, + authorizedKeys: debugConfig.ConstellationDebugConfig.AuthorizedKeys, + systemdUnits: debugConfig.ConstellationDebugConfig.SystemdUnits, } if err := deployOnEndpoint(cmd.Context(), input); err != nil { return err @@ -105,14 +105,14 @@ func deploy(cmd *cobra.Command, fileHandler file.Handler, constellationConfig *c } type deployOnEndpointInput struct { - debugdEndpoint string - coordinatorPath string - reader fileToStreamReader - authorizedKeys []configc.UserKey - systemdUnits []depl.SystemdUnit + debugdEndpoint string + bootstrapperPath string + reader fileToStreamReader + authorizedKeys []configc.UserKey + systemdUnits []depl.SystemdUnit } -// deployOnEndpoint deploys SSH public keys, systemd units and a locally built coordinator binary to a debugd endpoint. +// deployOnEndpoint deploys SSH public keys, systemd units and a locally built bootstrapper binary to a debugd endpoint. func deployOnEndpoint(ctx context.Context, in deployOnEndpointInput) error { log.Printf("Deploying on %v\n", in.debugdEndpoint) dialCTX, cancel := context.WithTimeout(ctx, debugd.GRPCTimeout) @@ -134,7 +134,7 @@ func deployOnEndpoint(ctx context.Context, in deployOnEndpointInput) error { } authorizedKeysResponse, err := client.UploadAuthorizedKeys(ctx, &pb.UploadAuthorizedKeysRequest{Keys: pbKeys}, grpc.WaitForReady(true)) if err != nil || authorizedKeysResponse.Status != pb.UploadAuthorizedKeysStatus_UPLOAD_AUTHORIZED_KEYS_SUCCESS { - return fmt.Errorf("uploading coordinator to instance %v failed: %v / %w", in.debugdEndpoint, authorizedKeysResponse, err) + return fmt.Errorf("uploading bootstrapper to instance %v failed: %v / %w", in.debugdEndpoint, authorizedKeysResponse, err) } if len(in.systemdUnits) > 0 { @@ -153,36 +153,36 @@ func deployOnEndpoint(ctx context.Context, in deployOnEndpointInput) error { } } - stream, err := client.UploadCoordinator(ctx) + stream, err := client.UploadBootstrapper(ctx) if err != nil { - return fmt.Errorf("starting coordinator upload to instance %v: %w", in.debugdEndpoint, err) + return fmt.Errorf("starting bootstrapper upload to instance %v: %w", in.debugdEndpoint, err) } - streamErr := in.reader.ReadStream(in.coordinatorPath, stream, debugd.Chunksize, true) + streamErr := in.reader.ReadStream(in.bootstrapperPath, stream, debugd.Chunksize, true) uploadResponse, closeErr := stream.CloseAndRecv() if closeErr != nil { - return fmt.Errorf("closing upload stream after uploading coordinator to %v: %w", in.debugdEndpoint, closeErr) + return fmt.Errorf("closing upload stream after uploading bootstrapper to %v: %w", in.debugdEndpoint, closeErr) } - if uploadResponse.Status == pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_FILE_EXISTS { - log.Println("Coordinator was already uploaded") + if uploadResponse.Status == pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_FILE_EXISTS { + log.Println("Bootstrapper was already uploaded") return nil } - if uploadResponse.Status != pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_SUCCESS || streamErr != nil { - return fmt.Errorf("uploading coordinator to instance %v failed: %v / %w", in.debugdEndpoint, uploadResponse, streamErr) + if uploadResponse.Status != pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_SUCCESS || streamErr != nil { + return fmt.Errorf("uploading bootstrapper to instance %v failed: %v / %w", in.debugdEndpoint, uploadResponse, streamErr) } - log.Println("Uploaded coordinator") + log.Println("Uploaded bootstrapper") return nil } func getIPsFromConfig(stat statec.ConstellationState, config configc.Config) ([]string, error) { - coordinators, nodes, err := state.GetScalingGroupsFromConfig(stat, &config) + controlPlanes, workers, err := state.GetScalingGroupsFromConfig(stat, &config) if err != nil { return nil, err } var ips []string // only deploy to non empty public IPs - for _, ip := range append(coordinators.PublicIPs(), nodes.PublicIPs()...) { + for _, ip := range append(controlPlanes.PublicIPs(), workers.PublicIPs()...) { if ip != "" { ips = append(ips, ip) } @@ -197,10 +197,10 @@ func getIPsFromConfig(stat statec.ConstellationState, config configc.Config) ([] func init() { rootCmd.AddCommand(deployCmd) - deployCmd.Flags().StringSlice("ips", nil, "override the ips that the coordinator will be uploaded to (defaults to ips from constellation config)") - deployCmd.Flags().String("coordinator", "", "override the path to the coordinator binary uploaded to instances (defaults to path set in config)") + deployCmd.Flags().StringSlice("ips", nil, "override the ips that the bootstrapper will be uploaded to (defaults to ips from constellation config)") + deployCmd.Flags().String("bootstrapper", "", "override the path to the bootstrapper binary uploaded to instances (defaults to path set in config)") } type fileToStreamReader interface { - ReadStream(filename string, stream coordinator.WriteChunkStream, chunksize uint, showProgress bool) error + ReadStream(filename string, stream bootstrapper.WriteChunkStream, chunksize uint, showProgress bool) error } diff --git a/debugd/cdbg/cmd/root.go b/debugd/cdbg/cmd/root.go index 435a4f331..0efb61cb8 100644 --- a/debugd/cdbg/cmd/root.go +++ b/debugd/cdbg/cmd/root.go @@ -11,7 +11,7 @@ var rootCmd = &cobra.Command{ Use: "cdbg", Short: "Constellation debugging client", Long: `cdbg is the constellation debugging client. -It connects to CoreOS instances running debugd and deploys a self-compiled version of the coordinator.`, +It connects to CoreOS instances running debugd and deploys a self-compiled version of the bootstrapper.`, } // Execute starts the CLI. diff --git a/debugd/cdbg/config/config.go b/debugd/cdbg/config/config.go index 88fc99e97..3c427c88f 100644 --- a/debugd/cdbg/config/config.go +++ b/debugd/cdbg/config/config.go @@ -17,9 +17,9 @@ type CDBGConfig struct { // ConstellationDebugdConfig is the cdbg specific configuration. type ConstellationDebugdConfig struct { - AuthorizedKeys []configc.UserKey `yaml:"authorizedKeys"` - CoordinatorPath string `yaml:"coordinatorPath"` - SystemdUnits []deploy.SystemdUnit `yaml:"systemdUnits,omitempty"` + AuthorizedKeys []configc.UserKey `yaml:"authorizedKeys"` + BootstrapperPath string `yaml:"bootstrapperPath"` + SystemdUnits []deploy.SystemdUnit `yaml:"systemdUnits,omitempty"` } // FromFile reads a debug configuration. diff --git a/debugd/cdbg/state/state.go b/debugd/cdbg/state/state.go index 77d5a254a..8cd9c74c1 100644 --- a/debugd/cdbg/state/state.go +++ b/debugd/cdbg/state/state.go @@ -8,71 +8,71 @@ import ( "github.com/edgelesssys/constellation/internal/state" ) -// Code in this file is mostly copied from constellation-coordinator -// TODO: import as package from coordinator once it is properly refactored +// Code in this file is mostly copied from constellation-controlPlane +// TODO: import as package from controlPlane once it is properly refactored -func GetScalingGroupsFromConfig(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { +func GetScalingGroupsFromConfig(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { switch { - case len(stat.GCPCoordinators) != 0: + case len(stat.GCPControlPlanes) != 0: return getGCPInstances(stat, config) - case len(stat.AzureCoordinators) != 0: + case len(stat.AzureControlPlane) != 0: return getAzureInstances(stat, config) - case len(stat.QEMUCoordinators) != 0: + case len(stat.QEMUControlPlane) != 0: return getQEMUInstances(stat, config) default: return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no instances to init") } } -func getGCPInstances(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { - if len(stat.GCPCoordinators) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane nodes available, can't create Constellation without any instance") +func getGCPInstances(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { + if len(stat.GCPControlPlanes) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane workers available, can't create Constellation without any instance") } - // GroupID of coordinators is empty, since they currently do not scale. - coordinators = cloudtypes.ScalingGroup{Instances: stat.GCPCoordinators} + // GroupID of controlPlanes is empty, since they currently do not scale. + controlPlanes = cloudtypes.ScalingGroup{Instances: stat.GCPControlPlanes} - if len(stat.GCPNodes) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker nodes available, can't create Constellation with one instance") + if len(stat.GCPWorkers) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker workers available, can't create Constellation with one instance") } // TODO: make min / max configurable and abstract autoscaling for different cloud providers - nodes = cloudtypes.ScalingGroup{Instances: stat.GCPNodes} + workers = cloudtypes.ScalingGroup{Instances: stat.GCPWorkers} return } -func getAzureInstances(stat state.ConstellationState, _ *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { - if len(stat.AzureCoordinators) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane nodes available, can't create Constellation cluster without any instance") +func getAzureInstances(stat state.ConstellationState, _ *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { + if len(stat.AzureControlPlane) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no control-plane workers available, can't create Constellation cluster without any instance") } - // GroupID of coordinators is empty, since they currently do not scale. - coordinators = cloudtypes.ScalingGroup{Instances: stat.AzureCoordinators} + // GroupID of controlPlanes is empty, since they currently do not scale. + controlPlanes = cloudtypes.ScalingGroup{Instances: stat.AzureControlPlane} - if len(stat.AzureNodes) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker nodes available, can't create Constellation cluster with one instance") + if len(stat.AzureWorkers) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no worker workers available, can't create Constellation cluster with one instance") } // TODO: make min / max configurable and abstract autoscaling for different cloud providers - nodes = cloudtypes.ScalingGroup{Instances: stat.AzureNodes} + workers = cloudtypes.ScalingGroup{Instances: stat.AzureWorkers} return } -func getQEMUInstances(stat state.ConstellationState, config *config.Config) (coordinators, nodes cloudtypes.ScalingGroup, err error) { - coordinatorMap := stat.QEMUCoordinators - if len(coordinatorMap) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no coordinators available, can't create Constellation without any instance") +func getQEMUInstances(stat state.ConstellationState, config *config.Config) (controlPlanes, workers cloudtypes.ScalingGroup, err error) { + controlPlaneMap := stat.QEMUControlPlane + if len(controlPlaneMap) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no controlPlanes available, can't create Constellation without any instance") } // QEMU does not support autoscaling - coordinators = cloudtypes.ScalingGroup{Instances: stat.QEMUCoordinators} + controlPlanes = cloudtypes.ScalingGroup{Instances: stat.QEMUControlPlane} - if len(stat.QEMUNodes) == 0 { - return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no nodes available, can't create Constellation with one instance") + if len(stat.QEMUWorkers) == 0 { + return cloudtypes.ScalingGroup{}, cloudtypes.ScalingGroup{}, errors.New("no workers available, can't create Constellation with one instance") } // QEMU does not support autoscaling - nodes = cloudtypes.ScalingGroup{Instances: stat.QEMUNodes} + workers = cloudtypes.ScalingGroup{Instances: stat.QEMUWorkers} return } diff --git a/debugd/debugd/cmd/debugd/debugd.go b/debugd/debugd/cmd/debugd/debugd.go index 1b619b7aa..1dc246700 100644 --- a/debugd/debugd/cmd/debugd/debugd.go +++ b/debugd/debugd/cmd/debugd/debugd.go @@ -6,7 +6,7 @@ import ( "os" "sync" - "github.com/edgelesssys/constellation/debugd/coordinator" + "github.com/edgelesssys/constellation/debugd/bootstrapper" "github.com/edgelesssys/constellation/debugd/debugd/deploy" "github.com/edgelesssys/constellation/debugd/debugd/metadata" "github.com/edgelesssys/constellation/debugd/debugd/metadata/cloudprovider" @@ -27,7 +27,7 @@ func main() { flag.Parse() log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity)) fs := afero.NewOsFs() - streamer := coordinator.NewFileStreamer(fs) + streamer := bootstrapper.NewFileStreamer(fs) serviceManager := deploy.NewServiceManager(log.Named("serviceManager")) ssh := ssh.NewAccess(log, user.NewLinuxUserManager(fs)) diff --git a/debugd/debugd/constants.go b/debugd/debugd/constants.go index 7449d3337..ac58a3b15 100644 --- a/debugd/debugd/constants.go +++ b/debugd/debugd/constants.go @@ -3,17 +3,17 @@ package debugd import "time" const ( - DebugdMetadataFlag = "constellation-debugd" - DebugdPort = "4000" - GRPCTimeout = 5 * time.Minute - SSHCheckInterval = 30 * time.Second - DiscoverDebugdInterval = 30 * time.Second - CoordinatorDownloadRetryBackoff = 1 * time.Minute - CoordinatorDeployFilename = "/opt/coordinator" - Chunksize = 1024 - CoordinatorSystemdUnitName = "coordinator.service" - CoordinatorSystemdUnitContents = `[Unit] -Description=Constellation Coordinator + DebugdMetadataFlag = "constellation-debugd" + DebugdPort = "4000" + GRPCTimeout = 5 * time.Minute + SSHCheckInterval = 30 * time.Second + DiscoverDebugdInterval = 30 * time.Second + BootstrapperDownloadRetryBackoff = 1 * time.Minute + BootstrapperDeployFilename = "/opt/bootstrapper" + Chunksize = 1024 + BootstrapperSystemdUnitName = "bootstrapper.service" + BootstrapperSystemdUnitContents = `[Unit] +Description=Constellation Bootstrapper Wants=network-online.target After=network-online.target [Service] @@ -23,7 +23,7 @@ ExecStartPre=-setenforce Permissive ExecStartPre=/usr/bin/mkdir -p /opt/cni/bin/ # merge all CNI binaries in writable folder until containerd can use multiple CNI bins: https://github.com/containerd/containerd/issues/6600 ExecStartPre=/bin/sh -c "/usr/bin/cp /usr/libexec/cni/* /opt/cni/bin/" -ExecStart=/opt/coordinator +ExecStart=/opt/bootstrapper [Install] WantedBy=multi-user.target ` diff --git a/debugd/debugd/deploy/download.go b/debugd/debugd/deploy/download.go index 0b60655c6..3a4d3e35a 100644 --- a/debugd/debugd/deploy/download.go +++ b/debugd/debugd/deploy/download.go @@ -6,7 +6,7 @@ import ( "net" "time" - "github.com/edgelesssys/constellation/debugd/coordinator" + "github.com/edgelesssys/constellation/debugd/bootstrapper" "github.com/edgelesssys/constellation/debugd/debugd" pb "github.com/edgelesssys/constellation/debugd/service" "github.com/edgelesssys/constellation/internal/logger" @@ -15,7 +15,7 @@ import ( "google.golang.org/grpc/credentials/insecure" ) -// Download downloads a coordinator from a given debugd instance. +// Download downloads a bootstrapper from a given debugd instance. type Download struct { log *logger.Logger dialer NetDialer @@ -35,15 +35,15 @@ func New(log *logger.Logger, dialer NetDialer, serviceManager serviceManager, wr } } -// DownloadCoordinator will open a new grpc connection to another instance, attempting to download a coordinator from that instance. -func (d *Download) DownloadCoordinator(ctx context.Context, ip string) error { +// DownloadBootstrapper will open a new grpc connection to another instance, attempting to download a bootstrapper from that instance. +func (d *Download) DownloadBootstrapper(ctx context.Context, ip string) error { log := d.log.With(zap.String("ip", ip)) serverAddr := net.JoinHostPort(ip, debugd.DebugdPort) // only retry download from same endpoint after backoff - if lastAttempt, ok := d.attemptedDownloads[serverAddr]; ok && time.Since(lastAttempt) < debugd.CoordinatorDownloadRetryBackoff { - return fmt.Errorf("download failed too recently: %v / %v", time.Since(lastAttempt), debugd.CoordinatorDownloadRetryBackoff) + if lastAttempt, ok := d.attemptedDownloads[serverAddr]; ok && time.Since(lastAttempt) < debugd.BootstrapperDownloadRetryBackoff { + return fmt.Errorf("download failed too recently: %v / %v", time.Since(lastAttempt), debugd.BootstrapperDownloadRetryBackoff) } - log.Infof("Trying to download coordinator") + log.Infof("Trying to download bootstrapper") d.attemptedDownloads[serverAddr] = time.Now() conn, err := d.dial(ctx, serverAddr) if err != nil { @@ -52,23 +52,23 @@ func (d *Download) DownloadCoordinator(ctx context.Context, ip string) error { defer conn.Close() client := pb.NewDebugdClient(conn) - stream, err := client.DownloadCoordinator(ctx, &pb.DownloadCoordinatorRequest{}) + stream, err := client.DownloadBootstrapper(ctx, &pb.DownloadBootstrapperRequest{}) if err != nil { - return fmt.Errorf("starting coordinator download from other instance: %w", err) + return fmt.Errorf("starting bootstrapper download from other instance: %w", err) } - if err := d.writer.WriteStream(debugd.CoordinatorDeployFilename, stream, true); err != nil { - return fmt.Errorf("streaming coordinator from other instance: %w", err) + if err := d.writer.WriteStream(debugd.BootstrapperDeployFilename, stream, true); err != nil { + return fmt.Errorf("streaming bootstrapper from other instance: %w", err) } - log.Infof("Successfully downloaded coordinator") + log.Infof("Successfully downloaded bootstrapper") - // after the upload succeeds, try to restart the coordinator + // after the upload succeeds, try to restart the bootstrapper restartAction := ServiceManagerRequest{ - Unit: debugd.CoordinatorSystemdUnitName, + Unit: debugd.BootstrapperSystemdUnitName, Action: Restart, } if err := d.serviceManager.SystemdAction(ctx, restartAction); err != nil { - return fmt.Errorf("restarting coordinator: %w", err) + return fmt.Errorf("restarting bootstrapper: %w", err) } return nil @@ -92,7 +92,7 @@ type serviceManager interface { } type streamToFileWriter interface { - WriteStream(filename string, stream coordinator.ReadChunkStream, showProgress bool) error + WriteStream(filename string, stream bootstrapper.ReadChunkStream, showProgress bool) error } // NetDialer can open a net.Conn. diff --git a/debugd/debugd/deploy/download_test.go b/debugd/debugd/deploy/download_test.go index bbe8be085..5f2237830 100644 --- a/debugd/debugd/deploy/download_test.go +++ b/debugd/debugd/deploy/download_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/edgelesssys/constellation/debugd/coordinator" + "github.com/edgelesssys/constellation/debugd/bootstrapper" "github.com/edgelesssys/constellation/debugd/debugd" pb "github.com/edgelesssys/constellation/debugd/service" "github.com/edgelesssys/constellation/internal/grpc/testdialer" @@ -27,8 +27,8 @@ func TestMain(m *testing.M) { ) } -func TestDownloadCoordinator(t *testing.T) { - filename := "/opt/coordinator" +func TestDownloadBootstrapper(t *testing.T) { + filename := "/opt/bootstrapper" testCases := map[string]struct { server fakeOnlyDownloadServer @@ -108,7 +108,7 @@ func TestDownloadCoordinator(t *testing.T) { serviceManager: &tc.serviceManager, attemptedDownloads: tc.attemptedDownloads, } - err := download.DownloadCoordinator(context.Background(), ip) + err := download.DownloadBootstrapper(context.Background(), ip) grpcServ.GracefulStop() if tc.wantDownloadErr { @@ -124,7 +124,7 @@ func TestDownloadCoordinator(t *testing.T) { if tc.wantSystemdAction { assert.ElementsMatch( []ServiceManagerRequest{ - {Unit: debugd.CoordinatorSystemdUnitName, Action: Restart}, + {Unit: debugd.BootstrapperSystemdUnitName, Action: Restart}, }, tc.serviceManager.requests, ) @@ -134,13 +134,13 @@ func TestDownloadCoordinator(t *testing.T) { } type stubDownloadClient struct { - requests []*pb.DownloadCoordinatorRequest - stream coordinator.ReadChunkStream + requests []*pb.DownloadBootstrapperRequest + stream bootstrapper.ReadChunkStream downloadErr error } -func (s *stubDownloadClient) DownloadCoordinator(ctx context.Context, in *pb.DownloadCoordinatorRequest, opts ...grpc.CallOption) (coordinator.ReadChunkStream, error) { - s.requests = append(s.requests, proto.Clone(in).(*pb.DownloadCoordinatorRequest)) +func (s *stubDownloadClient) DownloadBootstrapper(ctx context.Context, in *pb.DownloadBootstrapperRequest, opts ...grpc.CallOption) (bootstrapper.ReadChunkStream, error) { + s.requests = append(s.requests, proto.Clone(in).(*pb.DownloadBootstrapperRequest)) return s.stream, s.downloadErr } @@ -159,7 +159,7 @@ type fakeStreamToFileWriter struct { filename string } -func (f *fakeStreamToFileWriter) WriteStream(filename string, stream coordinator.ReadChunkStream, showProgress bool) error { +func (f *fakeStreamToFileWriter) WriteStream(filename string, stream bootstrapper.ReadChunkStream, showProgress bool) error { f.filename = filename for { chunk, err := stream.Recv() @@ -173,14 +173,14 @@ func (f *fakeStreamToFileWriter) WriteStream(filename string, stream coordinator } } -// fakeOnlyDownloadServer implements DebugdServer; only fakes DownloadCoordinator, panics on every other rpc. +// fakeOnlyDownloadServer implements DebugdServer; only fakes DownloadBootstrapper, panics on every other rpc. type fakeOnlyDownloadServer struct { chunks [][]byte downladErr error pb.UnimplementedDebugdServer } -func (f *fakeOnlyDownloadServer) DownloadCoordinator(request *pb.DownloadCoordinatorRequest, stream pb.Debugd_DownloadCoordinatorServer) error { +func (f *fakeOnlyDownloadServer) DownloadBootstrapper(request *pb.DownloadBootstrapperRequest, stream pb.Debugd_DownloadBootstrapperServer) error { for _, chunk := range f.chunks { if err := stream.Send(&pb.Chunk{Content: chunk}); err != nil { return fmt.Errorf("sending chunk: %w", err) diff --git a/debugd/debugd/deploy/service.go b/debugd/debugd/deploy/service.go index f02125c9b..a3b789c3d 100644 --- a/debugd/debugd/deploy/service.go +++ b/debugd/debugd/deploy/service.go @@ -140,21 +140,21 @@ func (s *ServiceManager) WriteSystemdUnitFile(ctx context.Context, unit SystemdU return nil } -// DeployDefaultServiceUnit will write the default "coordinator.service" unit file. +// DeployDefaultServiceUnit will write the default "bootstrapper.service" unit file. func DeployDefaultServiceUnit(ctx context.Context, serviceManager *ServiceManager) error { if err := serviceManager.WriteSystemdUnitFile(ctx, SystemdUnit{ - Name: debugd.CoordinatorSystemdUnitName, - Contents: debugd.CoordinatorSystemdUnitContents, + Name: debugd.BootstrapperSystemdUnitName, + Contents: debugd.BootstrapperSystemdUnitContents, }); err != nil { - return fmt.Errorf("writing systemd unit file %q: %w", debugd.CoordinatorSystemdUnitName, err) + return fmt.Errorf("writing systemd unit file %q: %w", debugd.BootstrapperSystemdUnitName, err) } // try to start the default service if the binary exists but ignore failure. - // this is meant to start the coordinator after a reboot - // if a coordinator binary was uploaded before. - if ok, err := afero.Exists(serviceManager.fs, debugd.CoordinatorDeployFilename); ok && err == nil { + // this is meant to start the bootstrapper after a reboot + // if a bootstrapper binary was uploaded before. + if ok, err := afero.Exists(serviceManager.fs, debugd.BootstrapperDeployFilename); ok && err == nil { _ = serviceManager.SystemdAction(ctx, ServiceManagerRequest{ - Unit: debugd.CoordinatorSystemdUnitName, + Unit: debugd.BootstrapperSystemdUnitName, Action: Start, }) } diff --git a/debugd/debugd/metadata/cloudprovider/cloudprovider.go b/debugd/debugd/metadata/cloudprovider/cloudprovider.go index faa8d38d9..4cb223785 100644 --- a/debugd/debugd/metadata/cloudprovider/cloudprovider.go +++ b/debugd/debugd/metadata/cloudprovider/cloudprovider.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure" - gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp" - qemucloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/qemu" + azurecloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/azure" + gcpcloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/gcp" + qemucloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/qemu" "github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/deploy/ssh" ) diff --git a/debugd/debugd/metadata/scheduler.go b/debugd/debugd/metadata/scheduler.go index 53f230ea6..9bc922c86 100644 --- a/debugd/debugd/metadata/scheduler.go +++ b/debugd/debugd/metadata/scheduler.go @@ -54,7 +54,7 @@ func (s *Scheduler) discoveryLoop(ctx context.Context, wg *sync.WaitGroup) { if err != nil { s.log.With(zap.Error(err)).Errorf("Discovering debugd IPs failed") } else { - if s.downloadCoordinator(ctx, ips) { + if s.downloadBootstrapper(ctx, ips) { return } } @@ -71,7 +71,7 @@ func (s *Scheduler) discoveryLoop(ctx context.Context, wg *sync.WaitGroup) { continue } s.log.With(zap.Strings("ips", ips)).Infof("Discovered instances") - if s.downloadCoordinator(ctx, ips) { + if s.downloadBootstrapper(ctx, ips) { return } case <-ctx.Done(): @@ -102,19 +102,19 @@ func (s *Scheduler) sshLoop(ctx context.Context, wg *sync.WaitGroup) { } } -// downloadCoordinator tries to download coordinator from a list of ips and logs errors encountered. -func (s *Scheduler) downloadCoordinator(ctx context.Context, ips []string) (success bool) { +// downloadBootstrapper tries to download bootstrapper from a list of ips and logs errors encountered. +func (s *Scheduler) downloadBootstrapper(ctx context.Context, ips []string) (success bool) { for _, ip := range ips { - err := s.downloader.DownloadCoordinator(ctx, ip) + err := s.downloader.DownloadBootstrapper(ctx, ip) if err == nil { - // early exit with success since coordinator should only be downloaded once + // early exit with success since bootstrapper should only be downloaded once return true } if errors.Is(err, fs.ErrExist) { - // coordinator was already uploaded + // bootstrapper was already uploaded return true } - s.log.With(zap.Error(err), zap.String("peer", ip)).Errorf("Downloading coordinator from peer failed") + s.log.With(zap.Error(err), zap.String("peer", ip)).Errorf("Downloading bootstrapper from peer failed") } return false } @@ -131,7 +131,7 @@ func (s *Scheduler) deploySSHKeys(ctx context.Context, keys []ssh.UserKey) { } type downloader interface { - DownloadCoordinator(ctx context.Context, ip string) error + DownloadBootstrapper(ctx context.Context, ip string) error } type sshDeployer interface { diff --git a/debugd/debugd/metadata/scheduler_test.go b/debugd/debugd/metadata/scheduler_test.go index 5936361c7..658bc2f4e 100644 --- a/debugd/debugd/metadata/scheduler_test.go +++ b/debugd/debugd/metadata/scheduler_test.go @@ -134,7 +134,7 @@ type stubDownloader struct { err error } -func (s *stubDownloader) DownloadCoordinator(ctx context.Context, ip string) error { +func (s *stubDownloader) DownloadBootstrapper(ctx context.Context, ip string) error { s.ips = append(s.ips, ip) return s.err } diff --git a/debugd/debugd/server/server.go b/debugd/debugd/server/server.go index e9bd95890..6f4cecf63 100644 --- a/debugd/debugd/server/server.go +++ b/debugd/debugd/server/server.go @@ -8,7 +8,7 @@ import ( "net" "sync" - "github.com/edgelesssys/constellation/debugd/coordinator" + "github.com/edgelesssys/constellation/debugd/bootstrapper" "github.com/edgelesssys/constellation/debugd/debugd" "github.com/edgelesssys/constellation/debugd/debugd/deploy" pb "github.com/edgelesssys/constellation/debugd/service" @@ -52,46 +52,46 @@ func (s *debugdServer) UploadAuthorizedKeys(ctx context.Context, in *pb.UploadAu }, nil } -// UploadCoordinator receives a coordinator binary in a stream of chunks and writes to a file. -func (s *debugdServer) UploadCoordinator(stream pb.Debugd_UploadCoordinatorServer) error { +// UploadBootstrapper receives a bootstrapper binary in a stream of chunks and writes to a file. +func (s *debugdServer) UploadBootstrapper(stream pb.Debugd_UploadBootstrapperServer) error { startAction := deploy.ServiceManagerRequest{ - Unit: debugd.CoordinatorSystemdUnitName, + Unit: debugd.BootstrapperSystemdUnitName, Action: deploy.Start, } - var responseStatus pb.UploadCoordinatorStatus + var responseStatus pb.UploadBootstrapperStatus defer func() { if err := s.serviceManager.SystemdAction(stream.Context(), startAction); err != nil { - s.log.With(zap.Error(err)).Errorf("Starting uploaded coordinator failed") - if responseStatus == pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_SUCCESS { - responseStatus = pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_START_FAILED + s.log.With(zap.Error(err)).Errorf("Starting uploaded bootstrapper failed") + if responseStatus == pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_SUCCESS { + responseStatus = pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_START_FAILED } } - stream.SendAndClose(&pb.UploadCoordinatorResponse{ + stream.SendAndClose(&pb.UploadBootstrapperResponse{ Status: responseStatus, }) }() - s.log.Infof("Starting coordinator upload") - if err := s.streamer.WriteStream(debugd.CoordinatorDeployFilename, stream, true); err != nil { + s.log.Infof("Starting bootstrapper upload") + if err := s.streamer.WriteStream(debugd.BootstrapperDeployFilename, stream, true); err != nil { if errors.Is(err, fs.ErrExist) { - // coordinator was already uploaded - s.log.Warnf("Coordinator already uploaded") - responseStatus = pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_FILE_EXISTS + // bootstrapper was already uploaded + s.log.Warnf("Bootstrapper already uploaded") + responseStatus = pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_FILE_EXISTS return nil } - s.log.With(zap.Error(err)).Errorf("Uploading coordinator failed") - responseStatus = pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_UPLOAD_FAILED - return fmt.Errorf("uploading coordinator: %w", err) + s.log.With(zap.Error(err)).Errorf("Uploading bootstrapper failed") + responseStatus = pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_UPLOAD_FAILED + return fmt.Errorf("uploading bootstrapper: %w", err) } - s.log.Infof("Successfully uploaded coordinator") - responseStatus = pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_SUCCESS + s.log.Infof("Successfully uploaded bootstrapper") + responseStatus = pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_SUCCESS return nil } -// DownloadCoordinator streams the local coordinator binary to other instances. -func (s *debugdServer) DownloadCoordinator(request *pb.DownloadCoordinatorRequest, stream pb.Debugd_DownloadCoordinatorServer) error { - s.log.Infof("Sending coordinator to other instance") - return s.streamer.ReadStream(debugd.CoordinatorDeployFilename, stream, debugd.Chunksize, true) +// DownloadBootstrapper streams the local bootstrapper binary to other instances. +func (s *debugdServer) DownloadBootstrapper(request *pb.DownloadBootstrapperRequest, stream pb.Debugd_DownloadBootstrapperServer) error { + s.log.Infof("Sending bootstrapper to other instance") + return s.streamer.ReadStream(debugd.BootstrapperDeployFilename, stream, debugd.Chunksize, true) } // UploadSystemServiceUnits receives systemd service units, writes them to a service file and schedules a daemon-reload. @@ -133,6 +133,6 @@ type serviceManager interface { } type streamer interface { - WriteStream(filename string, stream coordinator.ReadChunkStream, showProgress bool) error - ReadStream(filename string, stream coordinator.WriteChunkStream, chunksize uint, showProgress bool) error + WriteStream(filename string, stream bootstrapper.ReadChunkStream, showProgress bool) error + ReadStream(filename string, stream bootstrapper.WriteChunkStream, chunksize uint, showProgress bool) error } diff --git a/debugd/debugd/server/server_test.go b/debugd/debugd/server/server_test.go index 93a97afe2..60bc28c1f 100644 --- a/debugd/debugd/server/server_test.go +++ b/debugd/debugd/server/server_test.go @@ -8,7 +8,7 @@ import ( "net" "testing" - "github.com/edgelesssys/constellation/debugd/coordinator" + "github.com/edgelesssys/constellation/debugd/bootstrapper" "github.com/edgelesssys/constellation/debugd/debugd/deploy" pb "github.com/edgelesssys/constellation/debugd/service" "github.com/edgelesssys/constellation/internal/deploy/ssh" @@ -104,7 +104,7 @@ func TestUploadAuthorizedKeys(t *testing.T) { } } -func TestUploadCoordinator(t *testing.T) { +func TestUploadBootstrapper(t *testing.T) { endpoint := "192.0.2.1:4000" testCases := map[string]struct { @@ -113,7 +113,7 @@ func TestUploadCoordinator(t *testing.T) { streamer fakeStreamer uploadChunks [][]byte wantErr bool - wantResponseStatus pb.UploadCoordinatorStatus + wantResponseStatus pb.UploadBootstrapperStatus wantFile bool wantChunks [][]byte }{ @@ -125,27 +125,27 @@ func TestUploadCoordinator(t *testing.T) { wantChunks: [][]byte{ []byte("test"), }, - wantResponseStatus: pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_SUCCESS, + wantResponseStatus: pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_SUCCESS, }, "recv fails": { streamer: fakeStreamer{ writeStreamErr: errors.New("recv error"), }, - wantResponseStatus: pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_UPLOAD_FAILED, + wantResponseStatus: pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_UPLOAD_FAILED, wantErr: true, }, - "starting coordinator fails": { + "starting bootstrapper fails": { uploadChunks: [][]byte{ []byte("test"), }, serviceManager: stubServiceManager{ - systemdActionErr: errors.New("starting coordinator error"), + systemdActionErr: errors.New("starting bootstrapper error"), }, wantFile: true, wantChunks: [][]byte{ []byte("test"), }, - wantResponseStatus: pb.UploadCoordinatorStatus_UPLOAD_COORDINATOR_START_FAILED, + wantResponseStatus: pb.UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_START_FAILED, }, } @@ -165,7 +165,7 @@ func TestUploadCoordinator(t *testing.T) { require.NoError(err) defer conn.Close() client := pb.NewDebugdClient(conn) - stream, err := client.UploadCoordinator(context.Background()) + stream, err := client.UploadBootstrapper(context.Background()) require.NoError(err) require.NoError(fakeWrite(stream, tc.uploadChunks)) resp, err := stream.CloseAndRecv() @@ -180,7 +180,7 @@ func TestUploadCoordinator(t *testing.T) { assert.Equal(tc.wantResponseStatus, resp.Status) if tc.wantFile { assert.Equal(tc.wantChunks, tc.streamer.writeStreamChunks) - assert.Equal("/opt/coordinator", tc.streamer.writeStreamFilename) + assert.Equal("/opt/bootstrapper", tc.streamer.writeStreamFilename) } else { assert.Empty(tc.streamer.writeStreamChunks) assert.Empty(tc.streamer.writeStreamFilename) @@ -189,18 +189,18 @@ func TestUploadCoordinator(t *testing.T) { } } -func TestDownloadCoordinator(t *testing.T) { +func TestDownloadBootstrapper(t *testing.T) { endpoint := "192.0.2.1:4000" testCases := map[string]struct { ssh stubSSHDeployer serviceManager stubServiceManager - request *pb.DownloadCoordinatorRequest + request *pb.DownloadBootstrapperRequest streamer fakeStreamer wantErr bool wantChunks [][]byte }{ "download works": { - request: &pb.DownloadCoordinatorRequest{}, + request: &pb.DownloadBootstrapperRequest{}, streamer: fakeStreamer{ readStreamChunks: [][]byte{ []byte("test"), @@ -212,9 +212,9 @@ func TestDownloadCoordinator(t *testing.T) { }, }, "download fails": { - request: &pb.DownloadCoordinatorRequest{}, + request: &pb.DownloadBootstrapperRequest{}, streamer: fakeStreamer{ - readStreamErr: errors.New("read coordinator fails"), + readStreamErr: errors.New("read bootstrapper fails"), }, wantErr: true, }, @@ -236,7 +236,7 @@ func TestDownloadCoordinator(t *testing.T) { require.NoError(err) defer conn.Close() client := pb.NewDebugdClient(conn) - stream, err := client.DownloadCoordinator(context.Background(), tc.request) + stream, err := client.DownloadBootstrapper(context.Background(), tc.request) require.NoError(err) chunks, err := fakeRead(stream) grpcServ.GracefulStop() @@ -247,7 +247,7 @@ func TestDownloadCoordinator(t *testing.T) { } require.NoError(err) assert.Equal(tc.wantChunks, chunks) - assert.Equal("/opt/coordinator", tc.streamer.readStreamFilename) + assert.Equal("/opt/bootstrapper", tc.streamer.readStreamFilename) }) } } @@ -383,7 +383,7 @@ type fakeStreamer struct { readStreamErr error } -func (f *fakeStreamer) WriteStream(filename string, stream coordinator.ReadChunkStream, showProgress bool) error { +func (f *fakeStreamer) WriteStream(filename string, stream bootstrapper.ReadChunkStream, showProgress bool) error { f.writeStreamFilename = filename for { chunk, err := stream.Recv() @@ -397,7 +397,7 @@ func (f *fakeStreamer) WriteStream(filename string, stream coordinator.ReadChunk } } -func (f *fakeStreamer) ReadStream(filename string, stream coordinator.WriteChunkStream, chunksize uint, showProgress bool) error { +func (f *fakeStreamer) ReadStream(filename string, stream bootstrapper.WriteChunkStream, chunksize uint, showProgress bool) error { f.readStreamFilename = filename for _, chunk := range f.readStreamChunks { if err := stream.Send(&pb.Chunk{Content: chunk}); err != nil { @@ -422,7 +422,7 @@ func setupServerWithConn(endpoint string, serv *debugdServer) (*grpc.Server, *gr return grpcServ, conn, nil } -func fakeWrite(stream coordinator.WriteChunkStream, chunks [][]byte) error { +func fakeWrite(stream bootstrapper.WriteChunkStream, chunks [][]byte) error { for _, chunk := range chunks { err := stream.Send(&pb.Chunk{ Content: chunk, @@ -434,7 +434,7 @@ func fakeWrite(stream coordinator.WriteChunkStream, chunks [][]byte) error { return nil } -func fakeRead(stream coordinator.ReadChunkStream) ([][]byte, error) { +func fakeRead(stream bootstrapper.ReadChunkStream) ([][]byte, error) { var chunks [][]byte for { chunk, err := stream.Recv() diff --git a/debugd/service/debugd.pb.go b/debugd/service/debugd.pb.go index 7e46a6cd4..5470e6640 100644 --- a/debugd/service/debugd.pb.go +++ b/debugd/service/debugd.pb.go @@ -66,55 +66,55 @@ func (UploadAuthorizedKeysStatus) EnumDescriptor() ([]byte, []int) { return file_debugd_proto_rawDescGZIP(), []int{0} } -type UploadCoordinatorStatus int32 +type UploadBootstrapperStatus int32 const ( - UploadCoordinatorStatus_UPLOAD_COORDINATOR_SUCCESS UploadCoordinatorStatus = 0 - UploadCoordinatorStatus_UPLOAD_COORDINATOR_UPLOAD_FAILED UploadCoordinatorStatus = 1 - UploadCoordinatorStatus_UPLOAD_COORDINATOR_START_FAILED UploadCoordinatorStatus = 2 - UploadCoordinatorStatus_UPLOAD_COORDINATOR_FILE_EXISTS UploadCoordinatorStatus = 3 + UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_SUCCESS UploadBootstrapperStatus = 0 + UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_UPLOAD_FAILED UploadBootstrapperStatus = 1 + UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_START_FAILED UploadBootstrapperStatus = 2 + UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_FILE_EXISTS UploadBootstrapperStatus = 3 ) -// Enum value maps for UploadCoordinatorStatus. +// Enum value maps for UploadBootstrapperStatus. var ( - UploadCoordinatorStatus_name = map[int32]string{ - 0: "UPLOAD_COORDINATOR_SUCCESS", - 1: "UPLOAD_COORDINATOR_UPLOAD_FAILED", - 2: "UPLOAD_COORDINATOR_START_FAILED", - 3: "UPLOAD_COORDINATOR_FILE_EXISTS", + UploadBootstrapperStatus_name = map[int32]string{ + 0: "UPLOAD_BOOTSTRAPPER_SUCCESS", + 1: "UPLOAD_BOOTSTRAPPER_UPLOAD_FAILED", + 2: "UPLOAD_BOOTSTRAPPER_START_FAILED", + 3: "UPLOAD_BOOTSTRAPPER_FILE_EXISTS", } - UploadCoordinatorStatus_value = map[string]int32{ - "UPLOAD_COORDINATOR_SUCCESS": 0, - "UPLOAD_COORDINATOR_UPLOAD_FAILED": 1, - "UPLOAD_COORDINATOR_START_FAILED": 2, - "UPLOAD_COORDINATOR_FILE_EXISTS": 3, + UploadBootstrapperStatus_value = map[string]int32{ + "UPLOAD_BOOTSTRAPPER_SUCCESS": 0, + "UPLOAD_BOOTSTRAPPER_UPLOAD_FAILED": 1, + "UPLOAD_BOOTSTRAPPER_START_FAILED": 2, + "UPLOAD_BOOTSTRAPPER_FILE_EXISTS": 3, } ) -func (x UploadCoordinatorStatus) Enum() *UploadCoordinatorStatus { - p := new(UploadCoordinatorStatus) +func (x UploadBootstrapperStatus) Enum() *UploadBootstrapperStatus { + p := new(UploadBootstrapperStatus) *p = x return p } -func (x UploadCoordinatorStatus) String() string { +func (x UploadBootstrapperStatus) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (UploadCoordinatorStatus) Descriptor() protoreflect.EnumDescriptor { +func (UploadBootstrapperStatus) Descriptor() protoreflect.EnumDescriptor { return file_debugd_proto_enumTypes[1].Descriptor() } -func (UploadCoordinatorStatus) Type() protoreflect.EnumType { +func (UploadBootstrapperStatus) Type() protoreflect.EnumType { return &file_debugd_proto_enumTypes[1] } -func (x UploadCoordinatorStatus) Number() protoreflect.EnumNumber { +func (x UploadBootstrapperStatus) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use UploadCoordinatorStatus.Descriptor instead. -func (UploadCoordinatorStatus) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use UploadBootstrapperStatus.Descriptor instead. +func (UploadBootstrapperStatus) EnumDescriptor() ([]byte, []int) { return file_debugd_proto_rawDescGZIP(), []int{1} } @@ -164,14 +164,14 @@ func (UploadSystemdServiceUnitsStatus) EnumDescriptor() ([]byte, []int) { return file_debugd_proto_rawDescGZIP(), []int{2} } -type DownloadCoordinatorRequest struct { +type DownloadBootstrapperRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *DownloadCoordinatorRequest) Reset() { - *x = DownloadCoordinatorRequest{} +func (x *DownloadBootstrapperRequest) Reset() { + *x = DownloadBootstrapperRequest{} if protoimpl.UnsafeEnabled { mi := &file_debugd_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -179,13 +179,13 @@ func (x *DownloadCoordinatorRequest) Reset() { } } -func (x *DownloadCoordinatorRequest) String() string { +func (x *DownloadBootstrapperRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DownloadCoordinatorRequest) ProtoMessage() {} +func (*DownloadBootstrapperRequest) ProtoMessage() {} -func (x *DownloadCoordinatorRequest) ProtoReflect() protoreflect.Message { +func (x *DownloadBootstrapperRequest) ProtoReflect() protoreflect.Message { mi := &file_debugd_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -197,8 +197,8 @@ func (x *DownloadCoordinatorRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use DownloadCoordinatorRequest.ProtoReflect.Descriptor instead. -func (*DownloadCoordinatorRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use DownloadBootstrapperRequest.ProtoReflect.Descriptor instead. +func (*DownloadBootstrapperRequest) Descriptor() ([]byte, []int) { return file_debugd_proto_rawDescGZIP(), []int{0} } @@ -398,16 +398,16 @@ func (x *Chunk) GetContent() []byte { return nil } -type UploadCoordinatorResponse struct { +type UploadBootstrapperResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Status UploadCoordinatorStatus `protobuf:"varint,1,opt,name=status,proto3,enum=debugd.UploadCoordinatorStatus" json:"status,omitempty"` + Status UploadBootstrapperStatus `protobuf:"varint,1,opt,name=status,proto3,enum=debugd.UploadBootstrapperStatus" json:"status,omitempty"` } -func (x *UploadCoordinatorResponse) Reset() { - *x = UploadCoordinatorResponse{} +func (x *UploadBootstrapperResponse) Reset() { + *x = UploadBootstrapperResponse{} if protoimpl.UnsafeEnabled { mi := &file_debugd_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -415,13 +415,13 @@ func (x *UploadCoordinatorResponse) Reset() { } } -func (x *UploadCoordinatorResponse) String() string { +func (x *UploadBootstrapperResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UploadCoordinatorResponse) ProtoMessage() {} +func (*UploadBootstrapperResponse) ProtoMessage() {} -func (x *UploadCoordinatorResponse) ProtoReflect() protoreflect.Message { +func (x *UploadBootstrapperResponse) ProtoReflect() protoreflect.Message { mi := &file_debugd_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -433,16 +433,16 @@ func (x *UploadCoordinatorResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UploadCoordinatorResponse.ProtoReflect.Descriptor instead. -func (*UploadCoordinatorResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use UploadBootstrapperResponse.ProtoReflect.Descriptor instead. +func (*UploadBootstrapperResponse) Descriptor() ([]byte, []int) { return file_debugd_proto_rawDescGZIP(), []int{5} } -func (x *UploadCoordinatorResponse) GetStatus() UploadCoordinatorStatus { +func (x *UploadBootstrapperResponse) GetStatus() UploadBootstrapperStatus { if x != nil { return x.Status } - return UploadCoordinatorStatus_UPLOAD_COORDINATOR_SUCCESS + return UploadBootstrapperStatus_UPLOAD_BOOTSTRAPPER_SUCCESS } type ServiceUnit struct { @@ -598,99 +598,99 @@ var File_debugd_proto protoreflect.FileDescriptor var file_debugd_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, - 0x61, 0x64, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6b, 0x65, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x48, - 0x0a, 0x1b, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, - 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x64, 0x65, - 0x62, 0x75, 0x67, 0x64, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, - 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x5a, 0x0a, 0x1c, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, - 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, - 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x22, 0x21, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x18, 0x0a, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x54, 0x0a, 0x19, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3d, 0x0a, - 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x4d, 0x0a, 0x20, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x29, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x55, 0x6e, 0x69, 0x74, 0x52, 0x05, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x22, 0x64, 0x0a, 0x21, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x3f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x27, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, - 0x69, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2a, 0x64, 0x0a, 0x1a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x22, 0x0a, 0x1e, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, - 0x49, 0x5a, 0x45, 0x44, 0x5f, 0x4b, 0x45, 0x59, 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, - 0x53, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x41, 0x55, - 0x54, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, 0x44, 0x5f, 0x4b, 0x45, 0x59, 0x53, 0x5f, 0x46, 0x41, - 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x2a, 0xa8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x1a, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x43, 0x4f, - 0x4f, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, - 0x53, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x43, 0x4f, - 0x4f, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, - 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x55, 0x50, 0x4c, - 0x4f, 0x41, 0x44, 0x5f, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x49, 0x4e, 0x41, 0x54, 0x4f, 0x52, 0x5f, - 0x53, 0x54, 0x41, 0x52, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x22, - 0x0a, 0x1e, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x49, 0x4e, - 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, - 0x10, 0x03, 0x2a, 0x75, 0x0a, 0x1f, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x24, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, - 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, - 0x55, 0x4e, 0x49, 0x54, 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, - 0x28, 0x0a, 0x24, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, - 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x49, 0x54, 0x53, 0x5f, - 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x32, 0xf9, 0x02, 0x0a, 0x06, 0x44, 0x65, - 0x62, 0x75, 0x67, 0x64, 0x12, 0x63, 0x0a, 0x14, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x23, 0x2e, 0x64, - 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x24, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x11, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0d, - 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0x21, 0x2e, - 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6f, - 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x28, 0x01, 0x12, 0x4c, 0x0a, 0x13, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, - 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x22, 0x2e, 0x64, 0x65, - 0x62, 0x75, 0x67, 0x64, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6f, - 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0d, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x71, 0x0a, 0x18, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x28, - 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, - 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, - 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, + 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6b, 0x65, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x48, 0x0a, 0x1b, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, + 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x64, + 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x4b, 0x65, 0x79, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x5a, 0x0a, 0x1c, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x64, 0x65, 0x62, 0x75, + 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x21, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x18, + 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x56, 0x0a, 0x1a, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, + 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, + 0x4d, 0x0a, 0x20, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x52, 0x05, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x22, 0x64, + 0x0a, 0x21, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x64, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x73, 0x79, 0x73, 0x2f, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x65, - 0x62, 0x75, 0x67, 0x64, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x2a, 0x64, 0x0a, 0x1a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x22, 0x0a, 0x1e, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x41, 0x55, 0x54, + 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, 0x44, 0x5f, 0x4b, 0x45, 0x59, 0x53, 0x5f, 0x53, 0x55, 0x43, + 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, + 0x5f, 0x41, 0x55, 0x54, 0x48, 0x4f, 0x52, 0x49, 0x5a, 0x45, 0x44, 0x5f, 0x4b, 0x45, 0x59, 0x53, + 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, 0x01, 0x2a, 0xad, 0x01, 0x0a, 0x18, 0x55, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, 0x65, + 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x1b, 0x55, 0x50, 0x4c, 0x4f, 0x41, + 0x44, 0x5f, 0x42, 0x4f, 0x4f, 0x54, 0x53, 0x54, 0x52, 0x41, 0x50, 0x50, 0x45, 0x52, 0x5f, 0x53, + 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x25, 0x0a, 0x21, 0x55, 0x50, 0x4c, 0x4f, + 0x41, 0x44, 0x5f, 0x42, 0x4f, 0x4f, 0x54, 0x53, 0x54, 0x52, 0x41, 0x50, 0x50, 0x45, 0x52, 0x5f, + 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, + 0x24, 0x0a, 0x20, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x42, 0x4f, 0x4f, 0x54, 0x53, 0x54, + 0x52, 0x41, 0x50, 0x50, 0x45, 0x52, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x23, 0x0a, 0x1f, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, + 0x42, 0x4f, 0x4f, 0x54, 0x53, 0x54, 0x52, 0x41, 0x50, 0x50, 0x45, 0x52, 0x5f, 0x46, 0x49, 0x4c, + 0x45, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x53, 0x10, 0x03, 0x2a, 0x75, 0x0a, 0x1f, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, + 0x24, 0x55, 0x50, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x44, 0x5f, + 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x49, 0x54, 0x53, 0x5f, 0x53, 0x55, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x28, 0x0a, 0x24, 0x55, 0x50, 0x4c, 0x4f, 0x41, + 0x44, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, + 0x45, 0x5f, 0x55, 0x4e, 0x49, 0x54, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, + 0x01, 0x32, 0xfd, 0x02, 0x0a, 0x06, 0x44, 0x65, 0x62, 0x75, 0x67, 0x64, 0x12, 0x63, 0x0a, 0x14, + 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, + 0x4b, 0x65, 0x79, 0x73, 0x12, 0x23, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x4b, 0x65, + 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x64, 0x65, 0x62, 0x75, + 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x7a, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x4b, 0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, + 0x74, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x0d, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, + 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x1a, 0x22, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, + 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x70, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x12, 0x4e, + 0x0a, 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, + 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x64, 0x65, + 0x62, 0x75, 0x67, 0x64, 0x2e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x00, 0x30, 0x01, 0x12, 0x71, + 0x0a, 0x18, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x12, 0x28, 0x2e, 0x64, 0x65, 0x62, + 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, 0x2e, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x65, 0x64, 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x73, 0x79, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x73, + 0x74, 0x65, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x64, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -709,14 +709,14 @@ var file_debugd_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_debugd_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_debugd_proto_goTypes = []interface{}{ (UploadAuthorizedKeysStatus)(0), // 0: debugd.UploadAuthorizedKeysStatus - (UploadCoordinatorStatus)(0), // 1: debugd.UploadCoordinatorStatus + (UploadBootstrapperStatus)(0), // 1: debugd.UploadBootstrapperStatus (UploadSystemdServiceUnitsStatus)(0), // 2: debugd.UploadSystemdServiceUnitsStatus - (*DownloadCoordinatorRequest)(nil), // 3: debugd.DownloadCoordinatorRequest + (*DownloadBootstrapperRequest)(nil), // 3: debugd.DownloadBootstrapperRequest (*AuthorizedKey)(nil), // 4: debugd.AuthorizedKey (*UploadAuthorizedKeysRequest)(nil), // 5: debugd.UploadAuthorizedKeysRequest (*UploadAuthorizedKeysResponse)(nil), // 6: debugd.UploadAuthorizedKeysResponse (*Chunk)(nil), // 7: debugd.Chunk - (*UploadCoordinatorResponse)(nil), // 8: debugd.UploadCoordinatorResponse + (*UploadBootstrapperResponse)(nil), // 8: debugd.UploadBootstrapperResponse (*ServiceUnit)(nil), // 9: debugd.ServiceUnit (*UploadSystemdServiceUnitsRequest)(nil), // 10: debugd.UploadSystemdServiceUnitsRequest (*UploadSystemdServiceUnitsResponse)(nil), // 11: debugd.UploadSystemdServiceUnitsResponse @@ -724,16 +724,16 @@ var file_debugd_proto_goTypes = []interface{}{ var file_debugd_proto_depIdxs = []int32{ 4, // 0: debugd.UploadAuthorizedKeysRequest.keys:type_name -> debugd.AuthorizedKey 0, // 1: debugd.UploadAuthorizedKeysResponse.status:type_name -> debugd.UploadAuthorizedKeysStatus - 1, // 2: debugd.UploadCoordinatorResponse.status:type_name -> debugd.UploadCoordinatorStatus + 1, // 2: debugd.UploadBootstrapperResponse.status:type_name -> debugd.UploadBootstrapperStatus 9, // 3: debugd.UploadSystemdServiceUnitsRequest.units:type_name -> debugd.ServiceUnit 2, // 4: debugd.UploadSystemdServiceUnitsResponse.status:type_name -> debugd.UploadSystemdServiceUnitsStatus 5, // 5: debugd.Debugd.UploadAuthorizedKeys:input_type -> debugd.UploadAuthorizedKeysRequest - 7, // 6: debugd.Debugd.UploadCoordinator:input_type -> debugd.Chunk - 3, // 7: debugd.Debugd.DownloadCoordinator:input_type -> debugd.DownloadCoordinatorRequest + 7, // 6: debugd.Debugd.UploadBootstrapper:input_type -> debugd.Chunk + 3, // 7: debugd.Debugd.DownloadBootstrapper:input_type -> debugd.DownloadBootstrapperRequest 10, // 8: debugd.Debugd.UploadSystemServiceUnits:input_type -> debugd.UploadSystemdServiceUnitsRequest 6, // 9: debugd.Debugd.UploadAuthorizedKeys:output_type -> debugd.UploadAuthorizedKeysResponse - 8, // 10: debugd.Debugd.UploadCoordinator:output_type -> debugd.UploadCoordinatorResponse - 7, // 11: debugd.Debugd.DownloadCoordinator:output_type -> debugd.Chunk + 8, // 10: debugd.Debugd.UploadBootstrapper:output_type -> debugd.UploadBootstrapperResponse + 7, // 11: debugd.Debugd.DownloadBootstrapper:output_type -> debugd.Chunk 11, // 12: debugd.Debugd.UploadSystemServiceUnits:output_type -> debugd.UploadSystemdServiceUnitsResponse 9, // [9:13] is the sub-list for method output_type 5, // [5:9] is the sub-list for method input_type @@ -749,7 +749,7 @@ func file_debugd_proto_init() { } if !protoimpl.UnsafeEnabled { file_debugd_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DownloadCoordinatorRequest); i { + switch v := v.(*DownloadBootstrapperRequest); i { case 0: return &v.state case 1: @@ -809,7 +809,7 @@ func file_debugd_proto_init() { } } file_debugd_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UploadCoordinatorResponse); i { + switch v := v.(*UploadBootstrapperResponse); i { case 0: return &v.state case 1: diff --git a/debugd/service/debugd.proto b/debugd/service/debugd.proto index fdf1a15a7..ac767d92e 100644 --- a/debugd/service/debugd.proto +++ b/debugd/service/debugd.proto @@ -6,12 +6,12 @@ package debugd; service Debugd { rpc UploadAuthorizedKeys(UploadAuthorizedKeysRequest) returns (UploadAuthorizedKeysResponse) {} - rpc UploadCoordinator(stream Chunk) returns (UploadCoordinatorResponse) {} - rpc DownloadCoordinator(DownloadCoordinatorRequest) returns (stream Chunk) {} + rpc UploadBootstrapper(stream Chunk) returns (UploadBootstrapperResponse) {} + rpc DownloadBootstrapper(DownloadBootstrapperRequest) returns (stream Chunk) {} rpc UploadSystemServiceUnits(UploadSystemdServiceUnitsRequest) returns (UploadSystemdServiceUnitsResponse) {} } -message DownloadCoordinatorRequest {} +message DownloadBootstrapperRequest {} message AuthorizedKey { string username = 1; @@ -35,15 +35,15 @@ message Chunk { bytes content = 1; } -message UploadCoordinatorResponse { - UploadCoordinatorStatus status = 1; +message UploadBootstrapperResponse { + UploadBootstrapperStatus status = 1; } -enum UploadCoordinatorStatus { - UPLOAD_COORDINATOR_SUCCESS = 0; - UPLOAD_COORDINATOR_UPLOAD_FAILED = 1; - UPLOAD_COORDINATOR_START_FAILED = 2; - UPLOAD_COORDINATOR_FILE_EXISTS = 3; +enum UploadBootstrapperStatus { + UPLOAD_BOOTSTRAPPER_SUCCESS = 0; + UPLOAD_BOOTSTRAPPER_UPLOAD_FAILED = 1; + UPLOAD_BOOTSTRAPPER_START_FAILED = 2; + UPLOAD_BOOTSTRAPPER_FILE_EXISTS = 3; } message ServiceUnit { diff --git a/debugd/service/debugd_grpc.pb.go b/debugd/service/debugd_grpc.pb.go index 59ef7a23a..71e20b865 100644 --- a/debugd/service/debugd_grpc.pb.go +++ b/debugd/service/debugd_grpc.pb.go @@ -23,8 +23,8 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type DebugdClient interface { UploadAuthorizedKeys(ctx context.Context, in *UploadAuthorizedKeysRequest, opts ...grpc.CallOption) (*UploadAuthorizedKeysResponse, error) - UploadCoordinator(ctx context.Context, opts ...grpc.CallOption) (Debugd_UploadCoordinatorClient, error) - DownloadCoordinator(ctx context.Context, in *DownloadCoordinatorRequest, opts ...grpc.CallOption) (Debugd_DownloadCoordinatorClient, error) + UploadBootstrapper(ctx context.Context, opts ...grpc.CallOption) (Debugd_UploadBootstrapperClient, error) + DownloadBootstrapper(ctx context.Context, in *DownloadBootstrapperRequest, opts ...grpc.CallOption) (Debugd_DownloadBootstrapperClient, error) UploadSystemServiceUnits(ctx context.Context, in *UploadSystemdServiceUnitsRequest, opts ...grpc.CallOption) (*UploadSystemdServiceUnitsResponse, error) } @@ -45,46 +45,46 @@ func (c *debugdClient) UploadAuthorizedKeys(ctx context.Context, in *UploadAutho return out, nil } -func (c *debugdClient) UploadCoordinator(ctx context.Context, opts ...grpc.CallOption) (Debugd_UploadCoordinatorClient, error) { - stream, err := c.cc.NewStream(ctx, &Debugd_ServiceDesc.Streams[0], "/debugd.Debugd/UploadCoordinator", opts...) +func (c *debugdClient) UploadBootstrapper(ctx context.Context, opts ...grpc.CallOption) (Debugd_UploadBootstrapperClient, error) { + stream, err := c.cc.NewStream(ctx, &Debugd_ServiceDesc.Streams[0], "/debugd.Debugd/UploadBootstrapper", opts...) if err != nil { return nil, err } - x := &debugdUploadCoordinatorClient{stream} + x := &debugdUploadBootstrapperClient{stream} return x, nil } -type Debugd_UploadCoordinatorClient interface { +type Debugd_UploadBootstrapperClient interface { Send(*Chunk) error - CloseAndRecv() (*UploadCoordinatorResponse, error) + CloseAndRecv() (*UploadBootstrapperResponse, error) grpc.ClientStream } -type debugdUploadCoordinatorClient struct { +type debugdUploadBootstrapperClient struct { grpc.ClientStream } -func (x *debugdUploadCoordinatorClient) Send(m *Chunk) error { +func (x *debugdUploadBootstrapperClient) Send(m *Chunk) error { return x.ClientStream.SendMsg(m) } -func (x *debugdUploadCoordinatorClient) CloseAndRecv() (*UploadCoordinatorResponse, error) { +func (x *debugdUploadBootstrapperClient) CloseAndRecv() (*UploadBootstrapperResponse, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } - m := new(UploadCoordinatorResponse) + m := new(UploadBootstrapperResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } -func (c *debugdClient) DownloadCoordinator(ctx context.Context, in *DownloadCoordinatorRequest, opts ...grpc.CallOption) (Debugd_DownloadCoordinatorClient, error) { - stream, err := c.cc.NewStream(ctx, &Debugd_ServiceDesc.Streams[1], "/debugd.Debugd/DownloadCoordinator", opts...) +func (c *debugdClient) DownloadBootstrapper(ctx context.Context, in *DownloadBootstrapperRequest, opts ...grpc.CallOption) (Debugd_DownloadBootstrapperClient, error) { + stream, err := c.cc.NewStream(ctx, &Debugd_ServiceDesc.Streams[1], "/debugd.Debugd/DownloadBootstrapper", opts...) if err != nil { return nil, err } - x := &debugdDownloadCoordinatorClient{stream} + x := &debugdDownloadBootstrapperClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -94,16 +94,16 @@ func (c *debugdClient) DownloadCoordinator(ctx context.Context, in *DownloadCoor return x, nil } -type Debugd_DownloadCoordinatorClient interface { +type Debugd_DownloadBootstrapperClient interface { Recv() (*Chunk, error) grpc.ClientStream } -type debugdDownloadCoordinatorClient struct { +type debugdDownloadBootstrapperClient struct { grpc.ClientStream } -func (x *debugdDownloadCoordinatorClient) Recv() (*Chunk, error) { +func (x *debugdDownloadBootstrapperClient) Recv() (*Chunk, error) { m := new(Chunk) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -125,8 +125,8 @@ func (c *debugdClient) UploadSystemServiceUnits(ctx context.Context, in *UploadS // for forward compatibility type DebugdServer interface { UploadAuthorizedKeys(context.Context, *UploadAuthorizedKeysRequest) (*UploadAuthorizedKeysResponse, error) - UploadCoordinator(Debugd_UploadCoordinatorServer) error - DownloadCoordinator(*DownloadCoordinatorRequest, Debugd_DownloadCoordinatorServer) error + UploadBootstrapper(Debugd_UploadBootstrapperServer) error + DownloadBootstrapper(*DownloadBootstrapperRequest, Debugd_DownloadBootstrapperServer) error UploadSystemServiceUnits(context.Context, *UploadSystemdServiceUnitsRequest) (*UploadSystemdServiceUnitsResponse, error) mustEmbedUnimplementedDebugdServer() } @@ -138,11 +138,11 @@ type UnimplementedDebugdServer struct { func (UnimplementedDebugdServer) UploadAuthorizedKeys(context.Context, *UploadAuthorizedKeysRequest) (*UploadAuthorizedKeysResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UploadAuthorizedKeys not implemented") } -func (UnimplementedDebugdServer) UploadCoordinator(Debugd_UploadCoordinatorServer) error { - return status.Errorf(codes.Unimplemented, "method UploadCoordinator not implemented") +func (UnimplementedDebugdServer) UploadBootstrapper(Debugd_UploadBootstrapperServer) error { + return status.Errorf(codes.Unimplemented, "method UploadBootstrapper not implemented") } -func (UnimplementedDebugdServer) DownloadCoordinator(*DownloadCoordinatorRequest, Debugd_DownloadCoordinatorServer) error { - return status.Errorf(codes.Unimplemented, "method DownloadCoordinator not implemented") +func (UnimplementedDebugdServer) DownloadBootstrapper(*DownloadBootstrapperRequest, Debugd_DownloadBootstrapperServer) error { + return status.Errorf(codes.Unimplemented, "method DownloadBootstrapper not implemented") } func (UnimplementedDebugdServer) UploadSystemServiceUnits(context.Context, *UploadSystemdServiceUnitsRequest) (*UploadSystemdServiceUnitsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UploadSystemServiceUnits not implemented") @@ -178,25 +178,25 @@ func _Debugd_UploadAuthorizedKeys_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -func _Debugd_UploadCoordinator_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DebugdServer).UploadCoordinator(&debugdUploadCoordinatorServer{stream}) +func _Debugd_UploadBootstrapper_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DebugdServer).UploadBootstrapper(&debugdUploadBootstrapperServer{stream}) } -type Debugd_UploadCoordinatorServer interface { - SendAndClose(*UploadCoordinatorResponse) error +type Debugd_UploadBootstrapperServer interface { + SendAndClose(*UploadBootstrapperResponse) error Recv() (*Chunk, error) grpc.ServerStream } -type debugdUploadCoordinatorServer struct { +type debugdUploadBootstrapperServer struct { grpc.ServerStream } -func (x *debugdUploadCoordinatorServer) SendAndClose(m *UploadCoordinatorResponse) error { +func (x *debugdUploadBootstrapperServer) SendAndClose(m *UploadBootstrapperResponse) error { return x.ServerStream.SendMsg(m) } -func (x *debugdUploadCoordinatorServer) Recv() (*Chunk, error) { +func (x *debugdUploadBootstrapperServer) Recv() (*Chunk, error) { m := new(Chunk) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err @@ -204,24 +204,24 @@ func (x *debugdUploadCoordinatorServer) Recv() (*Chunk, error) { return m, nil } -func _Debugd_DownloadCoordinator_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(DownloadCoordinatorRequest) +func _Debugd_DownloadBootstrapper_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DownloadBootstrapperRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(DebugdServer).DownloadCoordinator(m, &debugdDownloadCoordinatorServer{stream}) + return srv.(DebugdServer).DownloadBootstrapper(m, &debugdDownloadBootstrapperServer{stream}) } -type Debugd_DownloadCoordinatorServer interface { +type Debugd_DownloadBootstrapperServer interface { Send(*Chunk) error grpc.ServerStream } -type debugdDownloadCoordinatorServer struct { +type debugdDownloadBootstrapperServer struct { grpc.ServerStream } -func (x *debugdDownloadCoordinatorServer) Send(m *Chunk) error { +func (x *debugdDownloadBootstrapperServer) Send(m *Chunk) error { return x.ServerStream.SendMsg(m) } @@ -261,13 +261,13 @@ var Debugd_ServiceDesc = grpc.ServiceDesc{ }, Streams: []grpc.StreamDesc{ { - StreamName: "UploadCoordinator", - Handler: _Debugd_UploadCoordinator_Handler, + StreamName: "UploadBootstrapper", + Handler: _Debugd_UploadBootstrapper_Handler, ClientStreams: true, }, { - StreamName: "DownloadCoordinator", - Handler: _Debugd_DownloadCoordinator_Handler, + StreamName: "DownloadBootstrapper", + Handler: _Debugd_DownloadBootstrapper_Handler, ServerStreams: true, }, }, diff --git a/docs/upgrade-kubernetes.md b/docs/upgrade-kubernetes.md index 3262a6991..8cfe3b295 100644 --- a/docs/upgrade-kubernetes.md +++ b/docs/upgrade-kubernetes.md @@ -5,7 +5,7 @@ Constellation is a Kubernetes distribution and a sidecar. This means that the Ku - Kubernetes linux binaries installed in the CoreOS image (`kubelet`, `kubectl`, `kubeadm`) - The desired Kubernetes version deployed by `kubeadm init` - Kubernetes resources (deployments made while initializing Kubernetes, including the `cloud-controller-manager`, `cluster-autoscaler` and more) -- Kubernetes go dependencies for the coordinator code +- Kubernetes go dependencies for the bootstrapper code ## Understand what has changed @@ -56,7 +56,7 @@ const ( ## Upgrading Kubernetes resources During the cluster initialization, multiple Kubernetes resources are deployed. Some of these should be upgraded with Kubernetes. -Look at [the resources folder](/coordinator/internal/kubernetes/k8sapi/resources) and decide what needs to be upgraded. Cloud provider specific images are defined in [`github.com/edgelesssys/constellation/coordinator/cloudprovider`](/coordinator/cloudprovider/images.go). You can check available version tags for container images using [the container registry tags API](https://docs.docker.com/registry/spec/api/#listing-image-tags): +Look at [the resources folder](/bootstrapper/internal/kubernetes/k8sapi/resources) and decide what needs to be upgraded. Cloud provider specific images are defined in [`github.com/edgelesssys/constellation/bootstrapper/cloudprovider`](/bootstrapper/cloudprovider/images.go). You can check available version tags for container images using [the container registry tags API](https://docs.docker.com/registry/spec/api/#listing-image-tags): ``` curl -q https://k8s.gcr.io/v2/autoscaling/cluster-autoscaler/tags/list | jq .tags @@ -76,7 +76,7 @@ See the diff of [this PR](https://github.com/edgelesssys/constellation/pull/110) ## Test the new Kubernetes version -- Setup a Constellation cluster using the new image with the new coordinator binary and check if Kubernetes is deployed successfully. +- Setup a Constellation cluster using the new image with the new bootstrapper binary and check if Kubernetes is deployed successfully. ``` # should print the new k8s version for every node diff --git a/hack/pcr-reader/README.md b/hack/pcr-reader/README.md index 52d542cde..e748df4ef 100644 --- a/hack/pcr-reader/README.md +++ b/hack/pcr-reader/README.md @@ -8,14 +8,14 @@ This utility program makes it simple to update the expected PCR values of the CL To read the PCR state of any running Constellation node, run the following: ```shell -go run main.go -constell-ip -constell-port +go run main.go -constell-ip -constell-port ``` The output is similar to the following: ```shell $ go run main.go -constell-ip 192.0.2.3 -constell-port 30081 -connecting to Coordinator at 192.0.2.3:30081 +connecting to verification service at 192.0.2.3:30081 PCRs: { "0": "DzXCFGCNk8em5ornNZtKi+Wg6Z7qkQfs5CfE3qTkOc8=", @@ -67,7 +67,7 @@ We use the TPM and its PCRs to verify all nodes of a Constellation run with the PCR[0] measures the firmware volume (FV). Changes to FV also change PCR[0], making it unreliable for attestation. PCR[6] measures the VM ID. This is unusable for cluster attestation for two reasons: -1. The Coordinator does not know the VM ID of nodes wanting to join the cluster, so it can not compute the expected PCR[6] for the joining VM +1. The verification service does not know the VM ID of nodes wanting to join the cluster, so it can not compute the expected PCR[6] for the joining VM 2. A user may attest any node of the cluster without knowing the VM ID PCR[10] is used by Linux Integrity Measurement Architecture (IMA). diff --git a/hack/pcr-reader/main.go b/hack/pcr-reader/main.go index dfd169c6e..c95e9066e 100644 --- a/hack/pcr-reader/main.go +++ b/hack/pcr-reader/main.go @@ -14,7 +14,7 @@ import ( "strconv" "time" - "github.com/edgelesssys/constellation/coordinator/util" + "github.com/edgelesssys/constellation/bootstrapper/util" "github.com/edgelesssys/constellation/internal/attestation/vtpm" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/verify/verifyproto" @@ -25,18 +25,18 @@ import ( ) var ( - coordIP = flag.String("constell-ip", "", "Public IP of the Constellation") - coordinatorPort = flag.String("constell-port", strconv.Itoa(constants.VerifyServiceNodePortGRPC), "NodePort of the Constellation's verification service") - export = flag.String("o", "", "Write PCRs, formatted as Go code, to file") - format = flag.String("format", "json", "Output format: json, yaml (default json)") - quiet = flag.Bool("q", false, "Set to disable output") - timeout = flag.Duration("timeout", 2*time.Minute, "Wait this duration for the verification service to become available") + coordIP = flag.String("constell-ip", "", "Public IP of the Constellation") + port = flag.String("constell-port", strconv.Itoa(constants.VerifyServiceNodePortGRPC), "NodePort of the Constellation's verification service") + export = flag.String("o", "", "Write PCRs, formatted as Go code, to file") + format = flag.String("format", "json", "Output format: json, yaml (default json)") + quiet = flag.Bool("q", false, "Set to disable output") + timeout = flag.Duration("timeout", 2*time.Minute, "Wait this duration for the verification service to become available") ) func main() { flag.Parse() - addr := net.JoinHostPort(*coordIP, *coordinatorPort) + addr := net.JoinHostPort(*coordIP, *port) ctx, cancel := context.WithTimeout(context.Background(), *timeout) defer cancel() diff --git a/hack/terraform-to-state/create-state.go b/hack/terraform-to-state/create-state.go index 335ca8167..edfb12201 100644 --- a/hack/terraform-to-state/create-state.go +++ b/hack/terraform-to-state/create-state.go @@ -41,17 +41,17 @@ func transformState(tfOut terraformOutput) state.ConstellationState { Name: "qemu", UID: "debug", CloudProvider: "qemu", - QEMUNodes: cloudtypes.Instances{}, - QEMUCoordinators: cloudtypes.Instances{}, + QEMUWorkers: cloudtypes.Instances{}, + QEMUControlPlane: cloudtypes.Instances{}, } for i, ip := range tfOut.ControlPlaneIPs.Value { - conState.QEMUCoordinators[fmt.Sprintf("control-plane-%d", i)] = cloudtypes.Instance{ + conState.QEMUControlPlane[fmt.Sprintf("control-plane-%d", i)] = cloudtypes.Instance{ PublicIP: ip, PrivateIP: ip, } } for i, ip := range tfOut.WorkerIPs.Value { - conState.QEMUNodes[fmt.Sprintf("worker-%d", i)] = cloudtypes.Instance{ + conState.QEMUWorkers[fmt.Sprintf("worker-%d", i)] = cloudtypes.Instance{ PublicIP: ip, PrivateIP: ip, } diff --git a/image/Makefile b/image/Makefile index 0c6eaaf97..9650a3765 100644 --- a/image/Makefile +++ b/image/Makefile @@ -5,7 +5,7 @@ COREOS_BUILD_PATH ?= $(BASE_PATH)/build OVERRIDES ?= $(COREOS_BUILD_PATH)/overrides OVERRIDES_RPM ?= $(OVERRIDES)/rpm OVERRIDES_ROOTFS ?= $(OVERRIDES)/rootfs -COORDINATOR_OVERRIDE_PATH ?= $(OVERRIDES_ROOTFS)/usr/bin/coordinator +BOOTSTRAPPER_OVERRIDE_PATH ?= $(OVERRIDES_ROOTFS)/usr/bin/bootstrapper CILIUM_CLI_OVERRIDE_PATH ?= $(OVERRIDES_ROOTFS)/usr/bin/cilium KERNEL_RPM ?= $(OVERRIDES_RPM)/kernel.rpm KERNEL_CORE_RPM ?= $(OVERRIDES_RPM)/kernel-core.rpm @@ -14,8 +14,8 @@ OVERRIDE_KERNEL ?= n KERNEL_RPM_URL ?= "https://kojipkgs.fedoraproject.org/packages/kernel/5.17.0/0.rc3.89.fc36/x86_64/kernel-5.17.0-0.rc3.89.fc36.x86_64.rpm" KERNEL_CORE_RPM_URL ?= "https://kojipkgs.fedoraproject.org/packages/kernel/5.17.0/0.rc3.89.fc36/x86_64/kernel-core-5.17.0-0.rc3.89.fc36.x86_64.rpm" KERNEL_MODULES_RPM_URL ?= "https://kojipkgs.fedoraproject.org/packages/kernel/5.17.0/0.rc3.89.fc36/x86_64/kernel-modules-5.17.0-0.rc3.89.fc36.x86_64.rpm" -DOWNLOAD_COORDINATOR ?= n -COORDINATOR_BINARY ?= $(BASE_PATH)/../build/coordinator +DOWNLOAD_BOOTSTRAPPER ?= n +BOOTSTRAPPER_BINARY ?= $(BASE_PATH)/../build/bootstrapper CILIUM_CLI_BINARY ?= $(DEPENDENCIES)/cilium CILIUM_CLI_URL ?= "https://github.com/cilium/cilium-cli/releases/download/v0.11.1/cilium-linux-amd64.tar.gz" DISK_MAPPER_BINARY ?= $(BASE_PATH)/../build/disk-mapper @@ -48,19 +48,19 @@ AZURE_SKU ?= constellation-coreos -include $(CURDIR)/config.mk -.PHONY: clean all kernel coreos run shell cosa-init cosa-fetch images image-gcp upload-gcp image-azure upload-azure-non-cvm $(COORDINATOR_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) +.PHONY: clean all kernel coreos run shell cosa-init cosa-fetch images image-gcp upload-gcp image-azure upload-azure-non-cvm $(BOOTSTRAPPER_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) SHELL := /bin/bash all: coreos images -ifeq ($(DOWNLOAD_COORDINATOR), y) -$(COORDINATOR_BINARY): - wget -q $(COORDINATOR_URL) -O $@ +ifeq ($(DOWNLOAD_BOOTSTRAPPER), y) +$(BOOTSTRAPPER_BINARY): + wget -q $(BOOTSTRAPPER_URL) -O $@ endif -$(COORDINATOR_OVERRIDE_PATH): $(COORDINATOR_BINARY) | cosa-init +$(BOOTSTRAPPER_OVERRIDE_PATH): $(BOOTSTRAPPER_BINARY) | cosa-init mkdir -p $(COREOS_BUILD_PATH)/overrides/rootfs/usr/bin - cp $(COORDINATOR_BINARY) $@ + cp $(BOOTSTRAPPER_BINARY) $@ chmod +x $@ $(CILIUM_CLI_BINARY): @@ -81,16 +81,16 @@ $(DISK_MAPPER_OVERRIDE_PATH): $(DISK_MAPPER_BINARY) | cosa-init cosa-init: -flock $(COSA_LOCKFILE) -c '. $(COSA_ENV) && cd $(COREOS_BUILD_PATH) && NETRC=$(NETRC) cosa init --branch $(COSA_INIT_BRANCH) $(COSA_INIT_REPO)' -cosa-fetch: cosa-init kernel $(COORDINATOR_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) +cosa-fetch: cosa-init kernel $(BOOTSTRAPPER_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) flock $(COSA_LOCKFILE) -c '. $(COSA_ENV) && cd $(COREOS_BUILD_PATH) && NETRC=$(NETRC) cosa fetch' -coreos: cosa-fetch $(COORDINATOR_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) +coreos: cosa-fetch $(BOOTSTRAPPER_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) flock $(COSA_LOCKFILE) -c '. $(COSA_ENV) && cd $(COREOS_BUILD_PATH) && NETRC=$(NETRC) cosa build' -run: $(COORDINATOR_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) +run: $(BOOTSTRAPPER_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) flock $(COSA_LOCKFILE) -c '. $(COSA_ENV) && cd $(COREOS_BUILD_PATH) && NETRC=$(NETRC) cosa run --devshell-console' -shell: $(COORDINATOR_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) +shell: $(BOOTSTRAPPER_OVERRIDE_PATH) $(DISK_MAPPER_OVERRIDE_PATH) $(CILIUM_CLI_OVERRIDE_PATH) flock $(COSA_LOCKFILE) -c '. $(COSA_ENV) && cd $(COREOS_BUILD_PATH) && NETRC=$(NETRC) cosa shell' $(GCP_IMAGE_PATH): coreos @@ -115,7 +115,7 @@ upload-gcp: $(GCP_IMAGE_PATH) --family $(GCP_IMAGE_FAMILY) \ --source-uri=gs://$(GCP_BUCKET)/$(GCP_IMAGE_FILENAME) \ --guest-os-features=GVNIC,SEV_CAPABLE,VIRTIO_SCSI_MULTIQUEUE,UEFI_COMPATIBLE \ - --labels=coordinator-sha1=$$(shasum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1),coordinator-sha512=$$(sha512sum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1 | cut -c-63) \ + --labels=bootstrapper-sha1=$$(shasum $(BOOTSTRAPPER_OVERRIDE_PATH) | cut -d " " -f 1),bootstrapper-sha512=$$(sha512sum $(BOOTSTRAPPER_OVERRIDE_PATH) | cut -d " " -f 1 | cut -c-63) \ --project $(GCP_PROJECT) gsutil rm gs://$(GCP_BUCKET)/$(GCP_IMAGE_FILENAME) @@ -127,7 +127,7 @@ image-azure: $(AZURE_IMAGE_PATH) upload-azure: $(AZURE_IMAGE_PATH) $(eval SIZE := $(shell cat $(AZURE_IMAGE_PATH) | wc -c)) @echo "creating disk of size $(SIZE)" - az disk create -n $(AZURE_IMAGE_NAME) -g $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) --hyper-v-generation V2 --os-type Linux --for-upload --upload-size-bytes $(SIZE) --sku standard_lrs --tags coordinator-sha512=$$(sha512sum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1) + az disk create -n $(AZURE_IMAGE_NAME) -g $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) --hyper-v-generation V2 --os-type Linux --for-upload --upload-size-bytes $(SIZE) --sku standard_lrs --tags bootstrapper-sha512=$$(sha512sum $(BOOTSTRAPPER_OVERRIDE_PATH) | cut -d " " -f 1) @echo "waiting for disk to be created" az disk wait --created -n $(AZURE_IMAGE_NAME) -g $(AZURE_RESOURCE_GROUP_NAME) @echo "created disk $(AZURE_IMAGE_NAME)" @@ -137,12 +137,12 @@ upload-azure: $(AZURE_IMAGE_PATH) azcopy copy "$(AZURE_IMAGE_PATH)" "$$(az disk grant-access -n $(AZURE_IMAGE_NAME) -g $(AZURE_RESOURCE_GROUP_NAME) --access-level Write --duration-in-seconds 86400 | jq -r .accessSas)" --blob-type PageBlob @echo "Revoking write access" az disk revoke-access -n $(AZURE_IMAGE_NAME) -g $(AZURE_RESOURCE_GROUP_NAME) - az image create -g $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) -n $(AZURE_IMAGE_NAME) --hyper-v-generation V2 --os-type Linux --tags coordinator-sha512=$$(sha512sum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1) --source "$$(az disk list --query "[?name == '$(AZURE_IMAGE_NAME)' && resourceGroup == '$(AZURE_RESOURCE_GROUP_NAME)'] | [0].id" --output json | jq -r)" + az image create -g $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) -n $(AZURE_IMAGE_NAME) --hyper-v-generation V2 --os-type Linux --tags bootstrapper-sha512=$$(sha512sum $(BOOTSTRAPPER_OVERRIDE_PATH) | cut -d " " -f 1) --source "$$(az disk list --query "[?name == '$(AZURE_IMAGE_NAME)' && resourceGroup == '$(AZURE_RESOURCE_GROUP_NAME)'] | [0].id" --output json | jq -r)" @echo "Create shared image gallery (if it does not exist yet)" -az sig create -l $(AZURE_REGION) --gallery-name $(AZURE_GALLERY_NAME) --resource-group $(AZURE_RESOURCE_GROUP_NAME) @echo "Create image definition (if it does not exist yet)" -az sig image-definition create --resource-group $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) --gallery-name $(AZURE_GALLERY_NAME) --gallery-image-definition $(AZURE_IMAGE_DEFINITION) --publisher $(AZURE_PUBLISHER) --offer $(AZURE_IMAGE_OFFER) --sku $(AZURE_SKU) --os-type Linux --os-state generalized --hyper-v-generation V2 --features SecurityType=TrustedLaunch - az sig image-version create --resource-group $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) --gallery-name $(AZURE_GALLERY_NAME) --gallery-image-definition $(AZURE_IMAGE_DEFINITION) --gallery-image-version $(AZURE_IMAGE_VERSION) --target-regions $(AZURE_REGION) --replica-count 1 --tags coordinator-sha512=$$(sha512sum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1) --managed-image "$$(az image list --query "[?name == '$(AZURE_IMAGE_NAME)' && resourceGroup == '$(AZURE_RESOURCE_GROUP_NAME)'] | [0].id" --output json | jq -r)" + az sig image-version create --resource-group $(AZURE_RESOURCE_GROUP_NAME) -l $(AZURE_REGION) --gallery-name $(AZURE_GALLERY_NAME) --gallery-image-definition $(AZURE_IMAGE_DEFINITION) --gallery-image-version $(AZURE_IMAGE_VERSION) --target-regions $(AZURE_REGION) --replica-count 1 --tags bootstrapper-sha512=$$(sha512sum $(BOOTSTRAPPER_OVERRIDE_PATH) | cut -d " " -f 1) --managed-image "$$(az image list --query "[?name == '$(AZURE_IMAGE_NAME)' && resourceGroup == '$(AZURE_RESOURCE_GROUP_NAME)'] | [0].id" --output json | jq -r)" @echo "Cleaning up resources" az image delete --resource-group $(AZURE_RESOURCE_GROUP_NAME) -n $(AZURE_IMAGE_NAME) az disk delete --resource-group $(AZURE_RESOURCE_GROUP_NAME) -n $(AZURE_IMAGE_NAME) --yes diff --git a/image/README.md b/image/README.md index 464b5bd0a..52143a346 100644 --- a/image/README.md +++ b/image/README.md @@ -35,7 +35,7 @@ We use the [Fedora CoreOS Assembler](https://coreos.github.io/coreos-assembler/) Create a configuration file in `image/config.mk` to override any of the variables found at the top of the [Makefile](Makefile). Important settings are: -- `COORDINATOR_BINARY`: path to a coordinator binary. Can be substituted with a path to a `debugd` binary if a debug image should be built. The binary has to be built before! +- `BOOTSTRAPPER_BINARY`: path to a bootstrapper binary. Can be substituted with a path to a `debugd` binary if a debug image should be built. The binary has to be built before! - `CONTAINER_ENGINE`: container engine used to run COSA. either `podman` or `docker`. - `COSA_INIT_REPO`: Git repository containing CoreOS config. Cloned in `cosa-init` target. - `COSA_INIT_BRANCH`: Git branch checked out from `COSA_INIT_REPO`. Can be used to test out changes on another branch before merging. @@ -46,7 +46,7 @@ Important settings are: Example `config.mk` to create a debug image with docker and name it `my-custom-image`: ```Makefile -COORDINATOR_BINARY = ../build/debugd +BOOTSTRAPPER_BINARY = ../build/debugd CONTAINER_ENGINE = docker GCP_IMAGE_NAME = my-custom-image AZURE_IMAGE_NAME = my-custom-image diff --git a/image/assembler/README.md b/image/assembler/README.md index 937bf6683..6a53d8c9e 100644 --- a/image/assembler/README.md +++ b/image/assembler/README.md @@ -21,9 +21,9 @@ sudo chmod 666 /dev/kvm ``` source fcos/.env ``` -3. Set the `COORDINATOR_BINARY` environment variable to a path of the compiled coordinator binary. It will be mounted in the cosa container and copied into the resulting coreos image. +3. Set the `BOOTSTRAPPER_BINARY` environment variable to a path of the compiled bootstrapper binary. It will be mounted in the cosa container and copied into the resulting coreos image. ``` - COORDINATOR_BINARY="/path/to/coordinator" + BOOTSTRAPPER_BINARY="/path/to/bootstrapper" ``` 4. Go into the build folder and initialize cosa: ``` diff --git a/internal/atls/atls.go b/internal/atls/atls.go index f11dea106..893e59d1a 100644 --- a/internal/atls/atls.go +++ b/internal/atls/atls.go @@ -17,7 +17,7 @@ import ( "math/big" "time" - "github.com/edgelesssys/constellation/coordinator/util" + "github.com/edgelesssys/constellation/bootstrapper/util" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/oid" ) diff --git a/internal/cloud/metadata/metadata.go b/internal/cloud/metadata/metadata.go index b4a1a3a2f..675eeba53 100644 --- a/internal/cloud/metadata/metadata.go +++ b/internal/cloud/metadata/metadata.go @@ -6,7 +6,7 @@ import ( "net" "strconv" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/constants" ) @@ -48,10 +48,9 @@ func InitServerEndpoints(ctx context.Context, lister InstanceLister) ([]string, } initServerEndpoints := []string{} for _, instance := range instances { - // check if role of instance is "Coordinator" - if instance.Role == role.Coordinator { + if instance.Role == role.ControlPlane { for _, ip := range instance.PrivateIPs { - initServerEndpoints = append(initServerEndpoints, net.JoinHostPort(ip, strconv.Itoa(constants.CoordinatorPort))) + initServerEndpoints = append(initServerEndpoints, net.JoinHostPort(ip, strconv.Itoa(constants.BootstrapperPort))) } } } diff --git a/internal/config/config.go b/internal/config/config.go index 819f917cc..ed5292ec9 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -169,11 +169,11 @@ func Default() *Config { StateDiskSizeGB: 30, IngressFirewall: Firewall{ { - Name: "coordinator", - Description: "Coordinator default port", + Name: "bootstrapper", + Description: "bootstrapper default port", Protocol: "tcp", IPRange: "0.0.0.0/0", - FromPort: constants.CoordinatorPort, + FromPort: constants.BootstrapperPort, }, { Name: "wireguard", diff --git a/internal/constants/constants.go b/internal/constants/constants.go index 9b08b4994..91cbc37f6 100644 --- a/internal/constants/constants.go +++ b/internal/constants/constants.go @@ -35,12 +35,12 @@ const ( // KMSATLSPort is the port the KMS aTLS server listens on. KMSATLSPort = 9001 // KMSNodePort is the aTLS port exposed as a NodePort. - KMSNodePort = 30091 - CoordinatorPort = 9000 - EnclaveSSHPort = 2222 - SSHPort = 22 - WireguardPort = 51820 - NVMEOverTCPPort = 8009 + KMSNodePort = 30091 + BootstrapperPort = 9000 + EnclaveSSHPort = 2222 + SSHPort = 22 + WireguardPort = 51820 + NVMEOverTCPPort = 8009 // Default NodePort Range // https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport NodePortFrom = 30000 diff --git a/internal/deploy/ssh/proto.go b/internal/deploy/ssh/proto.go index 6a740e454..968e970a6 100644 --- a/internal/deploy/ssh/proto.go +++ b/internal/deploy/ssh/proto.go @@ -1,7 +1,7 @@ package ssh import ( - "github.com/edgelesssys/constellation/coordinator/initproto" + "github.com/edgelesssys/constellation/bootstrapper/initproto" ) // FromProtoSlice converts a SSH UserKey definition from pubproto to the Go flavor. diff --git a/internal/grpc/atlscredentials/atlscredentials_test.go b/internal/grpc/atlscredentials/atlscredentials_test.go index 3213e4889..b119fc037 100644 --- a/internal/grpc/atlscredentials/atlscredentials_test.go +++ b/internal/grpc/atlscredentials/atlscredentials_test.go @@ -9,7 +9,7 @@ import ( "net" "testing" - "github.com/edgelesssys/constellation/coordinator/initproto" + "github.com/edgelesssys/constellation/bootstrapper/initproto" "github.com/edgelesssys/constellation/internal/atls" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/state/state.go b/internal/state/state.go index 410365762..ff8af0da2 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -10,35 +10,35 @@ type ConstellationState struct { UID string `json:"uid,omitempty"` CloudProvider string `json:"cloudprovider,omitempty"` - GCPNodes cloudtypes.Instances `json:"gcpnodes,omitempty"` - GCPCoordinators cloudtypes.Instances `json:"gcpcoordinators,omitempty"` - GCPNodeInstanceGroup string `json:"gcpnodeinstancegroup,omitempty"` - GCPCoordinatorInstanceGroup string `json:"gcpcoordinatorinstancegroup,omitempty"` - GCPNodeInstanceTemplate string `json:"gcpnodeinstancetemplate,omitempty"` - GCPCoordinatorInstanceTemplate string `json:"gcpcoordinatorinstancetemplate,omitempty"` - GCPNetwork string `json:"gcpnetwork,omitempty"` - GCPSubnetwork string `json:"gcpsubnetwork,omitempty"` - GCPFirewalls []string `json:"gcpfirewalls,omitempty"` - GCPBackendService string `json:"gcpbackendservice,omitempty"` - GCPHealthCheck string `json:"gcphealthcheck,omitempty"` - GCPForwardingRule string `json:"gcpforwardingrule,omitempty"` - GCPProject string `json:"gcpproject,omitempty"` - GCPZone string `json:"gcpzone,omitempty"` - GCPRegion string `json:"gcpregion,omitempty"` - GCPServiceAccount string `json:"gcpserviceaccount,omitempty"` + GCPWorkers cloudtypes.Instances `json:"gcpworkers,omitempty"` + GCPControlPlanes cloudtypes.Instances `json:"gcpcontrolplanes,omitempty"` + GCPWorkerInstanceGroup string `json:"gcpworkerinstancegroup,omitempty"` + GCPControlPlaneInstanceGroup string `json:"gcpcontrolplaneinstancegroup,omitempty"` + GCPWorkerInstanceTemplate string `json:"gcpworkerinstancetemplate,omitempty"` + GCPControlPlaneInstanceTemplate string `json:"gcpcontrolplaneinstancetemplate,omitempty"` + GCPNetwork string `json:"gcpnetwork,omitempty"` + GCPSubnetwork string `json:"gcpsubnetwork,omitempty"` + GCPFirewalls []string `json:"gcpfirewalls,omitempty"` + GCPBackendService string `json:"gcpbackendservice,omitempty"` + GCPHealthCheck string `json:"gcphealthcheck,omitempty"` + GCPForwardingRule string `json:"gcpforwardingrule,omitempty"` + GCPProject string `json:"gcpproject,omitempty"` + GCPZone string `json:"gcpzone,omitempty"` + GCPRegion string `json:"gcpregion,omitempty"` + GCPServiceAccount string `json:"gcpserviceaccount,omitempty"` - AzureNodes cloudtypes.Instances `json:"azurenodes,omitempty"` - AzureCoordinators cloudtypes.Instances `json:"azurecoordinators,omitempty"` - AzureResourceGroup string `json:"azureresourcegroup,omitempty"` - AzureLocation string `json:"azurelocation,omitempty"` - AzureSubscription string `json:"azuresubscription,omitempty"` - AzureTenant string `json:"azuretenant,omitempty"` - AzureSubnet string `json:"azuresubnet,omitempty"` - AzureNetworkSecurityGroup string `json:"azurenetworksecuritygroup,omitempty"` - AzureNodesScaleSet string `json:"azurenodesscaleset,omitempty"` - AzureCoordinatorsScaleSet string `json:"azurecoordinatorsscaleset,omitempty"` - AzureADAppObjectID string `json:"azureadappobjectid,omitempty"` + AzureWorkers cloudtypes.Instances `json:"azureworkers,omitempty"` + AzureControlPlane cloudtypes.Instances `json:"azurecontrolplanes,omitempty"` + AzureResourceGroup string `json:"azureresourcegroup,omitempty"` + AzureLocation string `json:"azurelocation,omitempty"` + AzureSubscription string `json:"azuresubscription,omitempty"` + AzureTenant string `json:"azuretenant,omitempty"` + AzureSubnet string `json:"azuresubnet,omitempty"` + AzureNetworkSecurityGroup string `json:"azurenetworksecuritygroup,omitempty"` + AzureWorkersScaleSet string `json:"azureworkersscaleset,omitempty"` + AzureControlPlanesScaleSet string `json:"azurecontrolplanesscaleset,omitempty"` + AzureADAppObjectID string `json:"azureadappobjectid,omitempty"` - QEMUNodes cloudtypes.Instances `json:"qemunodes,omitempty"` - QEMUCoordinators cloudtypes.Instances `json:"qemucoordinators,omitempty"` + QEMUWorkers cloudtypes.Instances `json:"qemuworkers,omitempty"` + QEMUControlPlane cloudtypes.Instances `json:"qemucontrolplanes,omitempty"` } diff --git a/kms/kms/cluster/cluster.go b/kms/kms/cluster/cluster.go index be201781c..0e94167a2 100644 --- a/kms/kms/cluster/cluster.go +++ b/kms/kms/cluster/cluster.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "github.com/edgelesssys/constellation/coordinator/util" + "github.com/edgelesssys/constellation/bootstrapper/util" ) // ClusterKMS implements the kms.CloudKMS interface for in cluster key management. diff --git a/proto/Dockerfile.gen-proto b/proto/Dockerfile.gen-proto index e71bd077f..c093dbf9a 100644 --- a/proto/Dockerfile.gen-proto +++ b/proto/Dockerfile.gen-proto @@ -50,7 +50,7 @@ COPY verify/verifyproto/*.proto /verify ## init WORKDIR /init -COPY coordinator/initproto/*.proto /init +COPY bootstrapper/initproto/*.proto /init RUN protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto FROM scratch as export @@ -59,4 +59,4 @@ COPY --from=build /service/*.go debugd/service/ COPY --from=build /kms/*.go kms/kmsproto/ COPY --from=build /activation/*.go activation/activationproto/ COPY --from=build /verify/*.go verify/verifyproto/ -COPY --from=build /init/*.go coordinator/initproto/ +COPY --from=build /init/*.go bootstrapper/initproto/ diff --git a/state/cmd/main.go b/state/cmd/main.go index 875105de6..af0e66c72 100644 --- a/state/cmd/main.go +++ b/state/cmd/main.go @@ -11,8 +11,8 @@ import ( "strings" "time" - azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure" - gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp" + azurecloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/azure" + gcpcloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/gcp" qemucloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/qemu" "github.com/edgelesssys/constellation/coordinator/core" "github.com/edgelesssys/constellation/internal/attestation/azure" diff --git a/state/keyservice/keyservice.go b/state/keyservice/keyservice.go index fb8bb2cba..6e395253f 100644 --- a/state/keyservice/keyservice.go +++ b/state/keyservice/keyservice.go @@ -7,8 +7,8 @@ import ( "sync" "time" - "github.com/edgelesssys/constellation/coordinator/core" - "github.com/edgelesssys/constellation/coordinator/pubapi/pubproto" + "github.com/edgelesssys/constellation/bootstrapper/core" + "github.com/edgelesssys/constellation/bootstrapper/pubapi/pubproto" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/grpc/atlscredentials" "github.com/edgelesssys/constellation/internal/logger" diff --git a/state/keyservice/keyservice_test.go b/state/keyservice/keyservice_test.go index 4a88786db..21b0e759d 100644 --- a/state/keyservice/keyservice_test.go +++ b/state/keyservice/keyservice_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/edgelesssys/constellation/coordinator/cloudprovider/cloudtypes" - "github.com/edgelesssys/constellation/coordinator/pubapi/pubproto" - "github.com/edgelesssys/constellation/coordinator/role" + "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/cloudtypes" + "github.com/edgelesssys/constellation/bootstrapper/pubapi/pubproto" + "github.com/edgelesssys/constellation/bootstrapper/role" "github.com/edgelesssys/constellation/internal/atls" "github.com/edgelesssys/constellation/internal/grpc/atlscredentials" "github.com/edgelesssys/constellation/internal/logger" @@ -33,7 +33,7 @@ func TestRequestKeyLoop(t *testing.T) { defaultInstance := cloudtypes.Instance{ Name: "test-instance", ProviderID: "/test/provider", - Role: role.Coordinator, + Role: role.ControlPlane, PrivateIPs: []string{"192.0.2.1"}, } @@ -69,7 +69,7 @@ func TestRequestKeyLoop(t *testing.T) { { Name: "test-instance-2", ProviderID: "/test/provider", - Role: role.Coordinator, + Role: role.ControlPlane, PrivateIPs: []string{"192.0.2.2"}, }, }, diff --git a/state/setup/setup.go b/state/setup/setup.go index 937a575f4..729e360b8 100644 --- a/state/setup/setup.go +++ b/state/setup/setup.go @@ -8,7 +8,7 @@ import ( "path/filepath" "syscall" - "github.com/edgelesssys/constellation/coordinator/nodestate" + "github.com/edgelesssys/constellation/bootstrapper/nodestate" "github.com/edgelesssys/constellation/internal/attestation/vtpm" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" diff --git a/state/setup/setup_test.go b/state/setup/setup_test.go index dda4af916..89b6fabc9 100644 --- a/state/setup/setup_test.go +++ b/state/setup/setup_test.go @@ -7,7 +7,7 @@ import ( "path/filepath" "testing" - "github.com/edgelesssys/constellation/coordinator/nodestate" + "github.com/edgelesssys/constellation/bootstrapper/nodestate" "github.com/edgelesssys/constellation/internal/attestation/vtpm" "github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/file" diff --git a/state/test/integration_test.go b/state/test/integration_test.go index f5229c140..20cb0becd 100644 --- a/state/test/integration_test.go +++ b/state/test/integration_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/edgelesssys/constellation/coordinator/core" + "github.com/edgelesssys/constellation/bootstrapper/core" "github.com/edgelesssys/constellation/internal/atls" "github.com/edgelesssys/constellation/internal/grpc/atlscredentials" "github.com/edgelesssys/constellation/internal/logger" diff --git a/test/Dockerfile b/test/Dockerfile index d45c68047..227ee77c7 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -12,6 +12,6 @@ RUN git clone -b v1.0.20210914 --depth=1 https://git.zx2c4.com/wireguard-tools & RUN git clone -b 0.0.20211016 --depth=1 https://git.zx2c4.com/wireguard-go && cd wireguard-go && make -j`nproc` && make install COPY . /constellation -RUN rm -rf build && mkdir build && cd build && cmake .. && make debug_coordinator -j`nproc` && cd / +RUN rm -rf build && mkdir build && cd build && cmake .. && make debug_bootstrapper -j`nproc` && cd / -CMD wireguard-go wg0 && /constellation/build/debug_coordinator -debug +CMD wireguard-go wg0 && /constellation/build/debug_bootstrapper -debug