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
eb4a187d
Commit
eb4a187d
authored
Apr 04, 2017
by
Matt Butcher
Committed by
GitHub
Apr 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2145 from technosophos/fix/2127-skip-refrsh-on-init
fix(helm): add 'skip-refresh' flag to 'helm init'
parents
6d5b3bbb
ba6c55c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
16 deletions
+24
-16
init.go
cmd/helm/init.go
+20
-14
init_test.go
cmd/helm/init_test.go
+4
-1
chartrepo.go
pkg/repo/chartrepo.go
+0
-1
No files found.
cmd/helm/init.go
View file @
eb4a187d
...
@@ -62,16 +62,17 @@ const (
...
@@ -62,16 +62,17 @@ const (
)
)
type
initCmd
struct
{
type
initCmd
struct
{
image
string
image
string
clientOnly
bool
clientOnly
bool
canary
bool
canary
bool
upgrade
bool
upgrade
bool
namespace
string
namespace
string
dryRun
bool
dryRun
bool
out
io
.
Writer
skipRefresh
bool
home
helmpath
.
Home
out
io
.
Writer
opts
installer
.
Options
home
helmpath
.
Home
kubeClient
internalclientset
.
Interface
opts
installer
.
Options
kubeClient
internalclientset
.
Interface
}
}
func
newInitCmd
(
out
io
.
Writer
)
*
cobra
.
Command
{
func
newInitCmd
(
out
io
.
Writer
)
*
cobra
.
Command
{
...
@@ -99,6 +100,7 @@ func newInitCmd(out io.Writer) *cobra.Command {
...
@@ -99,6 +100,7 @@ func newInitCmd(out io.Writer) *cobra.Command {
f
.
BoolVar
(
&
i
.
upgrade
,
"upgrade"
,
false
,
"upgrade if tiller is already installed"
)
f
.
BoolVar
(
&
i
.
upgrade
,
"upgrade"
,
false
,
"upgrade if tiller is already installed"
)
f
.
BoolVarP
(
&
i
.
clientOnly
,
"client-only"
,
"c"
,
false
,
"if set does not install tiller"
)
f
.
BoolVarP
(
&
i
.
clientOnly
,
"client-only"
,
"c"
,
false
,
"if set does not install tiller"
)
f
.
BoolVar
(
&
i
.
dryRun
,
"dry-run"
,
false
,
"do not install local or remote"
)
f
.
BoolVar
(
&
i
.
dryRun
,
"dry-run"
,
false
,
"do not install local or remote"
)
f
.
BoolVar
(
&
i
.
skipRefresh
,
"skip-refresh"
,
false
,
"do not refresh (download) the local repository cache"
)
// f.BoolVar(&tlsEnable, "tiller-tls", false, "install tiller with TLS enabled")
// f.BoolVar(&tlsEnable, "tiller-tls", false, "install tiller with TLS enabled")
// f.BoolVar(&tlsVerify, "tiller-tls-verify", false, "install tiller with TLS enabled and to verify remote certificates")
// f.BoolVar(&tlsVerify, "tiller-tls-verify", false, "install tiller with TLS enabled and to verify remote certificates")
...
@@ -207,7 +209,7 @@ func (i *initCmd) run() error {
...
@@ -207,7 +209,7 @@ func (i *initCmd) run() error {
if
err
:=
ensureDirectories
(
i
.
home
,
i
.
out
);
err
!=
nil
{
if
err
:=
ensureDirectories
(
i
.
home
,
i
.
out
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
ensureDefaultRepos
(
i
.
home
,
i
.
out
);
err
!=
nil
{
if
err
:=
ensureDefaultRepos
(
i
.
home
,
i
.
out
,
i
.
skipRefresh
);
err
!=
nil
{
return
err
return
err
}
}
if
err
:=
ensureRepoFileFormat
(
i
.
home
.
RepositoryFile
(),
i
.
out
);
err
!=
nil
{
if
err
:=
ensureRepoFileFormat
(
i
.
home
.
RepositoryFile
(),
i
.
out
);
err
!=
nil
{
...
@@ -273,12 +275,12 @@ func ensureDirectories(home helmpath.Home, out io.Writer) error {
...
@@ -273,12 +275,12 @@ func ensureDirectories(home helmpath.Home, out io.Writer) error {
return
nil
return
nil
}
}
func
ensureDefaultRepos
(
home
helmpath
.
Home
,
out
io
.
Writer
)
error
{
func
ensureDefaultRepos
(
home
helmpath
.
Home
,
out
io
.
Writer
,
skipRefresh
bool
)
error
{
repoFile
:=
home
.
RepositoryFile
()
repoFile
:=
home
.
RepositoryFile
()
if
fi
,
err
:=
os
.
Stat
(
repoFile
);
err
!=
nil
{
if
fi
,
err
:=
os
.
Stat
(
repoFile
);
err
!=
nil
{
fmt
.
Fprintf
(
out
,
"Creating %s
\n
"
,
repoFile
)
fmt
.
Fprintf
(
out
,
"Creating %s
\n
"
,
repoFile
)
f
:=
repo
.
NewRepoFile
()
f
:=
repo
.
NewRepoFile
()
sr
,
err
:=
initStableRepo
(
home
.
CacheIndex
(
stableRepository
))
sr
,
err
:=
initStableRepo
(
home
.
CacheIndex
(
stableRepository
)
,
skipRefresh
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -297,7 +299,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer) error {
...
@@ -297,7 +299,7 @@ func ensureDefaultRepos(home helmpath.Home, out io.Writer) error {
return
nil
return
nil
}
}
func
initStableRepo
(
cacheFile
string
)
(
*
repo
.
Entry
,
error
)
{
func
initStableRepo
(
cacheFile
string
,
skipRefresh
bool
)
(
*
repo
.
Entry
,
error
)
{
c
:=
repo
.
Entry
{
c
:=
repo
.
Entry
{
Name
:
stableRepository
,
Name
:
stableRepository
,
URL
:
stableRepositoryURL
,
URL
:
stableRepositoryURL
,
...
@@ -308,6 +310,10 @@ func initStableRepo(cacheFile string) (*repo.Entry, error) {
...
@@ -308,6 +310,10 @@ func initStableRepo(cacheFile string) (*repo.Entry, error) {
return
nil
,
err
return
nil
,
err
}
}
if
skipRefresh
{
return
&
c
,
nil
}
// In this case, the cacheFile is always absolute. So passing empty string
// In this case, the cacheFile is always absolute. So passing empty string
// is safe.
// is safe.
if
err
:=
r
.
DownloadIndexFile
(
""
);
err
!=
nil
{
if
err
:=
r
.
DownloadIndexFile
(
""
);
err
!=
nil
{
...
...
cmd/helm/init_test.go
View file @
eb4a187d
...
@@ -185,7 +185,10 @@ func TestEnsureHome(t *testing.T) {
...
@@ -185,7 +185,10 @@ func TestEnsureHome(t *testing.T) {
if
err
:=
ensureDirectories
(
hh
,
b
);
err
!=
nil
{
if
err
:=
ensureDirectories
(
hh
,
b
);
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
if
err
:=
ensureDefaultRepos
(
hh
,
b
);
err
!=
nil
{
if
err
:=
ensureDefaultRepos
(
hh
,
b
,
false
);
err
!=
nil
{
t
.
Error
(
err
)
}
if
err
:=
ensureDefaultRepos
(
hh
,
b
,
true
);
err
!=
nil
{
t
.
Error
(
err
)
t
.
Error
(
err
)
}
}
if
err
:=
ensureRepoFileFormat
(
hh
.
RepositoryFile
(),
b
);
err
!=
nil
{
if
err
:=
ensureRepoFileFormat
(
hh
.
RepositoryFile
(),
b
);
err
!=
nil
{
...
...
pkg/repo/chartrepo.go
View file @
eb4a187d
...
@@ -161,7 +161,6 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error {
...
@@ -161,7 +161,6 @@ func (r *ChartRepository) DownloadIndexFile(cachePath string) error {
if
!
filepath
.
IsAbs
(
cp
)
{
if
!
filepath
.
IsAbs
(
cp
)
{
cp
=
filepath
.
Join
(
cachePath
,
cp
)
cp
=
filepath
.
Join
(
cachePath
,
cp
)
}
}
println
(
"Writing to"
,
cp
)
return
ioutil
.
WriteFile
(
cp
,
index
,
0644
)
return
ioutil
.
WriteFile
(
cp
,
index
,
0644
)
}
}
...
...
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