Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/worker/keymanager/status: Show active version of the km runtime #5320

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changelog/5320.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go/worker/keymanager/status: Show active version of the km runtime

The status of the key manager was updated to include a new attribute called
`active_version`, which stores the version number of the currently deployed
key manager runtime. If no deployment is active, the value is set to null.
4 changes: 4 additions & 0 deletions go/worker/keymanager/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

beacon "github.com/oasisprotocol/oasis-core/go/beacon/api"
"github.com/oasisprotocol/oasis-core/go/common"
"github.com/oasisprotocol/oasis-core/go/common/version"
"github.com/oasisprotocol/oasis-core/go/keymanager/api"
)

Expand Down Expand Up @@ -96,6 +97,9 @@ type WorkerStatus struct {
// Status is a concise status of the key manager worker.
Status StatusState `json:"status"`

// ActiveVersion is the currently active version.
ActiveVersion *version.Version `json:"active_version"`

// MayGenerate returns whether the enclave can generate a master secret.
MayGenerate bool `json:"may_generate"`

Expand Down
8 changes: 8 additions & 0 deletions go/worker/keymanager/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/libp2p/go-libp2p/core/peer"

"github.com/oasisprotocol/oasis-core/go/common"
"github.com/oasisprotocol/oasis-core/go/common/version"
"github.com/oasisprotocol/oasis-core/go/worker/keymanager/api"
)

Expand Down Expand Up @@ -62,10 +63,17 @@ func (w *Worker) GetStatus(ctx context.Context) (*api.Status, error) {
pc = w.enclaveStatus.InitResponse.PolicyChecksum
}

var aw *version.Version
if w.rtStatus != nil {
aw = &w.rtStatus.version
}

gs := w.globalStatus
ws := api.WorkerStatus{
Status: ss,
ActiveVersion: aw,
MayGenerate: w.mayGenerate,
RuntimeID: &w.runtimeID,
ClientRuntimes: rts,
AccessList: al,
PrivatePeers: ps,
Expand Down