-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCM-6318 | ci: Build up deprovision step
- Loading branch information
1 parent
c9d870e
commit 7325467
Showing
73 changed files
with
24,010 additions
and
20,808 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
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
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
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,69 @@ | ||
package kubeletconfig | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
"text/tabwriter" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/openshift/rosa/pkg/kubeletconfig" | ||
"github.com/openshift/rosa/pkg/ocm" | ||
"github.com/openshift/rosa/pkg/output" | ||
"github.com/openshift/rosa/pkg/rosa" | ||
) | ||
|
||
const ( | ||
use = "kubeletconfigs" | ||
short = "List kubeletconfigs" | ||
long = short | ||
example = ` # List the kubeletconfigs for cluster 'foo' | ||
rosa list kubeletconfig --cluster foo` | ||
alias = "kubelet-configs" | ||
) | ||
|
||
func NewListKubeletConfigsCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: use, | ||
Short: short, | ||
Long: long, | ||
Example: example, | ||
Aliases: []string{alias}, | ||
Args: cobra.NoArgs, | ||
Run: rosa.DefaultRunner(rosa.RuntimeWithOCM(), ListKubeletConfigRunner()), | ||
} | ||
|
||
output.AddFlag(cmd) | ||
ocm.AddClusterFlag(cmd) | ||
return cmd | ||
} | ||
|
||
func ListKubeletConfigRunner() rosa.CommandRunner { | ||
return func(ctx context.Context, runtime *rosa.Runtime, command *cobra.Command, args []string) error { | ||
|
||
cluster, err := runtime.OCMClient.GetCluster(runtime.GetClusterKey(), runtime.Creator) | ||
if err != nil { | ||
return err | ||
} | ||
kubeletConfigs, err := runtime.OCMClient.ListKubeletConfigs(ctx, cluster.ID()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if output.HasFlag() { | ||
output.Print(kubeletConfigs) | ||
} else { | ||
if len(kubeletConfigs) == 0 { | ||
runtime.Reporter.Infof("There are no KubeletConfigs for cluster '%s'.", runtime.ClusterKey) | ||
return nil | ||
} | ||
|
||
writer := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0) | ||
fmt.Fprint(writer, kubeletconfig.PrintKubeletConfigsForTabularOutput(kubeletConfigs)) | ||
return writer.Flush() | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package kubeletconfig | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestListKubeletConfigs(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "List KubeletConfigs Suite") | ||
} |
Oops, something went wrong.