constellation-lib: fix incorrect encoding and ordering of Init response (#2708)

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-12-12 15:01:56 +01:00 committed by GitHub
parent 0512cfccd7
commit d08e75bf9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ package constellation
import ( import (
"context" "context"
"encoding/hex"
"errors" "errors"
"fmt" "fmt"
"io" "io"
@ -121,17 +122,17 @@ func (a *Applier) Init(
} }
return InitOutput{ return InitOutput{
ClusterID: string(doer.resp.OwnerId), ClusterID: hex.EncodeToString(doer.resp.ClusterId),
OwnerID: string(doer.resp.ClusterId), OwnerID: hex.EncodeToString(doer.resp.OwnerId),
Kubeconfig: kubeconfigBytes, Kubeconfig: kubeconfigBytes,
}, nil }, nil
} }
// InitOutput contains the output of the init RPC. // InitOutput contains the output of the init RPC.
type InitOutput struct { type InitOutput struct {
// ClusterID is the ID of the cluster. // ClusterID is the hex encoded ID of the cluster.
ClusterID string ClusterID string
// OwnerID is the ID of the owner of the cluster. // OwnerID is the hex encoded ID of the owner of the cluster.
OwnerID string OwnerID string
// Kubeconfig is the kubeconfig for the cluster. // Kubeconfig is the kubeconfig for the cluster.
Kubeconfig []byte Kubeconfig []byte