Skip to content

Commit

Permalink
operator: fix CEP GC
Browse files Browse the repository at this point in the history
When CEP was converted to an internal CEP structure, the UID
field was not copied, causing the delete requests of CEPs to have their
UID precondition set as empty. When kube-apiserver received this delete
request it didn't delete the CEP because an empty CEP UID didn't match
an existent UID.

Fixes: 6f7bf6c ("Prevent CiliumEndpoint removal by non-owning agent")

Reported-by: Bruno Custódio <bruno@isovalent.com>
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Nov 22, 2022
1 parent 3a5e985 commit 6c98f15
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion operator/cmd/k8s_cep_gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func doCiliumEndpointSyncGC(ctx context.Context, clientset k8sClient.Clientset,
case err == nil:
successfulEndpointObjectGC()
case k8serrors.IsNotFound(err), k8serrors.IsConflict(err):
// No-op.
scopedLog.WithError(err).Debug("Unable to delete CEP, will retry again")
default:
scopedLog.WithError(err).Warning("Unable to delete orphaned CEP")
failedEndpointObjectGC()
Expand Down
2 changes: 2 additions & 0 deletions operator/watchers/cilium_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func convertToCiliumEndpoint(obj interface{}) interface{} {
Namespace: concreteObj.Namespace,
ResourceVersion: concreteObj.ResourceVersion,
OwnerReferences: concreteObj.OwnerReferences,
UID: concreteObj.UID,
},
Status: cilium_api_v2.EndpointStatus{
Identity: concreteObj.Status.Identity,
Expand All @@ -156,6 +157,7 @@ func convertToCiliumEndpoint(obj interface{}) interface{} {
Namespace: ciliumEndpoint.Namespace,
ResourceVersion: ciliumEndpoint.ResourceVersion,
OwnerReferences: ciliumEndpoint.OwnerReferences,
UID: ciliumEndpoint.UID,
},
Status: cilium_api_v2.EndpointStatus{
Identity: ciliumEndpoint.Status.Identity,
Expand Down

0 comments on commit 6c98f15

Please sign in to comment.