Updating apiserver Endpoints management to set skip-mirror label

This will ensure that the self-referential kubernetes Endpoints
resources is not mirrored by the EndpointSliceMirroring controller.
This commit is contained in:
Rob Scott
2020-06-26 16:16:06 -07:00
parent 8691466059
commit 0695896caa
6 changed files with 136 additions and 69 deletions

View File

@@ -76,6 +76,11 @@ func (r *masterCountEndpointReconciler) ReconcileEndpoints(serviceName string, i
},
}
}
// Don't use the EndpointSliceMirroring controller to mirror this to
// EndpointSlices. This may change in the future.
skipMirrorChanged := setSkipMirrorTrue(e)
if errors.IsNotFound(err) {
// Simply create non-existing endpoints for the service.
e.Subsets = []corev1.EndpointSubset{{
@@ -99,7 +104,8 @@ func (r *masterCountEndpointReconciler) ReconcileEndpoints(serviceName string, i
_, err = r.epAdapter.Update(metav1.NamespaceDefault, e)
return err
}
if ipCorrect && portsCorrect {
if !skipMirrorChanged && ipCorrect && portsCorrect {
return r.epAdapter.EnsureEndpointSliceFromEndpoints(metav1.NamespaceDefault, e)
}
if !ipCorrect {