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
Hide 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
if
buildErr
!=
nil
{
return
buildErr
}
err
=
perform
(
c
,
namespace
,
infos
,
createResource
)
if
err
!=
nil
{
if
err
:=
perform
(
c
,
namespace
,
infos
,
createResource
);
err
!=
nil
{
return
err
}
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
{
...
...
@@ -264,9 +263,9 @@ func (c *Client) Update(namespace string, originalReader, targetReader io.Reader
}
}
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
...
...
@@ -338,8 +337,7 @@ func createResource(info *resource.Info) error {
if
err
!=
nil
{
return
err
}
info
.
Refresh
(
obj
,
true
)
return
nil
return
info
.
Refresh
(
obj
,
true
)
}
func
deleteResource
(
c
*
Client
,
info
*
resource
.
Info
)
error
{
...
...
@@ -398,8 +396,8 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
// send patch to server
helper
:=
resource
.
NewHelper
(
target
.
Client
,
target
.
Mapping
)
var
obj
runtime
.
Object
if
obj
,
err
=
helper
.
Patch
(
target
.
Namespace
,
target
.
Name
,
patchType
,
patch
);
err
!=
nil
{
obj
,
err
:=
helper
.
Patch
(
target
.
Namespace
,
target
.
Name
,
patchType
,
patch
)
if
err
!=
nil
{
return
err
}
...
...
@@ -407,8 +405,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
client
,
_
:=
c
.
ClientSet
()
return
recreatePods
(
client
,
target
.
Namespace
,
extractSelector
(
currentObj
))
}
target
.
Refresh
(
obj
,
true
)
return
nil
return
target
.
Refresh
(
obj
,
true
)
}
func
extractSelector
(
obj
runtime
.
Object
)
map
[
string
]
string
{
...
...
@@ -431,7 +428,6 @@ func recreatePods(client *internalclientset.Clientset, namespace string, selecto
FieldSelector
:
fields
.
Everything
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
(),
})
if
err
!=
nil
{
return
err
}
...
...
@@ -445,7 +441,6 @@ func recreatePods(client *internalclientset.Clientset, namespace string, selecto
return
err
}
}
return
nil
}
...
...
@@ -491,9 +486,6 @@ func watchUntilReady(timeout time.Duration, info *resource.Info) error {
}
func
podsReady
(
pods
[]
api
.
Pod
)
bool
{
if
len
(
pods
)
==
0
{
return
true
}
for
_
,
pod
:=
range
pods
{
if
!
api
.
IsPodReady
(
&
pod
)
{
return
false
...
...
@@ -503,9 +495,6 @@ func podsReady(pods []api.Pod) bool {
}
func
servicesReady
(
svc
[]
api
.
Service
)
bool
{
if
len
(
svc
)
==
0
{
return
true
}
for
_
,
s
:=
range
svc
{
if
!
api
.
IsServiceIPSet
(
&
s
)
{
return
false
...
...
@@ -519,9 +508,6 @@ func servicesReady(svc []api.Service) bool {
}
func
volumesReady
(
vols
[]
api
.
PersistentVolumeClaim
)
bool
{
if
len
(
vols
)
==
0
{
return
true
}
for
_
,
v
:=
range
vols
{
if
v
.
Status
.
Phase
!=
api
.
ClaimBound
{
return
false
...
...
@@ -535,10 +521,7 @@ func getPods(client *internalclientset.Clientset, namespace string, selector map
FieldSelector
:
fields
.
Everything
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
(),
})
if
err
!=
nil
{
return
nil
,
err
}
return
list
.
Items
,
nil
return
list
.
Items
,
err
}
// 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
log
.
Printf
(
"uninstall: Failed to store updated release: %s"
,
err
)
}
var
errs
error
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
,
errs
return
res
,
nil
}
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