mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-17 12:15:37 +02:00
Ability to pre-pull VM images by targeting workers with labels
This commit is contained in:
@@ -10,7 +10,13 @@ func NewCommand() *cobra.Command {
|
||||
Short: "Delete resources from the controller",
|
||||
}
|
||||
|
||||
command.AddCommand(newDeleteVMCommand(), newDeleteServiceComandCommand(), newDeleteWorkerCommand())
|
||||
command.AddCommand(
|
||||
newDeleteVMCommand(),
|
||||
newDeleteServiceComandCommand(),
|
||||
newDeleteWorkerCommand(),
|
||||
newDeleteImagePullCommand(),
|
||||
newDeleteImagePullJobCommand(),
|
||||
)
|
||||
|
||||
return command
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package deletecmd
|
||||
|
||||
import (
|
||||
"github.com/cirruslabs/orchard/pkg/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newDeleteImagePullCommand() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "imagepull NAME",
|
||||
Short: "Delete an image pull",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: runDeleteImagePull,
|
||||
}
|
||||
}
|
||||
|
||||
func runDeleteImagePull(cmd *cobra.Command, args []string) error {
|
||||
name := args[0]
|
||||
|
||||
client, err := client.New()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return client.ImagePulls().Delete(cmd.Context(), name)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package deletecmd
|
||||
|
||||
import (
|
||||
"github.com/cirruslabs/orchard/pkg/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newDeleteImagePullJobCommand() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "imagepulljob NAME",
|
||||
Short: "Delete an image pull job",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: runDeleteImagePullJob,
|
||||
}
|
||||
}
|
||||
|
||||
func runDeleteImagePullJob(cmd *cobra.Command, args []string) error {
|
||||
name := args[0]
|
||||
|
||||
client, err := client.New()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return client.ImagePullJobs().Delete(cmd.Context(), name)
|
||||
}
|
||||
Reference in New Issue
Block a user