Merge pull request #163 from microsoft/user/vishalk/os-registration-status
Adding osRegistrationStatus
This commit is contained in:
Коммит
497c8460a1
2
go.mod
2
go.mod
|
@ -7,7 +7,7 @@ require (
|
|||
github.com/Azure/go-autorest/autorest v0.9.0
|
||||
github.com/Azure/go-autorest/autorest/date v0.2.0
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/microsoft/moc v0.11.0-alpha.9
|
||||
github.com/microsoft/moc v0.11.0-alpha.11
|
||||
google.golang.org/grpc v1.54.0
|
||||
k8s.io/klog v1.0.0
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -577,8 +577,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/microsoft/moc v0.11.0-alpha.9 h1:S2cUf9k7oGIYRPD/7Ft/sYDbZMzRCcDcPSCAUbx3IbA=
|
||||
github.com/microsoft/moc v0.11.0-alpha.9/go.mod h1:bnWMITK+904B4ALQBH5LqDz6ulh4pj+o4Q/6a9pJU4Q=
|
||||
github.com/microsoft/moc v0.11.0-alpha.11 h1:0DILZWgGwcH3F00nrenNMYId2dU1rKwdrYkWdmFeNy8=
|
||||
github.com/microsoft/moc v0.11.0-alpha.11/go.mod h1:bnWMITK+904B4ALQBH5LqDz6ulh4pj+o4Q/6a9pJU4Q=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
|
|
|
@ -11,4 +11,5 @@ const (
|
|||
DefaultServerContextTimeout = 10 * time.Minute
|
||||
CertificateValidityThreshold float64 = (30.0 / 100.0)
|
||||
RenewalBackoff float64 = (2.0 / 100.0)
|
||||
OsRegistrationStatus string = "osRegistrationStatus"
|
||||
)
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
package node
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/microsoft/moc-sdk-for-go/pkg/constant"
|
||||
"github.com/microsoft/moc-sdk-for-go/services/cloud"
|
||||
|
||||
"github.com/microsoft/moc/pkg/convert"
|
||||
|
@ -65,6 +68,7 @@ func getNode(nd *wssdcloud.Node) *cloud.Node {
|
|||
Statuses: getNodeStatuses(nd),
|
||||
},
|
||||
Version: &nd.Status.Version.Number,
|
||||
Tags: generateNodeTags(nd),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,3 +78,19 @@ func getNodeStatuses(node *wssdcloud.Node) map[string]*string {
|
|||
statuses["Info"] = convert.ToStringPtr(node.GetInfo().String())
|
||||
return statuses
|
||||
}
|
||||
|
||||
func generateNodeTags(node *wssdcloud.Node) map[string]*string {
|
||||
tags := make(map[string]*string)
|
||||
populateOsRegistrationStatusTag(tags, node)
|
||||
if len(tags) > 0 {
|
||||
return tags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func populateOsRegistrationStatusTag(tags map[string]*string, node *wssdcloud.Node) {
|
||||
if node.Info != nil && node.Info.OsInfo != nil && node.Info.OsInfo.OsRegistrationStatus != nil {
|
||||
osRegistrationStatus := strconv.Itoa(int(node.Info.OsInfo.OsRegistrationStatus.Status))
|
||||
tags[constant.OsRegistrationStatus] = &osRegistrationStatus
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче