Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
ae969191
Commit
ae969191
authored
Feb 10, 2017
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref(kube): code style cleanup
parent
6b7efb9c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
31 deletions
+12
-31
client.go
pkg/kube/client.go
+10
-27
release_server.go
pkg/tiller/release_server.go
+2
-4
No files found.
pkg/kube/client.go
View file @
ae969191
...
@@ -84,14 +84,13 @@ func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shoul
...
@@ -84,14 +84,13 @@ func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shoul
if
buildErr
!=
nil
{
if
buildErr
!=
nil
{
return
buildErr
return
buildErr
}
}
err
=
perform
(
c
,
namespace
,
infos
,
createResource
)
if
err
:=
perform
(
c
,
namespace
,
infos
,
createResource
);
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
shouldWait
{
if
shouldWait
{
err
=
c
.
waitForResources
(
time
.
Duration
(
timeout
)
*
time
.
Second
,
infos
)
return
c
.
waitForResources
(
time
.
Duration
(
timeout
)
*
time
.
Second
,
infos
)
}
}
return
err
return
nil
}
}
func
(
c
*
Client
)
newBuilder
(
namespace
string
,
reader
io
.
Reader
)
*
resource
.
Result
{
func
(
c
*
Client
)
newBuilder
(
namespace
string
,
reader
io
.
Reader
)
*
resource
.
Result
{
...
@@ -264,9 +263,9 @@ func (c *Client) Update(namespace string, originalReader, targetReader io.Reader
...
@@ -264,9 +263,9 @@ func (c *Client) Update(namespace string, originalReader, targetReader io.Reader
}
}
}
}
if
shouldWait
{
if
shouldWait
{
err
=
c
.
waitForResources
(
time
.
Duration
(
timeout
)
*
time
.
Second
,
target
)
return
c
.
waitForResources
(
time
.
Duration
(
timeout
)
*
time
.
Second
,
target
)
}
}
return
err
return
nil
}
}
// Delete deletes kubernetes resources from an io.reader
// Delete deletes kubernetes resources from an io.reader
...
@@ -338,8 +337,7 @@ func createResource(info *resource.Info) error {
...
@@ -338,8 +337,7 @@ func createResource(info *resource.Info) error {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
info
.
Refresh
(
obj
,
true
)
return
info
.
Refresh
(
obj
,
true
)
return
nil
}
}
func
deleteResource
(
c
*
Client
,
info
*
resource
.
Info
)
error
{
func
deleteResource
(
c
*
Client
,
info
*
resource
.
Info
)
error
{
...
@@ -398,8 +396,8 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
...
@@ -398,8 +396,8 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
// send patch to server
// send patch to server
helper
:=
resource
.
NewHelper
(
target
.
Client
,
target
.
Mapping
)
helper
:=
resource
.
NewHelper
(
target
.
Client
,
target
.
Mapping
)
var
obj
runtime
.
Object
obj
,
err
:=
helper
.
Patch
(
target
.
Namespace
,
target
.
Name
,
patchType
,
patch
)
if
obj
,
err
=
helper
.
Patch
(
target
.
Namespace
,
target
.
Name
,
patchType
,
patch
);
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -407,8 +405,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
...
@@ -407,8 +405,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
client
,
_
:=
c
.
ClientSet
()
client
,
_
:=
c
.
ClientSet
()
return
recreatePods
(
client
,
target
.
Namespace
,
extractSelector
(
currentObj
))
return
recreatePods
(
client
,
target
.
Namespace
,
extractSelector
(
currentObj
))
}
}
target
.
Refresh
(
obj
,
true
)
return
target
.
Refresh
(
obj
,
true
)
return
nil
}
}
func
extractSelector
(
obj
runtime
.
Object
)
map
[
string
]
string
{
func
extractSelector
(
obj
runtime
.
Object
)
map
[
string
]
string
{
...
@@ -431,7 +428,6 @@ func recreatePods(client *internalclientset.Clientset, namespace string, selecto
...
@@ -431,7 +428,6 @@ func recreatePods(client *internalclientset.Clientset, namespace string, selecto
FieldSelector
:
fields
.
Everything
(),
FieldSelector
:
fields
.
Everything
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
(),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -445,7 +441,6 @@ func recreatePods(client *internalclientset.Clientset, namespace string, selecto
...
@@ -445,7 +441,6 @@ func recreatePods(client *internalclientset.Clientset, namespace string, selecto
return
err
return
err
}
}
}
}
return
nil
return
nil
}
}
...
@@ -491,9 +486,6 @@ func watchUntilReady(timeout time.Duration, info *resource.Info) error {
...
@@ -491,9 +486,6 @@ func watchUntilReady(timeout time.Duration, info *resource.Info) error {
}
}
func
podsReady
(
pods
[]
api
.
Pod
)
bool
{
func
podsReady
(
pods
[]
api
.
Pod
)
bool
{
if
len
(
pods
)
==
0
{
return
true
}
for
_
,
pod
:=
range
pods
{
for
_
,
pod
:=
range
pods
{
if
!
api
.
IsPodReady
(
&
pod
)
{
if
!
api
.
IsPodReady
(
&
pod
)
{
return
false
return
false
...
@@ -503,9 +495,6 @@ func podsReady(pods []api.Pod) bool {
...
@@ -503,9 +495,6 @@ func podsReady(pods []api.Pod) bool {
}
}
func
servicesReady
(
svc
[]
api
.
Service
)
bool
{
func
servicesReady
(
svc
[]
api
.
Service
)
bool
{
if
len
(
svc
)
==
0
{
return
true
}
for
_
,
s
:=
range
svc
{
for
_
,
s
:=
range
svc
{
if
!
api
.
IsServiceIPSet
(
&
s
)
{
if
!
api
.
IsServiceIPSet
(
&
s
)
{
return
false
return
false
...
@@ -519,9 +508,6 @@ func servicesReady(svc []api.Service) bool {
...
@@ -519,9 +508,6 @@ func servicesReady(svc []api.Service) bool {
}
}
func
volumesReady
(
vols
[]
api
.
PersistentVolumeClaim
)
bool
{
func
volumesReady
(
vols
[]
api
.
PersistentVolumeClaim
)
bool
{
if
len
(
vols
)
==
0
{
return
true
}
for
_
,
v
:=
range
vols
{
for
_
,
v
:=
range
vols
{
if
v
.
Status
.
Phase
!=
api
.
ClaimBound
{
if
v
.
Status
.
Phase
!=
api
.
ClaimBound
{
return
false
return
false
...
@@ -535,10 +521,7 @@ func getPods(client *internalclientset.Clientset, namespace string, selector map
...
@@ -535,10 +521,7 @@ func getPods(client *internalclientset.Clientset, namespace string, selector map
FieldSelector
:
fields
.
Everything
(),
FieldSelector
:
fields
.
Everything
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
(),
})
})
if
err
!=
nil
{
return
list
.
Items
,
err
return
nil
,
err
}
return
list
.
Items
,
nil
}
}
// waitForResources polls to get the current status of all pods, PVCs, and Services
// waitForResources polls to get the current status of all pods, PVCs, and Services
...
...
pkg/tiller/release_server.go
View file @
ae969191
...
@@ -1037,12 +1037,10 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR
...
@@ -1037,12 +1037,10 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR
log
.
Printf
(
"uninstall: Failed to store updated release: %s"
,
err
)
log
.
Printf
(
"uninstall: Failed to store updated release: %s"
,
err
)
}
}
var
errs
error
if
len
(
es
)
>
0
{
if
len
(
es
)
>
0
{
errs
=
fmt
.
Errorf
(
"deletion completed with %d error(s): %s"
,
len
(
es
),
strings
.
Join
(
es
,
"; "
))
return
res
,
fmt
.
Errorf
(
"deletion completed with %d error(s): %s"
,
len
(
es
),
strings
.
Join
(
es
,
"; "
))
}
}
return
res
,
nil
return
res
,
errs
}
}
func
validateManifest
(
c
environment
.
KubeClient
,
ns
string
,
manifest
[]
byte
)
error
{
func
validateManifest
(
c
environment
.
KubeClient
,
ns
string
,
manifest
[]
byte
)
error
{
...
...
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