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
3c62cd9f
Commit
3c62cd9f
authored
Feb 09, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref(cmd): break up command definitions
parent
20d3ea9f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
173 additions
and
124 deletions
+173
-124
create.go
cmd/helm/create.go
+12
-0
deploy.go
cmd/helm/deploy.go
+39
-0
dm.go
cmd/helm/dm.go
+74
-0
doctor.go
cmd/helm/doctor.go
+15
-1
get.go
cmd/helm/get.go
+4
-0
helm.go
cmd/helm/helm.go
+12
-123
list.go
cmd/helm/list.go
+4
-0
pack.go
cmd/helm/pack.go
+13
-0
No files found.
cmd/helm/create.go
View file @
3c62cd9f
...
@@ -7,6 +7,18 @@ import (
...
@@ -7,6 +7,18 @@ import (
"github.com/kubernetes/deployment-manager/chart"
"github.com/kubernetes/deployment-manager/chart"
)
)
func
init
()
{
addCommands
(
createCmd
())
}
func
createCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"create"
,
Usage
:
"Create a new local chart for editing."
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
create
)
},
}
}
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
{
...
...
cmd/helm/deploy.go
View file @
3c62cd9f
...
@@ -10,6 +10,45 @@ import (
...
@@ -10,6 +10,45 @@ import (
"github.com/kubernetes/deployment-manager/chart"
"github.com/kubernetes/deployment-manager/chart"
)
)
func
init
()
{
addCommands
(
deployCmd
())
}
func
deployCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"deploy"
,
Aliases
:
[]
string
{
"install"
},
Usage
:
"Deploy a chart into the cluster."
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
deploy
)
},
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Only display the underlying kubectl commands."
,
},
cli
.
BoolFlag
{
Name
:
"stdin,i"
,
Usage
:
"Read a configuration from STDIN."
,
},
cli
.
StringFlag
{
Name
:
"name"
,
Usage
:
"Name of deployment, used for deploy and update commands (defaults to template name)"
,
},
// TODO: I think there is a Generic flag type that we can implement parsing with.
cli
.
StringFlag
{
Name
:
"properties,p"
,
Usage
:
"A comma-separated list of key=value pairs: 'foo=bar,foo2=baz'."
,
},
cli
.
StringFlag
{
// FIXME: This is not right. It's sort of a half-baked forward
// port of dm.go.
Name
:
"repository"
,
Usage
:
"The default repository"
,
Value
:
"kubernetes/application-dm-templates"
,
},
},
}
}
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
{
...
...
cmd/helm/dm.go
View file @
3c62cd9f
...
@@ -2,7 +2,9 @@ package main
...
@@ -2,7 +2,9 @@ package main
import
(
import
(
"errors"
"errors"
"os"
"github.com/codegangsta/cli"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/kubectl"
"github.com/deis/helm-dm/kubectl"
...
@@ -11,6 +13,78 @@ import (
...
@@ -11,6 +13,78 @@ import (
// ErrAlreadyInstalled indicates that DM is already installed.
// ErrAlreadyInstalled indicates that DM is already installed.
var
ErrAlreadyInstalled
=
errors
.
New
(
"Already Installed"
)
var
ErrAlreadyInstalled
=
errors
.
New
(
"Already Installed"
)
func
init
()
{
addCommands
(
dmCmd
())
}
func
dmCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"dm"
,
Usage
:
"Manage DM on Kubernetes"
,
Subcommands
:
[]
cli
.
Command
{
{
Name
:
"install"
,
Usage
:
"Install DM on Kubernetes."
,
Description
:
``
,
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Show what would be installed, but don't install anything."
,
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
install
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
}
},
},
{
Name
:
"uninstall"
,
Usage
:
"Uninstall the DM from Kubernetes."
,
Description
:
``
,
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Show what would be installed, but don't install anything."
,
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
uninstall
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
}
},
},
{
Name
:
"status"
,
Usage
:
"Show status of DM."
,
Action
:
func
(
c
*
cli
.
Context
)
{
format
.
Err
(
"Not yet implemented"
)
os
.
Exit
(
1
)
},
},
{
Name
:
"target"
,
Usage
:
"Displays information about cluster."
,
ArgsUsage
:
""
,
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
target
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
(
"%s (Is the cluster running?)"
,
err
)
os
.
Exit
(
1
)
}
},
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Only display the underlying kubectl commands."
,
},
},
},
},
}
}
func
install
(
dryRun
bool
)
error
{
func
install
(
dryRun
bool
)
error
{
runner
:=
getKubectlRunner
(
dryRun
)
runner
:=
getKubectlRunner
(
dryRun
)
...
...
cmd/helm/doctor.go
View file @
3c62cd9f
package
main
package
main
import
(
import
(
"github.com/codegangsta/cli"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/kubectl"
"github.com/deis/helm-dm/kubectl"
)
)
func
doctor
()
error
{
func
init
()
{
addCommands
(
doctorCmd
())
}
func
doctorCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"doctor"
,
Usage
:
"Run a series of checks for necessary prerequisites."
,
ArgsUsage
:
""
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
doctor
)
},
}
}
func
doctor
(
c
*
cli
.
Context
)
error
{
var
runner
kubectl
.
Runner
var
runner
kubectl
.
Runner
runner
=
&
kubectl
.
RealRunner
{}
runner
=
&
kubectl
.
RealRunner
{}
if
dm
.
IsInstalled
(
runner
)
{
if
dm
.
IsInstalled
(
runner
)
{
...
...
cmd/helm/get.go
View file @
3c62cd9f
...
@@ -7,6 +7,10 @@ import (
...
@@ -7,6 +7,10 @@ import (
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/format"
)
)
func
init
()
{
addCommands
(
getCmd
())
}
func
getCmd
()
cli
.
Command
{
func
getCmd
()
cli
.
Command
{
return
cli
.
Command
{
return
cli
.
Command
{
Name
:
"get"
,
Name
:
"get"
,
...
...
cmd/helm/helm.go
View file @
3c62cd9f
...
@@ -10,12 +10,18 @@ import (
...
@@ -10,12 +10,18 @@ import (
var
version
=
"0.0.1"
var
version
=
"0.0.1"
var
commands
[]
cli
.
Command
func
init
()
{
commands
=
cmds
()
}
func
main
()
{
func
main
()
{
app
:=
cli
.
NewApp
()
app
:=
cli
.
NewApp
()
app
.
Name
=
"helm"
app
.
Name
=
"helm"
app
.
Version
=
version
app
.
Version
=
version
app
.
Usage
=
`Deploy and manage packages.`
app
.
Usage
=
`Deploy and manage packages.`
app
.
Commands
=
commands
()
app
.
Commands
=
commands
// TODO: make better
// TODO: make better
app
.
Flags
=
[]
cli
.
Flag
{
app
.
Flags
=
[]
cli
.
Flag
{
...
@@ -38,73 +44,8 @@ func main() {
...
@@ -38,73 +44,8 @@ func main() {
app
.
Run
(
os
.
Args
)
app
.
Run
(
os
.
Args
)
}
}
func
c
omman
ds
()
[]
cli
.
Command
{
func
c
m
ds
()
[]
cli
.
Command
{
return
[]
cli
.
Command
{
return
[]
cli
.
Command
{
{
Name
:
"dm"
,
Usage
:
"Manage DM on Kubernetes"
,
Subcommands
:
[]
cli
.
Command
{
{
Name
:
"install"
,
Usage
:
"Install DM on Kubernetes."
,
Description
:
``
,
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Show what would be installed, but don't install anything."
,
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
install
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
}
},
},
{
Name
:
"uninstall"
,
Usage
:
"Uninstall the DM from Kubernetes."
,
Description
:
``
,
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Show what would be installed, but don't install anything."
,
},
},
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
uninstall
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
(
"%s (Run 'helm doctor' for more information)"
,
err
)
os
.
Exit
(
1
)
}
},
},
{
Name
:
"status"
,
Usage
:
"Show status of DM."
,
Action
:
func
(
c
*
cli
.
Context
)
{
format
.
Err
(
"Not yet implemented"
)
os
.
Exit
(
1
)
},
},
{
Name
:
"target"
,
Usage
:
"Displays information about cluster."
,
ArgsUsage
:
""
,
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
target
(
c
.
Bool
(
"dry-run"
));
err
!=
nil
{
format
.
Err
(
"%s (Is the cluster running?)"
,
err
)
os
.
Exit
(
1
)
}
},
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Only display the underlying kubectl commands."
,
},
},
},
},
},
{
{
Name
:
"init"
,
Name
:
"init"
,
Usage
:
"Initialize the client and install DM on Kubernetes."
,
Usage
:
"Initialize the client and install DM on Kubernetes."
,
...
@@ -122,68 +63,16 @@ func commands() []cli.Command {
...
@@ -122,68 +63,16 @@ func commands() []cli.Command {
}
}
},
},
},
},
{
Name
:
"doctor"
,
Usage
:
"Run a series of checks for necessary prerequisites."
,
ArgsUsage
:
""
,
Action
:
func
(
c
*
cli
.
Context
)
{
if
err
:=
doctor
();
err
!=
nil
{
format
.
Err
(
"%s"
,
err
)
os
.
Exit
(
1
)
}
},
},
{
Name
:
"create"
,
Usage
:
"Create a new local chart for editing."
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
create
)
},
},
{
Name
:
"package"
,
Aliases
:
[]
string
{
"pack"
},
Usage
:
"Given a chart directory, package it into a release."
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
pack
)
},
},
{
Name
:
"deploy"
,
Aliases
:
[]
string
{
"install"
},
Usage
:
"Deploy a chart into the cluster."
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
deploy
)
},
Flags
:
[]
cli
.
Flag
{
cli
.
BoolFlag
{
Name
:
"dry-run"
,
Usage
:
"Only display the underlying kubectl commands."
,
},
cli
.
BoolFlag
{
Name
:
"stdin,i"
,
Usage
:
"Read a configuration from STDIN."
,
},
cli
.
StringFlag
{
Name
:
"name"
,
Usage
:
"Name of deployment, used for deploy and update commands (defaults to template name)"
,
},
// TODO: I think there is a Generic flag type that we can implement parsing with.
cli
.
StringFlag
{
Name
:
"properties,p"
,
Usage
:
"A comma-separated list of key=value pairs: 'foo=bar,foo2=baz'."
,
},
cli
.
StringFlag
{
// FIXME: This is not right. It's sort of a half-baked forward
// port of dm.go.
Name
:
"repository"
,
Usage
:
"The default repository"
,
Value
:
"kubernetes/application-dm-templates"
,
},
},
},
{
{
Name
:
"search"
,
Name
:
"search"
,
},
},
listCmd
(),
getCmd
(),
}
}
}
}
func
addCommands
(
cmds
...
cli
.
Command
)
{
commands
=
append
(
commands
,
cmds
...
)
}
func
run
(
c
*
cli
.
Context
,
f
func
(
c
*
cli
.
Context
)
error
)
{
func
run
(
c
*
cli
.
Context
,
f
func
(
c
*
cli
.
Context
)
error
)
{
if
err
:=
f
(
c
);
err
!=
nil
{
if
err
:=
f
(
c
);
err
!=
nil
{
os
.
Stderr
.
Write
([]
byte
(
err
.
Error
()))
os
.
Stderr
.
Write
([]
byte
(
err
.
Error
()))
...
...
cmd/helm/list.go
View file @
3c62cd9f
...
@@ -5,6 +5,10 @@ import (
...
@@ -5,6 +5,10 @@ import (
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/format"
)
)
func
init
()
{
addCommands
(
listCmd
())
}
func
listCmd
()
cli
.
Command
{
func
listCmd
()
cli
.
Command
{
return
cli
.
Command
{
return
cli
.
Command
{
Name
:
"list"
,
Name
:
"list"
,
...
...
cmd/helm/pack.go
View file @
3c62cd9f
...
@@ -10,6 +10,19 @@ import (
...
@@ -10,6 +10,19 @@ import (
"github.com/kubernetes/deployment-manager/chart"
"github.com/kubernetes/deployment-manager/chart"
)
)
func
init
()
{
addCommands
(
packageCmd
())
}
func
packageCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"package"
,
Aliases
:
[]
string
{
"pack"
},
Usage
:
"Given a chart directory, package it into a release."
,
Action
:
func
(
c
*
cli
.
Context
)
{
run
(
c
,
pack
)
},
}
}
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
{
...
...
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