Skip to content

Commit

Permalink
Merge pull request #5320 from oasisprotocol/peternose/feature/km-acti…
Browse files Browse the repository at this point in the history
…ve-version

go/worker/keymanager/status: Show active version of the km runtime
  • Loading branch information
peternose committed Jul 12, 2023
2 parents d81131e + a8fca61 commit 95d40fc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
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

0 comments on commit 95d40fc

Please sign in to comment.