Skip to content

Conversation

@Miciah
Copy link
Contributor

@Miciah Miciah commented Mar 27, 2021

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; if the administrator changes the scope on the ingresscontroller, the operator will report Progressing=True until the administrator either reverts the change or deletes the service. If the administrator deletes the service, then the operator will recreate the service with the desired scope. On Azure and GCP, it suffices to update the existing service's annotations.

This commit is based on #472, which was reverted by commit #514. Unlike the original implementation of this feature, the operator does not delete the service but instead leaves it up to the administrator to do so as needed.

  • pkg/operator/controller/ingress/controller.go (setDefaultPublishingStrategy): Update scope if needed.
    (ensureIngressController): Pass infraConfig to syncIngressControllerStatus.
  • 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.
    (desiredLoadBalancerService): Use new externalLBAnnotations variable to simplify logic.
    (updateLoadBalancerService): Pass platform to loadBalancerServiceScopeChanged.
    (loadBalancerServiceChanged): Add platform parameter. Check if the scope changed and if the platform supports changing scope without recreating the service, and update the appropriate annotations if so.
    (loadBalancerServiceScopeChanged): New function. Check if the load balancer's scope changed.
    (IsServiceInternal): New function. Return a Boolean value indicating whether the provided service is annotated to request an internal load-balancer
  • pkg/operator/controller/ingress/load_balancer_service_test.go (TestLoadBalancerServiceChanged): Update to pass platform status to loadBalancerServiceChanged.
  • pkg/operator/controller/ingress/status.go (syncIngressControllerStatus): Add infraConfig parameter. Use infraConfig to get the platform type. Call the new computeIngressProgressingCondition function with the ingresscontroller, service, and platform to compute a "Progressing" status condition for the ingresscontroller.
    (computeIngressProgressingCondition): New function. Compute a "Progressing" status condition. In particular, this status condition will indicate if it is necessary to delete the service so that it can be recreated with the updated scope.
  • pkg/operator/controller/ingress/status_test.go (TestComputeIngressProgressCondition): New test. Verify that computeIngressProgressingCondition returns the expected status condition.
  • pkg/operator/controller/status/controller.go (Reconcile): Pass ingresscontrollers to computeOperatorProgressingCondition.
    (computeOperatorProgressingCondition): Report Progressing=True on the clusteroperator if any ingresscontroller reports Progressing=True.
  • pkg/operator/controller/status/controller_test.go (TestComputeOperatorProgressingCondition): Add test case where an ingresscontroller is progressing.
  • test/e2e/operator_test.go (TestScopeChange): New test. Verify that the operator performs the appropriate behavior for the platform on which the test is running when an ingresscontroller's scope is changed from the default external scope to internal and then back to external.

@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 Mar 27, 2021
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah

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-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 27, 2021
@Miciah Miciah force-pushed the mutable-publishing-scope-2 branch 2 times, most recently from ad1d844 to 5d08c79 Compare March 27, 2021 18:01
@Miciah
Copy link
Contributor Author

Miciah commented Mar 28, 2021

/test e2e-azure-operator

@Miciah Miciah force-pushed the mutable-publishing-scope-2 branch from 5d08c79 to 1db1da3 Compare March 29, 2021 04:32
@Miciah
Copy link
Contributor Author

Miciah commented Mar 29, 2021

/test e2e-azure-operator

}

// IsServiceInternal returns a Boolean indicating whether the provided service
// Is annotated to request an internal load balancer.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
// Is annotated to request an internal load balancer.
// is annotated to request an internal load balancer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed.


platform, err := oputil.GetPlatformStatus(r.client, infraConfig)
if err != nil {
return fmt.Errorf("failed to determine infrastructure platform status for ingresscontroller %s/%s: %w", ic.Namespace, ic.Name, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

is %w preferable for err over %v?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, IMO we should use %w in new code, and eventually update old code to use %w as well, so that we can unwrap errors and more easily check the type of an error (see https://blog.golang.org/go1.13-errors). Eventually, consistent use of %w will enable us to simplify some error-handling code (e.g., the retryable-error logic).

message := fmt.Sprintf("Have load balancer with scope %q, want load balancer with scope %q.", haveScope, wantScope)
switch platform.Type {
case configv1.AWSPlatformType, configv1.IBMCloudPlatformType:
message = fmt.Sprintf("%s You can delete the %s/%s service to proceed, and the service load-balancer will be deprovisioned and recreated.", message, service.Namespace, service.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think as is, this message could be confusing to a cluster administrator:

  1. I think recreated in this context sort of implies that the new load-balancer will have the same hostname and IP as the last load-balancer. Should we explicitly state that when deleting the load-balancer service, a new load-balancer will be stood up that will most likely have a new hostname and IP?

  2. Should we make it clear to the cluster administrator that they are free to "undo" their scope change without any reprocussions? I think some more details in general could be useful here as to not confuse a cluster administrator.

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've updated the message to convey these points. Does it look all right? (I hope it isn't too verbose.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks fine to me 😁

@Miciah Miciah force-pushed the mutable-publishing-scope-2 branch from 1db1da3 to 1a45ce8 Compare March 31, 2021 23:24
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 31, 2021
@Miciah
Copy link
Contributor Author

Miciah commented Mar 31, 2021

Rebased.

@Miciah Miciah force-pushed the mutable-publishing-scope-2 branch from 1a45ce8 to 7daeb6f Compare March 31, 2021 23:26
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 31, 2021
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 30, 2021
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 30, 2021
@openshift-bot
Copy link
Contributor

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 29, 2021

@openshift-bot: Closed this PR.

Details

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen.
Mark the issue as fresh by commenting /remove-lifecycle rotten.
Exclude this issue from closing again by commenting /lifecycle frozen.

/close

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.

@Miciah
Copy link
Contributor Author

Miciah commented Nov 30, 2021

/reopen

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 30, 2021

@Miciah: Reopened this PR.

Details

In response to this:

/reopen

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 openshift-ci bot reopened this Nov 30, 2021
@openshift-ci openshift-ci bot changed the title WIP: Support changing ingresscontroller load balancer scope NE-621: Support changing ingresscontroller load balancer scope Dec 13, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2021
@frobware
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 13, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 13, 2021

[APPROVALNOTIFIER] This PR is APPROVED

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

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-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

7 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@Miciah
Copy link
Contributor Author

Miciah commented Dec 14, 2021

/hold
CI is failing because of openshift/build-machinery-go#56.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2021
@Miciah
Copy link
Contributor Author

Miciah commented Dec 14, 2021

#687 merged.
/retest

@Miciah
Copy link
Contributor Author

Miciah commented Dec 14, 2021

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 14, 2021
@Miciah
Copy link
Contributor Author

Miciah commented Dec 14, 2021

Must-gather failed.
/test e2e-aws-operator

@Miciah
Copy link
Contributor Author

Miciah commented Dec 14, 2021

TestConfigurableRouteNoConsumingUserNoRBAC and TestRouteAdmissionPolicy failed.
/test e2e-aws-operator

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@Miciah
Copy link
Contributor Author

Miciah commented Dec 15, 2021

Unschedulable worker node.
/test e2e-aws-operator

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 15, 2021

@Miciah: all tests passed!

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.

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. lgtm Indicates that a PR is ready to be merged. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants