Skip to content

Commit

Permalink
cmd,pkg,test: Rename the DeleteCRB -> DeleteCRBs for the Config struc…
Browse files Browse the repository at this point in the history
…ture

Rename the `DeleteCRB` field to `DeleteCRB` to match the naming of the
other delete-related fields in the `Config` structure.
  • Loading branch information
timflannagan committed Feb 10, 2021
1 parent 62aa81a commit b074b39
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/deploy-metering/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&deployManifestsDir, "deploy-manifests-dir", "manifests/deploy", "The absolute/relative path to the metering manifest directory. This can also be specified through the INSTALLER_MANIFESTS_DIR.")

uninstallCmd.Flags().BoolVar(&cfg.DeleteCRDs, "delete-crd", false, "If true, this would delete the metering CRDs during an uninstall. This can also be specified through the METERING_DELETE_CRDS ENV var.")
uninstallCmd.Flags().BoolVar(&cfg.DeleteCRB, "delete-crb", false, "If true, this would delete the metering cluster role bindings during an uninstall. This can also be specified through METERING_DELETE_CRB ENV var.")
uninstallCmd.Flags().BoolVar(&cfg.DeleteCRBs, "delete-crb", false, "If true, this would delete the metering cluster role bindings during an uninstall. This can also be specified through METERING_DELETE_CRB ENV var.")
uninstallCmd.Flags().BoolVar(&cfg.DeleteNamespace, "delete-namespace", false, "If true, this would delete the namespace during an uninstall. This can also be specified through the METERING_DELETE_NAMESPACE ENV var.")
uninstallCmd.Flags().BoolVar(&cfg.DeletePVCs, "delete-pvc", true, "If true, this would delete the PVCs used by metering resources during an uninstall. This can also be specified through the METERING_DELETE_PVCS ENV var.")
uninstallCmd.Flags().BoolVar(&cfg.DeleteAll, "delete-all", false, "If true, this would delete the all metering resources during an uninstall. This can also be specified through the METERING_DELETE_ALL ENV var.")
Expand All @@ -92,7 +92,7 @@ func init() {
// are both using the same flagset. We could switch to an installCmd and uninstallCmd, and
// have a --olm sub-command configuration so we could share flags between install/uninstall.
olmUninstallCmd.Flags().BoolVar(&cfg.DeleteCRDs, "delete-crd", false, "If true, this would delete the metering CRDs during an uninstall. This can also be specified through the METERING_DELETE_CRDS ENV var.")
olmUninstallCmd.Flags().BoolVar(&cfg.DeleteCRB, "delete-crb", false, "If true, this would delete the metering cluster role bindings during an uninstall. This can also be specified through METERING_DELETE_CRB ENV var.")
olmUninstallCmd.Flags().BoolVar(&cfg.DeleteCRBs, "delete-crb", false, "If true, this would delete the metering cluster role bindings during an uninstall. This can also be specified through METERING_DELETE_CRB ENV var.")
olmUninstallCmd.Flags().BoolVar(&cfg.DeleteNamespace, "delete-namespace", false, "If true, this would delete the namespace during an uninstall. This can also be specified through the METERING_DELETE_NAMESPACE ENV var.")
olmUninstallCmd.Flags().BoolVar(&cfg.DeletePVCs, "delete-pvc", true, "If true, this would delete the PVCs used by metering resources during an uninstall. This can also be specified through the METERING_DELETE_PVCS ENV var.")
olmUninstallCmd.Flags().BoolVar(&cfg.DeleteAll, "delete-all", false, "If true, this would delete the all metering resources during an uninstall. This can also be specified through the METERING_DELETE_ALL ENV var.")
Expand Down
6 changes: 3 additions & 3 deletions pkg/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Config struct {
SkipMeteringDeployment bool
RunMeteringOperatorLocal bool
DeleteCRDs bool
DeleteCRB bool
DeleteCRBs bool
DeleteNamespace bool
DeletePVCs bool
DeleteAll bool
Expand Down Expand Up @@ -139,7 +139,7 @@ func NewDeployer(
if deploy.Config.DeleteAll {
deploy.Config.DeletePVCs = true
deploy.Config.DeleteNamespace = true
deploy.Config.DeleteCRB = true
deploy.Config.DeleteCRBs = true
deploy.Config.DeleteCRDs = true
}
if deploy.Config.Namespace == "" {
Expand Down Expand Up @@ -220,7 +220,7 @@ func (deploy *Deployer) UninstallOLM() error {
return fmt.Errorf("failed to uninstall the %s metering namespace: %v", deploy.Config.Namespace, err)
}
}
if deploy.Config.DeleteCRB {
if deploy.Config.DeleteCRBs {
err = deploy.uninstallReportingOperatorClusterRole()
if err != nil {
return fmt.Errorf("failed to delete the reporting-operator ClusterRole resources: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/deploy/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (deploy *Deployer) uninstallMeteringResources() error {
return fmt.Errorf("failed to delete the metering role binding: %v", err)
}

if deploy.Config.DeleteCRB {
if deploy.Config.DeleteCRBs {
err = deploy.uninstallMeteringClusterRole()
if err != nil {
return fmt.Errorf("failed to delete the metering cluster role: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion test/deployframework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (df *DeployFramework) NewDeployerConfig(
Tag: meteringOperatorImageTag,
Platform: defaultPlatform,
DeleteNamespace: defaultDeleteNamespace,
DeleteCRB: defaultDeleteCRB,
DeleteCRBs: defaultDeleteCRB,
SubscriptionName: defaultSubscriptionName,
PackageName: defaultPackageName,
CatalogSourceName: catalogSourceName,
Expand Down
2 changes: 1 addition & 1 deletion test/deployframework/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestNewDeployerConfig(t *testing.T) {
CatalogSourceName: testCatalogSourceName,
CatalogSourceNamespace: testCatalogSourceNamespace,
Channel: testSubscriptionChannel,
DeleteCRB: defaultDeleteCRB,
DeleteCRBs: defaultDeleteCRB,
DeleteNamespace: defaultDeleteNamespace,
ExtraNamespaceLabels: map[string]string{
"name": fmt.Sprintf("%s-%s", df.NamespacePrefix, testNamespaceLabel),
Expand Down

0 comments on commit b074b39

Please sign in to comment.