Skip to content

Commit 6221851

Browse files
committed
address feedback from Tim:
* update field name to loadBalancerClass * validate field against label-style format * only enforce immutability when the type is LoadBalancer * add requirements for integration tests Signed-off-by: Andrew Sy Kim <[email protected]>
1 parent 4ba7d87 commit 6221851

File tree

1 file changed

+18
-14
lines changed
  • keps/sig-cloud-provider/1959-service-lb-class-field

1 file changed

+18
-14
lines changed

keps/sig-cloud-provider/1959-service-lb-class-field/README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ with the GatewayClass resource. However, until Gateway/GatewayClass APIs become
5757
support similar functionality for Services of Type=LoadBalancer. Introducing a new resource like
5858
`ServiceClass` is probably not worthwhile given that there are new APIs already in development.
5959
This KEP proposes a light-weight approach for Service Type=LoadBalancer by introducing a Service
60-
field `service.spec.loadBalancerClassName`.
60+
field `service.spec.loadBalancerClass`.
6161

6262
## Motivation
6363

@@ -83,7 +83,7 @@ to disabling it from the cloud provider.
8383

8484
## Proposal
8585

86-
This KEP proposes to add a new field `spec.loadBalancerClassName` in Service which allows for
86+
This KEP proposes to add a new field `spec.loadBalancerClass` in Service which allows for
8787
multiple implementations of Service Type=LoadBalancer in a cluster.
8888

8989
### User Stories (Optional)
@@ -107,14 +107,14 @@ rely on protocols from hardware load balancers.
107107
### Risks and Mitigations
108108

109109
Many cloud providers today support an "opt-out" annotation for this behavior. The annotation is specific
110-
to the cloud provider. Introduction of the `loadBalancerClassName` field at this point would mean that
110+
to the cloud provider. Introduction of the `loadBalancerClass` field at this point would mean that
111111
cloud providers need to start accounting for both existing annotations and the new field.
112112

113113
## Design Details
114114

115-
Introduce a new field to Service `spec.loadBalancerClassName`.
115+
Introduce a new field to Service `spec.loadBalancerClass`.
116116

117-
If the field `spec.loadBalancerClassName` is not set, the existing cloud provider will assume
117+
If the field `spec.loadBalancerClass` is not set, the existing cloud provider will assume
118118
ownership of the Service Type=LoadBalancer resource. This is required to not break existing clusters
119119
that assume Service Type=LoadBalancer is always managed by the cloud provider.
120120

@@ -125,21 +125,22 @@ type ServiceSpec struct {
125125
...
126126
...
127127

128-
// loadBalancerClassName is the name of the load balancer implementation this Service belongs to.
128+
// loadBalancerClass is the name of the load balancer implementation this Service belongs to.
129129
// This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load
130130
// balancer implementation is used, today this is typically done through the cloud provider integration,
131131
// but should apply for any default implementation. If set, it is assumed that a load balancer
132132
// implementation is watching for Services with a matching class name. Any default load balancer
133133
// implementation (e.g. cloud providers) should ignore Services that set this field.
134134
// +optional
135-
LoadBalancerClassName string `json:"loadBalancerClassName,omitempty"`
135+
LoadBalancerClassName string `json:"loadBalancerClass,omitempty"`
136136
}
137137
```
138138

139-
* `loadBalancerClassName` will be immutable so that existing and future implementations do not have to worry
140-
about handling Services that change the class name.
141-
* `loadBalancerClassName` can carry arbitrary string values.
142-
* the `loadBalancerClassName` field will be feature gated. The field will be dropped during API strategy unless
139+
* `loadBalancerClass` will be immutable only when the Service type is `LoadBalancer`, this way existing and future implementations
140+
do not have to worry about handling Services that change the class name. The class name is mutable and can be cleared when the
141+
type changes.
142+
* `loadBalancerClass` will be validated against label-style format.
143+
* the `loadBalancerClass` field will be feature gated. The field will be dropped during API strategy unless
143144
the feature gate is enabled.
144145

145146
Required updates to service controller:
@@ -150,24 +151,27 @@ Required updates to service controller:
150151

151152
Unit tests:
152153
* test that service controller does not call the cloud provider if the class field is set.
153-
* test API strategy to ensure the `loadBalancerClassName` field is dropped unless the feature gate is enabled
154+
* test API strategy to ensure the `loadBalancerClass` field is dropped unless the feature gate is enabled
154155
or an existing Service has the field set.
155156
* test API validation for immutability.
156157

158+
Integration tests:
159+
* test that the class field is propoerly cleared/validated when the Service type changes to and from `LoadBalancer`.
160+
157161
E2E tests:
158162
* test that creating a Service with an unknown class name results in no load balancer being created for a Service.
159163

160164
### Graduation Criteria
161165

162166
Alpha:
163-
* the `loadBalancerClassName` field is added to Service with an alpha feature gate.
167+
* the `loadBalancerClass` field is added to Service with an alpha feature gate.
164168
* when enabled, service controller will ignore Service LBs with a non-empty class name.
165169
* unit tests for service controller.
166170
* unit tests for API strategy (drop disabled fields).
167171

168172
### Upgrade / Downgrade Strategy
169173

170-
* Usage of `loadBalancerClassName` will be off by default during the alpha stage but can handle existing Services that
174+
* Usage of `loadBalancerClass` will be off by default during the alpha stage but can handle existing Services that
171175
has the field set already. This ensures apiserver can handle the new field on downgrade.
172176
* On upgrade, if the feature gate is enabled, there should be no changes since the default behavior has not changed
173177
(service controller calls the cloud provider to reconcile load balancers).

0 commit comments

Comments
 (0)