Skip to content

Commit acb5ec5

Browse files
committed
KEP-1959: Service Type=LoadBalancer Class Annotation
Signed-off-by: Andrew Sy Kim <[email protected]>
1 parent 1b35274 commit acb5ec5

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# KEP-1959: Service Type=LoadBalancer Class Annotations
2+
3+
<!-- toc -->
4+
- [Release Signoff Checklist](#release-signoff-checklist)
5+
- [Summary](#summary)
6+
- [Motivation](#motivation)
7+
- [Goals](#goals)
8+
- [Non-Goals](#non-goals)
9+
- [Proposal](#proposal)
10+
- [User Stories (Optional)](#user-stories-optional)
11+
- [Story 1](#story-1)
12+
- [Story 2](#story-2)
13+
- [Risks and Mitigations](#risks-and-mitigations)
14+
- [Design Details](#design-details)
15+
- [Test Plan](#test-plan)
16+
- [Graduation Criteria](#graduation-criteria)
17+
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
18+
- [Version Skew Strategy](#version-skew-strategy)
19+
- [Implementation History](#implementation-history)
20+
- [Drawbacks](#drawbacks)
21+
- [Alternatives](#alternatives)
22+
- [ServiceClass Resource](#serviceclass-resource)
23+
- [Provider-Specific Annotations](#provider-specific-annotations)
24+
- [Infrastructure Needed (Optional)](#infrastructure-needed-optional)
25+
<!-- /toc -->
26+
27+
## Release Signoff Checklist
28+
29+
Items marked with (R) are required *prior to targeting to a milestone / release*.
30+
31+
- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
32+
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
33+
- [ ] (R) Design details are appropriately documented
34+
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input
35+
- [ ] (R) Graduation criteria is in place
36+
- [ ] (R) Production readiness review completed
37+
- [ ] Production readiness review approved
38+
- [ ] "Implementation History" section is up-to-date for milestone
39+
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
40+
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
41+
42+
[kubernetes.io]: https://kubernetes.io/
43+
[kubernetes/enhancements]: https://git.k8s.io/enhancements
44+
[kubernetes/kubernetes]: https://git.k8s.io/kubernetes
45+
[kubernetes/website]: https://git.k8s.io/website
46+
47+
## Summary
48+
49+
When Service Type=LoadBalancer is enabled by a Kubernetes cloud provider, it is a global
50+
configuration that applies for all Service Type=LoadBalancer resources in a given cluster.
51+
This becomes problematic if users want to leverage multiple Service Type=LoadBalancer
52+
implementations in a given cluster.
53+
54+
The new [Services APIs](https://github.com/kubernetes-sigs/service-apis) addresses this already
55+
with the GatewayClass resource. However, until Gateway/GatewayClass APIs become mature, we should
56+
support similar functionality for Services of Type=LoadBalancer. Introducing a new resource like
57+
`ServiceClass` is probably not worthwhile given that there are new APIs already in development.
58+
This KEP proposes a light-weight approach for Service Type=LoadBalancer by introducing a Service
59+
annotation `service.kubernetes.io/load-balancer-class`.
60+
61+
## Motivation
62+
63+
The main use-case for this feature is being able to support multiple Service Type=LoadBalancer
64+
implementations in a cluster, as different workloads may want to leverage different loadbalancer
65+
providers based on efficiency, availability, cost and other factors.
66+
67+
For example, a cluster admin may want to use a public load balancer from a cloud provider
68+
for workloads that must be assigned a publically routable address, but they may want to
69+
enable a lower-cost solution for workloads that are only internally accessible.
70+
71+
### Goals
72+
73+
* allow users to opt-out of the Service Type=LoadBalancer implementation by the cloud provider.
74+
* allow multiple implementations of Service Type=LoadBalancer in a given cluster.
75+
76+
### Non-Goals
77+
78+
* performance improvements for Service Type=LoadBalancer.
79+
* changing any other existing behaviors for Service Type=LoadBalancer aside from being able
80+
to disabling it from the cloud provider.
81+
82+
## Proposal
83+
84+
This KEP proposes to add a new Service annotation `service.kubernetes.io/load-balancer-class`
85+
that allows for multiple implementations of Service Type=LoadBalancer in a cluster.
86+
87+
### User Stories (Optional)
88+
89+
#### Story 1
90+
91+
As a cluster admin:
92+
* I want to use my cloud provider's public load balancer service for applications that require
93+
public ingress.
94+
* I want to use my own load balancing solution for any applications that only talk internally
95+
within my own network because I want to save costs.
96+
97+
#### Story 2
98+
99+
As an application developer:
100+
* I MUST use a hardware-based loadbalancer for certain applications due to specific protocols
101+
only available there.
102+
* I want to use the cloud provider's default load balancer for any applications that do not
103+
rely on protocols from hardware load balancers.
104+
105+
### Risks and Mitigations
106+
107+
Many Service Type=LoadBalancer implementations today support a lot of knobs via annotations already.
108+
Introducing yet another annotation for Service Type=LoadBalancer is not ideal, but this is better than
109+
every cloud provider supporting their own "skip this Service" annotation.
110+
111+
## Design Details
112+
113+
Introduce a new Service annotation `service.kubernetes.io/load-balancer-class`.
114+
115+
If the loadbalancer class annotation is not set, the existing cloud provider
116+
will assume ownership of the Service Type=LoadBalancer resource. This is required
117+
to not break existing clusters that assume Service Type=LoadBalancer is always
118+
managed by the cloud provider.
119+
120+
Required updates to service controller:
121+
* if the class annotation is NOT set for a Service, allow the cloud provider
122+
to reconcile the load balancer.
123+
* if the class annotation IS set for a Service, skip reconciliation of the Service
124+
by the cloud provider.
125+
126+
### Test Plan
127+
128+
Unit tests:
129+
* test that service controller does not call the cloud provider if the class annotation is set.
130+
* the annotation `service.kubernetes.io/load-balancer-class` is not accepted when the feature gate `ServiceLoadBalancerClass` is disabled.
131+
132+
E2E tests:
133+
* test that creating a Service with an unknown class annotation results in no load balancer being created for a Service.
134+
135+
### Graduation Criteria
136+
137+
N/A since we can't apply alpha/beta/GA criteria for annotations.
138+
139+
### Upgrade / Downgrade Strategy
140+
141+
On upgrade, use of this annotation will be allowed. On downgrade, service controller
142+
may ignore existing Services with the annotation, leading to multiple implementations
143+
trying to create load balancers. On downgrade, if the class annotation is used
144+
and there are multiple implementations of Service Type=LoadBalancer, a user must ensure
145+
there is only 1 implementation of Service Type=LoadBalancer in the cluster.
146+
147+
Though the downgrade scenario isn't ideal, it is assumed if that a cluster was upgraded to v1.20,
148+
and already has multiple Service Type=LoadBalancer implementations enabled, it will likely not be
149+
downgrading to v1.19 anytime soon.
150+
151+
### Version Skew Strategy
152+
153+
N/A since this only impacts one component.
154+
155+
## Implementation History
156+
157+
- the `Summary`, `Motivation`, `Proposal` and `Design Details` sections was merged, signaling SIG acceptance
158+
159+
## Drawbacks
160+
161+
* Annotations are a clunky way to implement "Class" semantics to Service Type=LoadBalancer.
162+
* In **most** clusters, a single Service Type=LoadBalancer implementation from the cloud provider is sufficient.
163+
* The potential risks during downgrade can cause outages if Service Status is updated by the wrong load balancer implementation.
164+
165+
## Alternatives
166+
167+
### ServiceClass Resource
168+
169+
Similar to GatewayClass and IngressClass, we could introduce a new resource so that multiple implementations of
170+
Service Type=LoadBalancer can exist, however, a new resource just for Service Type=LoadBalancer seems unnecessary,
171+
especially if GatewayClass will satisfy this use-case better in the near future.
172+
173+
### Provider-Specific Annotations
174+
175+
Instead of a generic Kubernetes annotation read by service controller, each cloud provider could implement
176+
their own "skip this Service"-like logic with custom annotations. Given that many cloud providers have been
177+
asking for this feature, a generic well-known annotation used across all providers may be more beneficial.
178+
179+
## Infrastructure Needed (Optional)
180+
181+
<!--
182+
Use this section if you need things from the project/SIG. Examples include a
183+
new subproject, repos requested, or GitHub details. Listing these here allows a
184+
SIG to get the process for these resources started right away.
185+
-->
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
title: Service Type=LoadBalancer Class Annotation
2+
kep-number: 1959
3+
authors:
4+
- "@andrewsykim"
5+
owning-sig: sig-cloud-provider
6+
participating-sigs:
7+
- sig-network
8+
status: implementable
9+
creation-date: 2020-08-31
10+
reviewers:
11+
- "@bowei"
12+
- "@cheftako"
13+
- "@thockin"
14+
approvers:
15+
- "@bowei"
16+
- "@cheftako"
17+
- "@thockin"
18+
prr-approvers:
19+
- "@johnbelamaric"
20+
21+
# The target maturity stage in the current dev cycle for this KEP.
22+
stage: stable
23+
24+
# The most recent milestone for which work toward delivery of this KEP has been
25+
# done. This can be the current (upcoming) milestone, if it is being actively
26+
# worked on.
27+
latest-milestone: "v1.20"
28+
29+
# The milestone at which this feature was, or is targeted to be, at each stage.
30+
milestone:
31+
stable: "v1.20"
32+

0 commit comments

Comments
 (0)