-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Greg Haynes <[email protected]>
- Loading branch information
1 parent
d415367
commit ee9a96f
Showing
3 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package list | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/spf13/cobra" | ||
ctrl "sigs.k8s.io/controller-runtime" | ||
"sigs.k8s.io/controller-runtime/pkg/log/zap" | ||
"sigs.k8s.io/kind/pkg/cluster" | ||
) | ||
|
||
var ( | ||
// Flags | ||
buildName string | ||
) | ||
|
||
var ListCmd = &cobra.Command{ | ||
Use: "list", | ||
Short: "List idp clusters", | ||
Long: ``, | ||
RunE: delete, | ||
} | ||
|
||
func init() { | ||
ListCmd.PersistentFlags().StringVar(&buildName, "buildName", "localdev", "Name of the kind cluster to be deleted.") | ||
|
||
zapfs := flag.NewFlagSet("zap", flag.ExitOnError) | ||
opts := zap.Options{ | ||
Development: true, | ||
} | ||
opts.BindFlags(zapfs) | ||
ListCmd.Flags().AddGoFlagSet(zapfs) | ||
|
||
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) | ||
} | ||
|
||
func delete(cmd *cobra.Command, args []string) error { | ||
provider := cluster.NewProvider(cluster.ProviderWithDocker()) | ||
clusters, err := provider.List() | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to delete cluster %q", buildName) | ||
} | ||
|
||
fmt.Printf("Clusters: %v\n", clusters) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters