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
7b821dd5
Commit
7b821dd5
authored
Sep 17, 2018
by
Louis Munro
Committed by
Matthew Fisher
Sep 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ping() request a specific image. Add a getTillerPodImage method. (#4622)
Signed-off-by:
Louis Munro
<
lm@louismunro.com
>
parent
e868da17
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
10 deletions
+26
-10
init.go
cmd/helm/init.go
+7
-7
install.go
cmd/helm/installer/install.go
+2
-2
options.go
cmd/helm/installer/options.go
+2
-1
portforwarder.go
pkg/helm/portforwarder/portforwarder.go
+15
-0
No files found.
cmd/helm/init.go
View file @
7b821dd5
...
...
@@ -274,7 +274,7 @@ func (i *initCmd) run() error {
if
err
:=
installer
.
Upgrade
(
i
.
kubeClient
,
&
i
.
opts
);
err
!=
nil
{
return
fmt
.
Errorf
(
"error when upgrading: %s"
,
err
)
}
if
err
:=
i
.
ping
();
err
!=
nil
{
if
err
:=
i
.
ping
(
i
.
opts
.
SelectImage
()
);
err
!=
nil
{
return
err
}
fmt
.
Fprintln
(
i
.
out
,
"
\n
Tiller (the Helm server-side component) has been upgraded to the current version."
)
...
...
@@ -290,7 +290,7 @@ func (i *initCmd) run() error {
"For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation"
)
}
}
if
err
:=
i
.
ping
();
err
!=
nil
{
if
err
:=
i
.
ping
(
i
.
opts
.
SelectImage
()
);
err
!=
nil
{
return
err
}
}
else
{
...
...
@@ -301,13 +301,13 @@ func (i *initCmd) run() error {
return
nil
}
func
(
i
*
initCmd
)
ping
()
error
{
func
(
i
*
initCmd
)
ping
(
image
string
)
error
{
if
i
.
wait
{
_
,
kubeClient
,
err
:=
getKubeClient
(
settings
.
KubeContext
,
settings
.
KubeConfig
)
if
err
!=
nil
{
return
err
}
if
!
watchTillerUntilReady
(
settings
.
TillerNamespace
,
kubeClient
,
settings
.
TillerConnectionTimeout
)
{
if
!
watchTillerUntilReady
(
settings
.
TillerNamespace
,
kubeClient
,
settings
.
TillerConnectionTimeout
,
image
)
{
return
fmt
.
Errorf
(
"tiller was not found. polling deadline exceeded"
)
}
...
...
@@ -439,7 +439,7 @@ func ensureRepoFileFormat(file string, out io.Writer) error {
// want to wait before we call New().
//
// Returns true if it exists. If the timeout was reached and it could not find the pod, it returns false.
func
watchTillerUntilReady
(
namespace
string
,
client
kubernetes
.
Interface
,
timeout
int64
)
bool
{
func
watchTillerUntilReady
(
namespace
string
,
client
kubernetes
.
Interface
,
timeout
int64
,
newImage
string
)
bool
{
deadlinePollingChan
:=
time
.
NewTimer
(
time
.
Duration
(
timeout
)
*
time
.
Second
)
.
C
checkTillerPodTicker
:=
time
.
NewTicker
(
500
*
time
.
Millisecond
)
doneChan
:=
make
(
chan
bool
)
...
...
@@ -448,8 +448,8 @@ func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeou
go
func
()
{
for
range
checkTillerPodTicker
.
C
{
_
,
err
:=
portforwarder
.
GetTillerPodNam
e
(
client
.
CoreV1
(),
namespace
)
if
err
==
nil
{
image
,
err
:=
portforwarder
.
GetTillerPodImag
e
(
client
.
CoreV1
(),
namespace
)
if
err
==
nil
&&
image
==
newImage
{
doneChan
<-
true
break
}
...
...
cmd/helm/installer/install.go
View file @
7b821dd5
...
...
@@ -68,7 +68,7 @@ func Upgrade(client kubernetes.Interface, opts *Options) error {
if
semverCompare
(
tillerImage
)
==
-
1
&&
!
opts
.
ForceUpgrade
{
return
errors
.
New
(
"current Tiller version is newer, use --force-upgrade to downgrade"
)
}
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
=
opts
.
s
electImage
()
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
=
opts
.
S
electImage
()
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
ImagePullPolicy
=
opts
.
pullPolicy
()
obj
.
Spec
.
Template
.
Spec
.
ServiceAccountName
=
opts
.
ServiceAccount
if
_
,
err
:=
client
.
ExtensionsV1beta1
()
.
Deployments
(
opts
.
Namespace
)
.
Update
(
obj
);
err
!=
nil
{
...
...
@@ -223,7 +223,7 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) {
Containers
:
[]
v1
.
Container
{
{
Name
:
"tiller"
,
Image
:
opts
.
s
electImage
(),
Image
:
opts
.
S
electImage
(),
ImagePullPolicy
:
opts
.
pullPolicy
(),
Ports
:
[]
v1
.
ContainerPort
{
{
ContainerPort
:
44134
,
Name
:
"tiller"
},
...
...
cmd/helm/installer/options.go
View file @
7b821dd5
...
...
@@ -99,7 +99,8 @@ type Options struct {
Values
[]
string
}
func
(
opts
*
Options
)
selectImage
()
string
{
// SelectImage returns the image according to whether UseCanary is true or not
func
(
opts
*
Options
)
SelectImage
()
string
{
switch
{
case
opts
.
UseCanary
:
return
defaultImage
+
":canary"
...
...
pkg/helm/portforwarder/portforwarder.go
View file @
7b821dd5
...
...
@@ -54,6 +54,21 @@ func GetTillerPodName(client corev1.PodsGetter, namespace string) (string, error
return
pod
.
ObjectMeta
.
GetName
(),
nil
}
// GetTillerPodImage fetches the image of tiller pod running in the given namespace.
func
GetTillerPodImage
(
client
corev1
.
PodsGetter
,
namespace
string
)
(
string
,
error
)
{
selector
:=
tillerPodLabels
.
AsSelector
()
pod
,
err
:=
getFirstRunningPod
(
client
,
namespace
,
selector
)
if
err
!=
nil
{
return
""
,
err
}
for
_
,
c
:=
range
pod
.
Spec
.
Containers
{
if
c
.
Name
==
"tiller"
{
return
c
.
Image
,
nil
}
}
return
""
,
fmt
.
Errorf
(
"could not find a tiller pod"
)
}
func
getFirstRunningPod
(
client
corev1
.
PodsGetter
,
namespace
string
,
selector
labels
.
Selector
)
(
*
v1
.
Pod
,
error
)
{
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()}
pods
,
err
:=
client
.
Pods
(
namespace
)
.
List
(
options
)
...
...
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