mirror of https://github.com/k3d-io/k3d
parent
dcda1bbeec
commit
95c28f298c
@ -0,0 +1,47 @@ |
||||
/* |
||||
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 create |
||||
|
||||
import ( |
||||
"github.com/spf13/cobra" |
||||
|
||||
log "github.com/sirupsen/logrus" |
||||
) |
||||
|
||||
// NewCmdCreateCluster returns a new cobra command
|
||||
func NewCmdCreateCluster() *cobra.Command { |
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{ |
||||
Use: "cluster", |
||||
Short: "Create a new k3s cluster in docker", |
||||
Long: `Create a new k3s cluster with containerized nodes (k3s in docker).`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("create cluster called") |
||||
}, |
||||
} |
||||
|
||||
// add subcommands
|
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,45 @@ |
||||
/* |
||||
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 create |
||||
|
||||
import ( |
||||
"github.com/spf13/cobra" |
||||
|
||||
log "github.com/sirupsen/logrus" |
||||
) |
||||
|
||||
// NewCmdCreateNode returns a new cobra command
|
||||
func NewCmdCreateNode() *cobra.Command { |
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{ |
||||
Use: "node", |
||||
Short: "Create a new k3s node in docker", |
||||
Long: `Create a new containerized k3s node (k3s in docker).`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("create node called") |
||||
}, |
||||
} |
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,47 @@ |
||||
/* |
||||
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 delete |
||||
|
||||
import ( |
||||
log "github.com/sirupsen/logrus" |
||||
|
||||
"github.com/spf13/cobra" |
||||
) |
||||
|
||||
// NewCmdDeleteCluster returns a new cobra command
|
||||
func NewCmdDeleteCluster() *cobra.Command { |
||||
|
||||
// create new cobra command
|
||||
cmd := &cobra.Command{ |
||||
Use: "cluster", |
||||
Short: "Delete a cluster.", |
||||
Long: `Delete a cluster.`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("delete cluster called") |
||||
}, |
||||
} |
||||
|
||||
// add subcommands
|
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,47 @@ |
||||
/* |
||||
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 delete |
||||
|
||||
import ( |
||||
log "github.com/sirupsen/logrus" |
||||
|
||||
"github.com/spf13/cobra" |
||||
) |
||||
|
||||
// NewCmdDeleteNode returns a new cobra command
|
||||
func NewCmdDeleteNode() *cobra.Command { |
||||
|
||||
// create new cobra command
|
||||
cmd := &cobra.Command{ |
||||
Use: "node", |
||||
Short: "Delete a node.", |
||||
Long: `Delete a node.`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("delete node called") |
||||
}, |
||||
} |
||||
|
||||
// add subcommands
|
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,47 @@ |
||||
/* |
||||
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 get |
||||
|
||||
import ( |
||||
"github.com/spf13/cobra" |
||||
|
||||
log "github.com/sirupsen/logrus" |
||||
) |
||||
|
||||
// NewCmdGetCluster returns a new cobra command
|
||||
func NewCmdGetCluster() *cobra.Command { |
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{ |
||||
Use: "cluster", |
||||
Short: "Get cluster", |
||||
Long: `Get cluster.`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("get cluster called") |
||||
}, |
||||
} |
||||
|
||||
// add subcommands
|
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,47 @@ |
||||
/* |
||||
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 get |
||||
|
||||
import ( |
||||
"github.com/spf13/cobra" |
||||
|
||||
log "github.com/sirupsen/logrus" |
||||
) |
||||
|
||||
// NewCmdGetKubeconfig returns a new cobra command
|
||||
func NewCmdGetKubeconfig() *cobra.Command { |
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{ |
||||
Use: "kubeconfig", |
||||
Short: "Get kubeconfig", |
||||
Long: `Get kubeconfig.`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("get kubeconfig called") |
||||
}, |
||||
} |
||||
|
||||
// add subcommands
|
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,47 @@ |
||||
/* |
||||
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 get |
||||
|
||||
import ( |
||||
"github.com/spf13/cobra" |
||||
|
||||
log "github.com/sirupsen/logrus" |
||||
) |
||||
|
||||
// NewCmdGetNode returns a new cobra command
|
||||
func NewCmdGetNode() *cobra.Command { |
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{ |
||||
Use: "node", |
||||
Short: "Get node", |
||||
Long: `Get node.`, |
||||
Run: func(cmd *cobra.Command, args []string) { |
||||
log.Debugln("get node called") |
||||
}, |
||||
} |
||||
|
||||
// add subcommands
|
||||
|
||||
// done
|
||||
return cmd |
||||
} |
@ -0,0 +1,20 @@ |
||||
package types |
||||
|
||||
// Cluster describes a k3d cluster
|
||||
type Cluster struct { |
||||
Name string |
||||
Network string |
||||
Nodes []Node |
||||
} |
||||
|
||||
// Node describes a k3d node
|
||||
type Node struct { |
||||
Name string |
||||
Role string |
||||
Image string |
||||
Volumes []string |
||||
Env []string |
||||
Args []string |
||||
Ports []string |
||||
Restart bool |
||||
} |
Loading…
Reference in new issue