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
d744a3d0
Commit
d744a3d0
authored
Oct 17, 2016
by
Michelle Noorali
Committed by
GitHub
Oct 17, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1385 from michelleN/check-upgrade-kind
fix(kube): find current resource by name and kind
parents
d631328a
a8418dd7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
client.go
pkg/kube/client.go
+5
-3
No files found.
pkg/kube/client.go
View file @
d744a3d0
...
@@ -176,6 +176,7 @@ func (c *Client) Update(namespace string, currentReader, targetReader io.Reader)
...
@@ -176,6 +176,7 @@ func (c *Client) Update(namespace string, currentReader, targetReader io.Reader)
return
err
return
err
}
}
resourceName
:=
info
.
Name
resourceName
:=
info
.
Name
resourceKind
:=
info
.
Mapping
.
GroupVersionKind
.
Kind
helper
:=
resource
.
NewHelper
(
info
.
Client
,
info
.
Mapping
)
helper
:=
resource
.
NewHelper
(
info
.
Client
,
info
.
Mapping
)
if
_
,
err
:=
helper
.
Get
(
info
.
Namespace
,
resourceName
,
info
.
Export
);
err
!=
nil
{
if
_
,
err
:=
helper
.
Get
(
info
.
Namespace
,
resourceName
,
info
.
Export
);
err
!=
nil
{
...
@@ -193,7 +194,7 @@ func (c *Client) Update(namespace string, currentReader, targetReader io.Reader)
...
@@ -193,7 +194,7 @@ func (c *Client) Update(namespace string, currentReader, targetReader io.Reader)
return
nil
return
nil
}
}
currentObj
,
err
:=
getCurrentObject
(
resourceName
,
currentInfos
)
currentObj
,
err
:=
getCurrentObject
(
resourceName
,
resourceKind
,
currentInfos
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -453,10 +454,11 @@ func deleteUnwantedResources(currentInfos, targetInfos []*resource.Info) {
...
@@ -453,10 +454,11 @@ func deleteUnwantedResources(currentInfos, targetInfos []*resource.Info) {
}
}
}
}
func
getCurrentObject
(
targetName
string
,
infos
[]
*
resource
.
Info
)
(
runtime
.
Object
,
error
)
{
func
getCurrentObject
(
targetName
,
targetKind
string
,
infos
[]
*
resource
.
Info
)
(
runtime
.
Object
,
error
)
{
var
curr
*
resource
.
Info
var
curr
*
resource
.
Info
for
_
,
currInfo
:=
range
infos
{
for
_
,
currInfo
:=
range
infos
{
if
currInfo
.
Name
==
targetName
{
currKind
:=
currInfo
.
Mapping
.
GroupVersionKind
.
Kind
if
currInfo
.
Name
==
targetName
&&
currKind
==
targetKind
{
curr
=
currInfo
curr
=
currInfo
}
}
}
}
...
...
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