Skip to content

Commit bd3a694

Browse files
committed
feat(deisctl): add trireme tool
Trireme is an experimental alternative to deisctl, used just for development.
1 parent 8957a50 commit bd3a694

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

trireme/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Trireme: Development Control Program for Deis
2+
3+
This is a stand-in project during development of Kubernetes/Deis. It may
4+
or may not eventually become deisctl v2. But for now, it's a tool for
5+
working with k8s.
6+
7+
## Why the name "Trireme"?
8+
9+
It's a joke. A really nerdy joke.
10+
11+
"Trireme" is a Latin word (like Deis) that is a corruption of a Greek
12+
word. It refers to a ship that has three banks of oars. So...
13+
14+
- "Kubernetes" is the Greek name for a ship's captain...
15+
- "Trireme" is the latin word for a Greek boat...
16+
- And just like Deis needs about three nodes, a trireme has three banks
17+
of oars.
18+
19+
I warned you... it's a really nerdy joke.

trireme/main.go

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/codegangsta/cli"
8+
)
9+
10+
func main() {
11+
app := cli.NewApp()
12+
app.Name = "trireme"
13+
app.Usage = "A control tool for Deis"
14+
app.Commands = commands()
15+
app.Run(os.Args)
16+
}
17+
18+
func commands() []cli.Command {
19+
return []cli.Command{
20+
{
21+
Name: "install",
22+
Usage: "Install platform components",
23+
/*
24+
Action: func(c *cli.Context) {
25+
fmt.Println("I can only install Platform right now.")
26+
},
27+
*/
28+
Subcommands: installCommands(),
29+
},
30+
}
31+
}
32+
33+
func installCommands() []cli.Command {
34+
parts := map[string]string{
35+
// In alpha order, please.
36+
"builder": "the builder",
37+
"controller": "the controller",
38+
"database": "the database",
39+
"router": "the router mesh",
40+
"store": "the store and all of its components",
41+
// FIXME: Do the rest.
42+
}
43+
44+
// This basically ensures that append() will not have to reallocate.
45+
cmds := make([]cli.Command, 0, len(parts)+1)
46+
47+
for n, v := range parts {
48+
cmds = append(cmds, cli.Command{
49+
Name: n,
50+
Usage: fmt.Sprintf("Install %s.", v),
51+
Action: func(c *cli.Context) { installComponent(c, n) },
52+
})
53+
}
54+
cmds = append(cmds, cli.Command{
55+
Name: "platform",
56+
Usage: "Install the entire platform",
57+
Action: installPlatform,
58+
Flags: []cli.Flag{
59+
cli.StringFlag{
60+
Name: "units, u",
61+
Value: "units/",
62+
Usage: "The path to the Deis Kubernetes JSON unit files.",
63+
EnvVar: "DEIS_K8S_UNITS",
64+
},
65+
cli.StringFlag{
66+
Name: "registry, r",
67+
Usage: "The URL to a Docker registry that holds Deis images images.",
68+
EnvVar: "DEV_REGISTRY",
69+
},
70+
},
71+
})
72+
73+
return cmds
74+
}
75+
76+
func installPlatform(c *cli.Context) {
77+
fmt.Println("Installing platform")
78+
}
79+
func installComponent(c *cli.Context, name string) {
80+
fmt.Printf("Installing component '%s' is currently not supported.\n", name)
81+
os.Exit(1)
82+
}

0 commit comments

Comments
 (0)