Navigation Menu

Skip to content
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

endpoint: move patching update functionality to pkg/endpoint #8968

Merged
merged 4 commits into from Aug 22, 2019

Conversation

ianvernon
Copy link
Member

@ianvernon ianvernon commented Aug 20, 2019

A lot of Endpoint implementation information, including locking, internal fields, etc. was being leaked outside of the Endpoint package in the handling of PATCH /endpoint. Factor this into a function within the Endpoint package instead. As a result of this, the function ForcePolicyCompute is no longer used outside of pkg/endpoint, so do not export it.

Signed-off by: Ian Vernon ian@cilium.io


This change is Reviewable

@ianvernon ianvernon added pending-review kind/cleanup This includes no functional changes. labels Aug 20, 2019
@ianvernon ianvernon requested a review from a team as a code owner August 20, 2019 16:02
@ianvernon ianvernon added this to In progress in Endpoint Cleanup via automation Aug 20, 2019
@ianvernon
Copy link
Member Author

test-me-please

@coveralls
Copy link

coveralls commented Aug 20, 2019

Coverage Status

Coverage decreased (-0.03%) to 44.036% when pulling 0f5491b on pr/ianvernon/patch-refactor into 24833f7 on master.

@ianvernon
Copy link
Member Author

ianvernon commented Aug 20, 2019

@ianvernon
Copy link
Member Author

test-me-please

@ianvernon
Copy link
Member Author

test-me-please

Copy link
Contributor

@raybejjani raybejjani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally +1. I'm not very keen on ' ValidPatchTransitionState` but I'm not sure if you wanted to keep this a copy-paste refactor or were willing to change the order of operations.

daemon/endpoint.go Show resolved Hide resolved
// purposes should a caller choose to try to regenerate this endpoint, as well
// as an error if the Endpoint is being deleted, since there is no point in
// changing an Endpoint if it is going to be deleted.
func (e *Endpoint) ProcessChangeRequest(epTemplate *models.EndpointChangeRequest, newEp *Endpoint) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should endpoint.NewEndpointFromChangeModel also move here since it's strictly an API related thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, I'd like to do that. However, I'd have to then perform an endpointmanager lookup in the endpoint to see if the endpoint exists, which I can't do right now because the endpointmanager cannot be provided as a parameter anywhere.

pkg/endpoint/api.go Outdated Show resolved Hide resolved
pkg/endpoint/api.go Show resolved Hide resolved
@ianvernon
Copy link
Member Author

test-me-please

@ianvernon ianvernon added this to the 1.7 milestone Aug 21, 2019
@ianvernon
Copy link
Member Author

@ianvernon
Copy link
Member Author

test-me-please

Ian Vernon added 4 commits August 22, 2019 08:04
…oint package

This removes the leakage of a lot of internal endpoint implementations
unnecessarily. Hide this in a function which the daemon can call instead.

Signed-off by: Ian Vernon <ian@cilium.io>
This function is only used by `pkg/endpoint` now, do not export it.

Signed-off by: Ian Vernon <ian@cilium.io>
The `newEp` parameter has all the information we need; we don't need to pass in
the API model as well. As such, move the `ValidPatchTransitionState` function
out of `pkg/endpoint` back to `daemon` since the Endpoint package should not be
aware of what a `PATCH` operation is against it.

Signed-off by: Ian Vernon <ian@cilium.io>
Signed-off by: Ian Vernon <ian@cilium.io>
@ianvernon
Copy link
Member Author

Had to resolve conflicts, testing again

@ianvernon
Copy link
Member Author

test-me-please

@ianvernon
Copy link
Member Author

Running tests again, Cilium operator is taking forever to get ready:

10:45:41  STEP: Waiting for cilium-operator to be ready
10:49:09  STEP: Waiting for kube-dns to be ready

@ianvernon
Copy link
Member Author

test-me-please

@ianvernon
Copy link
Member Author

Failure is BPF NodePort with VXLAN: https://jenkins.cilium.io/job/Cilium-PR-Ginkgo-Tests-Validated/14596/testReport/junit/Suite-k8s-1/10/K8sServicesTest_Checks_service_across_nodes_Tests_NodePort_BPF_Tests_with_vxlan/

Unrelated to these changes - this has been flaky in master. Merging.

@ianvernon ianvernon merged commit 4d744c9 into master Aug 22, 2019
Endpoint Cleanup automation moved this from In progress to Done Aug 22, 2019
@ianvernon ianvernon deleted the pr/ianvernon/patch-refactor branch August 22, 2019 18:51
@aanm aanm added the release-note/misc This PR makes changes that have no direct user impact. label Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup This includes no functional changes. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants