Skip to content

Commit fdb2cb4

Browse files
authored
Merge pull request kubernetes#88509 from robscott/ingress-v1beta1-class
Adding IngressClass to networking/v1beta1
2 parents 1d40721 + 132d2af commit fdb2cb4

File tree

76 files changed

+4757
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4757
-406
lines changed

api/openapi-spec/swagger.json

Lines changed: 891 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/extensions/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/networking/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
5050
&NetworkPolicyList{},
5151
&Ingress{},
5252
&IngressList{},
53+
&IngressClass{},
54+
&IngressClassList{},
5355
)
5456
return nil
5557
}

pkg/apis/networking/types.go

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,23 @@ type IngressList struct {
235235

236236
// IngressSpec describes the Ingress the user wishes to exist.
237237
type IngressSpec struct {
238-
// A default backend capable of servicing requests that don't match any
239-
// rule. At least one of 'backend' or 'rules' must be specified. This field
240-
// is optional to allow the loadbalancer controller or defaulting logic to
241-
// specify a global default.
238+
// IngressClassName is the name of the IngressClass cluster resource. The
239+
// associated IngressClass defines which controller will implement the
240+
// resource. This replaces the deprecated `kubernetes.io/ingress.class`
241+
// annotation. For backwards compatibility, when that annotation is set, it
242+
// must be given precedence over this field. The controller may emit a
243+
// warning if the field and annotation have different values.
244+
// Implementations of this API should ignore Ingresses without a class
245+
// specified. An IngressClass resource may be marked as default, which can
246+
// be used to set a default value for this field. For more information,
247+
// refer to the IngressClass documentation.
248+
// +optional
249+
IngressClassName *string
250+
251+
// Backend is a default backend capable of servicing requests that don't
252+
// match any rule. At least one of 'backend' or 'rules' must be specified.
253+
// This field is optional to allow the loadbalancer controller or defaulting
254+
// logic to specify a global default.
242255
// +optional
243256
Backend *IngressBackend
244257

@@ -257,6 +270,55 @@ type IngressSpec struct {
257270
// TODO: Add the ability to specify load-balancer IP through claims
258271
}
259272

273+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
274+
275+
// IngressClass represents the class of the Ingress, referenced by the Ingress
276+
// Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be
277+
// used to indicate that an IngressClass should be considered default. When a
278+
// single IngressClass resource has this annotation set to true, new Ingress
279+
// resources without a class specified will be assigned this default class.
280+
type IngressClass struct {
281+
metav1.TypeMeta
282+
metav1.ObjectMeta
283+
284+
// Spec is the desired state of the IngressClass.
285+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
286+
// +optional
287+
Spec IngressClassSpec
288+
}
289+
290+
// IngressClassSpec provides information about the class of an Ingress.
291+
type IngressClassSpec struct {
292+
// Controller refers to the name of the controller that should handle this
293+
// class. This allows for different "flavors" that are controlled by the
294+
// same controller. For example, you may have different Parameters for the
295+
// same implementing controller. This should be specified as a
296+
// domain-prefixed path no more than 250 characters in length, e.g.
297+
// "acme.io/ingress-controller". This field is immutable.
298+
Controller string
299+
300+
// Parameters is a link to a resource containing additional configuration
301+
// for the controller. This is optional if the controller does not require
302+
// extra parameters. Example configuration resources include
303+
// `core.ConfigMap` or a controller specific Custom Resource.
304+
// +optional
305+
Parameters *api.TypedLocalObjectReference
306+
}
307+
308+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
309+
310+
// IngressClassList is a collection of IngressClasses.
311+
type IngressClassList struct {
312+
metav1.TypeMeta
313+
// Standard object's metadata.
314+
// +optional
315+
metav1.ListMeta
316+
317+
// Items is the list of IngressClasses.
318+
// +listType=set
319+
Items []IngressClass
320+
}
321+
260322
// IngressTLS describes the transport layer security associated with an Ingress.
261323
type IngressTLS struct {
262324
// Hosts are a list of hosts included in the TLS certificate. The values in
@@ -265,11 +327,11 @@ type IngressTLS struct {
265327
// Ingress, if left unspecified.
266328
// +optional
267329
Hosts []string
268-
// SecretName is the name of the secret used to terminate SSL traffic on 443.
269-
// Field is left optional to allow SSL routing based on SNI hostname alone.
270-
// If the SNI host in a listener conflicts with the "Host" header field used
271-
// by an IngressRule, the SNI host is used for termination and value of the
272-
// Host header is used for routing.
330+
// SecretName is the name of the secret used to terminate TLS traffic on
331+
// port 443. Field is left optional to allow TLS routing based on SNI
332+
// hostname alone. If the SNI host in a listener conflicts with the "Host"
333+
// header field used by an IngressRule, the SNI host is used for termination
334+
// and value of the Host header is used for routing.
273335
// +optional
274336
SecretName string
275337
// TODO: Consider specifying different modes of termination, protocols etc.

pkg/apis/networking/v1beta1/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ go_library(
1313
],
1414
importpath = "k8s.io/kubernetes/pkg/apis/networking/v1beta1",
1515
deps = [
16+
"//pkg/apis/core:go_default_library",
1617
"//pkg/apis/core/v1:go_default_library",
1718
"//pkg/apis/networking:go_default_library",
19+
"//staging/src/k8s.io/api/core/v1:go_default_library",
1820
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
1921
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
2022
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",

pkg/apis/networking/v1beta1/zz_generated.conversion.go

Lines changed: 107 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/networking/validation/BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ go_test(
1717
"//pkg/apis/core:go_default_library",
1818
"//pkg/apis/networking:go_default_library",
1919
"//pkg/features:go_default_library",
20+
"//staging/src/k8s.io/apimachinery/pkg/api/validation:go_default_library",
2021
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
2122
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
2223
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
24+
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
2325
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
2426
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
27+
"//vendor/k8s.io/utils/pointer:go_default_library",
2528
],
2629
)
2730

@@ -38,6 +41,7 @@ go_library(
3841
"//pkg/apis/networking:go_default_library",
3942
"//pkg/features:go_default_library",
4043
"//staging/src/k8s.io/apimachinery/pkg/api/validation:go_default_library",
44+
"//staging/src/k8s.io/apimachinery/pkg/api/validation/path:go_default_library",
4145
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library",
4246
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
4347
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",

0 commit comments

Comments
 (0)