From 63d5ddfa116d6e20c8c259d43a86819da69d2046 Mon Sep 17 00:00:00 2001 From: Malte Poll Date: Fri, 17 Mar 2023 09:41:48 +0100 Subject: [PATCH] bootstrapper: add support for OpenStack --- bootstrapper/cmd/bootstrapper/BUILD.bazel | 2 ++ bootstrapper/cmd/bootstrapper/main.go | 25 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/bootstrapper/cmd/bootstrapper/BUILD.bazel b/bootstrapper/cmd/bootstrapper/BUILD.bazel index 3f843316d..798176136 100644 --- a/bootstrapper/cmd/bootstrapper/BUILD.bazel +++ b/bootstrapper/cmd/bootstrapper/BUILD.bazel @@ -23,6 +23,7 @@ go_library( "//bootstrapper/internal/nodelock", "//internal/atls", "//internal/attestation/choose", + "//internal/attestation/measurements", "//internal/attestation/simulator", "//internal/attestation/vtpm", "//internal/cloud/aws", @@ -30,6 +31,7 @@ go_library( "//internal/cloud/cloudprovider", "//internal/cloud/gcp", "//internal/cloud/metadata", + "//internal/cloud/openstack", "//internal/cloud/qemu", "//internal/constants", "//internal/file", diff --git a/bootstrapper/cmd/bootstrapper/main.go b/bootstrapper/cmd/bootstrapper/main.go index 4fe908e15..18feaba27 100644 --- a/bootstrapper/cmd/bootstrapper/main.go +++ b/bootstrapper/cmd/bootstrapper/main.go @@ -19,12 +19,14 @@ import ( "github.com/edgelesssys/constellation/v2/bootstrapper/internal/kubernetes/kubewaiter" "github.com/edgelesssys/constellation/v2/bootstrapper/internal/logging" "github.com/edgelesssys/constellation/v2/internal/attestation/choose" + "github.com/edgelesssys/constellation/v2/internal/attestation/measurements" "github.com/edgelesssys/constellation/v2/internal/attestation/simulator" "github.com/edgelesssys/constellation/v2/internal/attestation/vtpm" awscloud "github.com/edgelesssys/constellation/v2/internal/cloud/aws" azurecloud "github.com/edgelesssys/constellation/v2/internal/cloud/azure" "github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider" gcpcloud "github.com/edgelesssys/constellation/v2/internal/cloud/gcp" + openstackcloud "github.com/edgelesssys/constellation/v2/internal/cloud/openstack" qemucloud "github.com/edgelesssys/constellation/v2/internal/cloud/qemu" "github.com/edgelesssys/constellation/v2/internal/constants" "github.com/edgelesssys/constellation/v2/internal/file" @@ -168,6 +170,29 @@ func main() { openTPM = vtpm.OpenVTPM fs = afero.NewOsFs() + case cloudprovider.OpenStack: + // TODO(malt3): add OpenStack TPM support + measurements := measurements.M{ + 15: measurements.Measurement{ + Expected: [32]byte{0x0000000000000000000000000000000000000000000000000000000000000000}, + WarnOnly: true, + }, + } + + cloudLogger = &logging.NopLogger{} + metadata, err := openstackcloud.New(ctx) + if err != nil { + log.With(zap.Error(err)).Fatalf("Failed to create OpenStack metadata client") + } + clusterInitJoiner = kubernetes.New( + "openstack", k8sapi.NewKubernetesUtil(), &k8sapi.KubdeadmConfiguration{}, kubectl.New(), + metadata, measurements, helmClient, &kubewaiter.CloudKubeAPIWaiter{}, + ) + metadataAPI = metadata + + // TODO(malt3): add OpenStack TPM support + openTPM = vtpm.OpenNOPTPM + fs = afero.NewOsFs() default: clusterInitJoiner = &clusterFake{} metadataAPI = &providerMetadataFake{}