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
cad89240
Unverified
Commit
cad89240
authored
Nov 23, 2017
by
Matthew Fisher
Committed by
GitHub
Nov 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3187 from hoesler/fix/chart_downloader
fix(helm): resolve relative chart paths
parents
7c79d1c7
98e0bd2e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
8 deletions
+51
-8
install.go
cmd/helm/install.go
+4
-3
helm_install.md
docs/helm/helm_install.md
+4
-3
chartrepo.go
pkg/repo/chartrepo.go
+25
-2
chartrepo_test.go
pkg/repo/chartrepo_test.go
+18
-0
No files found.
cmd/helm/install.go
View file @
cad89240
...
...
@@ -79,18 +79,19 @@ round-trip to the Tiller server.
If --verify is set, the chart MUST have a provenance file, and the provenenace
fall MUST pass all verification steps.
There are f
our
different ways you can express the chart you want to install:
There are f
ive
different ways you can express the chart you want to install:
1. By chart reference: helm install stable/mariadb
2. By path to a packaged chart: helm install ./nginx-1.2.3.tgz
3. By path to an unpacked chart directory: helm install ./nginx
4. By absolute URL: helm install https://example.com/charts/nginx-1.2.3.tgz
5. By chart reference and repo url: helm install --repo https://example.com/charts/ nginx
CHART REFERENCES
A chart reference is a convenient way of reference a chart in a chart repository.
When you use a chart reference ('stable/mariadb'), Helm will look in the local
When you use a chart reference
with a repo prefix
('stable/mariadb'), Helm will look in the local
configuration for a chart repository named 'stable', and will then look for a
chart in that repository whose name is 'mariadb'. It will install the latest
version of that chart unless you also supply a version number with the
...
...
@@ -443,7 +444,7 @@ func locateChartPath(repoURL, name, version string, verify bool, keyring,
return
filename
,
err
}
return
filename
,
fmt
.
Errorf
(
"f
ile %q not found
"
,
name
)
return
filename
,
fmt
.
Errorf
(
"f
ailed to download %q
"
,
name
)
}
func
generateName
(
nameTemplate
string
)
(
string
,
error
)
{
...
...
docs/helm/helm_install.md
View file @
cad89240
...
...
@@ -40,18 +40,19 @@ round-trip to the Tiller server.
If --verify is set, the chart MUST have a provenance file, and the provenenace
fall MUST pass all verification steps.
There are f
our
different ways you can express the chart you want to install:
There are f
ive
different ways you can express the chart you want to install:
1.
By chart reference: helm install stable/mariadb
2.
By path to a packaged chart: helm install ./nginx-1.2.3.tgz
3.
By path to an unpacked chart directory: helm install ./nginx
4.
By absolute URL: helm install https://example.com/charts/nginx-1.2.3.tgz
5.
By chart reference and repo url: helm install --repo https://example.com/charts/ nginx
CHART REFERENCES
A chart reference is a convenient way of reference a chart in a chart repository.
When you use a chart reference ('stable/mariadb'), Helm will look in the local
When you use a chart reference
with a repo prefix
('stable/mariadb'), Helm will look in the local
configuration for a chart repository named 'stable', and will then look for a
chart in that repository whose name is 'mariadb'. It will install the latest
version of that chart unless you also supply a version number with the
...
...
@@ -108,4 +109,4 @@ helm install [CHART]
### SEE ALSO
*
[
helm
](
helm.md
)
- The Helm package manager for Kubernetes.
###### Auto generated by spf13/cobra on
7
-Nov-2017
###### Auto generated by spf13/cobra on
22
-Nov-2017
pkg/repo/chartrepo.go
View file @
cad89240
...
...
@@ -184,7 +184,7 @@ func (r *ChartRepository) generateIndex() error {
}
// FindChartInRepoURL finds chart in chart repository pointed by repoURL
// without adding repo to repos
ti
ories
// without adding repo to repos
it
ories
func
FindChartInRepoURL
(
repoURL
,
chartName
,
chartVersion
,
certFile
,
keyFile
,
caFile
string
,
getters
getter
.
Providers
)
(
string
,
error
)
{
// Download and write the index file to a temporary location
...
...
@@ -227,5 +227,28 @@ func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caF
return
""
,
fmt
.
Errorf
(
"%s has no downloadable URLs"
,
errMsg
)
}
return
cv
.
URLs
[
0
],
nil
chartURL
:=
cv
.
URLs
[
0
]
absoluteChartURL
,
err
:=
ResolveReferenceURL
(
repoURL
,
chartURL
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"failed to make chart URL absolute: %v"
,
err
)
}
return
absoluteChartURL
,
nil
}
// ResolveReferenceURL resolves refURL relative to baseURL.
// If refURL is absolute, it simply returns refURL.
func
ResolveReferenceURL
(
baseURL
,
refURL
string
)
(
string
,
error
)
{
parsedBaseURL
,
err
:=
url
.
Parse
(
baseURL
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"failed to parse %s as URL: %v"
,
baseURL
,
err
)
}
parsedRefURL
,
err
:=
url
.
Parse
(
refURL
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"failed to parse %s as URL: %v"
,
refURL
,
err
)
}
return
parsedBaseURL
.
ResolveReference
(
parsedRefURL
)
.
String
(),
nil
}
pkg/repo/chartrepo_test.go
View file @
cad89240
...
...
@@ -277,3 +277,21 @@ func TestErrorFindChartInRepoURL(t *testing.T) {
t
.
Errorf
(
"Expected error for chart not found, but got a different error (%v)"
,
err
)
}
}
func
TestResolveReferenceURL
(
t
*
testing
.
T
)
{
chartURL
,
err
:=
ResolveReferenceURL
(
"http://localhost:8123/charts/"
,
"nginx-0.2.0.tgz"
)
if
err
!=
nil
{
t
.
Errorf
(
"%s"
,
err
)
}
if
chartURL
!=
"http://localhost:8123/charts/nginx-0.2.0.tgz"
{
t
.
Errorf
(
"%s"
,
chartURL
)
}
chartURL
,
err
=
ResolveReferenceURL
(
"http://localhost:8123"
,
"https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz"
)
if
err
!=
nil
{
t
.
Errorf
(
"%s"
,
err
)
}
if
chartURL
!=
"https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz"
{
t
.
Errorf
(
"%s"
,
chartURL
)
}
}
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