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
a2e928ad
Commit
a2e928ad
authored
Feb 10, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15 from adamreese/ref-cmd
ref(cmd): break up command definitions
parents
20d3ea9f
3c62cd9f
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 @
a2e928ad
...
...
@@ -7,6 +7,18 @@ import (
"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
{
args
:=
c
.
Args
()
if
len
(
args
)
<
1
{
...
...
cmd/helm/deploy.go
View file @
a2e928ad
...
...
@@ -10,6 +10,45 @@ import (
"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
{
args
:=
c
.
Args
()
if
len
(
args
)
<
1
{
...
...
cmd/helm/dm.go
View file @
a2e928ad
...
...
@@ -2,7 +2,9 @@ package main
import
(
"errors"
"os"
"github.com/codegangsta/cli"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/kubectl"
...
...
@@ -11,6 +13,78 @@ import (
// ErrAlreadyInstalled indicates that DM is 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
{
runner
:=
getKubectlRunner
(
dryRun
)
...
...
cmd/helm/doctor.go
View file @
a2e928ad
package
main
import
(
"github.com/codegangsta/cli"
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/format"
"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
runner
=
&
kubectl
.
RealRunner
{}
if
dm
.
IsInstalled
(
runner
)
{
...
...
cmd/helm/get.go
View file @
a2e928ad
...
...
@@ -7,6 +7,10 @@ import (
"github.com/deis/helm-dm/format"
)
func
init
()
{
addCommands
(
getCmd
())
}
func
getCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"get"
,
...
...
cmd/helm/helm.go
View file @
a2e928ad
...
...
@@ -10,12 +10,18 @@ import (
var
version
=
"0.0.1"
var
commands
[]
cli
.
Command
func
init
()
{
commands
=
cmds
()
}
func
main
()
{
app
:=
cli
.
NewApp
()
app
.
Name
=
"helm"
app
.
Version
=
version
app
.
Usage
=
`Deploy and manage packages.`
app
.
Commands
=
commands
()
app
.
Commands
=
commands
// TODO: make better
app
.
Flags
=
[]
cli
.
Flag
{
...
...
@@ -38,73 +44,8 @@ func main() {
app
.
Run
(
os
.
Args
)
}
func
c
omman
ds
()
[]
cli
.
Command
{
func
c
m
ds
()
[]
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"
,
Usage
:
"Initialize the client and install DM on Kubernetes."
,
...
...
@@ -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"
,
},
listCmd
(),
getCmd
(),
}
}
func
addCommands
(
cmds
...
cli
.
Command
)
{
commands
=
append
(
commands
,
cmds
...
)
}
func
run
(
c
*
cli
.
Context
,
f
func
(
c
*
cli
.
Context
)
error
)
{
if
err
:=
f
(
c
);
err
!=
nil
{
os
.
Stderr
.
Write
([]
byte
(
err
.
Error
()))
...
...
cmd/helm/list.go
View file @
a2e928ad
...
...
@@ -5,6 +5,10 @@ import (
"github.com/deis/helm-dm/format"
)
func
init
()
{
addCommands
(
listCmd
())
}
func
listCmd
()
cli
.
Command
{
return
cli
.
Command
{
Name
:
"list"
,
...
...
cmd/helm/pack.go
View file @
a2e928ad
...
...
@@ -10,6 +10,19 @@ import (
"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
{
args
:=
cxt
.
Args
()
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