diff --git a/cmd/image/build.go b/cmd/image/build.go index a3636ac..86ba99b 100644 --- a/cmd/image/build.go +++ b/cmd/image/build.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/projecteru2/cli/cmd/utils" + dockerengine "github.com/projecteru2/core/engine/docker" corepb "github.com/projecteru2/core/rpc/gen" @@ -37,10 +38,12 @@ func (o *buildImageOptions) run(ctx context.Context) error { break } if err != nil { + fmt.Printf("Build failed: %s\tErrorDetail: %s\n", msg.Error, msg.ErrorDetail) return err } if msg.Error != "" { // nolint + fmt.Printf("Build failed: %s\tErrorDetail: %s\n", msg.Error, msg.ErrorDetail) return cli.Exit(msg.ErrorDetail.Message, int(msg.ErrorDetail.Code)) } else if msg.Stream != "" { fmt.Print(msg.Stream) @@ -70,7 +73,7 @@ func (o *buildImageOptions) run(ctx context.Context) error { } } } - logrus.Infof("build image %s complete", o.opts.Name) + fmt.Printf("build image %s complete\n", o.opts.Name) return nil } diff --git a/cmd/image/cmd.go b/cmd/image/cmd.go index 44a91c0..2cf4c4a 100644 --- a/cmd/image/cmd.go +++ b/cmd/image/cmd.go @@ -103,6 +103,28 @@ func Command() *cli.Command { }, Action: utils.ExitCoder(cmdImageClean), }, + { + Name: "list", + Aliases: []string{"ls"}, + Usage: "list image(s) by podname or nodename(s)", + ArgsUsage: "[podname/nodenames]", + Flags: []cli.Flag{ + &cli.StringSliceFlag{ + Name: "nodename", + Usage: "nodename if you just want to list on specific nodes", + }, + &cli.StringFlag{ + Name: "podname", + Usage: "name of pod, if you want to list on all nodes in one pod", + }, + &cli.StringFlag{ + Name: "filter", + Usage: "filter the name of image", + Required: false, + }, + }, + Action: utils.ExitCoder(cmdImageList), + }, }, } } diff --git a/cmd/image/list.go b/cmd/image/list.go new file mode 100644 index 0000000..30531b7 --- /dev/null +++ b/cmd/image/list.go @@ -0,0 +1,81 @@ +package image + +import ( + "context" + "errors" + "fmt" + "io" + + "github.com/projecteru2/cli/cmd/utils" + "github.com/projecteru2/cli/describe" + "github.com/urfave/cli/v2" + + corepb "github.com/projecteru2/core/rpc/gen" +) + +type listImageOptions struct { + client corepb.CoreRPCClient + opts *corepb.ListImageOptions +} + +func (o *listImageOptions) run(ctx context.Context) error { + resp, err := o.client.ListImage(ctx, o.opts) + if err != nil { + return err + } + + msgs := []*corepb.ListImageMessage{} + for { + msg, err := resp.Recv() + if err == io.EOF { + break + } + if err != nil { + fmt.Printf("Build failed: %s\n", err.Error()) + return err + } + + if len(msg.Err) > 1 { + fmt.Printf("Build failed: %s\n", msg.Err) + return cli.Exit(msg.Err, -1) + } + + msgs = append(msgs, msg) + } + + describe.Images(msgs...) + return nil +} + +func cmdImageList(c *cli.Context) error { + client, err := utils.NewCoreRPCClient(c) + if err != nil { + return err + } + + opts, err := generateListOptions(c) + if err != nil { + return err + } + + o := &listImageOptions{ + client: client, + opts: opts, + } + return o.run(c.Context) +} + +func generateListOptions(c *cli.Context) (*corepb.ListImageOptions, error) { + filter := c.String("filter") + podname := c.String("podname") + nodename := c.StringSlice("nodename") + if len(nodename) < 1 && len(podname) < 1 { + return nil, errors.New("[List] podname or nodenames should be given") + } + + return &corepb.ListImageOptions{ + Podname: podname, + Nodenames: nodename, + Filter: filter, + }, nil +} diff --git a/describe/image.go b/describe/image.go new file mode 100644 index 0000000..490ceb2 --- /dev/null +++ b/describe/image.go @@ -0,0 +1,47 @@ +package describe + +import ( + "os" + + "github.com/jedib0t/go-pretty/v6/table" + "github.com/jedib0t/go-pretty/v6/text" + + corepb "github.com/projecteru2/core/rpc/gen" +) + +// Images describes a list of images +// output format can be json or yaml or table +func Images(msgs ...*corepb.ListImageMessage) { + switch { + case isJSON(): + describeAsJSON(msgs) + case isYAML(): + describeAsYAML(msgs) + default: + describeImages(msgs) + } +} + +func describeImages(msgs []*corepb.ListImageMessage) { + t := table.NewWriter() + t.SetOutputMirror(os.Stdout) + t.AppendHeader(table.Row{"Node", "Image", "Tags"}) + + for _, msg := range msgs { + for _, image := range msg.Images { + rows := [][]string{ + {msg.Nodename}, + {image.Id}, + image.Tags, + } + t.AppendRows(toTableRows(rows)) + } + } + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, AutoMerge: true, VAlign: text.VAlignMiddle}, + {Number: 2, AutoMerge: true}, + }) + t.SetStyle(table.StyleLight) + t.Style().Options.SeparateRows = true + t.Render() +} diff --git a/go.mod b/go.mod index 2bc6519..907df56 100644 --- a/go.mod +++ b/go.mod @@ -21,3 +21,5 @@ require ( golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 gopkg.in/yaml.v2 v2.4.0 ) + +replace github.com/projecteru2/core => github.com/aceralon/core v0.0.0-20211210073321-bb68d882cf88 diff --git a/go.sum b/go.sum index b4ac741..a786313 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,10 @@ github.com/Microsoft/hcsshim v0.8.11 h1:qs8+XI1mFA1H/zhXT9qVG/lcJO18p1yCsICIrCjV github.com/Microsoft/hcsshim v0.8.11/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= +github.com/aceralon/core v0.0.0-20211210030752-f73e23256b4d h1:PEmIDRI7XaDj8Wuqt9C0S00e7czA4hzWikCcd4UeHo8= +github.com/aceralon/core v0.0.0-20211210030752-f73e23256b4d/go.mod h1:K9utriteP7PNI2yWIKhQEnVEN8Ace8Z5ek0TMJqM7kM= +github.com/aceralon/core v0.0.0-20211210073321-bb68d882cf88 h1:FWD7uIJZF+8kYjEXNRznMX50VmYnxeZRwykAobyyBPA= +github.com/aceralon/core v0.0.0-20211210073321-bb68d882cf88/go.mod h1:K9utriteP7PNI2yWIKhQEnVEN8Ace8Z5ek0TMJqM7kM= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -107,10 +111,12 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= @@ -127,6 +133,7 @@ github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQ github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4= github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -162,6 +169,7 @@ github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NB github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -226,6 +234,7 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -303,12 +312,14 @@ github.com/juju/errors v0.0.0-20200330140219-3fe23663418f/go.mod h1:W54LbzXuIE0b github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/juju/httpprof v0.0.0-20141217160036-14bf14c30767/go.mod h1:+MaLYz4PumRkkyHYeXJ2G5g5cIW0sli2bOfpmbaMV/g= github.com/juju/loggo v0.0.0-20170605014607-8232ab8918d9/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/loggo v0.0.0-20200526014432-9ce3a2e09b5e h1:FdDd7bdI6cjq5vaoYlK1mfQYfF9sF2VZw8VEZMsl5t8= github.com/juju/loggo v0.0.0-20200526014432-9ce3a2e09b5e/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= github.com/juju/mutex v0.0.0-20171110020013-1fe2a4bf0a3a/go.mod h1:Y3oOzHH8CQ0Ppt0oCKJ2JFO81/EsWenH5AEqigLH+yY= github.com/juju/retry v0.0.0-20151029024821-62c620325291/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= github.com/juju/retry v0.0.0-20180821225755-9058e192b216/go.mod h1:OohPQGsr4pnxwD5YljhQ+TZnuVRYpa5irjugL1Yuif4= github.com/juju/testing v0.0.0-20180402130637-44801989f0f7/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= github.com/juju/testing v0.0.0-20190723135506-ce30eb24acd2/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/juju/testing v0.0.0-20201216035041-2be42bba85f3 h1:ram7cW6jDPTu6cv9xDMwa+tO7RsO4BdsubxrJ4EEw+E= github.com/juju/testing v0.0.0-20201216035041-2be42bba85f3/go.mod h1:IbSKFoKW0bzmbDZ7rBwF/L3lO3b1bpmOIhTXQl/WJxw= github.com/juju/utils v0.0.0-20180424094159-2000ea4ff043/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= github.com/juju/utils v0.0.0-20200116185830-d40c2fe10647/go.mod h1:6/KLg8Wz/y2KVGWEpkK9vMNGkOnu4k/cqs8Z1fKjTOk= @@ -343,6 +354,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= @@ -399,6 +411,7 @@ github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5Vgl github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -432,6 +445,7 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -442,11 +456,10 @@ github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6J github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk= github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/projecteru2/core v0.0.0-20211123023700-4c093d1c5b6a h1:04lfeJG46ldlC3gV1FEOyg1TvmKnIQ6c4tlCWX+lDYw= -github.com/projecteru2/core v0.0.0-20211123023700-4c093d1c5b6a/go.mod h1:pvAHWsHBU+qMK3KX2kL8J0y8lx729bZOltIAGRL/UHU= -github.com/projecteru2/libyavirt v0.0.0-20211112023512-fbd788e688d5/go.mod h1:FOc+hWBMLsMrmx5p3/moizKeSomedZPNwB6LhS+kEnE= +github.com/projecteru2/libyavirt v0.0.0-20211202092239-8539e8218458/go.mod h1:FOc+hWBMLsMrmx5p3/moizKeSomedZPNwB6LhS+kEnE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -520,6 +533,7 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -527,6 +541,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -756,6 +771,7 @@ golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -791,6 +807,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -850,6 +867,7 @@ gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5/go.mod h1:u0ALmqvLRxLI95fkdCEWrE6mhWYZW1aMOJHp5YXLHTg= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -862,6 +880,7 @@ gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -880,8 +899,11 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/manual.md b/manual.md index 760e788..4593c7f 100644 --- a/manual.md +++ b/manual.md @@ -5,50 +5,51 @@ - [Some Terms](#some-terms) - [Global Options](#global-options) - [Sub Commands](#sub-commands) - - [Core Sub Commands](#core-sub-commands) - - [info](#info) - - [Image Sub Commands](#image-sub-commands) - - [build](#build) - - [cache](#cache) - - [remove](#remove) - - [Lambda Sub Commands](#lambda-sub-commands) - - [Node Sub Commands](#node-sub-commands) - - [add](#add) - - [remove](#remove-1) - - [get](#get) - - [set](#set) - - [workloads, containers](#workloads--containers) - - [up](#up) - - [down](#down) - - [set-status](#set-status) - - [watch-status](#watch-status) - - [resource](#resource) - - [Pod Sub Commands](#pod-sub-commands) - - [add](#add-1) - - [list](#list) - - [remove](#remove-2) - - [resource](#resource-1) - - [capacity](#capacity) - - [nodes](#nodes) - - [networks](#networks) - - [Status Sub Commands](#status-sub-commands) - - [Workload / Container Sub Commands](#workload---container-sub-commands) - - [get](#get-1) - - [logs](#logs) - - [get-status](#get-status) - - [set-status](#set-status-1) - - [list](#list-1) - - [stop](#stop) - - [start](#start) - - [restart](#restart) - - [remove](#remove-3) - - [copy](#copy) - - [send](#send) - - [dissociate](#dissociate) - - [realloc](#realloc) - - [exec](#exec) - - [deploy](#deploy) - - [replace](#replace) + - [Core Sub Commands](#core-sub-commands) + - [info](#info) + - [Image Sub Commands](#image-sub-commands) + - [build](#build) + - [cache](#cache) + - [remove](#remove) + - [list](#list) + - [Lambda Sub Commands](#lambda-sub-commands) + - [Node Sub Commands](#node-sub-commands) + - [add](#add) + - [remove](#remove-1) + - [get](#get) + - [set](#set) + - [workloads, containers](#workloads--containers) + - [up](#up) + - [down](#down) + - [set-status](#set-status) + - [watch-status](#watch-status) + - [resource](#resource) + - [Pod Sub Commands](#pod-sub-commands) + - [add](#add-1) + - [list](#list-1) + - [remove](#remove-2) + - [resource](#resource-1) + - [capacity](#capacity) + - [nodes](#nodes) + - [networks](#networks) + - [Status Sub Commands](#status-sub-commands) + - [Workload / Container Sub Commands](#workload---container-sub-commands) + - [get](#get-1) + - [logs](#logs) + - [get-status](#get-status) + - [set-status](#set-status-1) + - [list](#list-2) + - [stop](#stop) + - [start](#start) + - [restart](#restart) + - [remove](#remove-3) + - [copy](#copy) + - [send](#send) + - [dissociate](#dissociate) + - [realloc](#realloc) + - [exec](#exec) + - [deploy](#deploy) + - [replace](#replace) ## Some Terms @@ -56,19 +57,20 @@ Sometimes it confuses users when an option is given as a flag, or a bool value. - When you see `flag`, it means you only need to give this option for a `true` value, or don't give for a `false` value. - - Assume `eru-cli` supports a flag option `--flag-option`, then: - - `eru-cli --flag-option` means `--flag-option` is `true`. - - `eru-cli` means `--flag-option` is `false`. + - Assume `eru-cli` supports a flag option `--flag-option`, then: + - `eru-cli --flag-option` means `--flag-option` is `true`. + - `eru-cli` means `--flag-option` is `false`. - When you see `use this option`, it means you give a value to this option, or give this option when it's a flag. - - Assume `eru-cli` supports `--use-this-option`, then: - - `eru-cli --use-this-option tonic` means the value of `--use-this-option` is `tonic`. - - `eru-cli --use-this-option muroq` means the value of `--use-this-option` is `muroq`. - - `eru-cli` means the value of `--use-this-option` is the default value, if it has a default value. - - For flag case, refer to the former one. + - Assume `eru-cli` supports `--use-this-option`, then: + - `eru-cli --use-this-option tonic` means the value of `--use-this-option` is `tonic`. + - `eru-cli --use-this-option muroq` means the value of `--use-this-option` is `muroq`. + - `eru-cli` means the value of `--use-this-option` is the default value, if it has a default value. + - For flag case, refer to the former one. -- When you see `define this option`, it means you set a value for this option, either via this cli option, or via environment variables. +- When you see `define this option`, it means you set a value for this option, either via this cli option, or via + environment variables. Also pay attention to the order of components, it should be: @@ -80,58 +82,62 @@ eru-cli [global options] command [command options] [arguments...] ## Global Options -Global options are used to define the global settings for eru-cli command. Once defined, options are affected to all sub commands. +Global options are used to define the global settings for eru-cli command. Once defined, options are affected to all sub +commands. We currently have these options: - `--debug`, `-d` - - This is a flag. - - If given, enables debug mode, debug mode prints more detailed information. - - Default value is empty, which means you don't use this option, this will disable debug mode. + - This is a flag. + - If given, enables debug mode, debug mode prints more detailed information. + - Default value is empty, which means you don't use this option, this will disable debug mode. - `--eru`, `-e` - - This option defines which eru-core you want to use. - - Default value is `localhost:5001` - - You can also set environment variable `ERU` to define this option. - - Note: eru-cli will try to connect to this eru-core instance, but if there're multiple eru-core instances, service discovery will decide which one is the one to use, it may not be the one you defined in this option. + - This option defines which eru-core you want to use. + - Default value is `localhost:5001` + - You can also set environment variable `ERU` to define this option. + - Note: eru-cli will try to connect to this eru-core instance, but if there're multiple eru-core instances, service + discovery will decide which one is the one to use, it may not be the one you defined in this option. - `--username`, `-u` - - This option defines the username of the target eru-core (as defined in `--eru` / `-e`). - - If your eru-core instance doesn't require a username, don't use this option. - - You can also set environment variable `ERU_USERNAME` to define this option. + - This option defines the username of the target eru-core (as defined in `--eru` / `-e`). + - If your eru-core instance doesn't require a username, don't use this option. + - You can also set environment variable `ERU_USERNAME` to define this option. - `--password`, `-p` - - This option defines the password of the target eru-core (as defined in `--eru`/ `-e`). - - If your eru-core instance doesn't require a password, dont' use this option. - - You can also set environment variable `ERU_PASSWORD` to define this option. + - This option defines the password of the target eru-core (as defined in `--eru`/ `-e`). + - If your eru-core instance doesn't require a password, dont' use this option. + - You can also set environment variable `ERU_PASSWORD` to define this option. - `--output`, `-o` - - This option defines the output format of eru-cli. - - Possible values are `json`, `yaml`, or don't use this option. - - Format `json` will print result in JSON format. - - Format `yaml` will print result in Yaml format. - - The default value is empty, which means you don't use this option, then the result will be printed as a table. - - Table format will only print some user friendly information, for details, `json` / `yaml` format is suggested. - - You can also set environment variable `ERU_OUTPUT_FORMAT` to define this option. + - This option defines the output format of eru-cli. + - Possible values are `json`, `yaml`, or don't use this option. + - Format `json` will print result in JSON format. + - Format `yaml` will print result in Yaml format. + - The default value is empty, which means you don't use this option, then the result will be printed as a table. + - Table format will only print some user friendly information, for details, `json` / `yaml` format is suggested. + - You can also set environment variable `ERU_OUTPUT_FORMAT` to define this option. - `--help`, `-h` - - When this option is used, eru-cli will print help message and exit. - - This option is also supported by all the sub commands. Hence when introducing sub commands, we will skip this `--help` / `-h` option. + - When this option is used, eru-cli will print help message and exit. + - This option is also supported by all the sub commands. Hence when introducing sub commands, we will skip + this `--help` / `-h` option. - `--version`, `-v` - - When this option is used, eru-cli will print version and exit. + - When this option is used, eru-cli will print version and exit. ## Sub Commands ### Core Sub Commands -Core sub commands are started with `core` command. The format should be `eru-cli core [sub command] [command options] [arguments...]` +Core sub commands are started with `core` command. The format should +be `eru-cli core [sub command] [command options] [arguments...]` These sub commands are supported: @@ -173,7 +179,8 @@ $ eru-cli --output json core info ### Image Sub Commands -Image sub commands are started with `image` command. The format should be `eru-cli image [sub command] [command options] [arguments...]`. +Image sub commands are started with `image` command. The format should +be `eru-cli image [sub command] [command options] [arguments...]`. The image sub commands are only supported by docker engine, systemd and virtual machine are not supported. @@ -182,6 +189,7 @@ These sub commands are supported: - `build` - `cache` - `remove` +- `list` #### build @@ -193,69 +201,74 @@ Command options are: - `--name` - - Defines the name of the image. - - MUST be given + - Defines the name of the image. + - MUST be given - `--tag` - - Defines the tag of the image. - - MUST be given + - Defines the tag of the image. + - MUST be given - `--raw` - - This is a flag. - - If this option is defined, `eru-cli image build --name ${name} --tag ${tag} path/to/content` acts like `docker build -t ${name}:${tag} path/to/content`. - - You need to make sure the content in `path/to/content` is exactly like when you are using `docker build`, for example, there is a default Dockerfile. - - This flag conflicts with `--exist`. + - This is a flag. + - If this option is defined, `eru-cli image build --name ${name} --tag ${tag} path/to/content` acts + like `docker build -t ${name}:${tag} path/to/content`. + - You need to make sure the content in `path/to/content` is exactly like when you are using `docker build`, for + example, there is a default Dockerfile. + - This flag conflicts with `--exist`. - `--exist` - - This is a flag. - - If this option is defined, `eru-cli image build --name ${name} --tag ${tag} ${containerID}` acts like `docker commit ${containerID} ${name}:${tag}`. - - This flag conflicts with `--raw`. - - This is useful when you want to create an image from existing ERU container. + - This is a flag. + - If this option is defined, `eru-cli image build --name ${name} --tag ${tag} ${containerID}` acts + like `docker commit ${containerID} ${name}:${tag}`. + - This flag conflicts with `--raw`. + - This is useful when you want to create an image from existing ERU container. - `--user` and `--uid` - - Defines the default user and uid of the image, equivalent to `USER` in Dockerfile. - - Default value of user is `root`. - - Default value of uid is `1`. + - Defines the default user and uid of the image, equivalent to `USER` in Dockerfile. + - Default value of user is `root`. + - Default value of uid is `1`. - `--stop-signal` - - Defines the signal sent to the workload for docker. - - Equivalent to `STOPSIGNAL` in Dockerfile. - - You can set the signal number or the signal name, `--stop-signal SIGKILL` and `--stop-signal 9` both work. + - Defines the signal sent to the workload for docker. + - Equivalent to `STOPSIGNAL` in Dockerfile. + - You can set the signal number or the signal name, `--stop-signal SIGKILL` and `--stop-signal 9` both work. Command arguments are: - `` - - This argument has multiple meanings. - - If `--exist` is defined, this argument refers to a working workload ID, note that workload type can only be docker container currently. - - If `--raw` is defined, this argument refers to a path that contains all the files for `docker build` command. - - If neither `--exist` nor `--raw` is defined, this argument refers to either a URL contains the specification file, or a path to the specification file. - - An example of specification file is: - - ``` - stages: - - test - - build - - builds: - test: - base: tonic/ubuntu:phistage - commands: - - echo tested - build: - base: tonic/ubuntu:phistage - repo: git@github.com:tonicbupt/phistage.git - version: "HEAD" - commands: - - echo built - - echo test > testfile - cache: - "testfile": "/usr/local/testfile - ``` + - This argument has multiple meanings. + - If `--exist` is defined, this argument refers to a working workload ID, note that workload type can only be docker + container currently. + - If `--raw` is defined, this argument refers to a path that contains all the files for `docker build` command. + - If neither `--exist` nor `--raw` is defined, this argument refers to either a URL contains the specification file, + or a path to the specification file. + - An example of specification file is: + + ``` + stages: + - test + - build + + builds: + test: + base: tonic/ubuntu:phistage + commands: + - echo tested + build: + base: tonic/ubuntu:phistage + repo: git@github.com:tonicbupt/phistage.git + version: "HEAD" + commands: + - echo built + - echo test > testfile + cache: + "testfile": "/usr/local/testfile + ``` #### cache @@ -263,25 +276,26 @@ This command will cache an image to all the nodes or pods specified. The format is `eru-cli image cache [command options] `. -The `` refers to the images to pull, can be given multiple times, like `eru-cli image cache --podname pod img1 img2 img3`. +The `` refers to the images to pull, can be given multiple times, +like `eru-cli image cache --podname pod img1 img2 img3`. Command options are: - `--nodename` - - This option can be defined multiple times, like `--nodename n1 --nodename n2` - - Defines the name of the node. - - If you only want to pre pull an image on some nodes, use this option. + - This option can be defined multiple times, like `--nodename n1 --nodename n2` + - Defines the name of the node. + - If you only want to pre pull an image on some nodes, use this option. - `--podname` - - Defines the name of the pod. - - If you want to pre pull an image on all nodes of a pod, use this option. + - Defines the name of the pod. + - If you want to pre pull an image on all nodes of a pod, use this option. - `--concurrent` - - Defines how many workers to pull image concurrently. - - Default value is `10`. + - Defines how many workers to pull image concurrently. + - Default value is `10`. #### remove @@ -289,34 +303,60 @@ This command will remove an image from all the nodes or pods specified. The format is `eru-cli image remove [command options] `. -The `` refers to the images to remove, can be given multiple times, like `eru-cli image remove --podname pod img1 img2 img3`. +The `` refers to the images to remove, can be given multiple times, +like `eru-cli image remove --podname pod img1 img2 img3`. Command options are: - `--nodename` - - This option can be defined multiple times, like `--nodename n1 --nodename n2` - - Defines the name of the node. - - If you only want to remove an image from some nodes, use this option. + - This option can be defined multiple times, like `--nodename n1 --nodename n2` + - Defines the name of the node. + - If you only want to remove an image from some nodes, use this option. - `--podname` - - Defines the name of the pod. - - If you want to remove an image from all nodes of a pod, use this option. + - Defines the name of the pod. + - If you want to remove an image from all nodes of a pod, use this option. - `--concurrent` - - Defines how many workers to remove image concurrently. - - Default value is `10`. + - Defines how many workers to remove image concurrently. + - Default value is `10`. - `--prune` - - This is a flag. - - If this flag is defined, will also remove unused images on the nodes. + - This is a flag. + - If this flag is defined, will also remove unused images on the nodes. + +#### list + +This command will list images from a pod or some nodes specified. Either `--nodename` or `--podname` should be set. + +The format is `eru-cli image list [command options]`. + +Command options are: + +- `--nodename` + + - This option can be defined multiple times, like `--nodename n1 --nodename n2` + - Defines the name of the node. + - If you only want to list images from some nodes, use this option. + - Setting this will ignore `--podname` + +- `--podname` + + - Defines the name of the pod. + - If you want to lis all image from all nodes of a pod, use this option. + +- `--filter` + + - To filter the image name. ### Lambda Sub Commands -Lambda sub commands are started with `lambda` command, and only contains one command: `eru-cli lambda`. The format should be `eru-cli lambda [command options] ` +Lambda sub commands are started with `lambda` command, and only contains one command: `eru-cli lambda`. The format +should be `eru-cli lambda [command options] ` `` refers to the command to execute, for example, `sh -c "ls ~ && echo done"`. @@ -324,68 +364,74 @@ Command options are: - `--name` - - This option defines the name of this lambda. - - MUST be given. + - This option defines the name of this lambda. + - MUST be given. - `--network` - - This option defines the network for this lambda workload. - - The format can be a single string representing the network name, like `--network calico` or `--network host`, - - Or can be a string contains a ":" to specify the network name and IPv4 IP address, like `--network calico:10.233.12.41`. - - If this value is not defined, an empty string will be used, the network will depend on the settings of eru-core engine. + - This option defines the network for this lambda workload. + - The format can be a single string representing the network name, like `--network calico` or `--network host`, + - Or can be a string contains a ":" to specify the network name and IPv4 IP address, + like `--network calico:10.233.12.41`. + - If this value is not defined, an empty string will be used, the network will depend on the settings of eru-core + engine. - `--pod`, `--node` - - This option defines the pod or the node for this lambda to run. - - Note that if pod and node are both defined, will take node for priority. For example if you define `--pod podname --node nodename` and `nodename` doesn't belong to `podname`, `nodename` will still be used while `podname` is ignored. + - This option defines the pod or the node for this lambda to run. + - Note that if pod and node are both defined, will take node for priority. For example if you + define `--pod podname --node nodename` and `nodename` doesn't belong to `podname`, `nodename` will still be used + while `podname` is ignored. - `--env` - - This option defines the environment variable for this lambda runtime. - - This option can be defined multiple times, like `--env A=1 --env B=2 --env C=3`. + - This option defines the environment variable for this lambda runtime. + - This option can be defined multiple times, like `--env A=1 --env B=2 --env C=3`. - `--working-dir`, `--working_dir` - - This option defines the working directory for this lambda runtime. - - The default value is `/`. - - `--working_dir` is only a compat, it looks so ugly... + - This option defines the working directory for this lambda runtime. + - The default value is `/`. + - `--working_dir` is only a compat, it looks so ugly... - `--image` - - This option defines the image for this lambda runtime. - - The default value is `alpine:latest`. + - This option defines the image for this lambda runtime. + - The default value is `alpine:latest`. - `--count` - - This option defines how many workloads to run this lambda concurrently. - - The default value is `1`, in most cases, you only need one lambda runtime. + - This option defines how many workloads to run this lambda concurrently. + - The default value is `1`, in most cases, you only need one lambda runtime. - `--stdin` - - This is a flag. - - If this flag is defined, stdin for this lambda runtime is open, you can interact with this lambda workload. + - This is a flag. + - If this flag is defined, stdin for this lambda runtime is open, you can interact with this lambda workload. - `--user` - - This option defines the user for this lambda runtime. - - The default value is `root`. + - This option defines the user for this lambda runtime. + - The default value is `root`. - `--file` - - This option defines the files for lambda runtime. - - This option can be defined multiple times, like `--file localpath1:remotepath1 --file path/to/local:path/to/remote`. - - Files will be sent to lambda runtime before the execution of commands. + - This option defines the files for lambda runtime. + - This option can be defined multiple times, + like `--file localpath1:remotepath1 --file path/to/local:path/to/remote`. + - Files will be sent to lambda runtime before the execution of commands. - `--async`, `--async-timeout` - - `--async` is a flag, if it's defined, eru-cli will not wait for the termination of lambda runtime. - - If `--async` is defined, you can use `--async-timeout` to define the timeout of this lambda runtime, default value is `30`, which means 30 seconds. - - The lambda runtime will terminate after `--async-timeout` seconds. + - `--async` is a flag, if it's defined, eru-cli will not wait for the termination of lambda runtime. + - If `--async` is defined, you can use `--async-timeout` to define the timeout of this lambda runtime, default value + is `30`, which means 30 seconds. + - The lambda runtime will terminate after `--async-timeout` seconds. - `--privileged`, `-p` - - This is a flag. - - If this option is defined, the extended privileges are given to this lambda runtime. - - Default value is `false`, which means if you don't use this option, no more extended privileges are given. + - This is a flag. + - If this option is defined, the extended privileges are given to this lambda runtime. + - Default value is `false`, which means if you don't use this option, no more extended privileges are given. An example is: @@ -411,7 +457,8 @@ mesg n || true ### Node Sub Commands -Node sub commands are started with `node` command. The format should be `eru-cli node [sub command] [command options] [arguments...]`. +Node sub commands are started with `node` command. The format should +be `eru-cli node [sub command] [command options] [arguments...]`. These sub commands are supported: @@ -438,47 +485,47 @@ Command options are: - `--nodename` - - Defines the name of the node. - - The default value is the hostname of the server (`$HOSTNAME` in environment variables). - - You can use a customized name to over write this. + - Defines the name of the node. + - The default value is the hostname of the server (`$HOSTNAME` in environment variables). + - You can use a customized name to over write this. - `--endpoint` - - Defines the endpoint of the node engine. - - For docker engine, this should be like `tcp://10.233.10.43:2376`. - - For systemd engine, this should be like `systemd://10.233.10.44:22`. - - For virtual machines controlled by yavirtd, this should be like `virt-grpc://10.233.10.45:9697`. + - Defines the endpoint of the node engine. + - For docker engine, this should be like `tcp://10.233.10.43:2376`. + - For systemd engine, this should be like `systemd://10.233.10.44:22`. + - For virtual machines controlled by yavirtd, this should be like `virt-grpc://10.233.10.45:9697`. - `--ca`, `--cert`, `--key` - - Defines the certificates for docker server. - - If you are not using docker engine, or your docker engine doesn't require certificates, don't use these options. + - Defines the certificates for docker server. + - If you are not using docker engine, or your docker engine doesn't require certificates, don't use these options. - `--cpu` - - Defines how many cores this node has. - - Usually this can be detected automatically, don't set this manually if you have no idea what you are doing. + - Defines how many cores this node has. + - Usually this can be detected automatically, don't set this manually if you have no idea what you are doing. - `--share` - - Defines the share of cores. - - Default value is `100`, usually default value is good, no need to change it. + - Defines the share of cores. + - Default value is `100`, usually default value is good, no need to change it. - `--memory` - - Defines how much memory this node has. - - Usually this can be detected automatically, don't set this manually if you have no idea what you are doing. - - Units are supported, you can use `--memory 128G` or `--memory 1024M` to set the value. + - Defines how much memory this node has. + - Usually this can be detected automatically, don't set this manually if you have no idea what you are doing. + - Units are supported, you can use `--memory 128G` or `--memory 1024M` to set the value. - `--label` - - Defines the labels to this node. - - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. + - Defines the labels to this node. + - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. - `--volumes` - - Defines the volumes of this node. - - This option can be defined multiple times, like `--volumes /data0:500G --volumes /data1:8T`. + - Defines the volumes of this node. + - This option can be defined multiple times, like `--volumes /data0:500G --volumes /data1:8T`. An example is: @@ -566,66 +613,69 @@ Command options are: - `--delta` - - This is a flag. - - If this flag is defined, `--memory`, `--storage`, `--volume` are using delta mode, the values of these options are relative to the current values. - - If this flag is not defined, the values of `--memory`, `--storage`, `--volume` are absolute values, regardless of the current values. - - This flag is very **IMPORTANT** as it can change the behavior of `eru-cli node set`. + - This is a flag. + - If this flag is defined, `--memory`, `--storage`, `--volume` are using delta mode, the values of these options are + relative to the current values. + - If this flag is not defined, the values of `--memory`, `--storage`, `--volume` are absolute values, regardless of + the current values. + - This flag is very **IMPORTANT** as it can change the behavior of `eru-cli node set`. - `--mark-workloads-down` - - This is a flag. - - If this flag is defined, all workloads of this node will be marked as unavailable. - - It's only a mark, the workloads may still work well. + - This is a flag. + - If this flag is defined, all workloads of this node will be marked as unavailable. + - It's only a mark, the workloads may still work well. - `--memory` - - Defines memory of this node. - - Units are supported, you can use `--memory 128G` or `--memory 1024M` to set the value. - - For example, if the current memory is `128G`: + - Defines memory of this node. + - Units are supported, you can use `--memory 128G` or `--memory 1024M` to set the value. + - For example, if the current memory is `128G`: - - `--memory 128G` will make it still `128G`; - - `--memory 256G` will make it `256G`; - - `--memory 0` will set it to `0`; - - `--memory 128G --delta` will make it `256G`; - - `--memory 0 --delta` will make it still `128G`; - - `--memory -128G --delta` will set it to `0`; + - `--memory 128G` will make it still `128G`; + - `--memory 256G` will make it `256G`; + - `--memory 0` will set it to `0`; + - `--memory 128G --delta` will make it `256G`; + - `--memory 0 --delta` will make it still `128G`; + - `--memory -128G --delta` will set it to `0`; - `--storage` - - Defines storage of this node. - - Units are supported, you can use `--storage 512G` or `--storage 8T` to set the value. - - For example, if the current storage is `1T`: + - Defines storage of this node. + - Units are supported, you can use `--storage 512G` or `--storage 8T` to set the value. + - For example, if the current storage is `1T`: - - `--storage 1T` will make it still `1T`; - - `--storage 2T` will make it `2T`; - - `--storage 0` will set it to `0`; - - `--storage 1T --delta` will make it `2T`; - - `--storage 0 --delta` will make it still `1T`; - - `--storage -1T --delta` will set it to `0`; + - `--storage 1T` will make it still `1T`; + - `--storage 2T` will make it `2T`; + - `--storage 0` will set it to `0`; + - `--storage 1T --delta` will make it `2T`; + - `--storage 0 --delta` will make it still `1T`; + - `--storage -1T --delta` will set it to `0`; - `--volumes` - - Defines the volumes of this node. - - The format is `PATH0:SIZE0,PATH1:SIZE1,...`, for example `--volume /data0:100G,/data1:200G`. - - Units are supported, you can use `--volume /data0:512G` or `--volume /data1:8T` to set the value. - - For example, if the current volume is `/data0:500G` and `/data1:300G`: + - Defines the volumes of this node. + - The format is `PATH0:SIZE0,PATH1:SIZE1,...`, for example `--volume /data0:100G,/data1:200G`. + - Units are supported, you can use `--volume /data0:512G` or `--volume /data1:8T` to set the value. + - For example, if the current volume is `/data0:500G` and `/data1:300G`: - - `--volume /data0:500G,/data1:300G,/data2:100G` will make it `/data0:500G`, `/data1:300G`, `/data2:100G`; - - `--volume /data0:800G,/data1:200G,/data2:100G` will make it `/data0:800G`, `/data1:200G`, `/data2:100G`; - - `--volume /data0:0,/data1:0,/data2:0` will make it `/data0:0`, `/data1:0`, `/data2:0`; - - `--volume /data0:500G,/data1:300G,/data2:100G --delta` will make it `/data0:1000G`, `/data1:600G`, `/data2:100G`; - - `--volume /data0:0,/data1:0,/data2:0 --delta` will make it `/data0:500G`, `/data1:300G`, `/data2:0`; - - `--volume /data0:-500G,/data1:-300G,/data2:100G --delta` will make it `/data0:0`, `/data1:0`, `/data2:100G`; + - `--volume /data0:500G,/data1:300G,/data2:100G` will make it `/data0:500G`, `/data1:300G`, `/data2:100G`; + - `--volume /data0:800G,/data1:200G,/data2:100G` will make it `/data0:800G`, `/data1:200G`, `/data2:100G`; + - `--volume /data0:0,/data1:0,/data2:0` will make it `/data0:0`, `/data1:0`, `/data2:0`; + - `--volume /data0:500G,/data1:300G,/data2:100G --delta` will make it `/data0:1000G`, `/data1:600G` + , `/data2:100G`; + - `--volume /data0:0,/data1:0,/data2:0 --delta` will make it `/data0:500G`, `/data1:300G`, `/data2:0`; + - `--volume /data0:-500G,/data1:-300G,/data2:100G --delta` will make it `/data0:0`, `/data1:0`, `/data2:100G`; - `--cpu` - - Defines the cores and shares of this node. - - The format is `CPUNO0:CPUSHARE0,CPUNO1:CPUSHARE1,CPUNO2:CPUSHARE2,...`, for example `--cpu 0:100,1:50,2:50,3:100` + - Defines the cores and shares of this node. + - The format is `CPUNO0:CPUSHARE0,CPUNO1:CPUSHARE1,CPUNO2:CPUSHARE2,...`, for example `--cpu 0:100,1:50,2:50,3:100` - `--label` - - Defines the labels to this node. - - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. + - Defines the labels to this node. + - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. An example is: @@ -672,8 +722,8 @@ Command options are: - `--label` - - Defines the labels of the workloads. - - This option can be defined multiple times, like `--label runtime=ubuntu --label ERU=1`. + - Defines the labels of the workloads. + - This option can be defined multiple times, like `--label runtime=ubuntu --label ERU=1`. An example is: @@ -771,12 +821,13 @@ Command options are: - `--check` - - This is a flag. - - If this flag is defined, `eru-cli node down` will check if the node is really down before set node to DOWN, if the node is healthy, will not set it to DOWN. + - This is a flag. + - If this flag is defined, `eru-cli node down` will check if the node is really down before set node to DOWN, if the + node is healthy, will not set it to DOWN. - `--check-timeout` - - Defines the timeout for checking the node. + - Defines the timeout for checking the node. An example is: @@ -853,14 +904,14 @@ Command options are: - `--ttl` - - Defines the TTL of the status data. - - Default value is `180`, which means the status data will be alive for 180 seconds, it not refreshed. + - Defines the TTL of the status data. + - Default value is `180`, which means the status data will be alive for 180 seconds, it not refreshed. - `--interval` - - Defines the interval of the set action. - - Default value is `0`, which means don't set the status periodically. - - If this option is defined, like `--interval 30`, eru-cli will set the status every 30 seconds. + - Defines the interval of the set action. + - Default value is `0`, which means don't set the status periodically. + - If this option is defined, like `--interval 30`, eru-cli will set the status every 30 seconds. #### watch-status @@ -890,8 +941,8 @@ Command options are: - `--fix` - - This is a flag. - - If this flag is defined, eru-cli will try to fix the resource inconsistency as well as print the current resource. + - This is a flag. + - If this flag is defined, eru-cli will try to fix the resource inconsistency as well as print the current resource. An example is: @@ -908,7 +959,8 @@ This command can sometimes help to fix the resource inconsistency of nodes, it's ### Pod Sub Commands -Pod sub commands are started with `pod` command. The format should be `eru-cli pod [sub command] [command options] [arguments...]`. +Pod sub commands are started with `pod` command. The format should +be `eru-cli pod [sub command] [command options] [arguments...]`. These sub commands are supported: @@ -932,8 +984,8 @@ Command options are: - `--desc` - - Defines the description of the pod. - - If not defined, an empty description will be used. + - Defines the description of the pod. + - If not defined, an empty description will be used. An example is: @@ -1003,11 +1055,11 @@ Command options are: - `--filter` - - Defines the filter to filter resource value. - - The filtered resource can be `cpu`, `memory`, `storage`, `volume`. - - The comparator can be `<`, `<=`, `>`, `>=`, `==`. - - The compare target can be like `40%` or `0.4`. - - The default value is `all`, which means no filter is used, will show resource of all nodes. + - Defines the filter to filter resource value. + - The filtered resource can be `cpu`, `memory`, `storage`, `volume`. + - The comparator can be `<`, `<=`, `>`, `>=`, `==`. + - The compare target can be like `40%` or `0.4`. + - The default value is `all`, which means no filter is used, will show resource of all nodes. An example is: @@ -1045,28 +1097,28 @@ Command options are: - `--cpu`, `-c` - - Defines the CPU the target workload requires. - - If the target workload doesn't require an exclusive CPU, define this option to `0` like `--cpu 0`. + - Defines the CPU the target workload requires. + - If the target workload doesn't require an exclusive CPU, define this option to `0` like `--cpu 0`. - `--memory`, `-m`, `--mem` - - Defines the memory the target workload requires. - - Units are supported, you can use `--memory 128G` or `--memory 1024M` to set the value. + - Defines the memory the target workload requires. + - Units are supported, you can use `--memory 128G` or `--memory 1024M` to set the value. - `--storage`, `-s` - - Defines the storage the target workload requires. - - Units are supported, you can use `--storage 500G` or `--storage 1T` to set the value. + - Defines the storage the target workload requires. + - Units are supported, you can use `--storage 500G` or `--storage 1T` to set the value. - `--cpu-bind` - - This is a flag. - - If this flag is defined, the CPU will be bound to workloads. + - This is a flag. + - If this flag is defined, the CPU will be bound to workloads. - `--nodename`, `--node`, `-n` - - Defines the nodes to join calculation. - - This option can be defined multiple times, like `--nodename node1 --nodename node2`. + - Defines the nodes to join calculation. + - This option can be defined multiple times, like `--nodename node1 --nodename node2`. An example is: @@ -1122,16 +1174,16 @@ Command options are: - `--filter`, `-f` - - Defines the filter for filtering the nodes. - - The value of this option can be defined as `up`, `down`, or `all`, default value is `all`. - - `--filter up` will only show those nodes with state UP. - - `--filter down` will only show those nodes with state DOWN. - - `--filter all` will show all nodes regardless of the state. + - Defines the filter for filtering the nodes. + - The value of this option can be defined as `up`, `down`, or `all`, default value is `all`. + - `--filter up` will only show those nodes with state UP. + - `--filter down` will only show those nodes with state DOWN. + - `--filter all` will show all nodes regardless of the state. - `--label` - - Defines the labels to filter. - - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. + - Defines the labels to filter. + - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. An example is: @@ -1176,8 +1228,8 @@ Command options are: - `--driver` - - Defines the network driver to filter. - - If this option is not defined, will show all networks. + - Defines the network driver to filter. + - If this option is not defined, will show all networks. An example is: @@ -1200,7 +1252,8 @@ root@tonic-eru-test:~# eru-cli pod networks --driver calico muroq ### Status Sub Commands -Status sub commands are started with `status` command, and only contains one command: `eru-cli status`. The format should be `eru-cli status [command options] `. +Status sub commands are started with `status` command, and only contains one command: `eru-cli status`. The format +should be `eru-cli status [command options] `. This command will show the events of the corresponding workloads. Usually used for debugging. @@ -1210,18 +1263,18 @@ Command options are: - `--entry` - - Defines the entrypoint of the workloads. - - If this option is not defined, will not filter events by entrypoint. + - Defines the entrypoint of the workloads. + - If this option is not defined, will not filter events by entrypoint. - `--node` - - Defines the node of the workloads. - - If this option is not defined, will not filter events by node. + - Defines the node of the workloads. + - If this option is not defined, will not filter events by node. - `--label` - - Defines the labels to filter. - - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. + - Defines the labels to filter. + - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. An example is: @@ -1236,9 +1289,11 @@ WARN[2021-06-17 17:32:09] 5b8129e deleted ### Workload / Container Sub Commands -Workload / container sub commands are started with `workload` command. The format should be `eru-cli workload [sub command] [command options] [arguments...]`. +Workload / container sub commands are started with `workload` command. The format should +be `eru-cli workload [sub command] [command options] [arguments...]`. -For legacy reasons, `container` sub commands are still supported, just use `container` instead of `workload`, but will be removed in the future version. +For legacy reasons, `container` sub commands are still supported, just use `container` instead of `workload`, but will +be removed in the future version. These sub commands are supported: @@ -1308,25 +1363,27 @@ Command options are: - `--tail` - - Defines the number of lines to show from the end, works just like `tail -n`. - - If this option is not defined, will show all logs from the beginning. + - Defines the number of lines to show from the end, works just like `tail -n`. + - If this option is not defined, will show all logs from the beginning. - `--since` - - Defines the timestamp for the log to show. - - Works just like `docker logs --since`. - - The value can be an absolute timestamp (e.g. `2013-01-02T13:23:37`) or relative time period (e.g. `42m` for 42 minutes). + - Defines the timestamp for the log to show. + - Works just like `docker logs --since`. + - The value can be an absolute timestamp (e.g. `2013-01-02T13:23:37`) or relative time period (e.g. `42m` for 42 + minutes). - `--until` - - Defines the timestamp for the log to show. - - Works just like `docker logs --until`. - - The value can be an absolute timestamp (e.g. `2013-01-02T13:23:37`) or relative time period (e.g. `42m` for 42 minutes). + - Defines the timestamp for the log to show. + - Works just like `docker logs --until`. + - The value can be an absolute timestamp (e.g. `2013-01-02T13:23:37`) or relative time period (e.g. `42m` for 42 + minutes). - `--follow`, `-f` - - This is a flag. - - If this flag is defined, will follow the log output. + - This is a flag. + - If this flag is defined, will follow the log output. An example is: @@ -1374,27 +1431,30 @@ Command options are: - `--running` - - Defines the running status of workloads. - - `--running=true` means set the running status to `true`, `--running=false` means set the running status to `false`. + - Defines the running status of workloads. + - `--running=true` means set the running status to `true`, `--running=false` means set the running status to `false` + . - `--healthy` - - Defines the healthy status of workloads. - - `--healthy=true` means set the healthy status to `true`, `--healthy=false` means set the healthy status to `false`. + - Defines the healthy status of workloads. + - `--healthy=true` means set the healthy status to `true`, `--healthy=false` means set the healthy status to `false` + . - `--ttl` - - Defines the TTL of this status value. + - Defines the TTL of this status value. - `--network` - - Defines the network for this workload. - - The format can be a single string representing the network name, like `--network calico` or `--network host`, - - Or can be a string contains a ":" to specify the network name and IPv4 IP address, like `--network calico:10.233.12.41`. + - Defines the network for this workload. + - The format can be a single string representing the network name, like `--network calico` or `--network host`, + - Or can be a string contains a ":" to specify the network name and IPv4 IP address, + like `--network calico:10.233.12.41`. - `--extension` - - Defines the `extension` field of workload. + - Defines the `extension` field of workload. An example is: @@ -1422,24 +1482,24 @@ Command options are: - `--entry` - - Defines the entrypoint of workloads. - - If defined, this will be used to filter the workloads. + - Defines the entrypoint of workloads. + - If defined, this will be used to filter the workloads. - `--nodename` - - Defines the node of workloads. - - If defined, this will be used to filter the workloads. + - Defines the node of workloads. + - If defined, this will be used to filter the workloads. - `--label` - - Defines the labels to filter. - - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. - - If defined, labels will be used to filter workloads, act like `AND` operator. + - Defines the labels to filter. + - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. + - If defined, labels will be used to filter workloads, act like `AND` operator. - `--limit` - - Defines the number of results returned. - - If not defined, will show all results. + - Defines the number of results returned. + - If not defined, will show all results. An example is: @@ -1481,9 +1541,10 @@ Command options are: - `--force` - - This is a flag. - - If this option is defined, stopping docker workloads will send SIGTERM then immediately SIGKILL, stopping yavirtd workloads will shutdown immediately. - - No matter this option is defined or not, the `BEFORE_STOP` hooks will be executed anyway. + - This is a flag. + - If this option is defined, stopping docker workloads will send SIGTERM then immediately SIGKILL, stopping yavirtd + workloads will shutdown immediately. + - No matter this option is defined or not, the `BEFORE_STOP` hooks will be executed anyway. #### start @@ -1499,8 +1560,8 @@ Command options are: - `--force` - - This is a flag. - - If this option is defined, any errors from `AFTER_START` hooks will be ignored, otherwise errors will be returned. + - This is a flag. + - If this option is defined, any errors from `AFTER_START` hooks will be ignored, otherwise errors will be returned. #### restart @@ -1516,8 +1577,8 @@ Command options are: - `--force` - - This is a flag. - - Refer to `stop` and `start` for the effect of this flag, this will affect both of them. + - This is a flag. + - Refer to `stop` and `start` for the effect of this flag, this will affect both of them. #### remove @@ -1531,13 +1592,13 @@ Command options are: - `--force` - - This is a flag. - - If this option is defined, the workloads will be removed regardless of their status. + - This is a flag. + - If this option is defined, the workloads will be removed regardless of their status. - `--step` - - Defines the concurrent step. - - The default value is `1`, which means the workloads will be removed one by one. + - Defines the concurrent step. + - The default value is `1`, which means the workloads will be removed one by one. #### copy @@ -1555,8 +1616,8 @@ Command options are: - `--dir` - - Defines the directory to store the copied files. - - Default value is `/tmp`. + - Defines the directory to store the copied files. + - Default value is `/tmp`. An example is: @@ -1593,8 +1654,9 @@ Command options are: - `--file` - - Defines the file to send. - - Format is `SRC_PATH:DEST_PATH`, can be defined multiple times, like `--file localfile1:/path/in/workload/file1 --file localfile2:/path/in/workload/file2` + - Defines the file to send. + - Format is `SRC_PATH:DEST_PATH`, can be defined multiple times, + like `--file localfile1:/path/in/workload/file1 --file localfile2:/path/in/workload/file2` An example is: @@ -1608,7 +1670,9 @@ root@tonic-eru-test:~/copy# docker exec 47ae97833e3042c57763206901b348c1956e5392 fae mage did 7 flame strikes in combustion! ``` -Note: The directory of the file path will not be created automatically, hence the path in the workload MUST exist, otherwise you will get an error. For example, if you specify `--file localfile:/a/nonexisting/path/file`, the `/a/nonexisting/path` should be created before. +Note: The directory of the file path will not be created automatically, hence the path in the workload MUST exist, +otherwise you will get an error. For example, if you specify `--file localfile:/a/nonexisting/path/file`, +the `/a/nonexisting/path` should be created before. #### dissociate @@ -1618,7 +1682,10 @@ The format is `eru-cli workload send [command options] workloadID(s)`. `workloadID(s)` refers to the IDs of the workloads. -Dissociating the workloads will release the bindings of workloads and ERU system. Sometimes you may find that ERU claims it has the record of a workload, but the workload doesn't exist on any nodes, now dissociating this workload will return its resources back to ERU system without removing it. Later you can remove it or keep it for debugging. Since the actual workload has gone away, we usually remove it. +Dissociating the workloads will release the bindings of workloads and ERU system. Sometimes you may find that ERU claims +it has the record of a workload, but the workload doesn't exist on any nodes, now dissociating this workload will return +its resources back to ERU system without removing it. Later you can remove it or keep it for debugging. Since the actual +workload has gone away, we usually remove it. Also sometimes you may want to release a workload from ERU system, you can use this command too. @@ -1636,66 +1703,69 @@ Command options are: - `--cpu-request`, `--cpu-limit` - - Defines the CPU request and limit **delta** value. - - Default value is `0`, means don't change the CPU request / limit value. - - For example, currently the workload has occupied 2 cores: + - Defines the CPU request and limit **delta** value. + - Default value is `0`, means don't change the CPU request / limit value. + - For example, currently the workload has occupied 2 cores: - - `--cpu-request 1` will reallocate 1 more core to this workload, it currently occupied 3 cores. - - `--cpu-request -1` will reallocate to 1 less core to this workload, it currently occupied 1 core. - - `--cpu-request 0` will not reallocate cores to this workload, it still occupied 2 cores. + - `--cpu-request 1` will reallocate 1 more core to this workload, it currently occupied 3 cores. + - `--cpu-request -1` will reallocate to 1 less core to this workload, it currently occupied 1 core. + - `--cpu-request 0` will not reallocate cores to this workload, it still occupied 2 cores. - `--cpu` - - This is a shortcut for `--cpu-request` and `--cpu-limit` - - If you define `--cpu 1`, it's equivalent to `--cpu-request 1 --cpu-limit 1` + - This is a shortcut for `--cpu-request` and `--cpu-limit` + - If you define `--cpu 1`, it's equivalent to `--cpu-request 1 --cpu-limit 1` - `--cpu-bind` - - This is a flag. - - If this flag is defined, workloads will bind fixed CPUs. - - If workload has already bound to fixed CPUs, this flag takes no effect. + - This is a flag. + - If this flag is defined, workloads will bind fixed CPUs. + - If workload has already bound to fixed CPUs, this flag takes no effect. - `--cpu-unbind` - - This is a flag. - - If this flag is defined, workloads will release the bound fixed CPUs. - - If workload has not bound to any fixed CPUs, this flag takes no effect. + - This is a flag. + - If this flag is defined, workloads will release the bound fixed CPUs. + - If workload has not bound to any fixed CPUs, this flag takes no effect. - `--memory-request`, `--memory-limit` - - Defines the memory request and limit **delta** value. - - Default value is `0`, means don't change the memory request / limit value. - - Units are supported, you can use `--memory-request 128G` or `--memory-limit 1024M` to set the value. - - It works just like `--cpu-request` and `--cpu-limit` + - Defines the memory request and limit **delta** value. + - Default value is `0`, means don't change the memory request / limit value. + - Units are supported, you can use `--memory-request 128G` or `--memory-limit 1024M` to set the value. + - It works just like `--cpu-request` and `--cpu-limit` - `--memory` - - This is a shortcut for `--memory-request` and `--memory-limit` - - If you define `--memory 10G`, it's equivalent to `--memory-request 10G --memory-limit 10G` + - This is a shortcut for `--memory-request` and `--memory-limit` + - If you define `--memory 10G`, it's equivalent to `--memory-request 10G --memory-limit 10G` - `--storage-request`, `--storage-limit` - - Defines the storage request and limit **delta** value. - - Default value is `0`, means don't change the storage request / limit value. - - Units are supported, you can use `--storage-request 128G` or `--storage-limit 1024M` to set the value. - - It works just like `--cpu-request` and `--cpu-limit` + - Defines the storage request and limit **delta** value. + - Default value is `0`, means don't change the storage request / limit value. + - Units are supported, you can use `--storage-request 128G` or `--storage-limit 1024M` to set the value. + - It works just like `--cpu-request` and `--cpu-limit` - `--storage` - - This is a shortcut for `--storage-request` and `--storage-limit` - - If you define `--storage 10G`, it's equivalent to `--storage-request 10G --storage-limit 10G` + - This is a shortcut for `--storage-request` and `--storage-limit` + - If you define `--storage 10G`, it's equivalent to `--storage-request 10G --storage-limit 10G` - `--volumes-request`, `--volumes-limit` - - Defines the volumes request and limit **delta** value. - - Default value is `0`, means don't change the volumes request / limit value. - - Format is `AUTO:{path}:{mode}:{size}` or `{workloadpath}:{hostpath}` + - Defines the volumes request and limit **delta** value. + - Default value is `0`, means don't change the volumes request / limit value. + - Format is `AUTO:{path}:{mode}:{size}` or `{workloadpath}:{hostpath}` - - `AUTO:/data:rw:-1G` means automatically choose a volume from host and bind it with `/data` in workload, the mode is `rw` which means read and write, the size is decreased by 1G, for how this AUTO thing works, refer to eru-core documents. - - `/tmp:/tmp` means still keep `/tmp` to `/tmp` in workload. + - `AUTO:/data:rw:-1G` means automatically choose a volume from host and bind it with `/data` in workload, the + mode is `rw` which means read and write, the size is decreased by 1G, for how this AUTO thing works, refer to + eru-core documents. + - `/tmp:/tmp` means still keep `/tmp` to `/tmp` in workload. - - Units are supported, you can use `--volumes-request AUTO:/data:rw:-10G` or `--volumes-limit AUTO:/data:rw:-10240M` to set the value. - - It will increase or decrease the size of the volumes. + - Units are supported, you can use `--volumes-request AUTO:/data:rw:-10G` or `--volumes-limit AUTO:/data:rw:-10240M` + to set the value. + - It will increase or decrease the size of the volumes. #### exec @@ -1711,18 +1781,19 @@ Command options are: - `--interactive`, `-i` - - This is a flag. - - If this flag is defined, you can interact from stdin with the workload, otherwise you can only see the output of your defined commands but can not send new commands to the workload. + - This is a flag. + - If this flag is defined, you can interact from stdin with the workload, otherwise you can only see the output of + your defined commands but can not send new commands to the workload. - `--env`, `-e` - - Defines the environment variables for this execution. - - This option can be defined multiple times, like `--env A=1 --env B=2`. + - Defines the environment variables for this execution. + - This option can be defined multiple times, like `--env A=1 --env B=2`. - `--workdir`, `-w` - - Defines the current working directory for this execution. - - Default value is `/`. + - Defines the current working directory for this execution. + - Default value is `/`. An example is: @@ -1754,117 +1825,125 @@ Command options are: - `--dry-run` - - This is a flag. - - If this flag is defined, eru-cli will not really deploy the workloads, but only shows the deployment plan instead. + - This is a flag. + - If this flag is defined, eru-cli will not really deploy the workloads, but only shows the deployment plan instead. - `--pod` - - Defines which pod to deploy. + - Defines which pod to deploy. - `--node` - - Defines which nodes to deploy. - - This option can be defined multiple times, like `--node node1 --node node2`. - - When this option is defined, `--pod` is ignored, which means the nodes specified in `--node` don't have to belong to the pod `--pod` specified. + - Defines which nodes to deploy. + - This option can be defined multiple times, like `--node node1 --node node2`. + - When this option is defined, `--pod` is ignored, which means the nodes specified in `--node` don't have to belong + to the pod `--pod` specified. - `--nodelabel` - - Defines the labels to filter nodes. - - This option can be defined multiple times, like `--nodelabel key1=value1 --nodelabel key2=value2`. - - If this option is defined, only the nodes with all the labels defined are selected. + - Defines the labels to filter nodes. + - This option can be defined multiple times, like `--nodelabel key1=value1 --nodelabel key2=value2`. + - If this option is defined, only the nodes with all the labels defined are selected. - `--entry` - - Defines the entrypoint. - - Entrypoint must exist in the specification file. + - Defines the entrypoint. + - Entrypoint must exist in the specification file. - `--image` - - Defines which image to use. + - Defines which image to use. - `--count` - - Defines how many workloads to deploy. - - Default value is `1`. + - Defines how many workloads to deploy. + - Default value is `1`. - `--network` - - Defines the network of workload. - - The format can be a single string representing the network name, like `--network calico` or `--network host`, - - Or can be a string contains a ":" to specify the network name and IPv4 IP address, like `--network calico:10.233.12.41`. + - Defines the network of workload. + - The format can be a single string representing the network name, like `--network calico` or `--network host`, + - Or can be a string contains a ":" to specify the network name and IPv4 IP address, + like `--network calico:10.233.12.41`. - `--cpu-request`, `--cpu-limit`, `--cpu` - - Defines the CPU request and limit value. - - Default value is `0`, means don't limit CPU request, and share CPU with other workloads. - - `--cpu` is a shortcut for `--cpu-request` and `--cpu-limit`, `--cpu 2` is equivalent to `--cpu-request 2 --cpu-limit 2`. + - Defines the CPU request and limit value. + - Default value is `0`, means don't limit CPU request, and share CPU with other workloads. + - `--cpu` is a shortcut for `--cpu-request` and `--cpu-limit`, `--cpu 2` is equivalent + to `--cpu-request 2 --cpu-limit 2`. - `--cpu-bind` - - This is a flag. - - If this flag is defined, workload will bind to fixed CPUs exclusively. + - This is a flag. + - If this flag is defined, workload will bind to fixed CPUs exclusively. - `--memory-request`, `--memory-limit`, `--memory` - - Defines the memory request and limit value. - - Default value is `0`, means don't limit memory request, and share memory with other workloads (which may lead to OOM killed). - - `--memory` is a shortcut for `--memory-request` and `--memory-limit`, `--memory 2G` is equivalent to `--memory-request 2G --memory-limit 2G`. - - Units are supported, you can use `--memory-request 128G` or `--memory-limit 1024M` to set the value. + - Defines the memory request and limit value. + - Default value is `0`, means don't limit memory request, and share memory with other workloads (which may lead to + OOM killed). + - `--memory` is a shortcut for `--memory-request` and `--memory-limit`, `--memory 2G` is equivalent + to `--memory-request 2G --memory-limit 2G`. + - Units are supported, you can use `--memory-request 128G` or `--memory-limit 1024M` to set the value. - `--storage-request`, `--storage-limit`, `--storage` - - Defines the storage request and limit value. - - Default value is `0`, means don't limit storage request, and share storage with other workloads. - - `--storage` is a shortcut for `--storage-request` and `--storage-limit`, `--storage 100G` is equivalent to `--storage-request 100G --storage-limit 100G`. - - Units are supported, you can use `--storage-request 100G` or `--storage-limit 1T` to set the value. + - Defines the storage request and limit value. + - Default value is `0`, means don't limit storage request, and share storage with other workloads. + - `--storage` is a shortcut for `--storage-request` and `--storage-limit`, `--storage 100G` is equivalent + to `--storage-request 100G --storage-limit 100G`. + - Units are supported, you can use `--storage-request 100G` or `--storage-limit 1T` to set the value. - `--env` - - Defines the environment variables for this workload. - - This option can be defined multiple times, like `--env A=1 --env B=2`. + - Defines the environment variables for this workload. + - This option can be defined multiple times, like `--env A=1 --env B=2`. - `--file` - - Defines the file to send to workloads. - - Format is `SRC_PATH:DEST_PATH`, can be defined multiple times, like `--file localfile1:/path/in/workload/file1 --file localfile2:/path/in/workload/file2` + - Defines the file to send to workloads. + - Format is `SRC_PATH:DEST_PATH`, can be defined multiple times, + like `--file localfile1:/path/in/workload/file1 --file localfile2:/path/in/workload/file2` - `--user` - - Defines the user to run the process in workloads. + - Defines the user to run the process in workloads. - `--deploy-strategy` - - Defines the deploy strategy. - - Possible choices are `AUTO`, `FILL`, `EACH`, `GLOBAL`. - - Default value is `AUTO`. - - For details of each strategy, refer to eru-core documents. + - Defines the deploy strategy. + - Possible choices are `AUTO`, `FILL`, `EACH`, `GLOBAL`. + - Default value is `AUTO`. + - For details of each strategy, refer to eru-core documents. - `--auto-replace` - - This is a flag. - - If this flag is defined, eru-core will create workloads if there're none, or replace the workloads of specified `appname`, `entrypoint` with new `image`, and `entrypoint`, etc. + - This is a flag. + - If this flag is defined, eru-core will create workloads if there're none, or replace the workloads of + specified `appname`, `entrypoint` with new `image`, and `entrypoint`, etc. Command arguments are: - `` - - This can be a local path to the file, or a remove URL to the file. - - An example of a specification file is like: - - ``` - appname: "test" - entrypoints: - http: - cmd: "python3 -m http.server" - restart: always - publish: - - "8000" - healthcheck: - tcp_ports: + - This can be a local path to the file, or a remove URL to the file. + - An example of a specification file is like: + + ``` + appname: "test" + entrypoints: + http: + cmd: "python3 -m http.server" + restart: always + publish: - "8000" - ping: - cmd: "ping 127.0.0.1" - ``` + healthcheck: + tcp_ports: + - "8000" + ping: + cmd: "ping 127.0.0.1" + ``` An example is: @@ -1897,70 +1976,76 @@ The format is `eru-cli workload replace [command options] `. `` refers to the path of local specification file, or a remote URL of specification file. -Replace will replace all workloads filtered by `--pod`, `--node`, `--entry` and `appname` in specification file, with new `--image`, `--count`, `--env`, `--user`... etc. +Replace will replace all workloads filtered by `--pod`, `--node`, `--entry` and `appname` in specification file, with +new `--image`, `--count`, `--env`, `--user`... etc. Command options are: - `--pod` - - Defines which pod to filter. + - Defines which pod to filter. - `--node` - - Defines which nodes to filter. - - This option can be defined multiple times, like `--node node1 --node node2`. - - When this option is defined, only the workloads on these nodes and also in pod specified by `--pod` will be selected to replace. + - Defines which nodes to filter. + - This option can be defined multiple times, like `--node node1 --node node2`. + - When this option is defined, only the workloads on these nodes and also in pod specified by `--pod` will be + selected to replace. - `--entry` - - Defines the entrypoint to filter. - - Entrypoint must exist in the specification file. + - Defines the entrypoint to filter. + - Entrypoint must exist in the specification file. - `--image` - - Defines new image to use. + - Defines new image to use. - `--count` - - Defines how many workloads to replace at the sametime. - - Default value is `1`, which means workloads are replaced one by one. + - Defines how many workloads to replace at the sametime. + - Default value is `1`, which means workloads are replaced one by one. - `--network` - - Defines the network of workload. - - The format can be a single string representing the network name, like `--network calico` or `--network host`, - - Or can be a string contains a ":" to specify the network name and IPv4 IP address, like `--network calico:10.233.12.41`. + - Defines the network of workload. + - The format can be a single string representing the network name, like `--network calico` or `--network host`, + - Or can be a string contains a ":" to specify the network name and IPv4 IP address, + like `--network calico:10.233.12.41`. - `--network-inherit` - - This is a flag. - - If this flag is defined, `--network` will be ignored, the original networks are used in new workloads. - - This is actually the design target for `replace`. + - This is a flag. + - If this flag is defined, `--network` will be ignored, the original networks are used in new workloads. + - This is actually the design target for `replace`. - `--env` - - Defines the environment variables for this workload. - - This option can be defined multiple times, like `--env A=1 --env B=2`. + - Defines the environment variables for this workload. + - This option can be defined multiple times, like `--env A=1 --env B=2`. - `--file` - - Defines the file to send to workloads. - - Format is `SRC_PATH:DEST_PATH`, can be defined multiple times, like `--file localfile1:/path/in/workload/file1 --file localfile2:/path/in/workload/file2` + - Defines the file to send to workloads. + - Format is `SRC_PATH:DEST_PATH`, can be defined multiple times, + like `--file localfile1:/path/in/workload/file1 --file localfile2:/path/in/workload/file2` - `--user` - - Defines the user to run the process in workloads. + - Defines the user to run the process in workloads. - `--label` - - Defines the labels to filter. - - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. - - If defined, labels will be used to filter workloads, only the workloads with all labels will be selected to replace. + - Defines the labels to filter. + - This option can be defined multiple times, like `--label rack=rack1 --label cluster=cluster3`. + - If defined, labels will be used to filter workloads, only the workloads with all labels will be selected to + replace. - `--copy` - - Defines the files copied from original workload to new workload. - - Format is `SRC_PATH:DEST_PATH`, this option can be defined multiple times, like `--copy /old/path/file1:/new/path/file1 --copy /old/path/file2:/new/path/file2`. + - Defines the files copied from original workload to new workload. + - Format is `SRC_PATH:DEST_PATH`, this option can be defined multiple times, + like `--copy /old/path/file1:/new/path/file1 --copy /old/path/file2:/new/path/file2`. An example is: