init loadImages command
This commit is contained in:
parent
4e24521c0d
commit
744b01a2d1
52
cmd/load/load.go
Normal file
52
cmd/load/load.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
Copyright © 2019 Thorsten Klein <iwilltry42@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
package load
|
||||||
|
|
||||||
|
import (
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewCmdLoad returns a new cobra command
|
||||||
|
func NewCmdLoad() *cobra.Command {
|
||||||
|
|
||||||
|
// create new cobra command
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "load",
|
||||||
|
Short: "Load a resource [image].",
|
||||||
|
Long: `Load a resource [image].`,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
if err := cmd.Help(); err != nil {
|
||||||
|
log.Errorln("Couldn't get help text")
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// add subcommands
|
||||||
|
cmd.AddCommand(NewCmdLoadImage())
|
||||||
|
|
||||||
|
// add flags
|
||||||
|
|
||||||
|
// done
|
||||||
|
return cmd
|
||||||
|
}
|
60
cmd/load/loadImage.go
Normal file
60
cmd/load/loadImage.go
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
Copyright © 2019 Thorsten Klein <iwilltry42@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
package load
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/rancher/k3d/pkg/runtimes"
|
||||||
|
k3d "github.com/rancher/k3d/pkg/types"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewCmdLoadImage returns a new cobra command
|
||||||
|
func NewCmdLoadImage() *cobra.Command {
|
||||||
|
|
||||||
|
// create new command
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "image",
|
||||||
|
Short: "Load an image from docker into a k3d cluster.",
|
||||||
|
Long: `Load an image from docker into a k3d cluster.`,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
runtime, images, clusters := parseLoadImageCmd(cmd, args)
|
||||||
|
log.Debugln("Load Images not yet implemented: ", runtime, images, clusters)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********
|
||||||
|
* Flags *
|
||||||
|
*********/
|
||||||
|
|
||||||
|
/* Subcommands */
|
||||||
|
|
||||||
|
// done
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
// parseLoadImageCmd parses the command input into variables required to create a cluster
|
||||||
|
func parseLoadImageCmd(cmd *cobra.Command, args []string) (runtimes.Runtime, []string, []k3d.Cluster) {
|
||||||
|
return nil, nil, nil
|
||||||
|
}
|
@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/rancher/k3d/cmd/create"
|
"github.com/rancher/k3d/cmd/create"
|
||||||
"github.com/rancher/k3d/cmd/delete"
|
"github.com/rancher/k3d/cmd/delete"
|
||||||
"github.com/rancher/k3d/cmd/get"
|
"github.com/rancher/k3d/cmd/get"
|
||||||
|
"github.com/rancher/k3d/cmd/load"
|
||||||
"github.com/rancher/k3d/cmd/start"
|
"github.com/rancher/k3d/cmd/start"
|
||||||
"github.com/rancher/k3d/cmd/stop"
|
"github.com/rancher/k3d/cmd/stop"
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ func init() {
|
|||||||
rootCmd.AddCommand(get.NewCmdGet())
|
rootCmd.AddCommand(get.NewCmdGet())
|
||||||
rootCmd.AddCommand(stop.NewCmdStop())
|
rootCmd.AddCommand(stop.NewCmdStop())
|
||||||
rootCmd.AddCommand(start.NewCmdStart())
|
rootCmd.AddCommand(start.NewCmdStart())
|
||||||
|
rootCmd.AddCommand(load.NewCmdLoad())
|
||||||
|
|
||||||
rootCmd.AddCommand(&cobra.Command{
|
rootCmd.AddCommand(&cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
|
16
thoughts.md
16
thoughts.md
@ -95,16 +95,16 @@ Here's how k3d types should translate to a runtime type:
|
|||||||
- --shell
|
- --shell
|
||||||
- auto, bash, zsh
|
- auto, bash, zsh
|
||||||
- create
|
- create
|
||||||
- --name
|
- --name -> y
|
||||||
- --volume
|
- --volume -> y
|
||||||
- --port
|
- --port -> y
|
||||||
- --api-port
|
- --api-port -> y
|
||||||
- --wait
|
- --wait
|
||||||
- --image
|
- --image -> y
|
||||||
- --server-arg
|
- --server-arg -> y
|
||||||
- --agent-arg
|
- --agent-arg -> y
|
||||||
- --env
|
- --env
|
||||||
- --workers
|
- --workers -> y
|
||||||
- --auto-restart
|
- --auto-restart
|
||||||
- (add-node)
|
- (add-node)
|
||||||
- --role
|
- --role
|
||||||
|
Loading…
Reference in New Issue
Block a user