-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds an onclustertesting binary to help with setup / teardown
- Loading branch information
1 parent
8001633
commit 6346406
Showing
11 changed files
with
1,303 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/openshift/machine-config-operator/test/framework" | ||
"github.com/spf13/cobra" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
var ( | ||
clearStatusCmd = &cobra.Command{ | ||
Use: "clear-build-status", | ||
Short: "Tears down the pool for on-cluster build testing", | ||
Long: "", | ||
Run: runClearStatusCmd, | ||
} | ||
|
||
clearStatusOpts struct { | ||
poolName string | ||
} | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(clearStatusCmd) | ||
clearStatusCmd.PersistentFlags().StringVar(&clearStatusOpts.poolName, "pool", defaultLayeredPoolName, "Pool name to clear build status on") | ||
} | ||
|
||
func runClearStatusCmd(_ *cobra.Command, _ []string) { | ||
common(clearStatusOpts) | ||
|
||
if clearStatusOpts.poolName == "" { | ||
klog.Fatalln("No pool name provided!") | ||
} | ||
|
||
failOnError(clearBuildStatusesOnPool(framework.NewClientSet(""), clearStatusOpts.poolName)) | ||
} |
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,56 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/openshift/machine-config-operator/test/framework" | ||
"github.com/spf13/cobra" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
var ( | ||
extractCmd = &cobra.Command{ | ||
Use: "extract", | ||
Short: "Extracts the Dockerfile and MachineConfig from an on-cluster build", | ||
Long: "", | ||
Run: runExtractCmd, | ||
} | ||
|
||
extractOpts struct { | ||
poolName string | ||
machineConfig string | ||
targetDir string | ||
noConfigMaps bool | ||
} | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(extractCmd) | ||
extractCmd.PersistentFlags().StringVar(&extractOpts.poolName, "pool", defaultLayeredPoolName, "Pool name to extract") | ||
extractCmd.PersistentFlags().StringVar(&extractOpts.machineConfig, "machineconfig", "", "MachineConfig name to extract") | ||
extractCmd.PersistentFlags().StringVar(&extractOpts.targetDir, "dir", "", "Dir to store extract build objects") | ||
} | ||
|
||
func runExtractCmd(_ *cobra.Command, _ []string) { | ||
common(extractOpts) | ||
|
||
if extractOpts.poolName == "" && extractOpts.machineConfig == "" { | ||
klog.Fatalln("No pool name or MachineConfig name provided!") | ||
} | ||
|
||
if extractOpts.poolName != "" && extractOpts.machineConfig != "" { | ||
klog.Fatalln("Either pool name or MachineConfig must be provided. Not both!") | ||
} | ||
|
||
targetDir := getDir(extractOpts.targetDir) | ||
|
||
cs := framework.NewClientSet("") | ||
|
||
if extractOpts.machineConfig != "" { | ||
failOnError(extractBuildObjectsForRenderedMC(cs, extractOpts.machineConfig, targetDir)) | ||
return | ||
} | ||
|
||
if extractOpts.poolName != "" { | ||
failOnError(extractBuildObjectsForTargetPool(cs, extractOpts.poolName, targetDir)) | ||
return | ||
} | ||
} |
Oops, something went wrong.