Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7425cd5a
Commit
7425cd5a
authored
Sep 18, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14209 from nikhiljindal/deploymentController
Auto commit by PR queue bot
parents
5de212ed
89e96910
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+0
-0
util.go
pkg/util/util.go
+20
-0
No files found.
pkg/controller/deployment/deployment_controller.go
View file @
7425cd5a
This diff is collapsed.
Click to expand it.
pkg/util/util.go
View file @
7425cd5a
...
...
@@ -22,6 +22,7 @@ import (
"encoding/json"
"fmt"
"io"
"math"
"net"
"net/http"
"os"
...
...
@@ -191,6 +192,25 @@ func (intstr *IntOrString) Fuzz(c fuzz.Continue) {
}
}
func
GetIntOrPercentValue
(
intStr
*
IntOrString
)
(
int
,
bool
,
error
)
{
switch
intStr
.
Kind
{
case
IntstrInt
:
return
intStr
.
IntVal
,
false
,
nil
case
IntstrString
:
s
:=
strings
.
Replace
(
intStr
.
StrVal
,
"%"
,
""
,
-
1
)
v
,
err
:=
strconv
.
Atoi
(
s
)
if
err
!=
nil
{
return
0
,
false
,
fmt
.
Errorf
(
"invalid value %q: %v"
,
intStr
.
StrVal
,
err
)
}
return
v
,
true
,
nil
}
return
0
,
false
,
fmt
.
Errorf
(
"invalid value: neither int nor percentage"
)
}
func
GetValueFromPercent
(
percent
int
,
value
int
)
int
{
return
int
(
math
.
Ceil
(
float64
(
percent
)
*
(
float64
(
value
))
/
100
))
}
// Takes a list of strings and compiles them into a list of regular expressions
func
CompileRegexps
(
regexpStrings
[]
string
)
([]
*
regexp
.
Regexp
,
error
)
{
regexps
:=
[]
*
regexp
.
Regexp
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment