mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-24 06:59:40 -05:00
Rename coordinator to bootstrapper and rename roles
This commit is contained in:
parent
3280ed200c
commit
916e5d6b55
@ -14,7 +14,7 @@
|
||||
#ignore build files
|
||||
/build
|
||||
admin.conf
|
||||
coordinator-*
|
||||
bootstrapper-*
|
||||
|
||||
go.work
|
||||
go.work.sum
|
||||
|
@ -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
|
||||
;;
|
||||
|
28
.github/workflows/build-coordinator.yml
vendored
28
.github/workflows/build-coordinator.yml
vendored
@ -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 }}
|
||||
|
2
.github/workflows/build-coreos-debug.yml
vendored
2
.github/workflows/build-coreos-debug.yml
vendored
@ -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 }}
|
||||
|
8
.github/workflows/build-coreos.yml
vendored
8
.github/workflows/build-coreos.yml
vendored
@ -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 }}
|
||||
|
27
.github/workflows/test-integration-etcdStore.yml
vendored
27
.github/workflows/test-integration-etcdStore.yml
vendored
@ -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
|
6
.github/workflows/test-integration.yml
vendored
6
.github/workflows/test-integration.yml
vendored
@ -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/
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -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
|
||||
|
@ -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/)
|
||||
|
@ -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 /
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
)
|
||||
|
19
bootstrapper/README.md
Normal file
19
bootstrapper/README.md
Normal 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
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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 .
|
@ -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
|
||||
}
|
@ -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",
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
@ -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"
|
@ -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{},
|
||||
},
|
@ -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
|
||||
}
|
@ -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{
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
||||
)
|
@ -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"
|
@ -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 {
|
@ -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"
|
@ -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 (
|
@ -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);
|
@ -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,
|
||||
}
|
@ -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"
|
@ -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
|
||||
}
|
||||
|
@ -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},
|
@ -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"
|
||||
)
|
@ -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"
|
@ -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 {
|
@ -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),
|
@ -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{}
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user