1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 21:32:10 +00:00

PublicEndpoints to node/service/pod

This commit is contained in:
Alena Prokharchyk
2018-01-29 16:51:02 -08:00
committed by Darren Shepherd
parent 3c6d1ba9b8
commit c15c1cf920
3 changed files with 24 additions and 3 deletions

View File

@@ -295,8 +295,10 @@ func podTypes(schemas *types.Schemas) *types.Schemas {
AddMapperForType(&Version, v1.ResourceRequirements{},
mapper.PivotMapper{Plural: true},
).
MustImport(&Version, v3.PublicEndpoint{}).
AddMapperForType(&Version, v1.Pod{},
&m.AnnotationField{Field: "description"},
&m.AnnotationField{Field: "publicEndpoints", List: true},
).
// Must import handlers before Container
MustImport(&Version, v1.Capabilities{}, struct {
@@ -320,8 +322,9 @@ func podTypes(schemas *types.Schemas) *types.Schemas {
PullPolicy string `norman:"type=enum,options=Always|Never|IfNotPresent,default=IfNotPresent"`
}{}).
MustImport(&Version, v1.Pod{}, projectOverride{}, struct {
Description string `json:"description"`
WorkloadID string `norman:"type=reference[workload]"`
Description string `json:"description"`
WorkloadID string `norman:"type=reference[workload]"`
PublicEndpoints string `json:"publicEndpoints" norman:"type=array[publicEndpoint],nocreate,noupdate"`
}{})
}
@@ -368,6 +371,7 @@ func addServiceOrDNSRecord(dns bool) types.SchemasInitFunc {
&m.AnnotationField{Field: "ipAddresses", List: true},
&m.AnnotationField{Field: "targetWorkloadIds", List: true},
&m.AnnotationField{Field: "targetDnsRecordIds", List: true},
&m.AnnotationField{Field: "publicEndpoints", List: true},
&m.Move{From: "serviceKind", To: "kind"},
)
@@ -402,6 +406,7 @@ func addServiceOrDNSRecord(dns bool) types.SchemasInitFunc {
WorkloadID string `json:"workloadId" norman:"type=reference[workload],nocreate,noupdate"`
TargetWorkloadIDs string `json:"targetWorkloadIds" norman:"type=array[reference[workload]]"`
TargetDNSRecordIDs string `json:"targetDnsRecordIds" norman:"type=array[reference[dnsRecord]]"`
PublicEndpoints string `json:"publicEndpoints" norman:"type=array[publicEndpoint],nocreate,noupdate"`
}{})
}
}

View File

@@ -141,3 +141,15 @@ type SSHAuth struct {
Fingerprint string `json:"certFingerprint" norman:"nocreate,noupdate"`
}
type NamespacedSSHAuth SSHAuth
type PublicEndpoint struct {
Node string `json:"node,omitempty" norman:"type=reference[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
Service string `json:"service,omitempty" norman:"type=reference[service],nocreate,noupdate"`
// for host port
Pod string `json:"pod,omitempty" norman:"type=reference[pod],nocreate,noupdate"`
//serviceName and podName are mutually exclusive
}