diff --git a/pkg/apis/experimental/deep_copy_generated.go b/pkg/apis/experimental/deep_copy_generated.go index bb080f66221..4bda77750ed 100644 --- a/pkg/apis/experimental/deep_copy_generated.go +++ b/pkg/apis/experimental/deep_copy_generated.go @@ -346,6 +346,26 @@ func deepCopy_api_Lifecycle(in api.Lifecycle, out *api.Lifecycle, c *conversion. return nil } +func deepCopy_api_LoadBalancerIngress(in api.LoadBalancerIngress, out *api.LoadBalancerIngress, c *conversion.Cloner) error { + out.IP = in.IP + out.Hostname = in.Hostname + return nil +} + +func deepCopy_api_LoadBalancerStatus(in api.LoadBalancerStatus, out *api.LoadBalancerStatus, c *conversion.Cloner) error { + if in.Ingress != nil { + out.Ingress = make([]api.LoadBalancerIngress, len(in.Ingress)) + for i := range in.Ingress { + if err := deepCopy_api_LoadBalancerIngress(in.Ingress[i], &out.Ingress[i], c); err != nil { + return err + } + } + } else { + out.Ingress = nil + } + return nil +} + func deepCopy_api_LocalObjectReference(in api.LocalObjectReference, out *api.LocalObjectReference, c *conversion.Cloner) error { out.Name = in.Name return nil @@ -997,6 +1017,97 @@ func deepCopy_experimental_HorizontalPodAutoscalerStatus(in HorizontalPodAutosca return nil } +func deepCopy_experimental_Ingress(in Ingress, out *Ingress, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := deepCopy_experimental_IngressSpec(in.Spec, &out.Spec, c); err != nil { + return err + } + if err := deepCopy_experimental_IngressStatus(in.Status, &out.Status, c); err != nil { + return err + } + return nil +} + +func deepCopy_experimental_IngressBackend(in IngressBackend, out *IngressBackend, c *conversion.Cloner) error { + if err := deepCopy_api_LocalObjectReference(in.ServiceRef, &out.ServiceRef, c); err != nil { + return err + } + if err := deepCopy_util_IntOrString(in.ServicePort, &out.ServicePort, c); err != nil { + return err + } + out.Protocol = in.Protocol + return nil +} + +func deepCopy_experimental_IngressList(in IngressList, out *IngressList, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]Ingress, len(in.Items)) + for i := range in.Items { + if err := deepCopy_experimental_Ingress(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func deepCopy_experimental_IngressPath(in IngressPath, out *IngressPath, c *conversion.Cloner) error { + out.Path = in.Path + if err := deepCopy_experimental_IngressBackend(in.Backend, &out.Backend, c); err != nil { + return err + } + return nil +} + +func deepCopy_experimental_IngressRule(in IngressRule, out *IngressRule, c *conversion.Cloner) error { + out.Host = in.Host + if in.Paths != nil { + out.Paths = make([]IngressPath, len(in.Paths)) + for i := range in.Paths { + if err := deepCopy_experimental_IngressPath(in.Paths[i], &out.Paths[i], c); err != nil { + return err + } + } + } else { + out.Paths = nil + } + return nil +} + +func deepCopy_experimental_IngressSpec(in IngressSpec, out *IngressSpec, c *conversion.Cloner) error { + if in.Rules != nil { + out.Rules = make([]IngressRule, len(in.Rules)) + for i := range in.Rules { + if err := deepCopy_experimental_IngressRule(in.Rules[i], &out.Rules[i], c); err != nil { + return err + } + } + } else { + out.Rules = nil + } + return nil +} + +func deepCopy_experimental_IngressStatus(in IngressStatus, out *IngressStatus, c *conversion.Cloner) error { + if err := deepCopy_api_LoadBalancerStatus(in.LoadBalancer, &out.LoadBalancer, c); err != nil { + return err + } + return nil +} + func deepCopy_experimental_Job(in Job, out *Job, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -1289,6 +1400,8 @@ func init() { deepCopy_api_HostPathVolumeSource, deepCopy_api_ISCSIVolumeSource, deepCopy_api_Lifecycle, + deepCopy_api_LoadBalancerIngress, + deepCopy_api_LoadBalancerStatus, deepCopy_api_LocalObjectReference, deepCopy_api_NFSVolumeSource, deepCopy_api_ObjectFieldSelector, @@ -1324,6 +1437,13 @@ func init() { deepCopy_experimental_HorizontalPodAutoscalerList, deepCopy_experimental_HorizontalPodAutoscalerSpec, deepCopy_experimental_HorizontalPodAutoscalerStatus, + deepCopy_experimental_Ingress, + deepCopy_experimental_IngressBackend, + deepCopy_experimental_IngressList, + deepCopy_experimental_IngressPath, + deepCopy_experimental_IngressRule, + deepCopy_experimental_IngressSpec, + deepCopy_experimental_IngressStatus, deepCopy_experimental_Job, deepCopy_experimental_JobCondition, deepCopy_experimental_JobList, diff --git a/pkg/apis/experimental/register.go b/pkg/apis/experimental/register.go index 1c207f083dd..74e718e0175 100644 --- a/pkg/apis/experimental/register.go +++ b/pkg/apis/experimental/register.go @@ -42,6 +42,8 @@ func addKnownTypes() { &DaemonSet{}, &ThirdPartyResourceData{}, &ThirdPartyResourceDataList{}, + &Ingress{}, + &IngressList{}, ) } @@ -59,3 +61,5 @@ func (*DaemonSet) IsAnAPIObject() {} func (*DaemonSetList) IsAnAPIObject() {} func (*ThirdPartyResourceData) IsAnAPIObject() {} func (*ThirdPartyResourceDataList) IsAnAPIObject() {} +func (*Ingress) IsAnAPIObject() {} +func (*IngressList) IsAnAPIObject() {} diff --git a/pkg/apis/experimental/types.go b/pkg/apis/experimental/types.go index c73871fc522..00c71d2c643 100644 --- a/pkg/apis/experimental/types.go +++ b/pkg/apis/experimental/types.go @@ -462,3 +462,80 @@ type JobCondition struct { // Human readable message indicating details about last transition. Message string `json:"message,omitempty"` } + +// An Ingress is a way to give services externally-reachable urls. Each Ingress is a +// collection of rules that allow inbound connections to reach the endpoints defined by +// a backend. +type Ingress struct { + unversioned.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + api.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the desired state of the Ingress. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status + Spec IngressSpec `json:"spec,omitempty"` + + // Status is the current state of the Ingress. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status + Status IngressStatus `json:"status,omitempty"` +} + +// IngressList is a collection of Ingress. +type IngressList struct { + unversioned.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + unversioned.ListMeta `json:"metadata,omitempty"` + + // Items is the list of Ingress. + Items []Ingress `json:"items"` +} + +// IngressSpec describes the Ingress the user wishes to exist. +type IngressSpec struct { + // TODO: Add the ability to specify load-balancer IP just like what Service has already done? + // A list of rules used to configure the Ingress. + // http://:/? -> IngressBackend + // Where parts of the url conform to RFC 1738. + Rules []IngressRule `json:"rules"` +} + +// IngressStatus describe the current state of the Ingress. +type IngressStatus struct { + // LoadBalancer contains the current status of the load-balancer. + LoadBalancer api.LoadBalancerStatus `json:"loadBalancer,omitempty"` +} + +// IngressRule represents the rules mapping the paths under a specified host to the related backend services. +type IngressRule struct { + // Host is the fully qualified domain name of a network host, or its IP + // address as a set of four decimal digit groups separated by ".". + // Conforms to RFC 1738. + Host string `json:"host,omitempty"` + + // Paths describe a list of load-balancer rules under the specified host. + Paths []IngressPath `json:"paths"` +} + +// IngressPath associates a path regex with an IngressBackend. +// Incoming urls matching the Path are forwarded to the Backend. +type IngressPath struct { + // Path is a regex matched against the url of an incoming request. + Path string `json:"path,omitempty"` + + // Define the referenced service endpoint which the traffic will be forwarded to. + Backend IngressBackend `json:"backend"` +} + +// IngressBackend describes all endpoints for a given Service, port and protocol. +type IngressBackend struct { + // Specifies the referenced service. + ServiceRef api.LocalObjectReference `json:"serviceRef"` + + // Specifies the port of the referenced service. + ServicePort util.IntOrString `json:"servicePort,omitempty"` + + // Specifies the protocol of the referenced service. + Protocol api.Protocol `json:"protocol,omitempty"` +} diff --git a/pkg/apis/experimental/v1/conversion_generated.go b/pkg/apis/experimental/v1/conversion_generated.go index 6feae3022ca..ba0a059eced 100644 --- a/pkg/apis/experimental/v1/conversion_generated.go +++ b/pkg/apis/experimental/v1/conversion_generated.go @@ -405,6 +405,32 @@ func convert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecycle, return nil } +func convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(in *api.LoadBalancerIngress, out *v1.LoadBalancerIngress, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.LoadBalancerIngress))(in) + } + out.IP = in.IP + out.Hostname = in.Hostname + return nil +} + +func convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(in *api.LoadBalancerStatus, out *v1.LoadBalancerStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*api.LoadBalancerStatus))(in) + } + if in.Ingress != nil { + out.Ingress = make([]v1.LoadBalancerIngress, len(in.Ingress)) + for i := range in.Ingress { + if err := convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { + return err + } + } + } else { + out.Ingress = nil + } + return nil +} + func convert_api_LocalObjectReference_To_v1_LocalObjectReference(in *api.LocalObjectReference, out *v1.LocalObjectReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.LocalObjectReference))(in) @@ -1154,6 +1180,32 @@ func convert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle, return nil } +func convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(in *v1.LoadBalancerIngress, out *api.LoadBalancerIngress, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.LoadBalancerIngress))(in) + } + out.IP = in.IP + out.Hostname = in.Hostname + return nil +} + +func convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(in *v1.LoadBalancerStatus, out *api.LoadBalancerStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*v1.LoadBalancerStatus))(in) + } + if in.Ingress != nil { + out.Ingress = make([]api.LoadBalancerIngress, len(in.Ingress)) + for i := range in.Ingress { + if err := convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress(&in.Ingress[i], &out.Ingress[i], s); err != nil { + return err + } + } + } else { + out.Ingress = nil + } + return nil +} + func convert_v1_LocalObjectReference_To_api_LocalObjectReference(in *v1.LocalObjectReference, out *api.LocalObjectReference, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.LocalObjectReference))(in) @@ -1752,6 +1804,118 @@ func convert_experimental_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAutos return nil } +func convert_experimental_Ingress_To_v1_Ingress(in *experimental.Ingress, out *Ingress, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.Ingress))(in) + } + if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + return err + } + if err := convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := convert_experimental_IngressSpec_To_v1_IngressSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := convert_experimental_IngressStatus_To_v1_IngressStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func convert_experimental_IngressBackend_To_v1_IngressBackend(in *experimental.IngressBackend, out *IngressBackend, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.IngressBackend))(in) + } + if err := convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ServiceRef, &out.ServiceRef, s); err != nil { + return err + } + if err := s.Convert(&in.ServicePort, &out.ServicePort, 0); err != nil { + return err + } + out.Protocol = v1.Protocol(in.Protocol) + return nil +} + +func convert_experimental_IngressList_To_v1_IngressList(in *experimental.IngressList, out *IngressList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.IngressList))(in) + } + if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + return err + } + if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]Ingress, len(in.Items)) + for i := range in.Items { + if err := convert_experimental_Ingress_To_v1_Ingress(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func convert_experimental_IngressPath_To_v1_IngressPath(in *experimental.IngressPath, out *IngressPath, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.IngressPath))(in) + } + out.Path = in.Path + if err := convert_experimental_IngressBackend_To_v1_IngressBackend(&in.Backend, &out.Backend, s); err != nil { + return err + } + return nil +} + +func convert_experimental_IngressRule_To_v1_IngressRule(in *experimental.IngressRule, out *IngressRule, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.IngressRule))(in) + } + out.Host = in.Host + if in.Paths != nil { + out.Paths = make([]IngressPath, len(in.Paths)) + for i := range in.Paths { + if err := convert_experimental_IngressPath_To_v1_IngressPath(&in.Paths[i], &out.Paths[i], s); err != nil { + return err + } + } + } else { + out.Paths = nil + } + return nil +} + +func convert_experimental_IngressSpec_To_v1_IngressSpec(in *experimental.IngressSpec, out *IngressSpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.IngressSpec))(in) + } + if in.Rules != nil { + out.Rules = make([]IngressRule, len(in.Rules)) + for i := range in.Rules { + if err := convert_experimental_IngressRule_To_v1_IngressRule(&in.Rules[i], &out.Rules[i], s); err != nil { + return err + } + } + } else { + out.Rules = nil + } + return nil +} + +func convert_experimental_IngressStatus_To_v1_IngressStatus(in *experimental.IngressStatus, out *IngressStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*experimental.IngressStatus))(in) + } + if err := convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { + return err + } + return nil +} + func convert_experimental_Job_To_v1_Job(in *experimental.Job, out *Job, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*experimental.Job))(in) @@ -2268,6 +2432,118 @@ func convert_v1_HorizontalPodAutoscalerStatus_To_experimental_HorizontalPodAutos return nil } +func convert_v1_Ingress_To_experimental_Ingress(in *Ingress, out *experimental.Ingress, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*Ingress))(in) + } + if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + return err + } + if err := convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { + return err + } + if err := convert_v1_IngressSpec_To_experimental_IngressSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := convert_v1_IngressStatus_To_experimental_IngressStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +func convert_v1_IngressBackend_To_experimental_IngressBackend(in *IngressBackend, out *experimental.IngressBackend, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressBackend))(in) + } + if err := convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ServiceRef, &out.ServiceRef, s); err != nil { + return err + } + if err := s.Convert(&in.ServicePort, &out.ServicePort, 0); err != nil { + return err + } + out.Protocol = api.Protocol(in.Protocol) + return nil +} + +func convert_v1_IngressList_To_experimental_IngressList(in *IngressList, out *experimental.IngressList, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressList))(in) + } + if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { + return err + } + if err := s.Convert(&in.ListMeta, &out.ListMeta, 0); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]experimental.Ingress, len(in.Items)) + for i := range in.Items { + if err := convert_v1_Ingress_To_experimental_Ingress(&in.Items[i], &out.Items[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func convert_v1_IngressPath_To_experimental_IngressPath(in *IngressPath, out *experimental.IngressPath, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressPath))(in) + } + out.Path = in.Path + if err := convert_v1_IngressBackend_To_experimental_IngressBackend(&in.Backend, &out.Backend, s); err != nil { + return err + } + return nil +} + +func convert_v1_IngressRule_To_experimental_IngressRule(in *IngressRule, out *experimental.IngressRule, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressRule))(in) + } + out.Host = in.Host + if in.Paths != nil { + out.Paths = make([]experimental.IngressPath, len(in.Paths)) + for i := range in.Paths { + if err := convert_v1_IngressPath_To_experimental_IngressPath(&in.Paths[i], &out.Paths[i], s); err != nil { + return err + } + } + } else { + out.Paths = nil + } + return nil +} + +func convert_v1_IngressSpec_To_experimental_IngressSpec(in *IngressSpec, out *experimental.IngressSpec, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressSpec))(in) + } + if in.Rules != nil { + out.Rules = make([]experimental.IngressRule, len(in.Rules)) + for i := range in.Rules { + if err := convert_v1_IngressRule_To_experimental_IngressRule(&in.Rules[i], &out.Rules[i], s); err != nil { + return err + } + } + } else { + out.Rules = nil + } + return nil +} + +func convert_v1_IngressStatus_To_experimental_IngressStatus(in *IngressStatus, out *experimental.IngressStatus, s conversion.Scope) error { + if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { + defaulting.(func(*IngressStatus))(in) + } + if err := convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus(&in.LoadBalancer, &out.LoadBalancer, s); err != nil { + return err + } + return nil +} + func convert_v1_Job_To_experimental_Job(in *Job, out *experimental.Job, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*Job))(in) @@ -2580,6 +2856,8 @@ func init() { convert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource, convert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource, convert_api_Lifecycle_To_v1_Lifecycle, + convert_api_LoadBalancerIngress_To_v1_LoadBalancerIngress, + convert_api_LoadBalancerStatus_To_v1_LoadBalancerStatus, convert_api_LocalObjectReference_To_v1_LocalObjectReference, convert_api_NFSVolumeSource_To_v1_NFSVolumeSource, convert_api_ObjectFieldSelector_To_v1_ObjectFieldSelector, @@ -2608,6 +2886,13 @@ func init() { convert_experimental_HorizontalPodAutoscalerSpec_To_v1_HorizontalPodAutoscalerSpec, convert_experimental_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAutoscalerStatus, convert_experimental_HorizontalPodAutoscaler_To_v1_HorizontalPodAutoscaler, + convert_experimental_IngressBackend_To_v1_IngressBackend, + convert_experimental_IngressList_To_v1_IngressList, + convert_experimental_IngressPath_To_v1_IngressPath, + convert_experimental_IngressRule_To_v1_IngressRule, + convert_experimental_IngressSpec_To_v1_IngressSpec, + convert_experimental_IngressStatus_To_v1_IngressStatus, + convert_experimental_Ingress_To_v1_Ingress, convert_experimental_JobCondition_To_v1_JobCondition, convert_experimental_JobList_To_v1_JobList, convert_experimental_JobSpec_To_v1_JobSpec, @@ -2654,12 +2939,21 @@ func init() { convert_v1_HorizontalPodAutoscaler_To_experimental_HorizontalPodAutoscaler, convert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource, convert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource, + convert_v1_IngressBackend_To_experimental_IngressBackend, + convert_v1_IngressList_To_experimental_IngressList, + convert_v1_IngressPath_To_experimental_IngressPath, + convert_v1_IngressRule_To_experimental_IngressRule, + convert_v1_IngressSpec_To_experimental_IngressSpec, + convert_v1_IngressStatus_To_experimental_IngressStatus, + convert_v1_Ingress_To_experimental_Ingress, convert_v1_JobCondition_To_experimental_JobCondition, convert_v1_JobList_To_experimental_JobList, convert_v1_JobSpec_To_experimental_JobSpec, convert_v1_JobStatus_To_experimental_JobStatus, convert_v1_Job_To_experimental_Job, convert_v1_Lifecycle_To_api_Lifecycle, + convert_v1_LoadBalancerIngress_To_api_LoadBalancerIngress, + convert_v1_LoadBalancerStatus_To_api_LoadBalancerStatus, convert_v1_LocalObjectReference_To_api_LocalObjectReference, convert_v1_NFSVolumeSource_To_api_NFSVolumeSource, convert_v1_ObjectFieldSelector_To_api_ObjectFieldSelector, diff --git a/pkg/apis/experimental/v1/deep_copy_generated.go b/pkg/apis/experimental/v1/deep_copy_generated.go index 084ce724761..fa0127a530d 100644 --- a/pkg/apis/experimental/v1/deep_copy_generated.go +++ b/pkg/apis/experimental/v1/deep_copy_generated.go @@ -384,6 +384,26 @@ func deepCopy_v1_Lifecycle(in v1.Lifecycle, out *v1.Lifecycle, c *conversion.Clo return nil } +func deepCopy_v1_LoadBalancerIngress(in v1.LoadBalancerIngress, out *v1.LoadBalancerIngress, c *conversion.Cloner) error { + out.IP = in.IP + out.Hostname = in.Hostname + return nil +} + +func deepCopy_v1_LoadBalancerStatus(in v1.LoadBalancerStatus, out *v1.LoadBalancerStatus, c *conversion.Cloner) error { + if in.Ingress != nil { + out.Ingress = make([]v1.LoadBalancerIngress, len(in.Ingress)) + for i := range in.Ingress { + if err := deepCopy_v1_LoadBalancerIngress(in.Ingress[i], &out.Ingress[i], c); err != nil { + return err + } + } + } else { + out.Ingress = nil + } + return nil +} + func deepCopy_v1_LocalObjectReference(in v1.LocalObjectReference, out *v1.LocalObjectReference, c *conversion.Cloner) error { out.Name = in.Name return nil @@ -1009,6 +1029,97 @@ func deepCopy_v1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerStatus, return nil } +func deepCopy_v1_Ingress(in Ingress, out *Ingress, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil { + return err + } + if err := deepCopy_v1_IngressSpec(in.Spec, &out.Spec, c); err != nil { + return err + } + if err := deepCopy_v1_IngressStatus(in.Status, &out.Status, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1_IngressBackend(in IngressBackend, out *IngressBackend, c *conversion.Cloner) error { + if err := deepCopy_v1_LocalObjectReference(in.ServiceRef, &out.ServiceRef, c); err != nil { + return err + } + if err := deepCopy_util_IntOrString(in.ServicePort, &out.ServicePort, c); err != nil { + return err + } + out.Protocol = in.Protocol + return nil +} + +func deepCopy_v1_IngressList(in IngressList, out *IngressList, c *conversion.Cloner) error { + if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { + return err + } + if err := deepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil { + return err + } + if in.Items != nil { + out.Items = make([]Ingress, len(in.Items)) + for i := range in.Items { + if err := deepCopy_v1_Ingress(in.Items[i], &out.Items[i], c); err != nil { + return err + } + } + } else { + out.Items = nil + } + return nil +} + +func deepCopy_v1_IngressPath(in IngressPath, out *IngressPath, c *conversion.Cloner) error { + out.Path = in.Path + if err := deepCopy_v1_IngressBackend(in.Backend, &out.Backend, c); err != nil { + return err + } + return nil +} + +func deepCopy_v1_IngressRule(in IngressRule, out *IngressRule, c *conversion.Cloner) error { + out.Host = in.Host + if in.Paths != nil { + out.Paths = make([]IngressPath, len(in.Paths)) + for i := range in.Paths { + if err := deepCopy_v1_IngressPath(in.Paths[i], &out.Paths[i], c); err != nil { + return err + } + } + } else { + out.Paths = nil + } + return nil +} + +func deepCopy_v1_IngressSpec(in IngressSpec, out *IngressSpec, c *conversion.Cloner) error { + if in.Rules != nil { + out.Rules = make([]IngressRule, len(in.Rules)) + for i := range in.Rules { + if err := deepCopy_v1_IngressRule(in.Rules[i], &out.Rules[i], c); err != nil { + return err + } + } + } else { + out.Rules = nil + } + return nil +} + +func deepCopy_v1_IngressStatus(in IngressStatus, out *IngressStatus, c *conversion.Cloner) error { + if err := deepCopy_v1_LoadBalancerStatus(in.LoadBalancer, &out.LoadBalancer, c); err != nil { + return err + } + return nil +} + func deepCopy_v1_Job(in Job, out *Job, c *conversion.Cloner) error { if err := deepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil { return err @@ -1315,6 +1426,8 @@ func init() { deepCopy_v1_HostPathVolumeSource, deepCopy_v1_ISCSIVolumeSource, deepCopy_v1_Lifecycle, + deepCopy_v1_LoadBalancerIngress, + deepCopy_v1_LoadBalancerStatus, deepCopy_v1_LocalObjectReference, deepCopy_v1_NFSVolumeSource, deepCopy_v1_ObjectFieldSelector, @@ -1346,6 +1459,13 @@ func init() { deepCopy_v1_HorizontalPodAutoscalerList, deepCopy_v1_HorizontalPodAutoscalerSpec, deepCopy_v1_HorizontalPodAutoscalerStatus, + deepCopy_v1_Ingress, + deepCopy_v1_IngressBackend, + deepCopy_v1_IngressList, + deepCopy_v1_IngressPath, + deepCopy_v1_IngressRule, + deepCopy_v1_IngressSpec, + deepCopy_v1_IngressStatus, deepCopy_v1_Job, deepCopy_v1_JobCondition, deepCopy_v1_JobList, diff --git a/pkg/apis/experimental/v1/register.go b/pkg/apis/experimental/v1/register.go index 88d0514b5a1..32745b3e074 100644 --- a/pkg/apis/experimental/v1/register.go +++ b/pkg/apis/experimental/v1/register.go @@ -46,6 +46,8 @@ func addKnownTypes() { &DaemonSet{}, &ThirdPartyResourceData{}, &ThirdPartyResourceDataList{}, + &Ingress{}, + &IngressList{}, ) } @@ -63,3 +65,5 @@ func (*DaemonSet) IsAnAPIObject() {} func (*DaemonSetList) IsAnAPIObject() {} func (*ThirdPartyResourceData) IsAnAPIObject() {} func (*ThirdPartyResourceDataList) IsAnAPIObject() {} +func (*Ingress) IsAnAPIObject() {} +func (*IngressList) IsAnAPIObject() {} diff --git a/pkg/apis/experimental/v1/types.go b/pkg/apis/experimental/v1/types.go index 33dfa058cf6..b4943c8b79a 100644 --- a/pkg/apis/experimental/v1/types.go +++ b/pkg/apis/experimental/v1/types.go @@ -464,3 +464,80 @@ type JobCondition struct { // Human readable message indicating details about last transition. Message string `json:"message,omitempty"` } + +// An Ingress is a way to give services externally-reachable urls. Each Ingress is a +// collection of rules that allow inbound connections to reach the endpoints defined by +// a backend. +type Ingress struct { + unversioned.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + v1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the desired state of the Ingress. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status + Spec IngressSpec `json:"spec,omitempty"` + + // Status is the current state of the Ingress. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status + Status IngressStatus `json:"status,omitempty"` +} + +// IngressList is a collection of Ingress. +type IngressList struct { + unversioned.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata + unversioned.ListMeta `json:"metadata,omitempty"` + + // Items is the list of Ingress. + Items []Ingress `json:"items"` +} + +// IngressSpec describes the Ingress the user wishes to exist. +type IngressSpec struct { + // TODO: Add the ability to specify load-balancer IP just like what Service has already done? + // A list of rules used to configure the Ingress. + // http://:/? -> IngressBackend + // Where parts of the url conform to RFC 1738. + Rules []IngressRule `json:"rules"` +} + +// IngressStatus describe the current state of the Ingress. +type IngressStatus struct { + // LoadBalancer contains the current status of the load-balancer. + LoadBalancer v1.LoadBalancerStatus `json:"loadBalancer,omitempty"` +} + +// IngressRule represents the rules mapping the paths under a specified host to the related backend services. +type IngressRule struct { + // Host is the fully qualified domain name of a network host, or its IP + // address as a set of four decimal digit groups separated by ".". + // Conforms to RFC 1738. + Host string `json:"host,omitempty"` + + // Paths describe a list of load-balancer rules under the specified host. + Paths []IngressPath `json:"paths"` +} + +// IngressPath associates a path regex with an IngressBackend. +// Incoming urls matching the Path are forwarded to the Backend. +type IngressPath struct { + // Path is a regex matched against the url of an incoming request. + Path string `json:"path,omitempty"` + + // Define the referenced service endpoint which the traffic will be forwarded to. + Backend IngressBackend `json:"backend"` +} + +// IngressBackend describes all endpoints for a given Service, port and protocol. +type IngressBackend struct { + // Specifies the referenced service. + ServiceRef v1.LocalObjectReference `json:"serviceRef"` + + // Specifies the port of the referenced service. + ServicePort util.IntOrString `json:"servicePort,omitempty"` + + // Specifies the protocol of the referenced service. + Protocol v1.Protocol `json:"protocol,omitempty"` +} diff --git a/pkg/apis/experimental/v1/types_swagger_doc_generated.go b/pkg/apis/experimental/v1/types_swagger_doc_generated.go index 49172351079..f8943449a57 100644 --- a/pkg/apis/experimental/v1/types_swagger_doc_generated.go +++ b/pkg/apis/experimental/v1/types_swagger_doc_generated.go @@ -178,6 +178,76 @@ func (HorizontalPodAutoscalerStatus) SwaggerDoc() map[string]string { return map_HorizontalPodAutoscalerStatus } +var map_Ingress = map[string]string{ + "": "An Ingress is a way to give services externally-reachable urls. Each Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend.", + "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + "spec": "Spec is the desired state of the Ingress. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status", + "status": "Status is the current state of the Ingress. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status", +} + +func (Ingress) SwaggerDoc() map[string]string { + return map_Ingress +} + +var map_IngressBackend = map[string]string{ + "": "IngressBackend describes all endpoints for a given Service, port and protocol.", + "serviceRef": "Specifies the referenced service.", + "servicePort": "Specifies the port of the referenced service.", + "protocol": "Specifies the protocol of the referenced service.", +} + +func (IngressBackend) SwaggerDoc() map[string]string { + return map_IngressBackend +} + +var map_IngressList = map[string]string{ + "": "IngressList is a collection of Ingress.", + "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", + "items": "Items is the list of Ingress.", +} + +func (IngressList) SwaggerDoc() map[string]string { + return map_IngressList +} + +var map_IngressPath = map[string]string{ + "": "IngressPath associates a path regex with an IngressBackend. Incoming urls matching the Path are forwarded to the Backend.", + "path": "Path is a regex matched against the url of an incoming request.", + "backend": "Define the referenced service endpoint which the traffic will be forwarded to.", +} + +func (IngressPath) SwaggerDoc() map[string]string { + return map_IngressPath +} + +var map_IngressRule = map[string]string{ + "": "IngressRule represents the rules mapping the paths under a specified host to the related backend services.", + "host": "Host is the fully qualified domain name of a network host, or its IP address as a set of four decimal digit groups separated by \".\". Conforms to RFC 1738.", + "paths": "Paths describe a list of load-balancer rules under the specified host.", +} + +func (IngressRule) SwaggerDoc() map[string]string { + return map_IngressRule +} + +var map_IngressSpec = map[string]string{ + "": "IngressSpec describes the Ingress the user wishes to exist.", + "rules": "A list of rules used to configure the Ingress. http://:/? -> IngressBackend Where parts of the url conform to RFC 1738.", +} + +func (IngressSpec) SwaggerDoc() map[string]string { + return map_IngressSpec +} + +var map_IngressStatus = map[string]string{ + "": "IngressStatus describe the current state of the Ingress.", + "loadBalancer": "LoadBalancer contains the current status of the load-balancer.", +} + +func (IngressStatus) SwaggerDoc() map[string]string { + return map_IngressStatus +} + var map_Job = map[string]string{ "": "Job represents the configuration of a single job.", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",