1
0
mirror of https://github.com/rancher/types.git synced 2025-06-29 15:06:48 +00:00

add desiredLabels and desiredAnnotations

This commit is contained in:
Daishan Peng 2018-03-02 12:55:40 -07:00 committed by Darren Shepherd
parent a66b99ac07
commit 496fb9f951
2 changed files with 18 additions and 9 deletions

View File

@ -154,14 +154,16 @@ type NodeSpec struct {
Worker bool `json:"worker" norman:"noupdate"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],noupdate"`
NodePoolName string `json:"nodePoolName" norman:"type=reference[nodePool],nocreate,noupdate"`
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,required"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
InternalNodeSpec v1.NodeSpec `json:"internalNodeSpec"`
NodePoolName string `json:"nodePoolName" norman:"type=reference[nodePool],nocreate,noupdate"`
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,required"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
InternalNodeSpec v1.NodeSpec `json:"internalNodeSpec"`
DesiredNodeLabels map[string]string `json:"desiredNodeLabels,omitempty"`
DesiredNodeAnnotations map[string]string `json:"desiredNodeAnnotations,omitempty"`
}
type NodeCommonParams struct {

View File

@ -178,11 +178,18 @@ func nodeTypes(schemas *types.Schemas) *types.Schemas {
&m.Drop{Field: "annotations"},
&m.Move{From: "nodeLabels", To: "labels"},
&m.Move{From: "nodeAnnotations", To: "annotations"},
&m.Drop{Field: "desiredNodeLabels"},
&m.Drop{Field: "desiredNodeAnnotations"},
m.DisplayName{}).
AddMapperForType(&Version, v3.NodeDriver{}, m.DisplayName{}).
AddMapperForType(&Version, v3.NodeTemplate{}, m.DisplayName{}).
MustImport(&Version, v3.NodePool{}).
MustImport(&Version, v3.Node{}).
MustImportAndCustomize(&Version, v3.Node{}, func(schema *types.Schema) {
labelField := schema.ResourceFields["labels"]
labelField.Create = true
labelField.Update = true
schema.ResourceFields["labels"] = labelField
}).
MustImportAndCustomize(&Version, v3.NodeDriver{}, func(schema *types.Schema) {
schema.ResourceActions["activate"] = types.Action{
Output: "nodeDriver",