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

Bug 1824426: tag primary OpenStack networks #3483

Merged
merged 1 commit into from Apr 24, 2020

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented Apr 20, 2020

In the case of multiple added networks the tag <infraID>-primaryClusterNetwork should allow cluster-api-provider-openstack to define which IP address to set as the primary one for machines.
Now CAPO can't do this, because Neutron returns the list of networks in alphabetical order.

@openshift-ci-robot
Copy link
Contributor

@Fedosin: This pull request references Bugzilla bug 1824426, 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.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1824426: set primaryClusterNetwork tag for the primary network

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 Apr 20, 2020
@openshift-ci-robot
Copy link
Contributor

@Fedosin: This pull request references Bugzilla bug 1824426, which is valid.

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

In response to this:

Bug 1824426: set primaryClusterNetwork tag for the primary network

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.

@iamemilio
Copy link

If we tag a custom network / aka IF machinesNetwork != nil
we need to remove that tag when we tear down the cluster as well

@Fedosin
Copy link
Contributor Author

Fedosin commented Apr 20, 2020

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 20, 2020
@Fedosin
Copy link
Contributor Author

Fedosin commented Apr 22, 2020

@iamemilio done :)

@Fedosin
Copy link
Contributor Author

Fedosin commented Apr 22, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2020
@Fedosin Fedosin changed the title Bug 1824426: set primaryClusterNetwork tag for the primary network Bug 1824426: tag primary OpenStack networks Apr 22, 2020
@openshift-ci-robot
Copy link
Contributor

@Fedosin: An error was encountered adding this pull request to the external tracker bugs for bug 1824426 on the Bugzilla server at https://bugzilla.redhat.com:

JSONRPC error 32000: Subcomponet is mandatory for the component 'Cloud Compute' in the product 'OpenShift Container Platform'.
Please contact an administrator to resolve this issue, then request a bug refresh with /bugzilla refresh.

In response to this:

Bug 1824426: tag primary OpenStack networks

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.

@iamemilio
Copy link

/hold cancel
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 22, 2020
return untagNetwork(opts, networkTag, logger)
})
if err != nil {
return errors.Errorf("Unrecoverable error/timed out: %v", err)
Copy link

@adduarte adduarte Apr 22, 2020

Choose a reason for hiding this comment

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

is "timed out" the only possible error here. If it is not it could make it difficult to debug. the user could be looking for a time out, when that is not the problem. 'err' sould have enough info in its message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, there could also be a bug with multiple networks with the same tag... I separated them as you ask.


// untagNetworks removes a tag from the network
func untagNetwork(opts *clientconfig.ClientOpts, networkTag string, logger logrus.FieldLogger) (bool, error) {
logger.Debug("Untagging openstack networks")
Copy link

@adduarte adduarte Apr 22, 2020

Choose a reason for hiding this comment

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

add network tagg to the message . Useful for user to verify which tags should have been removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

if len(allNetworks) > 1 {
return false, errors.Errorf("more than one network with tag %v", networkTag)

Choose a reason for hiding this comment

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

caps on "More..." Every other message starts with caps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link

@adduarte adduarte left a comment

Choose a reason for hiding this comment

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

Nothing but nits on strings.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2020
@Fedosin
Copy link
Contributor Author

Fedosin commented Apr 23, 2020

/test e2e-aws

@@ -110,6 +115,12 @@ func (o *ClusterUninstaller) Run() error {
}
}

// we need to untag the custom network if it was provided by the user
err := untagRunner(opts, o.InfraID+"-primaryClusterNetwork", o.Logger)
Copy link
Member

Choose a reason for hiding this comment

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

Just a general comment, untagRunner should be generic and not take the networkTag as an argument. Instead it should be the infra-id, and we derive the network-tag from it when calling untagNetwork from untagRunner.

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, makes sense

}

if len(allNetworks) > 1 {
return false, errors.Errorf("More than one network with tag %v", networkTag)
Copy link
Member

Choose a reason for hiding this comment

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

Why make it an error? That will cause the untagRunner to enter a loop to perform an action it can't do.
IMO, as opposed to deleting resources when we're not sure we were the ones creating them, it's OK to remove (internally used) tags from resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we return an error, then untagRunner stops working immediately, no matter how many attempts there are left. So, for the runner it basically means - stop looping and return the error.
https://github.com/kubernetes/apimachinery/blob/release-1.17/pkg/util/wait/wait.go#L293

Despite the fact we consider the tag to be unique because it contains an infra ID, users can still add the tag to other networks. So removing them from all networks can lead to unpleasant side effects, which means we must stop the execution and do not try to repeat the untagging.

In the case of multiple added networks the tag
<infraID>-primaryClusterNetwork should allow
cluster-api-provider-openstack to define which
IP address to set as the primary one for machines.

Now CAPO can't do this, because Neutron returns the
list of networks in alphabetical order.
@mandre
Copy link
Member

mandre commented Apr 23, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 23, 2020
@iamemilio
Copy link

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamemilio

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 23, 2020
@openshift-bot
Copy link
Contributor

/retest

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

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit 2c9bb22 into openshift:master Apr 24, 2020
@openshift-ci-robot
Copy link
Contributor

@Fedosin: Some pull requests linked via external trackers have merged: . The following pull requests linked via external trackers have not merged:

In response to this:

Bug 1824426: tag primary OpenStack networks

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.

@adduarte
Copy link

adduarte commented Aug 6, 2020

/cherry-pick release-4.4

@openshift-cherrypick-robot

@adduarte: #3483 failed to apply on top of branch "release-4.4":

In response to this:

/cherry-pick release-4.4

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/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.

None yet

8 participants