New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pod as an owner of a CiliumEndpoint and remove useless Delete #11195
Conversation
test-me-please |
215aa3d
to
60765fa
Compare
test-me-please |
Signed-off-by: André Martins <andre@cilium.io>
Signed-off-by: André Martins <andre@cilium.io>
During initialization, it is not required to delete the CEP as we will overwrite its status regardless of the state stored in k8s. Signed-off-by: André Martins <andre@cilium.io>
60765fa
to
59a5141
Compare
As a CiliumEndpoint can't exist without a Pod, we should set the Pod as an Owner of a particular endpoint. This will allow CiliumEndpoints from being automatically GCed by K8s once the Pod is gone. Signed-off-by: André Martins <andre@cilium.io>
59a5141
to
8c9bbad
Compare
test-me-please |
@@ -130,34 +130,37 @@ func (epSync *EndpointSynchronizer) RunK8sCiliumEndpointSync(e *endpoint.Endpoin | |||
return nil | |||
} | |||
|
|||
scopedLog.Debug("Deleting CEP during an initialization") | |||
err := ciliumClient.CiliumEndpoints(namespace).Delete(ctx, podName, meta_v1.DeleteOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was done a long time ago when we changed the format of the CIliumEndpoint at the very beginning for this feature and this allowed to up and downgrade.
@@ -211,6 +212,9 @@ type Endpoint struct { | |||
// K8sNamespace is the Kubernetes namespace of the endpoint | |||
K8sNamespace string | |||
|
|||
// pod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💎
Remove Delete operation when starting up Cilium which removes the CiliumEndpoint in the k8s apiserver. This is unnecessary since CiliumEndpoint will be updated immediately afterwards.
As a CiliumEndpoint can't exist without a Pod, we should set the Pod as an Owner of a particular endpoint.
This will allow CiliumEndpoints from being automatically GCed by K8s once the Pod is gone.