mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
debugd: implement qemu log collection
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
ac74de86fb
commit
56beb05170
@ -20,6 +20,7 @@ import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets"
|
||||
awsconfig "github.com/aws/aws-sdk-go-v2/config"
|
||||
awssecretmanager "github.com/aws/aws-sdk-go-v2/service/secretsmanager"
|
||||
"github.com/edgelesssys/constellation/v2/debugd/internal/debugd/info"
|
||||
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
||||
gaxv2 "github.com/googleapis/gax-go/v2"
|
||||
)
|
||||
@ -41,7 +42,7 @@ type openseachCredsGetter interface {
|
||||
}
|
||||
|
||||
// NewCloudCredentialGetter returns a new CloudCredentialGetter for the given cloud provider.
|
||||
func newCloudCredentialGetter(ctx context.Context, provider cloudprovider.Provider) (*credentialGetter, error) {
|
||||
func newCloudCredentialGetter(ctx context.Context, provider cloudprovider.Provider, infoMap *info.Map) (*credentialGetter, error) {
|
||||
switch provider {
|
||||
case cloudprovider.GCP:
|
||||
getter, err := newGCPCloudCredentialGetter(ctx)
|
||||
@ -61,6 +62,12 @@ func newCloudCredentialGetter(ctx context.Context, provider cloudprovider.Provid
|
||||
return nil, fmt.Errorf("creating AWS cloud credential getter: %w", err)
|
||||
}
|
||||
return &credentialGetter{getter}, nil
|
||||
case cloudprovider.QEMU:
|
||||
getter, err := newQemuCloudCredentialGetter(infoMap)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("creating QEMU cloud credential getter: %w", err)
|
||||
}
|
||||
return &credentialGetter{getter}, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("cloud provider not supported")
|
||||
}
|
||||
@ -213,3 +220,34 @@ type awsSecretManagerAPI interface {
|
||||
optFns ...func(*awssecretmanager.Options),
|
||||
) (*awssecretmanager.GetSecretValueOutput, error)
|
||||
}
|
||||
|
||||
type qemuCloudCredentialGetter struct {
|
||||
creds credentials
|
||||
}
|
||||
|
||||
func newQemuCloudCredentialGetter(infoMap *info.Map) (*qemuCloudCredentialGetter, error) {
|
||||
const username = "cluster-instance-qemu"
|
||||
|
||||
password, ok, err := infoMap.Get("qemu.opensearch-pw")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("getting qemu.opensearch-pw from info: %w", err)
|
||||
}
|
||||
if !ok {
|
||||
return nil, errors.New("qemu.opensearch-pw not found in info")
|
||||
}
|
||||
|
||||
return &qemuCloudCredentialGetter{
|
||||
creds: credentials{
|
||||
Username: username,
|
||||
Password: password,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (q *qemuCloudCredentialGetter) GetOpensearchCredentials(ctx context.Context) (credentials, error) {
|
||||
return q.creds, nil
|
||||
}
|
||||
|
||||
func (q *qemuCloudCredentialGetter) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ func NewStartTrigger(ctx context.Context, wg *sync.WaitGroup, provider cloudprov
|
||||
return
|
||||
}
|
||||
|
||||
cerdsGetter, err := newCloudCredentialGetter(ctx, provider)
|
||||
cerdsGetter, err := newCloudCredentialGetter(ctx, provider, infoMap)
|
||||
if err != nil {
|
||||
logger.Errorf("Creating cloud credential getter: %v", err)
|
||||
return
|
||||
|
@ -938,8 +938,8 @@ github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWV
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
|
||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw=
|
||||
github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
|
||||
|
Loading…
Reference in New Issue
Block a user