mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-09-18 12:04:41 -04:00
rewrote packages
keyservice joinservice upgrade-agent measurement-reader debugd disk-mapper rewrote joinservice main rewrote some unit tests rewrote upgrade-agent + some grpc functions rewrote measurement-reader rewrote debugd removed unused import removed forgotten zap reference in measurements reader rewrote disk-mapper + tests rewrote packages verify disk-mapper malicious join bootstrapper attestationconfigapi versionapi internal/cloud/azure disk-mapper tests image/upload/internal/cmd rewrote verify (WIP with loglevel increase) rewrote forgotten zap references in disk-mapper rewrote malicious join rewrote bootstrapper rewrote parts of internal/ rewrote attestationconfigapi (WIP) rewrote versionapi cli rewrote internal/cloud/azure rewrote disk-mapper tests (untested by me rn) rewrote image/upload/internal/cmd removed forgotten zap references in verify/cmd rewrote packages hack/oci-pin hack/qemu-metadata-api debugd/internal/debugd/deploy hack/bazel-deps-mirror cli/internal/cmd cli-k8s-compatibility rewrote hack/qemu-metadata-api/server rewrote debugd/internal/debugd/deploy rewrote hack/bazel-deps-mirror rewrote rest of hack/qemu-metadata-api rewrote forgotten zap references in joinservice server rewrote cli/internal/cmd rewrote cli-k8s-compatibility rewrote packages internal/staticupload e2d/internal/upgrade internal/constellation/helm internal/attestation/aws/snp internal/attestation/azure/trustedlaunch joinservice/internal/certcache/amkds some missed unit tests rewrote e2e/internal/upgrade rewrote internal/constellation/helm internal/attestation/aws/snp internal/attestation/azure/trustedlaunch joinservice/internal/certcache/amkds search and replace test logging over all left *_test.go
This commit is contained in:
parent
48d5a157dd
commit
f16ccf5679
158 changed files with 3400 additions and 1278 deletions
|
@ -13,6 +13,7 @@ package kms
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/logger"
|
||||
"github.com/edgelesssys/constellation/v2/keyservice/keyserviceproto"
|
||||
|
@ -22,13 +23,13 @@ import (
|
|||
|
||||
// Client interacts with Constellation's keyservice.
|
||||
type Client struct {
|
||||
log *logger.Logger
|
||||
log *slog.Logger
|
||||
endpoint string
|
||||
grpc grpcClient
|
||||
}
|
||||
|
||||
// New creates a new KMS.
|
||||
func New(log *logger.Logger, endpoint string) Client {
|
||||
func New(log *slog.Logger, endpoint string) Client {
|
||||
return Client{
|
||||
log: log,
|
||||
endpoint: endpoint,
|
||||
|
@ -41,14 +42,14 @@ func (c Client) GetDataKey(ctx context.Context, keyID string, length int) ([]byt
|
|||
log := c.log.With("keyID", keyID, "endpoint", c.endpoint)
|
||||
// the KMS does not use aTLS since traffic is only routed through the Constellation cluster
|
||||
// cluster internal connections are considered trustworthy
|
||||
log.Infof("Connecting to KMS")
|
||||
log.Info("Connecting to KMS")
|
||||
conn, err := grpc.DialContext(ctx, c.endpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
log.Infof("Requesting data key")
|
||||
log.Info("Requesting data key")
|
||||
res, err := c.grpc.GetDataKey(
|
||||
ctx,
|
||||
&keyserviceproto.GetDataKeyRequest{
|
||||
|
@ -61,7 +62,7 @@ func (c Client) GetDataKey(ctx context.Context, keyID string, length int) ([]byt
|
|||
return nil, fmt.Errorf("fetching data encryption key from Constellation KMS: %w", err)
|
||||
}
|
||||
|
||||
log.Infof("Data key request successful")
|
||||
log.Info("Data key request successful")
|
||||
return res.DataKey, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ package kms
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"testing"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/logger"
|
||||
|
@ -54,7 +55,7 @@ func TestGetDataKey(t *testing.T) {
|
|||
defer listener.Close()
|
||||
|
||||
client := New(
|
||||
logger.NewTest(t),
|
||||
slog.New(slog.NewTextHandler(logger.TestWriter{T: t}, nil)),
|
||||
listener.Addr().String(),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue