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
1b1269b0
Commit
1b1269b0
authored
Oct 21, 2016
by
Matt Butcher
Committed by
GitHub
Oct 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1427 from technosophos/fix/1410-localhost-ipv4
fix(helm): use 127.0.0.1 instead of localhost
parents
2eed3f04
4b7e4b71
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
init.go
cmd/helm/init.go
+3
-1
serve.go
cmd/helm/serve.go
+1
-1
local.go
pkg/repo/local.go
+4
-10
local_test.go
pkg/repo/local_test.go
+6
-2
No files found.
cmd/helm/init.go
View file @
1b1269b0
...
...
@@ -40,7 +40,9 @@ const (
stableRepository
=
"stable"
localRepository
=
"local"
stableRepositoryURL
=
"http://storage.googleapis.com/kubernetes-charts"
localRepositoryURL
=
"http://localhost:8879/charts"
// This is the IPv4 loopback, not localhost, because we have to force IPv4
// for Dockerized Helm: https://github.com/kubernetes/helm/issues/1410
localRepositoryURL
=
"http://127.0.0.1:8879/charts"
)
type
initCmd
struct
{
...
...
cmd/helm/serve.go
View file @
1b1269b0
...
...
@@ -51,7 +51,7 @@ func newServeCmd(out io.Writer) *cobra.Command {
f
:=
cmd
.
Flags
()
f
.
StringVar
(
&
srv
.
repoPath
,
"repo-path"
,
helmpath
.
Home
(
homePath
())
.
LocalRepository
(),
"local directory path from which to serve charts"
)
f
.
StringVar
(
&
srv
.
address
,
"address"
,
"
localhost
:8879"
,
"address to listen on"
)
f
.
StringVar
(
&
srv
.
address
,
"address"
,
"
127.0.0.1
:8879"
,
"address to listen on"
)
return
cmd
}
...
...
pkg/repo/local.go
View file @
1b1269b0
...
...
@@ -51,10 +51,6 @@ const indexHTMLTemplate = `
</html>
`
const
indexFile
=
`
Welcome to the Kubernetes Package manager!\nBrowse charts on localhost:8879/charts!
`
// RepositoryServer is an HTTP handler for serving a chart repository.
type
RepositoryServer
struct
{
RepoPath
string
...
...
@@ -64,10 +60,8 @@ type RepositoryServer struct {
func
(
s
*
RepositoryServer
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
uri
:=
r
.
URL
.
Path
switch
uri
{
case
"/"
:
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/plain; charset=utf-8"
)
fmt
.
Fprintf
(
w
,
indexFile
)
case
"/charts/"
,
"/charts/index.html"
,
"/charts/index"
:
case
"/"
,
"/charts/"
,
"/charts/index.html"
,
"/charts/index"
:
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/html; charset=utf-8"
)
s
.
htmlIndex
(
w
,
r
)
default
:
file
:=
strings
.
TrimPrefix
(
uri
,
"/charts/"
)
...
...
@@ -78,7 +72,7 @@ func (s *RepositoryServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// StartLocalRepo starts a web server and serves files from the given path
func
StartLocalRepo
(
path
,
address
string
)
error
{
if
address
==
""
{
address
=
":8879"
address
=
"
127.0.0.1
:8879"
}
s
:=
&
RepositoryServer
{
RepoPath
:
path
}
return
http
.
ListenAndServe
(
address
,
s
)
...
...
@@ -130,7 +124,7 @@ func Reindex(ch *chart.Chart, path string) error {
return
err
}
y
.
Add
(
ch
.
Metadata
,
name
+
".tgz"
,
"http://
localhost
:8879/charts"
,
"sha256:"
+
dig
)
y
.
Add
(
ch
.
Metadata
,
name
+
".tgz"
,
"http://
127.0.0.1
:8879/charts"
,
"sha256:"
+
dig
)
out
,
err
:=
yaml
.
Marshal
(
y
)
if
err
!=
nil
{
...
...
pkg/repo/local_test.go
View file @
1b1269b0
...
...
@@ -25,16 +25,20 @@ import (
)
func
TestRepositoryServer
(
t
*
testing
.
T
)
{
expectedIndexYAML
,
err
:=
ioutil
.
ReadFile
(
"testdata/server/index.yaml"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
tests
:=
[]
struct
{
name
string
path
string
expect
string
}{
{
"index YAML"
,
"/charts/index.yaml"
,
"apiVersion: v1"
},
{
"index YAML"
,
"/charts/index.yaml"
,
string
(
expectedIndexYAML
)
},
{
"index HTML"
,
"/charts/index.html"
,
"<html>"
},
{
"charts root"
,
"/charts/"
,
"<html>"
},
{
"root"
,
"/"
,
"
Welcome
"
},
{
"root"
,
"/"
,
"
<html>
"
},
{
"file"
,
"/test.txt"
,
"Hello World"
},
}
...
...
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