From a7ad937bdc789144fe1942735dbccd993b7abb06 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Fri, 16 Mar 2018 13:57:13 -0700 Subject: [PATCH] PublicEndpoints to node --- apis/management.cattle.io/v3/machine_types.go | 12 ++++++++++++ apis/management.cattle.io/v3/schema/schema.go | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apis/management.cattle.io/v3/machine_types.go b/apis/management.cattle.io/v3/machine_types.go index 9f00f25a..f459bbd4 100644 --- a/apis/management.cattle.io/v3/machine_types.go +++ b/apis/management.cattle.io/v3/machine_types.go @@ -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 +} diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 5bae9942..da4c510f 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -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",