1
0
mirror of https://github.com/rancher/types.git synced 2025-08-01 21:07:41 +00:00

Embed crt status

This commit is contained in:
Darren Shepherd 2018-02-01 15:15:48 -07:00
parent 8775720ab6
commit c06cbd77c9
3 changed files with 7 additions and 4 deletions

View File

@ -71,8 +71,8 @@ type MachineStatus struct {
MachineDriverConfig string `json:"machineDriverConfig,omitempty"`
NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"`
NodeLabels map[string]string `json:"nodeLabels,omitempty"`
Token string `json:"token"`
NodeTaints []v1.Taint `json:"nodeTaints,omitempty"`
ExternalID string `json:"externalId,omitempty"`
}
var (
@ -119,6 +119,7 @@ type CustomConfig struct {
type MachineSpec struct {
NodeSpec v1.NodeSpec `json:"nodeSpec"`
CustomConfig *CustomConfig `json:"customConfig"`
Imported bool `json:"imported"`
Description string `json:"description,omitempty"`
DisplayName string `json:"displayName"`
RequestedHostname string `json:"requestedHostname,omitempty" norman:"type=dnsLabel,nullable,noupdate"`

View File

@ -78,6 +78,9 @@ func clusterTypes(schemas *types.Schemas) *types.Schemas {
From: "type",
To: "eventType",
}).
AddMapperForType(&Version, v3.ClusterRegistrationToken{},
&m.Embed{Field: "status"},
).
MustImportAndCustomize(&Version, v3.Cluster{}, func(schema *types.Schema) {
schema.SubContext = "clusters"
}).
@ -119,7 +122,6 @@ func machineTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v3.MachineSpec{}, &m.Embed{Field: "nodeSpec"}).
AddMapperForType(&Version, v3.MachineStatus{},
&m.Drop{Field: "token"},
&m.Drop{Field: "rkeNode"},
&m.Drop{Field: "machineTemplateSpec"},
&m.Drop{Field: "machineDriverConfig"},

View File

@ -102,7 +102,7 @@ func Set(data map[string]interface{}) {
return
}
val, ok = values.GetValue(data, "status", "conditions")
val, conditionsOk := values.GetValue(data, "status", "conditions")
var conditions []condition
if err := convert.ToObj(val, &conditions); err != nil {
// ignore error
@ -182,7 +182,7 @@ func Set(data map[string]interface{}) {
}
apiVersion, _ := values.GetValueN(data, "apiVersion").(string)
if state == "" && len(conditions) == 0 && strings.Contains(apiVersion, "cattle.io") {
if state == "" && conditionsOk && len(conditions) == 0 && strings.Contains(apiVersion, "cattle.io") {
if val, ok := values.GetValue(data, "metadata", "created"); ok {
if i, err := convert.ToTimestamp(val); err == nil {
if time.Unix(i/1000, 0).Add(5 * time.Second).After(time.Now()) {