Rename coordinator to bootstrapper and rename roles

This commit is contained in:
katexochen 2022-06-29 15:26:29 +02:00 committed by Paul Meyer
parent 3280ed200c
commit 916e5d6b55
191 changed files with 1763 additions and 2030 deletions

View File

@ -14,7 +14,7 @@
#ignore build files #ignore build files
/build /build
admin.conf admin.conf
coordinator-* bootstrapper-*
go.work go.work
go.work.sum go.work.sum

View File

@ -43,14 +43,14 @@ runs:
run: | run: |
case $CSP in case $CSP in
azure) azure)
FIRST_NODE=$(jq -r ".azurecoordinators | keys | first" constellation-state.json) FIRST_NODE=$(jq -r ".azurebootstrappers | keys | first" constellation-state.json)
CONSTELL_IP=$(jq -r ".azurecoordinators.\"${FIRST_NODE}\".PublicIP" constellation-state.json) CONSTELL_IP=$(jq -r ".azurebootstrappers.\"${FIRST_NODE}\".PublicIP" constellation-state.json)
pcr-reader --constell-ip ${CONSTELL_IP} -format yaml > measurements.yaml 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 yq e 'del(.[0,6,10,11,12,13,14,15,16,17,18,19,20,21,22,23])' -i measurements.yaml
;; ;;
gcp) gcp)
FIRST_NODE=$(jq -r ".gcpcoordinators | keys | first" constellation-state.json) FIRST_NODE=$(jq -r ".gcpbootstrappers | keys | first" constellation-state.json)
CONSTELL_IP=$(jq -r ".gcpcoordinators.\"${FIRST_NODE}\".PublicIP" constellation-state.json) CONSTELL_IP=$(jq -r ".gcpbootstrappers.\"${FIRST_NODE}\".PublicIP" constellation-state.json)
pcr-reader --constell-ip ${CONSTELL_IP} -format yaml > measurements.yaml 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 yq e 'del(.[11,12,13,14,15,16,17,18,19,20,21,22,23])' -i measurements.yaml
;; ;;

View File

@ -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). # 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: on:
workflow_dispatch: workflow_dispatch:
@ -14,15 +14,15 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build-coordinator: build-bootstrapper:
name: "Build the Coordinator" name: "Build the bootstrapper"
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
outputs: outputs:
coordinator-name: ${{ steps.copy.outputs.coordinator-name }} bootstrapper-name: ${{ steps.copy.outputs.bootstrapper-name }}
steps: steps:
- name: Checkout - name: Checkout
id: checkout id: checkout
@ -35,32 +35,32 @@ jobs:
id: prepare id: prepare
run: sudo apt-get update && sudo apt-get -y install awscli cmake make 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 id: build
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake .. cmake ..
make coordinator make bootstrapper
mv coordinator coordinator-$(sha512sum coordinator | cut -d " " -f 1) 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 id: copy
# Only upload the Coordinator if this action is triggered from main branch # Only upload the Coordinator if this action is triggered from main branch
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
run: > 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-")" echo "::set-output name=bootstrapper-name::$(ls | grep "bootstrapper-")"
&& aws s3 cp ${{ github.workspace }}/build/ s3://${{ secrets.PUBLIC_BUCKET_NAME }}/coordinator/ --exclude "*" --include "coordinator-*" --include "constellation" --recursive --quiet) && aws s3 cp ${{ github.workspace }}/build/ s3://${{ secrets.PUBLIC_BUCKET_NAME }}/bootstrapper/ --exclude "*" --include "bootstrapper-*" --include "constellation" --recursive --quiet)
shell: bash {0} shell: bash {0}
working-directory: ${{ github.workspace }}/build/ working-directory: ${{ github.workspace }}/build/
call-coreos: call-coreos:
needs: build-coordinator needs: build-bootstrapper
if: ${{ (github.ref == 'refs/heads/main') && startsWith(needs.build-coordinator.outputs.coordinator-name, 'coordinator-') }} if: ${{ (github.ref == 'refs/heads/main') && startsWith(needs.build-bootstrapper.outputs.bootstrapper-name, 'bootstrapper-')
uses: ./.github/workflows/build-coreos.yml uses: ./.github/workflows/build-coreos.yml
with: with:
coordinator-name: ${{ needs.build-coordinator.outputs.coordinator-name }} bootstrapper-name: ${{ needs.build-bootstrapper.outputs.bootstrapper-name }}
secrets: secrets:
CI_GITHUB_REPOSITORY: ${{ secrets.CI_GITHUB_REPOSITORY }} CI_GITHUB_REPOSITORY: ${{ secrets.CI_GITHUB_REPOSITORY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}

View File

@ -80,6 +80,6 @@ jobs:
- name: "Build and Upload" - name: "Build and Upload"
run: > 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 }}" 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 image-gcp image-azure upload-gcp upload-azure
working-directory: ${{ env.working-directory }} working-directory: ${{ env.working-directory }}

View File

@ -5,14 +5,14 @@ env:
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
coordinator-name: bootstrapper-name:
description: Coordinator name description: bootstrapper name
required: true required: true
type: string type: string
workflow_call: workflow_call:
inputs: inputs:
coordinator-name: bootstrapper-name:
required: true required: true
type: string type: string
@ -101,6 +101,6 @@ jobs:
- name: "Build and Upload" - name: "Build and Upload"
run: > run: >
make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc GCP_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" AZURE_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" 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 image-gcp image-azure upload-gcp upload-azure
working-directory: ${{ env.working-directory }} working-directory: ${{ env.working-directory }}

View File

@ -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

View File

@ -34,9 +34,3 @@ jobs:
# Runs all test targets starting with "integration-" # Runs all test targets starting with "integration-"
- name: Integration Tests - name: Integration Tests
run: ctest -R integration- run: ctest -R integration-
- uses: actions/upload-artifact@v3
if: failure()
with:
name: coordinator-integrationtest-logs
path: /tmp/coordinator/logs/

4
.gitignore vendored
View File

@ -20,7 +20,7 @@ go.work.sum
build build
admin.conf admin.conf
coordinator-* bootstrapper-*
# VS Code configuration folder # VS Code configuration folder
.vscode .vscode
@ -30,7 +30,7 @@ debug/
# Image # Image
image/*.ign image/*.ign
image/build/* image/build/*
image/dependencies/coordinator image/dependencies/bootstrapper
image/dependencies/cilium image/dependencies/cilium
image/images/* image/images/*
image/cosa.lock image/cosa.lock

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.11) 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.") 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 add_custom_target(bootstrapper ALL
DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} --build-arg PROJECT_VERSION=${PROJECT_VERSION} -f Dockerfile.build --target coordinator . 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} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
BYPRODUCTS coordinator BYPRODUCTS bootstrapper
) )
@ -39,10 +39,10 @@ add_custom_target(cli ALL
# testing / debugging # testing / debugging
# #
add_custom_target(debug_coordinator add_custom_target(debug_bootstrapper
go build -o ${CMAKE_BINARY_DIR}/debug_coordinator -buildvcs=false -ldflags "-buildid='' -X main.version=${PROJECT_VERSION}" go build -o ${CMAKE_BINARY_DIR}/debug_bootstrapper -buildvcs=false -ldflags "-buildid='' -X main.version=${PROJECT_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coordinator/cmd/coordinator WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bootstrapper/cmd/bootstrapper
BYPRODUCTS debug_coordinator 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-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 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-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-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/)

View File

@ -21,19 +21,19 @@ RUN go mod download all
COPY . /constellation COPY . /constellation
RUN rm -rf ./hack/ RUN rm -rf ./hack/
FROM build AS build-coordinator FROM build AS build-bootstrapper
WORKDIR /constellation/coordinator/ WORKDIR /constellation/bootstrapper/
ARG PROJECT_VERSION 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 FROM build AS build-disk-mapper
WORKDIR /constellation/state/ WORKDIR /constellation/state/
RUN go build -o disk-mapper -ldflags "-s -w" ./cmd/ RUN go build -o disk-mapper -ldflags "-s -w" ./cmd/
FROM scratch AS coordinator FROM scratch AS bootstrapper
COPY --from=build-coordinator /constellation/coordinator/coordinator / COPY --from=build-bootstrapper /constellation/bootstrapper/bootstrapper /
FROM scratch AS disk-mapper FROM scratch AS disk-mapper
COPY --from=build-disk-mapper /constellation/state/disk-mapper / COPY --from=build-disk-mapper /constellation/state/disk-mapper /

View File

@ -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 * [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 * [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 * [image](image): Build files for the Constellation disk image
* [kms](kms): Constellation's key management client and server * [kms](kms): Constellation's key management client and server
* [mount](mount): Package used by CSI plugins to create and mount encrypted block devices * [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. 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. 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 coordinator binary to running instances and to obtain SSH access. 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) [Follow this introduction on how to install and setup `cdbg`](debugd/README.md)
## Development Guides ## Development Guides

View File

@ -10,7 +10,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/edgelesssys/constellation/coordinator/util" "github.com/edgelesssys/constellation/bootstrapper/util"
"github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/file"
"github.com/edgelesssys/constellation/internal/logger" "github.com/edgelesssys/constellation/internal/logger"
) )

19
bootstrapper/README.md Normal file
View File

@ -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

View File

@ -1,7 +1,7 @@
package azure package azure
import ( 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" "github.com/edgelesssys/constellation/internal/azureshared"
k8s "k8s.io/api/core/v1" k8s "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -3,7 +3,7 @@ package azure
import ( import (
"testing" "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/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
k8s "k8s.io/api/core/v1" k8s "k8s.io/api/core/v1"

View File

@ -4,8 +4,8 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"github.com/edgelesssys/constellation/coordinator/cloudprovider" "github.com/edgelesssys/constellation/bootstrapper/cloudprovider"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/resources" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/resources"
"github.com/edgelesssys/constellation/internal/azureshared" "github.com/edgelesssys/constellation/internal/azureshared"
"github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/cloud/metadata"
k8s "k8s.io/api/core/v1" k8s "k8s.io/api/core/v1"

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"testing" "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/cloud/metadata"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"

View File

@ -1,6 +1,6 @@
package azure package azure
import "github.com/edgelesssys/constellation/coordinator/cloudprovider" import "github.com/edgelesssys/constellation/bootstrapper/cloudprovider"
// CloudNodeManager holds the Azure cloud-node-manager configuration. // 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 . // reference: https://raw.githubusercontent.com/kubernetes-sigs/cloud-provider-azure/master/examples/out-of-tree/cloud-node-manager.yaml .

View File

@ -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/compute/armcompute"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "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/azureshared"
"github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/cloud/metadata"
) )
var ( var (
coordinatorScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-coordinators-[0-9a-zA-Z]+$`) controlPlaneScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-controlplanes-[0-9a-zA-Z]+$`)
nodeScaleSetRegexp = regexp.MustCompile(`constellation-scale-set-nodes-[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. // 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. // extractScaleSetVMRole extracts the constellation role of a scale set using its name.
func extractScaleSetVMRole(scaleSet string) role.Role { func extractScaleSetVMRole(scaleSet string) role.Role {
if coordinatorScaleSetRegexp.MatchString(scaleSet) { if controlPlaneScaleSetRegexp.MatchString(scaleSet) {
return role.Coordinator return role.ControlPlane
} }
if nodeScaleSetRegexp.MatchString(scaleSet) { if workerScaleSetRegexp.MatchString(scaleSet) {
return role.Node return role.Worker
} }
return role.Unknown return role.Unknown
} }

View File

@ -8,7 +8,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "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/compute/armcompute"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "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/edgelesssys/constellation/internal/cloud/metadata"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -220,13 +220,13 @@ func TestExtractScaleSetVMRole(t *testing.T) {
scaleSet string scaleSet string
wantRole role.Role wantRole role.Role
}{ }{
"coordinator role": { "bootstrapper role": {
scaleSet: "constellation-scale-set-coordinators-abcd123", scaleSet: "constellation-scale-set-bootstrappers-abcd123",
wantRole: role.Coordinator, wantRole: role.ControlPlane,
}, },
"node role": { "node role": {
scaleSet: "constellation-scale-set-nodes-abcd123", scaleSet: "constellation-scale-set-nodes-abcd123",
wantRole: role.Node, wantRole: role.Worker,
}, },
"unknown role": { "unknown role": {
scaleSet: "unknown", scaleSet: "unknown",

View File

@ -1,7 +1,7 @@
package gcp package gcp
import ( 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" k8s "k8s.io/api/core/v1"
) )

View File

@ -6,8 +6,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/edgelesssys/constellation/coordinator/cloudprovider" "github.com/edgelesssys/constellation/bootstrapper/cloudprovider"
"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/cloud/metadata"
"github.com/edgelesssys/constellation/internal/gcpshared" "github.com/edgelesssys/constellation/internal/gcpshared"
k8s "k8s.io/api/core/v1" k8s "k8s.io/api/core/v1"

View File

@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"testing" "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/cloud/metadata"
"github.com/edgelesssys/constellation/internal/gcpshared" "github.com/edgelesssys/constellation/internal/gcpshared"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"

View File

@ -6,7 +6,7 @@ import (
"testing" "testing"
compute "cloud.google.com/go/compute/apiv1" 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" "github.com/edgelesssys/constellation/internal/cloud/metadata"
gax "github.com/googleapis/gax-go/v2" gax "github.com/googleapis/gax-go/v2"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -48,7 +48,7 @@ func TestRetrieveInstances(t *testing.T) {
}, },
{ {
Key: proto.String(roleMetadataKey), 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", Name: "someInstance",
ProviderID: "gce://someProject/someZone/someInstance", ProviderID: "gce://someProject/someZone/someInstance",
Role: role.Coordinator, Role: role.ControlPlane,
AliasIPRanges: []string{"192.0.2.0/16"}, AliasIPRanges: []string{"192.0.2.0/16"},
PublicIPs: []string{"192.0.2.1"}, PublicIPs: []string{"192.0.2.1"},
PrivateIPs: []string{"192.0.2.0"}, PrivateIPs: []string{"192.0.2.0"},
@ -104,7 +104,7 @@ func TestRetrieveInstances(t *testing.T) {
{ {
Name: "someInstance", Name: "someInstance",
ProviderID: "gce://someProject/someZone/someInstance", ProviderID: "gce://someProject/someZone/someInstance",
Role: role.Coordinator, Role: role.ControlPlane,
AliasIPRanges: []string{}, AliasIPRanges: []string{},
PublicIPs: []string{}, PublicIPs: []string{},
PrivateIPs: []string{}, PrivateIPs: []string{},
@ -121,7 +121,7 @@ func TestRetrieveInstances(t *testing.T) {
{ {
Name: "someInstance", Name: "someInstance",
ProviderID: "gce://someProject/someZone/someInstance", ProviderID: "gce://someProject/someZone/someInstance",
Role: role.Coordinator, Role: role.ControlPlane,
AliasIPRanges: []string{"192.0.2.0/16"}, AliasIPRanges: []string{"192.0.2.0/16"},
PublicIPs: []string{"192.0.2.1"}, PublicIPs: []string{"192.0.2.1"},
PrivateIPs: []string{}, PrivateIPs: []string{},
@ -259,14 +259,14 @@ func TestRetrieveInstance(t *testing.T) {
clientInstance: newTestInstance(), clientInstance: newTestInstance(),
clientInstanceMutator: func(i *computepb.Instance) { clientInstanceMutator: func(i *computepb.Instance) {
i.Metadata.Items[0].Key = proto.String(roleMetadataKey) 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{ wantInstance: metadata.InstanceMetadata{
Name: "someInstance", Name: "someInstance",
ProviderID: "gce://someProject/someZone/someInstance", ProviderID: "gce://someProject/someZone/someInstance",
AliasIPRanges: []string{"192.0.2.0/16"}, AliasIPRanges: []string{"192.0.2.0/16"},
PublicIPs: []string{"192.0.2.1"}, PublicIPs: []string{"192.0.2.1"},
Role: role.Coordinator, Role: role.ControlPlane,
PrivateIPs: []string{"192.0.2.0"}, PrivateIPs: []string{"192.0.2.0"},
SSHKeys: map[string][]string{}, SSHKeys: map[string][]string{},
}, },

View File

@ -1,7 +1,7 @@
package gcp package gcp
import ( import (
"github.com/edgelesssys/constellation/coordinator/role" "github.com/edgelesssys/constellation/bootstrapper/role"
) )
const roleMetadataKey = "constellation-role" const roleMetadataKey = "constellation-role"
@ -9,10 +9,10 @@ const roleMetadataKey = "constellation-role"
// extractRole extracts role from cloud provider metadata. // extractRole extracts role from cloud provider metadata.
func extractRole(metadata map[string]string) role.Role { func extractRole(metadata map[string]string) role.Role {
switch metadata[roleMetadataKey] { switch metadata[roleMetadataKey] {
case role.Coordinator.String(): case role.ControlPlane.String():
return role.Coordinator return role.ControlPlane
case role.Node.String(): case role.Worker.String():
return role.Node return role.Worker
default: default:
return role.Unknown return role.Unknown
} }

View File

@ -3,7 +3,7 @@ package gcp
import ( import (
"testing" "testing"
"github.com/edgelesssys/constellation/coordinator/role" "github.com/edgelesssys/constellation/bootstrapper/role"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uber.org/goleak" "go.uber.org/goleak"
) )
@ -20,17 +20,17 @@ func TestExtractRole(t *testing.T) {
metadata map[string]string metadata map[string]string
wantRole role.Role wantRole role.Role
}{ }{
"coordinator role": { "bootstrapper role": {
metadata: map[string]string{ metadata: map[string]string{
roleMetadataKey: role.Coordinator.String(), roleMetadataKey: role.ControlPlane.String(),
}, },
wantRole: role.Coordinator, wantRole: role.ControlPlane,
}, },
"node role": { "node role": {
metadata: map[string]string{ metadata: map[string]string{
roleMetadataKey: role.Node.String(), roleMetadataKey: role.Worker.String(),
}, },
wantRole: role.Node, wantRole: role.Worker,
}, },
"unknown role": { "unknown role": {
metadata: map[string]string{ metadata: map[string]string{

View File

@ -1,7 +1,7 @@
package qemu package qemu
import ( 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" k8s "k8s.io/api/core/v1"
) )

View File

@ -3,7 +3,7 @@ package qemu
import ( import (
"context" "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" "github.com/edgelesssys/constellation/internal/cloud/metadata"
k8s "k8s.io/api/core/v1" k8s "k8s.io/api/core/v1"
) )

View File

@ -9,14 +9,14 @@ import (
"os" "os"
"strings" "strings"
azurecloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/azure" azurecloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/azure"
gcpcloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/gcp" gcpcloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/gcp"
qemucloud "github.com/edgelesssys/constellation/coordinator/cloudprovider/qemu" qemucloud "github.com/edgelesssys/constellation/bootstrapper/cloudprovider/qemu"
"github.com/edgelesssys/constellation/coordinator/internal/joinclient" "github.com/edgelesssys/constellation/bootstrapper/internal/joinclient"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes/k8sapi/kubectl" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes/k8sapi/kubectl"
"github.com/edgelesssys/constellation/coordinator/internal/logging" "github.com/edgelesssys/constellation/bootstrapper/internal/logging"
"github.com/edgelesssys/constellation/internal/atls" "github.com/edgelesssys/constellation/internal/atls"
"github.com/edgelesssys/constellation/internal/attestation/azure" "github.com/edgelesssys/constellation/internal/attestation/azure"
"github.com/edgelesssys/constellation/internal/attestation/gcp" "github.com/edgelesssys/constellation/internal/attestation/gcp"

View File

@ -3,10 +3,10 @@ package main
import ( import (
"net" "net"
"github.com/edgelesssys/constellation/coordinator/internal/initserver" "github.com/edgelesssys/constellation/bootstrapper/internal/initserver"
"github.com/edgelesssys/constellation/coordinator/internal/joinclient" "github.com/edgelesssys/constellation/bootstrapper/internal/joinclient"
"github.com/edgelesssys/constellation/coordinator/internal/logging" "github.com/edgelesssys/constellation/bootstrapper/internal/logging"
"github.com/edgelesssys/constellation/coordinator/internal/nodelock" "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock"
"github.com/edgelesssys/constellation/internal/attestation/vtpm" "github.com/edgelesssys/constellation/internal/attestation/vtpm"
"github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/file"
"github.com/edgelesssys/constellation/internal/grpc/dialer" "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, cloudLogger logging.CloudLogger, fs afero.Fs,
) { ) {
defer logger.Sync() defer logger.Sync()
logger.Info("starting coordinator", zap.String("version", version)) logger.Info("starting bootstrapper", zap.String("version", version))
defer cloudLogger.Close() defer cloudLogger.Close()
cloudLogger.Disclose("Coordinator started running...") cloudLogger.Disclose("bootstrapper started running...")
nodeActivated, err := vtpm.IsNodeInitialized(tpm) nodeActivated, err := vtpm.IsNodeInitialized(tpm)
if err != nil { if err != nil {

View File

@ -3,8 +3,8 @@ package main
import ( import (
"context" "context"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes"
"github.com/edgelesssys/constellation/coordinator/role" "github.com/edgelesssys/constellation/bootstrapper/role"
attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types"
"github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/cloud/metadata"
kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3"

View File

@ -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, 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, 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, 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, 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, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61,
0x74, 0x6f, 0x72, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x70, 0x70, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
0x72, 0x6f, 0x74, 0x6f, 0x33, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -2,7 +2,7 @@ syntax = "proto3";
package init; package init;
option go_package = "github.com/edgelesssys/constellation/coordinator/initproto"; option go_package = "github.com/edgelesssys/constellation/bootstrapper/initproto";
service API { service API {
rpc Init(InitRequest) returns (InitResponse); rpc Init(InitRequest) returns (InitResponse);

View File

@ -6,13 +6,13 @@ import (
"net" "net"
"strings" "strings"
"github.com/edgelesssys/constellation/coordinator/initproto" "github.com/edgelesssys/constellation/bootstrapper/initproto"
"github.com/edgelesssys/constellation/coordinator/internal/diskencryption" "github.com/edgelesssys/constellation/bootstrapper/internal/diskencryption"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes"
"github.com/edgelesssys/constellation/coordinator/internal/nodelock" "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock"
"github.com/edgelesssys/constellation/coordinator/nodestate" "github.com/edgelesssys/constellation/bootstrapper/nodestate"
"github.com/edgelesssys/constellation/coordinator/role" "github.com/edgelesssys/constellation/bootstrapper/role"
"github.com/edgelesssys/constellation/coordinator/util" "github.com/edgelesssys/constellation/bootstrapper/util"
attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types"
"github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/constants"
"github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/file"
@ -99,7 +99,7 @@ func (s *Server) Init(ctx context.Context, req *initproto.InitRequest) (*initpro
} }
state := nodestate.NodeState{ state := nodestate.NodeState{
Role: role.Coordinator, Role: role.ControlPlane,
OwnerID: id.Owner, OwnerID: id.Owner,
ClusterID: id.Cluster, ClusterID: id.Cluster,
} }

View File

@ -7,9 +7,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/edgelesssys/constellation/coordinator/initproto" "github.com/edgelesssys/constellation/bootstrapper/initproto"
"github.com/edgelesssys/constellation/coordinator/internal/kubernetes" "github.com/edgelesssys/constellation/bootstrapper/internal/kubernetes"
"github.com/edgelesssys/constellation/coordinator/internal/nodelock" "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock"
attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types" attestationtypes "github.com/edgelesssys/constellation/internal/attestation/types"
"github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/file"
"github.com/spf13/afero" "github.com/spf13/afero"

View File

@ -10,10 +10,10 @@ import (
"time" "time"
"github.com/edgelesssys/constellation/activation/activationproto" "github.com/edgelesssys/constellation/activation/activationproto"
"github.com/edgelesssys/constellation/coordinator/internal/diskencryption" "github.com/edgelesssys/constellation/bootstrapper/internal/diskencryption"
"github.com/edgelesssys/constellation/coordinator/internal/nodelock" "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock"
"github.com/edgelesssys/constellation/coordinator/nodestate" "github.com/edgelesssys/constellation/bootstrapper/nodestate"
"github.com/edgelesssys/constellation/coordinator/role" "github.com/edgelesssys/constellation/bootstrapper/role"
"github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/cloud/metadata"
"github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/constants"
"github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/file"
@ -155,13 +155,13 @@ func (c *JoinClient) Stop() {
} }
func (c *JoinClient) tryJoinAtAvailableServices() error { func (c *JoinClient) tryJoinAtAvailableServices() error {
ips, err := c.getCoordinatorIPs() ips, err := c.getControlPlaneIPs()
if err != nil { if err != nil {
return err return err
} }
if len(ips) == 0 { if len(ips) == 0 {
return errors.New("no coordinator IPs found") return errors.New("no control plane IPs found")
} }
for _, ip := range ips { for _, ip := range ips {
@ -188,9 +188,9 @@ func (c *JoinClient) join(serviceEndpoint string) error {
protoClient := activationproto.NewAPIClient(conn) protoClient := activationproto.NewAPIClient(conn)
switch c.role { switch c.role {
case role.Node: case role.Worker:
return c.joinAsWorkerNode(ctx, protoClient) return c.joinAsWorkerNode(ctx, protoClient)
case role.Coordinator: case role.ControlPlane:
return c.joinAsControlPlaneNode(ctx, protoClient) return c.joinAsControlPlaneNode(ctx, protoClient)
default: default:
return fmt.Errorf("cannot activate as %s", role.Unknown) return fmt.Errorf("cannot activate as %s", role.Unknown)
@ -332,7 +332,7 @@ func (c *JoinClient) getDiskUUID() (string, error) {
return c.disk.UUID() return c.disk.UUID()
} }
func (c *JoinClient) getCoordinatorIPs() ([]string, error) { func (c *JoinClient) getControlPlaneIPs() ([]string, error) {
ctx, cancel := c.timeoutCtx() ctx, cancel := c.timeoutCtx()
defer cancel() defer cancel()
@ -344,12 +344,12 @@ func (c *JoinClient) getCoordinatorIPs() ([]string, error) {
ips := []string{} ips := []string{}
for _, instance := range instances { for _, instance := range instances {
if instance.Role == role.Coordinator { if instance.Role == role.ControlPlane {
ips = append(ips, instance.PrivateIPs...) 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 return ips, nil
} }

View File

@ -10,8 +10,8 @@ import (
"time" "time"
"github.com/edgelesssys/constellation/activation/activationproto" "github.com/edgelesssys/constellation/activation/activationproto"
"github.com/edgelesssys/constellation/coordinator/internal/nodelock" "github.com/edgelesssys/constellation/bootstrapper/internal/nodelock"
"github.com/edgelesssys/constellation/coordinator/role" "github.com/edgelesssys/constellation/bootstrapper/role"
"github.com/edgelesssys/constellation/internal/cloud/metadata" "github.com/edgelesssys/constellation/internal/cloud/metadata"
"github.com/edgelesssys/constellation/internal/constants" "github.com/edgelesssys/constellation/internal/constants"
"github.com/edgelesssys/constellation/internal/file" "github.com/edgelesssys/constellation/internal/file"
@ -34,11 +34,11 @@ func TestMain(m *testing.M) {
func TestClient(t *testing.T) { func TestClient(t *testing.T) {
someErr := errors.New("failed") 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{ peers := []metadata.InstanceMetadata{
{Role: role.Node, Name: "node-2", PrivateIPs: []string{"192.0.2.8"}}, {Role: role.Worker, Name: "node-2", PrivateIPs: []string{"192.0.2.8"}},
{Role: role.Coordinator, Name: "node-3", PrivateIPs: []string{"192.0.2.1"}}, {Role: role.ControlPlane, 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.ControlPlane, Name: "node-4", PrivateIPs: []string{"192.0.2.2", "192.0.2.3"}},
} }
testCases := map[string]struct { testCases := map[string]struct {
@ -48,8 +48,8 @@ func TestClient(t *testing.T) {
nodeLock *nodelock.Lock nodeLock *nodelock.Lock
apiAnswers []any apiAnswers []any
}{ }{
"on node: metadata self: errors occur": { "on worker: metadata self: errors occur": {
role: role.Node, role: role.Worker,
apiAnswers: []any{ apiAnswers: []any{
selfAnswer{err: someErr}, selfAnswer{err: someErr},
selfAnswer{err: someErr}, selfAnswer{err: someErr},
@ -62,11 +62,11 @@ func TestClient(t *testing.T) {
nodeLock: nodelock.New(), nodeLock: nodelock.New(),
disk: &stubDisk{}, disk: &stubDisk{},
}, },
"on node: metadata self: invalid answer": { "on worker: metadata self: invalid answer": {
role: role.Node, role: role.Worker,
apiAnswers: []any{ apiAnswers: []any{
selfAnswer{}, selfAnswer{},
selfAnswer{instance: metadata.InstanceMetadata{Role: role.Node}}, selfAnswer{instance: metadata.InstanceMetadata{Role: role.Worker}},
selfAnswer{instance: metadata.InstanceMetadata{Name: "node-1"}}, selfAnswer{instance: metadata.InstanceMetadata{Name: "node-1"}},
selfAnswer{instance: self}, selfAnswer{instance: self},
listAnswer{instances: peers}, listAnswer{instances: peers},
@ -76,8 +76,8 @@ func TestClient(t *testing.T) {
nodeLock: nodelock.New(), nodeLock: nodelock.New(),
disk: &stubDisk{}, disk: &stubDisk{},
}, },
"on node: metadata list: errors occur": { "on worker: metadata list: errors occur": {
role: role.Node, role: role.Worker,
apiAnswers: []any{ apiAnswers: []any{
selfAnswer{instance: self}, selfAnswer{instance: self},
listAnswer{err: someErr}, listAnswer{err: someErr},
@ -90,8 +90,8 @@ func TestClient(t *testing.T) {
nodeLock: nodelock.New(), nodeLock: nodelock.New(),
disk: &stubDisk{}, disk: &stubDisk{},
}, },
"on node: metadata list: no coordinators in answer": { "on worker: metadata list: no control plane nodes in answer": {
role: role.Node, role: role.Worker,
apiAnswers: []any{ apiAnswers: []any{
selfAnswer{instance: self}, selfAnswer{instance: self},
listAnswer{}, listAnswer{},
@ -104,8 +104,8 @@ func TestClient(t *testing.T) {
nodeLock: nodelock.New(), nodeLock: nodelock.New(),
disk: &stubDisk{}, disk: &stubDisk{},
}, },
"on node: aaas ActivateNode: errors": { "on worker: aaas ActivateNode: errors": {
role: role.Node, role: role.Worker,
apiAnswers: []any{ apiAnswers: []any{
selfAnswer{instance: self}, selfAnswer{instance: self},
listAnswer{instances: peers}, listAnswer{instances: peers},

View File

@ -3,7 +3,7 @@ package kubernetes
import ( import (
"context" "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" "github.com/edgelesssys/constellation/internal/cloud/metadata"
k8s "k8s.io/api/core/v1" k8s "k8s.io/api/core/v1"
) )

View File

@ -3,7 +3,7 @@ package k8sapi
import ( import (
"path/filepath" "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" "github.com/edgelesssys/constellation/internal/constants"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"fmt" "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" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
@ -14,7 +14,7 @@ import (
"k8s.io/client-go/tools/clientcmd" "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. // Client implements k8sapi.Client interface and talks to the Kubernetes API.
type Client struct { type Client struct {

View File

@ -7,7 +7,7 @@ import (
"net/http" "net/http"
"testing" "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/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uber.org/goleak" "go.uber.org/goleak"
@ -188,7 +188,7 @@ func TestApplyOneObject(t *testing.T) {
}{ }{
"apply works": { "apply works": {
httpResponseData: map[string]string{ 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, wantObj: nginxDeployment,
resourcesYAML: string(nginxDeplYAML), resourcesYAML: string(nginxDeplYAML),

View File

@ -1,6 +1,6 @@
package kubectl 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. // generator implements clientGenerator interface.
type generator struct{} type generator struct{}

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"fmt" "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" "k8s.io/cli-runtime/pkg/resource"
) )

View File

@ -4,7 +4,7 @@ import (
"errors" "errors"
"testing" "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/assert"
"go.uber.org/goleak" "go.uber.org/goleak"
"k8s.io/cli-runtime/pkg/resource" "k8s.io/cli-runtime/pkg/resource"

Some files were not shown because too many files have changed in this diff Show More