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/delete"
|
||||
"github.com/rancher/k3d/cmd/get"
|
||||
"github.com/rancher/k3d/cmd/load"
|
||||
"github.com/rancher/k3d/cmd/start"
|
||||
"github.com/rancher/k3d/cmd/stop"
|
||||
|
||||
@ -83,6 +84,7 @@ func init() {
|
||||
rootCmd.AddCommand(get.NewCmdGet())
|
||||
rootCmd.AddCommand(stop.NewCmdStop())
|
||||
rootCmd.AddCommand(start.NewCmdStart())
|
||||
rootCmd.AddCommand(load.NewCmdLoad())
|
||||
|
||||
rootCmd.AddCommand(&cobra.Command{
|
||||
Use: "version",
|
||||
|
16
thoughts.md
16
thoughts.md
@ -95,16 +95,16 @@ Here's how k3d types should translate to a runtime type:
|
||||
- --shell
|
||||
- auto, bash, zsh
|
||||
- create
|
||||
- --name
|
||||
- --volume
|
||||
- --port
|
||||
- --api-port
|
||||
- --name -> y
|
||||
- --volume -> y
|
||||
- --port -> y
|
||||
- --api-port -> y
|
||||
- --wait
|
||||
- --image
|
||||
- --server-arg
|
||||
- --agent-arg
|
||||
- --image -> y
|
||||
- --server-arg -> y
|
||||
- --agent-arg -> y
|
||||
- --env
|
||||
- --workers
|
||||
- --workers -> y
|
||||
- --auto-restart
|
||||
- (add-node)
|
||||
- --role
|
||||
|
Loading…
Reference in New Issue
Block a user