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
be2a09d6
Commit
be2a09d6
authored
Feb 05, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(lint): correct several formatting issues
parent
9b494f55
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
33 additions
and
23 deletions
+33
-23
Makefile
Makefile
+2
-2
create.go
cmd/helm/create.go
+2
-2
deploy.go
cmd/helm/deploy.go
+2
-3
dm.go
cmd/helm/dm.go
+3
-2
helm.go
cmd/helm/helm.go
+6
-6
list.go
cmd/helm/list.go
+1
-1
pack.go
cmd/helm/pack.go
+2
-1
deploy.go
deploy/deploy.go
+1
-0
client.go
dm/client.go
+6
-4
install.go
dm/install.go
+1
-1
transport.go
dm/transport.go
+1
-0
messages.go
format/messages.go
+4
-1
get.go
kubectl/get.go
+2
-0
No files found.
Makefile
View file @
be2a09d6
...
@@ -4,7 +4,7 @@ endif
...
@@ -4,7 +4,7 @@ endif
BIN_DIR
:=
bin
BIN_DIR
:=
bin
DIST_DIR
:=
_dist
DIST_DIR
:=
_dist
GO_PACKAGES
:=
cmd/helm dm
GO_PACKAGES
:=
cmd/helm dm
deploy format kubectl
MAIN_GO
:=
github.com/deis/helm-dm/cmd/helm
MAIN_GO
:=
github.com/deis/helm-dm/cmd/helm
HELM_BIN
:=
helm-dm
HELM_BIN
:=
helm-dm
PATH_WITH_HELM
=
PATH
=
"
$(
shell
pwd
)
/
$(BIN_DIR)
/helm:
$(PATH)
"
PATH_WITH_HELM
=
PATH
=
"
$(
shell
pwd
)
/
$(BIN_DIR)
/helm:
$(PATH)
"
...
@@ -47,7 +47,7 @@ quicktest:
...
@@ -47,7 +47,7 @@ quicktest:
$(PATH_WITH_HELM)
go
test
-short
$
(
addprefix ./,
$(GO_PACKAGES)
)
$(PATH_WITH_HELM)
go
test
-short
$
(
addprefix ./,
$(GO_PACKAGES)
)
test
:
test-style
test
:
test-style
$(PATH_WITH_HELM)
go
test
-v
./
$
(
addprefix ./,
$(GO_PACKAGES)
)
$(PATH_WITH_HELM)
go
test
-v
$
(
addprefix ./,
$(GO_PACKAGES)
)
test-style
:
test-style
:
@
if
[
$(
shell
gofmt
-e
-l
-s
*
.go
$(GO_PACKAGES))
]
;
then
\
@
if
[
$(
shell
gofmt
-e
-l
-s
*
.go
$(GO_PACKAGES))
]
;
then
\
...
...
cmd/helm/create.go
View file @
be2a09d6
package
main
package
main
import
(
import
(
"
fmt
"
"
errors
"
"github.com/codegangsta/cli"
"github.com/codegangsta/cli"
"github.com/kubernetes/deployment-manager/chart"
"github.com/kubernetes/deployment-manager/chart"
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
func
create
(
c
*
cli
.
Context
)
error
{
func
create
(
c
*
cli
.
Context
)
error
{
args
:=
c
.
Args
()
args
:=
c
.
Args
()
if
len
(
args
)
<
1
{
if
len
(
args
)
<
1
{
return
fmt
.
Errorf
(
"'helm create' requires a chart name as an argument.
"
)
return
errors
.
New
(
"'helm create' requires a chart name as an argument
"
)
}
}
cf
:=
&
chart
.
Chartfile
{
cf
:=
&
chart
.
Chartfile
{
...
...
cmd/helm/deploy.go
View file @
be2a09d6
...
@@ -13,13 +13,13 @@ import (
...
@@ -13,13 +13,13 @@ import (
func
deploy
(
c
*
cli
.
Context
)
error
{
func
deploy
(
c
*
cli
.
Context
)
error
{
args
:=
c
.
Args
()
args
:=
c
.
Args
()
if
len
(
args
)
<
1
{
if
len
(
args
)
<
1
{
format
.
Err
or
(
"First argument, filename, is required. Try 'helm deploy --help'"
)
format
.
Err
(
"First argument, filename, is required. Try 'helm deploy --help'"
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
props
,
err
:=
parseProperties
(
c
.
String
(
"properties"
))
props
,
err
:=
parseProperties
(
c
.
String
(
"properties"
))
if
err
!=
nil
{
if
err
!=
nil
{
format
.
Err
or
(
"Failed to parse properties: %s"
,
err
)
format
.
Err
(
"Failed to parse properties: %s"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
...
@@ -36,7 +36,6 @@ func deploy(c *cli.Context) error {
...
@@ -36,7 +36,6 @@ func deploy(c *cli.Context) error {
}
}
return
doDeploy
(
d
,
c
.
GlobalString
(
"host"
),
c
.
Bool
(
"dry-run"
))
return
doDeploy
(
d
,
c
.
GlobalString
(
"host"
),
c
.
Bool
(
"dry-run"
))
return
nil
}
}
func
doDeploy
(
cfg
*
dep
.
Deployment
,
host
string
,
dry
bool
)
error
{
func
doDeploy
(
cfg
*
dep
.
Deployment
,
host
string
,
dry
bool
)
error
{
...
...
cmd/helm/dm.go
View file @
be2a09d6
...
@@ -8,14 +8,15 @@ import (
...
@@ -8,14 +8,15 @@ import (
"github.com/deis/helm-dm/kubectl"
"github.com/deis/helm-dm/kubectl"
)
)
var
ErrAlreadyInstalled
error
=
errors
.
New
(
"Already Installed"
)
// ErrAlreadyInstalled indicates that DM is already installed.
var
ErrAlreadyInstalled
=
errors
.
New
(
"Already Installed"
)
func
install
(
dryRun
bool
)
error
{
func
install
(
dryRun
bool
)
error
{
runner
:=
getKubectlRunner
(
dryRun
)
runner
:=
getKubectlRunner
(
dryRun
)
out
,
err
:=
dm
.
Install
(
runner
)
out
,
err
:=
dm
.
Install
(
runner
)
if
err
!=
nil
{
if
err
!=
nil
{
format
.
Err
or
(
"Error installing: %s %s"
,
out
,
err
)
format
.
Err
(
"Error installing: %s %s"
,
out
,
err
)
}
}
format
.
Msg
(
out
)
format
.
Msg
(
out
)
return
nil
return
nil
...
...
cmd/helm/helm.go
View file @
be2a09d6
...
@@ -47,7 +47,7 @@ func commands() []cli.Command {
...
@@ -47,7 +47,7 @@ func commands() []cli.Command {
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
install
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
if
err
:=
install
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
or
(
"%s (Run 'helm doctor' for more information)"
,
err
)
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
},
},
...
@@ -64,7 +64,7 @@ func commands() []cli.Command {
...
@@ -64,7 +64,7 @@ func commands() []cli.Command {
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
uninstall
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
if
err
:=
uninstall
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
or
(
"%s (Run 'helm doctor' for more information)"
,
err
)
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
},
},
...
@@ -73,7 +73,7 @@ func commands() []cli.Command {
...
@@ -73,7 +73,7 @@ func commands() []cli.Command {
Name
:
"status"
,
Name
:
"status"
,
Usage
:
"Show status of DM."
,
Usage
:
"Show status of DM."
,
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
format
.
Err
or
(
"Not yet implemented"
)
format
.
Err
(
"Not yet implemented"
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
},
},
},
},
...
@@ -83,7 +83,7 @@ func commands() []cli.Command {
...
@@ -83,7 +83,7 @@ func commands() []cli.Command {
ArgsUsage
:
""
,
ArgsUsage
:
""
,
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
target
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
if
err
:=
target
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
or
(
"%s (Is the cluster running?)"
,
err
)
format
.
Err
(
"%s (Is the cluster running?)"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
},
},
...
@@ -108,7 +108,7 @@ func commands() []cli.Command {
...
@@ -108,7 +108,7 @@ func commands() []cli.Command {
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
install
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
if
err
:=
install
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
or
(
"%s (Run 'helm doctor' for more information)"
,
err
)
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
},
},
...
@@ -119,7 +119,7 @@ func commands() []cli.Command {
...
@@ -119,7 +119,7 @@ func commands() []cli.Command {
ArgsUsage
:
""
,
ArgsUsage
:
""
,
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
doctor
();
err
!=
nil
{
if
err
:=
doctor
();
err
!=
nil
{
format
.
Err
or
(
"%s"
,
err
)
format
.
Err
(
"%s"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
},
},
...
...
cmd/helm/list.go
View file @
be2a09d6
...
@@ -14,7 +14,7 @@ func listCmd() cli.Command {
...
@@ -14,7 +14,7 @@ func listCmd() cli.Command {
Usage
:
"Lists the deployments in the cluster"
,
Usage
:
"Lists the deployments in the cluster"
,
Action
:
func
(
c
*
cli
.
Context
)
{
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
list
(
c
.
GlobalString
(
"host"
));
err
!=
nil
{
if
err
:=
list
(
c
.
GlobalString
(
"host"
));
err
!=
nil
{
format
.
Err
or
(
"%s (Is the cluster running?)"
,
err
)
format
.
Err
(
"%s (Is the cluster running?)"
,
err
)
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
},
},
...
...
cmd/helm/pack.go
View file @
be2a09d6
package
main
package
main
import
(
import
(
"errors"
"fmt"
"fmt"
"os"
"os"
...
@@ -12,7 +13,7 @@ import (
...
@@ -12,7 +13,7 @@ import (
func
pack
(
cxt
*
cli
.
Context
)
error
{
func
pack
(
cxt
*
cli
.
Context
)
error
{
args
:=
cxt
.
Args
()
args
:=
cxt
.
Args
()
if
len
(
args
)
<
1
{
if
len
(
args
)
<
1
{
return
fmt
.
Errorf
(
"'helm package' requires a path to a chart directory as an argument.
"
)
return
errors
.
New
(
"'helm package' requires a path to a chart directory as an argument
"
)
}
}
dir
:=
args
[
0
]
dir
:=
args
[
0
]
...
...
deploy/deploy.go
View file @
be2a09d6
...
@@ -78,6 +78,7 @@ func (d *Deployment) Prepare() error {
...
@@ -78,6 +78,7 @@ func (d *Deployment) Prepare() error {
return
nil
return
nil
}
}
// Chart retrieves the chart from teh deployment.
func
(
d
*
Deployment
)
Chart
()
*
chart
.
Chart
{
func
(
d
*
Deployment
)
Chart
()
*
chart
.
Chart
{
return
d
.
lchart
return
d
.
lchart
}
}
...
...
dm/client.go
View file @
be2a09d6
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
)
)
// The default HTTP timeout
// The default HTTP timeout
var
DefaultHTTPTimeout
time
.
Duration
=
time
.
Second
*
10
var
DefaultHTTPTimeout
=
time
.
Second
*
10
// Client is a DM client.
// Client is a DM client.
type
Client
struct
{
type
Client
struct
{
...
@@ -50,7 +50,7 @@ func (c *Client) url(path string) string {
...
@@ -50,7 +50,7 @@ func (c *Client) url(path string) string {
func
(
c
*
Client
)
CallService
(
path
,
method
,
action
string
,
dest
interface
{},
reader
io
.
ReadCloser
)
error
{
func
(
c
*
Client
)
CallService
(
path
,
method
,
action
string
,
dest
interface
{},
reader
io
.
ReadCloser
)
error
{
u
:=
c
.
url
(
path
)
u
:=
c
.
url
(
path
)
resp
,
err
:=
c
.
callH
ttp
(
u
,
method
,
action
,
reader
)
resp
,
err
:=
c
.
callH
TTP
(
u
,
method
,
action
,
reader
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -69,8 +69,8 @@ func (c *Client) CallService(path, method, action string, dest interface{}, read
...
@@ -69,8 +69,8 @@ func (c *Client) CallService(path, method, action string, dest interface{}, read
return
nil
return
nil
}
}
// callH
ttp
is a low-level primative for executing HTTP operations.
// callH
TTP
is a low-level primative for executing HTTP operations.
func
(
c
*
Client
)
callH
ttp
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
(
string
,
error
)
{
func
(
c
*
Client
)
callH
TTP
(
path
,
method
,
action
string
,
reader
io
.
ReadCloser
)
(
string
,
error
)
{
request
,
err
:=
http
.
NewRequest
(
method
,
path
,
reader
)
request
,
err
:=
http
.
NewRequest
(
method
,
path
,
reader
)
request
.
Header
.
Add
(
"Content-Type"
,
"application/json"
)
request
.
Header
.
Add
(
"Content-Type"
,
"application/json"
)
...
@@ -99,6 +99,7 @@ func (c *Client) callHttp(path, method, action string, reader io.ReadCloser) (st
...
@@ -99,6 +99,7 @@ func (c *Client) callHttp(path, method, action string, reader io.ReadCloser) (st
return
string
(
body
),
nil
return
string
(
body
),
nil
}
}
// ListDeployments lists the deployments in DM.
func
(
c
*
Client
)
ListDeployments
()
error
{
func
(
c
*
Client
)
ListDeployments
()
error
{
var
d
interface
{}
var
d
interface
{}
if
err
:=
c
.
CallService
(
"deployments"
,
"GET"
,
"foo"
,
&
d
,
nil
);
err
!=
nil
{
if
err
:=
c
.
CallService
(
"deployments"
,
"GET"
,
"foo"
,
&
d
,
nil
);
err
!=
nil
{
...
@@ -109,6 +110,7 @@ func (c *Client) ListDeployments() error {
...
@@ -109,6 +110,7 @@ func (c *Client) ListDeployments() error {
return
nil
return
nil
}
}
// DeployChart sends a chart to DM for deploying.
func
(
c
*
Client
)
DeployChart
(
filename
,
deployname
string
)
error
{
func
(
c
*
Client
)
DeployChart
(
filename
,
deployname
string
)
error
{
f
,
err
:=
os
.
Open
(
filename
)
f
,
err
:=
os
.
Open
(
filename
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
dm/install.go
View file @
be2a09d6
...
@@ -20,7 +20,7 @@ func IsInstalled(runner kubectl.Runner) bool {
...
@@ -20,7 +20,7 @@ func IsInstalled(runner kubectl.Runner) bool {
// we know that we have both the namespace and the manager API server.
// we know that we have both the namespace and the manager API server.
out
,
err
:=
runner
.
GetByKind
(
"rc"
,
"manager-rc"
,
"dm"
)
out
,
err
:=
runner
.
GetByKind
(
"rc"
,
"manager-rc"
,
"dm"
)
if
err
!=
nil
{
if
err
!=
nil
{
format
.
Err
or
(
"Installation not found: %s %s"
,
out
,
err
)
format
.
Err
(
"Installation not found: %s %s"
,
out
,
err
)
return
false
return
false
}
}
return
true
return
true
...
...
dm/transport.go
View file @
be2a09d6
...
@@ -15,6 +15,7 @@ type debugTransport struct {
...
@@ -15,6 +15,7 @@ type debugTransport struct {
http
.
RoundTripper
http
.
RoundTripper
}
}
// NewDebugTransport returns a debugging implementation of a RoundTripper.
func
NewDebugTransport
(
rt
http
.
RoundTripper
)
http
.
RoundTripper
{
func
NewDebugTransport
(
rt
http
.
RoundTripper
)
http
.
RoundTripper
{
return
debugTransport
{
return
debugTransport
{
RoundTripper
:
rt
,
RoundTripper
:
rt
,
...
...
format/messages.go
View file @
be2a09d6
...
@@ -7,16 +7,19 @@ import (
...
@@ -7,16 +7,19 @@ import (
// This is all just placeholder.
// This is all just placeholder.
func
Error
(
msg
string
,
v
...
interface
{})
{
// Err prints an error message to Stderr.
func
Err
(
msg
string
,
v
...
interface
{})
{
msg
=
"[ERROR] "
+
msg
+
"
\n
"
msg
=
"[ERROR] "
+
msg
+
"
\n
"
fmt
.
Fprintf
(
os
.
Stderr
,
msg
,
v
...
)
fmt
.
Fprintf
(
os
.
Stderr
,
msg
,
v
...
)
}
}
// Info prints an informational message to Stdout.
func
Info
(
msg
string
,
v
...
interface
{})
{
func
Info
(
msg
string
,
v
...
interface
{})
{
msg
=
"[INFO] "
+
msg
+
"
\n
"
msg
=
"[INFO] "
+
msg
+
"
\n
"
fmt
.
Fprintf
(
os
.
Stdout
,
msg
,
v
...
)
fmt
.
Fprintf
(
os
.
Stdout
,
msg
,
v
...
)
}
}
// Msg prints a raw message to Stdout.
func
Msg
(
msg
string
,
v
...
interface
{})
{
func
Msg
(
msg
string
,
v
...
interface
{})
{
fmt
.
Fprintf
(
os
.
Stdout
,
msg
,
v
...
)
fmt
.
Fprintf
(
os
.
Stdout
,
msg
,
v
...
)
}
}
...
...
kubectl/get.go
View file @
be2a09d6
...
@@ -13,6 +13,7 @@ func (r RealRunner) Get(stdin []byte, ns string) ([]byte, error) {
...
@@ -13,6 +13,7 @@ func (r RealRunner) Get(stdin []byte, ns string) ([]byte, error) {
return
cmd
.
CombinedOutput
()
return
cmd
.
CombinedOutput
()
}
}
// GetByKind gets a named thing by kind.
func
(
r
RealRunner
)
GetByKind
(
kind
,
name
,
ns
string
)
(
string
,
error
)
{
func
(
r
RealRunner
)
GetByKind
(
kind
,
name
,
ns
string
)
(
string
,
error
)
{
args
:=
[]
string
{
"get"
,
kind
,
name
}
args
:=
[]
string
{
"get"
,
kind
,
name
}
...
@@ -37,6 +38,7 @@ func (r PrintRunner) Get(stdin []byte, ns string) ([]byte, error) {
...
@@ -37,6 +38,7 @@ func (r PrintRunner) Get(stdin []byte, ns string) ([]byte, error) {
return
[]
byte
(
cmd
.
String
()),
nil
return
[]
byte
(
cmd
.
String
()),
nil
}
}
// GetByKind gets a named thing by kind.
func
(
r
PrintRunner
)
GetByKind
(
kind
,
name
,
ns
string
)
(
string
,
error
)
{
func
(
r
PrintRunner
)
GetByKind
(
kind
,
name
,
ns
string
)
(
string
,
error
)
{
args
:=
[]
string
{
"get"
,
kind
,
name
}
args
:=
[]
string
{
"get"
,
kind
,
name
}
...
...
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