1
0
mirror of https://github.com/rancher/types.git synced 2025-07-19 07:46:25 +00:00

PublicEndpoints to node

This commit is contained in:
Alena Prokharchyk 2018-03-16 13:57:13 -07:00 committed by Darren Shepherd
parent 704bb1871e
commit a7ad937bdc
2 changed files with 18 additions and 1 deletions

View File

@ -229,3 +229,15 @@ type NodeDriverSpec struct {
Checksum string `json:"checksum"`
UIURL string `json:"uiUrl"`
}
type PublicEndpoint struct {
NodeName string `json:"nodeName,omitempty" norman:"type=reference[/v3/schemas/node],nocreate,noupdate"`
Address string `json:"address,omitempty" norman:"nocreate,noupdate"`
Port int32 `json:"port,omitempty" norman:"nocreate,noupdate"`
Protocol string `json:"protocol,omitempty" norman:"nocreate,noupdate"`
// for node port service
ServiceName string `json:"serviceName,omitempty" norman:"type=reference[service],nocreate,noupdate"`
// for host port
PodName string `json:"podName,omitempty" norman:"type=reference[pod],nocreate,noupdate"`
//serviceName and podName are mutually exclusive
}

View File

@ -185,16 +185,21 @@ func nodeTypes(schemas *types.Schemas) *types.Schemas {
&m.Move{From: "nodeAnnotations", To: "annotations"},
&m.Drop{Field: "desiredNodeLabels"},
&m.Drop{Field: "desiredNodeAnnotations"},
&m.AnnotationField{Field: "publicEndpoints", List: true},
m.DisplayName{}).
AddMapperForType(&Version, v3.NodeDriver{}, m.DisplayName{}).
AddMapperForType(&Version, v3.NodeTemplate{}, m.DisplayName{}).
MustImport(&Version, v3.PublicEndpoint{}).
MustImport(&Version, v3.NodePool{}).
MustImportAndCustomize(&Version, v3.Node{}, func(schema *types.Schema) {
labelField := schema.ResourceFields["labels"]
labelField.Create = true
labelField.Update = true
schema.ResourceFields["labels"] = labelField
}).
}, struct {
PublicEndpoints string `json:"publicEndpoints" norman:"type=array[publicEndpoint],nocreate,noupdate"`
}{}).
MustImportAndCustomize(&Version, v3.NodeDriver{}, func(schema *types.Schema) {
schema.ResourceActions["activate"] = types.Action{
Output: "nodeDriver",