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

Add loadbalancer preserve annotation #69

Merged
merged 5 commits into from
Jun 16, 2020

Conversation

0xch4z
Copy link
Contributor

@0xch4z 0xch4z commented Jun 12, 2020

This change adds an annotation that can be used on services of type: LoadBalancer to ensure that the underlying NodeBalancer is not deleted when the service is.

This is the first of two PRs to enable reusing LoadBalancers.

@0xch4z 0xch4z force-pushed the feat/preserve-loadbal-annotation branch from 5817d84 to d51dad4 Compare June 12, 2020 13:01
@0xch4z 0xch4z force-pushed the feat/preserve-loadbal-annotation branch from d51dad4 to 2919ec5 Compare June 12, 2020 13:13
@0xch4z 0xch4z force-pushed the feat/preserve-loadbal-annotation branch from f2d4e26 to a1654c9 Compare June 12, 2020 15:53
if preserveRaw, ok := service.Annotations[annLinodeLoadBalancerPreserve]; ok {
if preserve, err := strconv.ParseBool(preserveRaw); err == nil && preserve {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a return err branch here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was intentional. When talking with @jnschaeffer, we thought it'd be better to interpret an invalid boolean as false and document it as such. Do you think there is value in throwing an error here instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, that does seem like the correct default behavior.

Note that in this case the docs should indicate that the value is a string, as all annotations are, and will accept the following values: 1, t, T, TRUE, true, True

https://golang.org/pkg/strconv/#ParseBool

Docs could even link to this doc.

Copy link
Contributor

Choose a reason for hiding this comment

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

I had this comment as pending for a while. Sorry for the confusion in chat.

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 added a note below the annotation lists describing the accepted string representations for true, here.

Copy link
Contributor

@asauber asauber left a comment

Choose a reason for hiding this comment

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

This looks perfect aside from my one comment above!

@0xch4z 0xch4z force-pushed the feat/preserve-loadbal-annotation branch from a1654c9 to 02d51da Compare June 13, 2020 01:58
@0xch4z 0xch4z requested a review from asauber June 15, 2020 14:46
@0xch4z 0xch4z merged commit 3ab53de into linode:master Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants