@@ -57,7 +57,7 @@ with the GatewayClass resource. However, until Gateway/GatewayClass APIs become
57
57
support similar functionality for Services of Type=LoadBalancer. Introducing a new resource like
58
58
` ServiceClass ` is probably not worthwhile given that there are new APIs already in development.
59
59
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 ` .
61
61
62
62
## Motivation
63
63
@@ -83,7 +83,7 @@ to disabling it from the cloud provider.
83
83
84
84
## Proposal
85
85
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
87
87
multiple implementations of Service Type=LoadBalancer in a cluster.
88
88
89
89
### User Stories (Optional)
@@ -107,14 +107,14 @@ rely on protocols from hardware load balancers.
107
107
### Risks and Mitigations
108
108
109
109
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
111
111
cloud providers need to start accounting for both existing annotations and the new field.
112
112
113
113
## Design Details
114
114
115
- Introduce a new field to Service ` spec.loadBalancerClassName ` .
115
+ Introduce a new field to Service ` spec.loadBalancerClass ` .
116
116
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
118
118
ownership of the Service Type=LoadBalancer resource. This is required to not break existing clusters
119
119
that assume Service Type=LoadBalancer is always managed by the cloud provider.
120
120
@@ -125,21 +125,22 @@ type ServiceSpec struct {
125
125
...
126
126
...
127
127
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.
129
129
// This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load
130
130
// balancer implementation is used, today this is typically done through the cloud provider integration,
131
131
// but should apply for any default implementation. If set, it is assumed that a load balancer
132
132
// implementation is watching for Services with a matching class name. Any default load balancer
133
133
// implementation (e.g. cloud providers) should ignore Services that set this field.
134
134
// +optional
135
- LoadBalancerClassName string ` json:"loadBalancerClassName ,omitempty"`
135
+ LoadBalancerClassName string ` json:"loadBalancerClass ,omitempty"`
136
136
}
137
137
```
138
138
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
143
144
the feature gate is enabled.
144
145
145
146
Required updates to service controller:
@@ -150,24 +151,27 @@ Required updates to service controller:
150
151
151
152
Unit tests:
152
153
* 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
154
155
or an existing Service has the field set.
155
156
* test API validation for immutability.
156
157
158
+ Integration tests:
159
+ * test that the class field is propoerly cleared/validated when the Service type changes to and from ` LoadBalancer ` .
160
+
157
161
E2E tests:
158
162
* test that creating a Service with an unknown class name results in no load balancer being created for a Service.
159
163
160
164
### Graduation Criteria
161
165
162
166
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.
164
168
* when enabled, service controller will ignore Service LBs with a non-empty class name.
165
169
* unit tests for service controller.
166
170
* unit tests for API strategy (drop disabled fields).
167
171
168
172
### Upgrade / Downgrade Strategy
169
173
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
171
175
has the field set already. This ensures apiserver can handle the new field on downgrade.
172
176
* On upgrade, if the feature gate is enabled, there should be no changes since the default behavior has not changed
173
177
(service controller calls the cloud provider to reconcile load balancers).
0 commit comments