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

Introduce cloud.google.com/app-protocols to eventually replace existing annotation #417

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

rramkumar1
Copy link
Contributor

/assign @bowei

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 31, 2018
val, ok := svc.v[ServiceApplicationProtocolKey]
var val string
var ok bool
// First check the new annotation, then fall back to the old one.
Copy link
Member

Choose a reason for hiding this comment

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

Actually, you should check old first and if it exists, use it. That way an old client can "win" in the face of a rollback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm missing something, but in a rollback situation, wouldn't the old annotation win always? My thinking is that if we rollback, the controller no longer "knows" about the new annotation and therefore proceeds as it did before, which is to look for the "old" annotation only.

@rramkumar1
Copy link
Contributor Author

/assign @MrHohn

@thockin
Copy link
Member

thockin commented Aug 1, 2018 via email

@rramkumar1
Copy link
Contributor Author

@thockin Even if there was a client rollback, I think this code still holds. For example, if a user replaces the alpha annotation w/ the Google-specific one and then rolled back their service, the old annotation would win given that the new one is not present anymore.

I think in any case, if both annotations exists and the controller knows that both of them exist, we want the new one to win.

@thockin
Copy link
Member

thockin commented Aug 13, 2018

Look at it this way.

User has YAML that uses the old annotation. They apply that to the apiserver.

User changes their YAML and also upgrades to the new annotation, removing the old one, and patch it. If any sort of merge patch can add the new but leave the old, we now have both. This is true for 2 fields (annotations -> real field), but maybe not for annotations.

User changes the value of the new annotation in their YAML and applies it. Now we have old and new disagreeing. It doesn't matter how we end up in this situation - you have old and new values that disagree...

If we troll back the controller, we have changed the behavior underneath the user. If they roll back their YAML and edit the old annotation, it becomes a silent no-op (again, not sure that can happen for 2 annotations).

The general rule is that in such cases, the older has to take precedence. If the user wants the newer, they have to remove the older explicitly. I am not sure we can get into this corner with 2 annotations, but consistent philosophy should apply.

@rramkumar1
Copy link
Contributor Author

@thockin Ack. Modified the PR, PTAL.

@thockin
Copy link
Member

thockin commented Aug 13, 2018

/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 Aug 13, 2018
@MrHohn MrHohn merged commit 6e74e5e into kubernetes:master Aug 13, 2018
@thockin
Copy link
Member

thockin commented Aug 13, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants