Skip to content

Conversation

@Miciah
Copy link
Contributor

@Miciah Miciah commented Oct 11, 2020

Add support for changing ingresscontroller load balancer scope. On AWS and IBM cloud, this requires deleting the existing load balancer service and recreating it with the desired scope. On Azure and GCP, it suffices to update the existing service's annotations.

This change also adds logic to remove the service finalizer, which is no longer needed to clean up DNS records since the DNSRecord CRD was added.

  • pkg/operator/controller/ingress/controller.go (setDefaultPublishingStrategy): Update scope if needed.
  • pkg/operator/controller/ingress/load_balancer_service.go (externalLBAnnotations): New variable. Map platform type to the annotation for that platform that makes the load balancer external, if the platform requires an explicit annotation.
    (ensureLoadBalancerService): Add delete and update logic. Use the new deleteLoadBalancerServiceFinalizer method to delete any finalizer on any existing service. Use the new createLoadBalancerService, deleteLoadBalancerService, and updateLoadBalancerService methods to create, update, or delete the service as needed.
    (desiredLoadBalancerService): Delete logic to add a finalizer to the service. Use new externalLBAnnotations variable to simplify logic.
    (finalizeLoadBalancerService): Refactor to use the new deleteLoadBalancerServiceFinalizer method.
    (createLoadBalancerService, deleteLoadBalancerService): New methods.
    (updateLoadBalancerService): New method. Update the LoadBalancer service, using the new loadBalancerServiceChanged function.
    (loadBalancerServiceScopeChanged): New function. Check if the load balancer's scope changed.
    (loadBalancerServiceChanged): New function. Check if the current service needs to be updated, and if so, whether it needs to be modified or deleted and recreated.
    (deleteLoadBalancerServiceFinalizer): New method. Delete any finalizer from the service.
  • pkg/operator/controller/ingress/load_balancer_service_test.go (TestLoadBalancerServiceChanged): New test.
    (TestLoadBalancerServiceChangedScopeNeedsRecreate): New test.
  • test/e2e/operator_test.go (isServiceInternal): New function. Return a Boolean value indicating whether the provided service is annotated to request an internal load-balancer.
    (TestScopeChange): New test. Verify that mutating scope from the default external scope to internal scope and from internal back to external succeeds on AWS, Azure, GCP, and IBM Cloud.

Based on #394.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 11, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 11, 2020
@Miciah Miciah force-pushed the mutable-publishing-scope branch 2 times, most recently from 0483460 to 6cd8ed8 Compare October 11, 2020 07:58
@Miciah
Copy link
Contributor Author

Miciah commented Oct 11, 2020

/test e2e-azure

@Miciah Miciah force-pushed the mutable-publishing-scope branch from 6cd8ed8 to 395121e Compare October 13, 2020 18:39
@Miciah
Copy link
Contributor Author

Miciah commented Oct 13, 2020

Latest push adds new deleteLoadBalancerService and updateLoadBalancerService methods, improves logging when it is necessary to delete and recreate the service, and fixes an error in the update logic that would cause unnecessary recreation of the service for changes unrelated to scope.

if currentAnnotations[name] != expectedAnnotations[name] {
scopeChanged = true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

At this point, it seems that if the needsRecreate determination were moved here and if scopeChanged && needsRecreate you could return immediately, bypassing all the irrelevant diffing logic for the case when an update is possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that makes sense. It would incur a second update if the user modified the scope and another field, but scope is really the only thing we expect users to modify at this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest push implements something along these lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, that makes sense. It would incur a second update if the user modified the scope and another field, but scope is really the only thing we expect users to modify at this time.

This is something I hadn't considered. Given that scenario I would expect the scope change to be batched with all other possible changes. I retract my suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't feel too strongly about it... but since you retracted the suggestion, I've reverted the change. * grin *.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Miciah Miciah force-pushed the mutable-publishing-scope branch 3 times, most recently from e608f60 to 328e6f4 Compare October 13, 2020 20:10
@openshift-ci-robot
Copy link
Contributor

@Miciah: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-aws 328e6f4 link /test e2e-aws
ci/prow/e2e-aws-operator 328e6f4 link /test e2e-aws-operator

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@Miciah
Copy link
Contributor Author

Miciah commented Oct 14, 2020

The ingress operator logs from the last CI run appear to be incomplete— the test output indicates that the operator created resources for the ingresscontroller named "scope", but the logs do not mention the ingresscontroller. (Or did some recent change break logging?) Let's see if another CI run gets us some useful logs.
/test e2e-aws-operator

@Miciah Miciah force-pushed the mutable-publishing-scope branch from 328e6f4 to 20c3d84 Compare October 14, 2020 18:21
Add support for changing ingresscontroller load balancer scope. On AWS and
IBM cloud, this requires deleting the existing load balancer service and
recreating it with the desired scope.  On Azure and GCP, it suffices to
update the existing service's annotations.

This commit also adds logic to remove the service finalizer, which is no
longer needed to clean up DNS records since the DNSRecord CRD was added.

* pkg/operator/controller/ingress/controller.go
(setDefaultPublishingStrategy): Update scope if needed.
* pkg/operator/controller/ingress/load_balancer_service.go
(externalLBAnnotations): New variable.  Map platform type to the annotation
for that platform that makes the load balancer external, if the platform
requires an explicit annotation.
(ensureLoadBalancerService): Add delete and update logic.  Use the new
deleteLoadBalancerServiceFinalizer method to delete any finalizer on any
existing service.  Use the new createLoadBalancerService,
deleteLoadBalancerService, and updateLoadBalancerService methods to create,
update, or delete the service as needed.
(desiredLoadBalancerService): Delete logic to add a finalizer to the
service.  Use new externalLBAnnotations variable to simplify logic.
(finalizeLoadBalancerService): Refactor to use the new
deleteLoadBalancerServiceFinalizer method.
(createLoadBalancerService, deleteLoadBalancerService): New methods.
(updateLoadBalancerService): New methods.  Update the LoadBalancer service,
using the new loadBalancerServiceChanged function.
(loadBalancerServiceScopeChanged): New function.  Check if the load
balancer's scope changed.
(loadBalancerServiceChanged): New function.  Check if the current service
needs to be updated, and if so, whether it needs to be modified or deleted
and recreated.
(deleteLoadBalancerServiceFinalizer): New method.  Delete any finalizer
from the service.
* pkg/operator/controller/ingress/load_balancer_service_test.go
(TestLoadBalancerServiceChanged): New test.
(TestLoadBalancerServiceChangedScopeNeedsRecreate): New test.
* test/e2e/operator_test.go (isServiceInternal): New function.  Return a
Boolean value indicating whether the provided service is annotated to
request an internal load-balancer.
(TestScopeChange): New test.  Verify that mutating scope from the default
external scope to internal scope and from internal back to external
succeeds on AWS, Azure, GCP, and IBM Cloud.

Co-authored-by: Dan Mace <ironcladlou@gmail.com>
@Miciah Miciah force-pushed the mutable-publishing-scope branch from 20c3d84 to 982682f Compare October 14, 2020 20:50
@Miciah Miciah changed the title WIP: Support changing ingresscontroller load balancer scope Support changing ingresscontroller load balancer scope Oct 20, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 20, 2020
@Miciah
Copy link
Contributor Author

Miciah commented Oct 20, 2020

/retest

@gregsheremeta
Copy link

which Jira is this related to?

@Miciah
Copy link
Contributor Author

Miciah commented Oct 21, 2020

which Jira is this related to?

https://issues.redhat.com/browse/NE-172

@Miciah
Copy link
Contributor Author

Miciah commented Oct 26, 2020

Linking a BZ to facilitate backports.
/retitle Bug 1891625: Support changing ingresscontroller load balancer scope

@openshift-ci-robot openshift-ci-robot changed the title Support changing ingresscontroller load balancer scope Bug 1891625: Support changing ingresscontroller load balancer scope Oct 26, 2020
@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. label Oct 26, 2020
@openshift-ci-robot
Copy link
Contributor

@Miciah: This pull request references Bugzilla bug 1891625, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)
Details

In response to this:

Bug 1891625: Support changing ingresscontroller load balancer scope

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Oct 26, 2020
@Miciah
Copy link
Contributor Author

Miciah commented Oct 26, 2020

/cherry-pick release-4.6

@openshift-cherrypick-robot

@Miciah: once the present PR merges, I will cherry-pick it on top of release-4.6 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-4.6

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.

Copy link
Contributor

@sgreene570 sgreene570 left a comment

Choose a reason for hiding this comment

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

Looks good!

/lgtm

cc @dustman9000

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah, sgreene570

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

The pull request process is described here

Details 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

@openshift-merge-robot openshift-merge-robot merged commit 3fbc377 into openshift:master Oct 28, 2020
@openshift-ci-robot
Copy link
Contributor

@Miciah: All pull requests linked via external trackers have merged:

Bugzilla bug 1891625 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1891625: Support changing ingresscontroller load balancer scope

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.

@openshift-cherrypick-robot

@Miciah: new pull request created: #482

Details

In response to this:

/cherry-pick release-4.6

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.

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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants