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 duration as a configurable type for localkube #1715

Merged
merged 1 commit into from
Jul 20, 2017

Conversation

r2d4
Copy link
Contributor

@r2d4 r2d4 commented Jul 19, 2017

Fixes #1712

I refactored a bit of this code. Now it works like this:

  1. Check the actual type, this will capture anything we have explicitly in the switch block and set it.
  2. If we don't have an explicit entry for the type, fall back to looking at the underlying primitive kind. This might not always work (e.g. for types that have a nontrivial parsers, i.e. time.ParseDuration), but it will work for many types.

Previously, we were checking the underlying primitive kind first, which captured time.Duration (which is a type alias for int) and tried to Atoi("5s").

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 19, 2017
@codecov-io
Copy link

Codecov Report

Merging #1715 into master will increase coverage by 0.26%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1715      +/-   ##
==========================================
+ Coverage   35.93%   36.19%   +0.26%     
==========================================
  Files          51       51              
  Lines        3337     3365      +28     
==========================================
+ Hits         1199     1218      +19     
- Misses       1958     1966       +8     
- Partials      180      181       +1
Impacted Files Coverage Δ
pkg/util/config.go 63.54% <66.66%> (+1.77%) ⬆️

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 9e8ef22...d56d41b. Read the comment docs.

@r2d4 r2d4 merged commit 98d0af6 into kubernetes:master Jul 20, 2017
@r2d4 r2d4 deleted the duration-configurator branch July 20, 2017 17:13
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants