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

Use Patch instead of Update for k8s Service client #1127

Merged
merged 2 commits into from
Oct 7, 2020

Conversation

skmatti
Copy link
Contributor

@skmatti skmatti commented Jun 3, 2020

This replaces of all instances of update calls of k8s Service resource from this controller.

Also, this uses k8s service helper function to patch Service.

/assign @freehan @prameshj

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 3, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @skmatti. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 3, 2020
func PatchServiceLoadBalancerStatus(client coreclient.CoreV1Interface, svc *corev1.Service, newStatus corev1.LoadBalancerStatus) error {
newSvc := svc.DeepCopy()
newSvc.Status.LoadBalancer = newStatus
_, err := svchelpers.PatchService(client, svc, newSvc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for reusing this!

@prameshj
Copy link
Contributor

prameshj commented Jun 3, 2020

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 3, 2020
skmatti added a commit to skmatti/kubernetes that referenced this pull request Jun 5, 2020
All the `update` calls are removed in Ingress-GCE in
kubernetes/ingress-gce#1125 and kubernetes/ingress-gce#1127.
Also, adds permissions for frontendconfig CRD.
skmatti added a commit to skmatti/ingress-gce that referenced this pull request Jun 5, 2020
This removes `update` permissions for Pod, Service and Ingress resources.
All the `update` calls are removed in Ingress-GCE in
kubernetes#1125 and kubernetes#1127.
pkg/utils/common/common.go Outdated Show resolved Hide resolved
pkg/utils/common/common.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 6, 2020
@skmatti skmatti force-pushed the patch-svc branch 2 times, most recently from d607135 to 8ce841f Compare June 8, 2020 05:05
@bowei
Copy link
Member

bowei commented Jun 8, 2020

Having both utils/common and utils/ doesn't make sense to me.
How about we just collapse common into utils/

@skmatti
Copy link
Contributor Author

skmatti commented Jun 8, 2020

Having both utils/common and utils/ doesn't make sense to me.
How about we just collapse common into utils/

Its because we will run into an import cycle if not. Both Namer and Finalizer workflows are in utils. I will move those out of utils and fix the import cycle in a followup PR.

@skmatti
Copy link
Contributor Author

skmatti commented Jun 8, 2020

Having both utils/common and utils/ doesn't make sense to me.
How about we just collapse common into utils/

I have used a different package patch for all patch methods. Currently, there are many import cycles if we merge common into utils.
Finalizer -> Utils -> Finalizer
Namer -> Utils -> Namer

We created common package so that these import cycles are resolved. Maybe we can clean that up later as it exists from longtime now.

@bowei
Copy link
Member

bowei commented Jun 8, 2020

I think the only thing that really causes the issue is the import of utils/namer from utils/, which is just one file. If we move that out somewhere else, does that resolve the issue/

@skmatti
Copy link
Contributor Author

skmatti commented Jun 8, 2020

I think the only thing that really causes the issue is the import of utils/namer from utils/, which is just one file. If we move that out somewhere else, does that resolve the issue/

This is the line that references namer (

"k8s.io/ingress-gce/pkg/utils/namer"
).
If I move this to say serviceport package, the import cycle would be
serviceport -> utils/namer -> utils -> serviceport
because of this(
func TraverseIngressBackends(ing *v1beta1.Ingress, process func(id ServicePortID) bool) {
)

Same with finalizer workflow because of this (

return common.IsDeletionCandidate(ing.ObjectMeta) || !IsGLBCIngress(ing)
)

spencerhance pushed a commit to spencerhance/ingress-gce that referenced this pull request Aug 20, 2020
This removes `update` permissions for Pod, Service and Ingress resources.
All the `update` calls are removed in Ingress-GCE in
kubernetes#1125 and kubernetes#1127.
@skmatti
Copy link
Contributor Author

skmatti commented Aug 25, 2020

@bowei Can you review this again?. Maybe if its better, I can isolate the refactoring into a separate PR so that the change is small.

Copy link
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

can you rebase?

Copy link
Contributor

@freehan freehan left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: freehan, prameshj, skmatti

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 7, 2020
@k8s-ci-robot k8s-ci-robot merged commit 8ccedad into kubernetes:master Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants