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

defaults: Add Rollback defaults #2080

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

aaronlehmann
Copy link
Collaborator

Right now, the updater uses Update defaults for a rollback if no Rollback settings are provided in the service. Make the Rollback defaults explicit instead.

@codecov
Copy link

codecov bot commented Mar 31, 2017

Codecov Report

Merging #2080 into master will increase coverage by <.01%.
The diff coverage is 67.85%.

@@            Coverage Diff             @@
##           master    #2080      +/-   ##
==========================================
+ Coverage   54.07%   54.07%   +<.01%     
==========================================
  Files          95       95              
  Lines       17293    17291       -2     
==========================================
- Hits         9351     9350       -1     
- Misses       6863     6867       +4     
+ Partials     1079     1074       -5

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37708f1...b6a4260. Read the comment docs.

if spec.Rollback == nil {
spec.Rollback = Service.Rollback.Copy()
} else {
if spec.Rollback.Monitor == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

else if {
        .....
}

How about that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm thinking we may add other fields that need to be handled here in the future. Right now there is only one, but putting it inside an else structures the code so that another one can be added along side it (even if it looks weird right now).

}

parallelism := int(defaults.Service.Update.Parallelism)
Copy link
Contributor

@cyli cyli Mar 31, 2017

Choose a reason for hiding this comment

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

In the previous code, it seemed like at this point the parallelism and monitoring period came from the current value of updateConfig, I guess because it could possible come from service.Spec.Rollback or service.Spec.Update? Should we set this to:

parallelism := int(updateConfig.Parallelism)
monitoringPeriod, err = gogotypes.DurationFromProto(updateConfig.Monitor)		
if err != nil {		
    monitoringPeriod, _ = gogotypes.DurationFromProto(defaults.Service.Update.Monitor)		
}

instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ugh, yes, that was supposed to be updateConfig.

@cyli
Copy link
Contributor

cyli commented Mar 31, 2017

Just double-checking - by the time the service gets to the updater, it will be interpolated already with the defaults?

@aaronlehmann
Copy link
Collaborator Author

No, interpolation is never used internally. It's an option for clients retrieving the service. See #1744.

@cyli
Copy link
Contributor

cyli commented Mar 31, 2017

@aaronlehmann Ah ok, thanks.

}

parallelism := int(updateConfig.Parallelism)
monitoringPeriod, _ := gogotypes.DurationFromProto(updateConfig.Monitor)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check this for nil, since this value could have come from service.Spec.Rollback or service.Spec.Update, which may not have been interpolated with defaults?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're absolutely correct. Sorry for all the defects.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not at all, that is the purpose of reviews :)

Right now, the updater uses Update defaults for a rollback if no
Rollback settings are provided in the service. Make the Rollback
defaults explicit instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
@cyli
Copy link
Contributor

cyli commented Mar 31, 2017

LGTM

@aaronlehmann
Copy link
Collaborator Author

Thanks

@aaronlehmann aaronlehmann merged commit 57436e7 into moby:master Mar 31, 2017
@aaronlehmann aaronlehmann deleted the rollback-defaults branch March 31, 2017 23:17
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.

3 participants