mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Add Ingress API Resource Type for L7 loadbalancing
This commit is contained in:
parent
cad5f03311
commit
a5e23ef5ca
@ -42,6 +42,8 @@ func addKnownTypes() {
|
|||||||
&DaemonSet{},
|
&DaemonSet{},
|
||||||
&ThirdPartyResourceData{},
|
&ThirdPartyResourceData{},
|
||||||
&ThirdPartyResourceDataList{},
|
&ThirdPartyResourceDataList{},
|
||||||
|
&Ingress{},
|
||||||
|
&IngressList{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,3 +61,5 @@ func (*DaemonSet) IsAnAPIObject() {}
|
|||||||
func (*DaemonSetList) IsAnAPIObject() {}
|
func (*DaemonSetList) IsAnAPIObject() {}
|
||||||
func (*ThirdPartyResourceData) IsAnAPIObject() {}
|
func (*ThirdPartyResourceData) IsAnAPIObject() {}
|
||||||
func (*ThirdPartyResourceDataList) IsAnAPIObject() {}
|
func (*ThirdPartyResourceDataList) IsAnAPIObject() {}
|
||||||
|
func (*Ingress) IsAnAPIObject() {}
|
||||||
|
func (*IngressList) IsAnAPIObject() {}
|
||||||
|
@ -462,3 +462,80 @@ type JobCondition struct {
|
|||||||
// Human readable message indicating details about last transition.
|
// Human readable message indicating details about last transition.
|
||||||
Message string `json:"message,omitempty"`
|
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://<host>:<port>/<path>?<searchpart> -> 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"`
|
||||||
|
}
|
||||||
|
@ -46,6 +46,8 @@ func addKnownTypes() {
|
|||||||
&DaemonSet{},
|
&DaemonSet{},
|
||||||
&ThirdPartyResourceData{},
|
&ThirdPartyResourceData{},
|
||||||
&ThirdPartyResourceDataList{},
|
&ThirdPartyResourceDataList{},
|
||||||
|
&Ingress{},
|
||||||
|
&IngressList{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,3 +65,5 @@ func (*DaemonSet) IsAnAPIObject() {}
|
|||||||
func (*DaemonSetList) IsAnAPIObject() {}
|
func (*DaemonSetList) IsAnAPIObject() {}
|
||||||
func (*ThirdPartyResourceData) IsAnAPIObject() {}
|
func (*ThirdPartyResourceData) IsAnAPIObject() {}
|
||||||
func (*ThirdPartyResourceDataList) IsAnAPIObject() {}
|
func (*ThirdPartyResourceDataList) IsAnAPIObject() {}
|
||||||
|
func (*Ingress) IsAnAPIObject() {}
|
||||||
|
func (*IngressList) IsAnAPIObject() {}
|
||||||
|
@ -464,3 +464,80 @@ type JobCondition struct {
|
|||||||
// Human readable message indicating details about last transition.
|
// Human readable message indicating details about last transition.
|
||||||
Message string `json:"message,omitempty"`
|
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://<host>:<port>/<path>?<searchpart> -> 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"`
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user