package cmd
import (
"context"
"fmt"
"io"
"github.com/spf13/cobra"
"github.com/gitpod-io/gitpod/common-go/log"
"github.com/gitpod-io/gitpod/ws-manager-bridge/api"
)
var clustersUncordonCmd = &cobra.Command{
Use: "uncordon --name [cluster name]",
Short: "Un-cordon a cluster",
Run: func(cmd *cobra.Command, args []string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
conn, client, err := getClustersClient(ctx)
if err != nil {
log.WithError(err).Fatal("cannot connect")
}
defer conn.Close()
name := getClusterName()
request := &api.UpdateRequest{Name: name, Property: &api.UpdateRequest_Cordoned{Cordoned: false}}
_, err = client.Update(ctx, request)
if err != nil && err != io.EOF {
log.Fatal(err)
}
fmt.Printf("cluster '%s' un-cordoned\n", name)
},
}
func init() {
clustersCmd.AddCommand(clustersUncordonCmd)
}