Skip to content

Commit b0e9d37

Browse files
authored
Merge pull request #1439 from wfernandes/master
🐛Add deprecation message to clusterctl commands
2 parents 6258ff3 + 7e3152d commit b0e9d37

17 files changed

+55
-21
lines changed

cmd/clusterctl/cmd/alpha_phase_apply_addons.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ var alphaPhaseApplyAddonsCmd = &cobra.Command{
3939
Long: `Apply Addons`,
4040
Run: func(cmd *cobra.Command, args []string) {
4141
if paao.Addons == "" {
42-
exitWithHelp(cmd, "Please provide yaml file for addons definition.")
42+
exitWithHelp(cmd, "Please provide yaml file for addons definition.\n")
4343
}
4444

4545
if paao.Kubeconfig == "" {
46-
exitWithHelp(cmd, "Please provide a kubeconfig file.")
46+
exitWithHelp(cmd, "Please provide a kubeconfig file.\n")
4747
}
4848

49+
fmt.Println(deprecationMsg)
4950
if err := RunAlphaPhaseApplyAddons(paao); err != nil {
5051
klog.Exit(err)
5152
}

cmd/clusterctl/cmd/alpha_phase_apply_boostrap_components.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
2021
"io/ioutil"
2122

2223
"github.com/pkg/errors"
@@ -39,13 +40,14 @@ var alphaPhaseApplyBootstrapComponentsCmd = &cobra.Command{
3940
Long: `Apply bootstrap components`,
4041
Run: func(cmd *cobra.Command, args []string) {
4142
if pabco.BootstrapComponents == "" {
42-
exitWithHelp(cmd, "Please provide yaml file for bootstrap component definition.")
43+
exitWithHelp(cmd, "Please provide yaml file for bootstrap component definition.\n")
4344
}
4445

4546
if pabco.Kubeconfig == "" {
46-
exitWithHelp(cmd, "Please provide a kubeconfig file.")
47+
exitWithHelp(cmd, "Please provide a kubeconfig file.\n")
4748
}
4849

50+
fmt.Println(deprecationMsg)
4951
if err := RunAlphaPhaseApplyBootstrapComponents(pabco); err != nil {
5052
klog.Exit(err)
5153
}

cmd/clusterctl/cmd/alpha_phase_apply_cluster.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
2021
"io/ioutil"
2122

2223
"github.com/pkg/errors"
@@ -40,13 +41,14 @@ var alphaPhaseApplyClusterCmd = &cobra.Command{
4041
Long: `Apply Cluster`,
4142
Run: func(cmd *cobra.Command, args []string) {
4243
if paco.Cluster == "" {
43-
exitWithHelp(cmd, "Please provide yaml file for cluster definition.")
44+
exitWithHelp(cmd, "Please provide yaml file for cluster definition.\n")
4445
}
4546

4647
if paco.Kubeconfig == "" {
47-
exitWithHelp(cmd, "Please provide a kubeconfig file.")
48+
exitWithHelp(cmd, "Please provide a kubeconfig file.\n")
4849
}
4950

51+
fmt.Println(deprecationMsg)
5052
if err := RunAlphaPhaseApplyCluster(paco); err != nil {
5153
klog.Exit(err)
5254
}

cmd/clusterctl/cmd/alpha_phase_apply_cluster_api_components.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
2021
"io/ioutil"
2122

2223
"github.com/pkg/errors"
@@ -39,13 +40,14 @@ var alphaPhaseApplyClusterAPIComponentsCmd = &cobra.Command{
3940
Long: `Apply Cluster API components`,
4041
Run: func(cmd *cobra.Command, args []string) {
4142
if pacaso.ProviderComponents == "" {
42-
exitWithHelp(cmd, "Please provide yaml file for provider component definition.")
43+
exitWithHelp(cmd, "Please provide yaml file for provider component definition.\n")
4344
}
4445

4546
if pacaso.Kubeconfig == "" {
46-
exitWithHelp(cmd, "Please provide a kubeconfig file.")
47+
exitWithHelp(cmd, "Please provide a kubeconfig file.\n")
4748
}
4849

50+
fmt.Println(deprecationMsg)
4951
if err := RunAlphaPhaseApplyClusterAPIComponents(pacaso); err != nil {
5052
klog.Exit(err)
5153
}

cmd/clusterctl/cmd/alpha_phase_apply_machines.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
2021
"io/ioutil"
2122

2223
"github.com/pkg/errors"
@@ -42,13 +43,14 @@ var alphaPhaseApplyMachinesCmd = &cobra.Command{
4243
Long: `Apply Machines`,
4344
Run: func(cmd *cobra.Command, args []string) {
4445
if pamo.Machines == "" {
45-
exitWithHelp(cmd, "Please provide yaml file for machines definition.")
46+
exitWithHelp(cmd, "Please provide yaml file for machines definition.\n")
4647
}
4748

4849
if pamo.Kubeconfig == "" {
49-
exitWithHelp(cmd, "Please provide a kubeconfig file.")
50+
exitWithHelp(cmd, "Please provide a kubeconfig file.\n")
5051
}
5152

53+
fmt.Println(deprecationMsg)
5254
if err := RunAlphaPhaseApplyMachines(pamo); err != nil {
5355
klog.Exit(err)
5456
}

cmd/clusterctl/cmd/alpha_phase_create_bootstrap_cluster.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
21+
2022
"github.com/pkg/errors"
2123
"github.com/spf13/cobra"
2224
"k8s.io/klog"
@@ -37,6 +39,7 @@ var alphaPhaseCreateBootstrapClusterCmd = &cobra.Command{
3739
Short: "Create a bootstrap cluster",
3840
Long: `Create a bootstrap cluster`,
3941
Run: func(cmd *cobra.Command, args []string) {
42+
fmt.Println(deprecationMsg)
4043
if err := RunAlphaPhaseCreateBootstrapCluster(pcbco); err != nil {
4144
klog.Exit(err)
4245
}

cmd/clusterctl/cmd/alpha_phase_get_kubeconfig.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ var alphaPhaseGetKubeconfigCmd = &cobra.Command{
4141
Long: `Get Kubeconfig`,
4242
Run: func(cmd *cobra.Command, args []string) {
4343
if pgko.Kubeconfig == "" {
44-
exitWithHelp(cmd, "Please provide a kubeconfig file.")
44+
exitWithHelp(cmd, "Please provide a kubeconfig file.\n")
4545
}
4646

4747
if pgko.ClusterName == "" {
48-
exitWithHelp(cmd, "Please specify a cluster name.")
48+
exitWithHelp(cmd, "Please specify a cluster name.\n")
4949
}
5050

51+
fmt.Println(deprecationMsg)
5152
if err := RunAlphaPhaseGetKubeconfig(pgko); err != nil {
5253
klog.Exit(err)
5354
}

cmd/clusterctl/cmd/alpha_phase_pivot.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ var alphaPhasePivotCmd = &cobra.Command{
4040
Long: `Pivot`,
4141
Run: func(cmd *cobra.Command, args []string) {
4242
if ppo.ProviderComponents == "" {
43-
exitWithHelp(cmd, "Please provide yaml file for provider components definition.")
43+
exitWithHelp(cmd, "Please provide yaml file for provider components definition.\n")
4444
}
4545

4646
if ppo.SourceKubeconfig == "" {
47-
exitWithHelp(cmd, "Please provide a source kubeconfig file.")
47+
exitWithHelp(cmd, "Please provide a source kubeconfig file.\n")
4848
}
4949

5050
if ppo.TargetKubeconfig == "" {
51-
exitWithHelp(cmd, "Please provide a target kubeconfig file.")
51+
exitWithHelp(cmd, "Please provide a target kubeconfig file.\n")
5252
}
5353

54+
fmt.Println(deprecationMsg)
5455
if err := RunAlphaPhasePivot(ppo); err != nil {
5556
klog.Exit(err)
5657
}

cmd/clusterctl/cmd/create_cluster.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
2021
"io/ioutil"
2122

2223
"github.com/pkg/errors"
@@ -47,14 +48,15 @@ var createClusterCmd = &cobra.Command{
4748
Long: `Create a kubernetes cluster with one command`,
4849
Run: func(cmd *cobra.Command, args []string) {
4950
if co.Cluster == "" {
50-
exitWithHelp(cmd, "Please provide yaml file for cluster definition.")
51+
exitWithHelp(cmd, "Please provide yaml file for cluster definition.\n")
5152
}
5253
if co.Machine == "" {
53-
exitWithHelp(cmd, "Please provide yaml file for machine definition.")
54+
exitWithHelp(cmd, "Please provide yaml file for machine definition.\n")
5455
}
5556
if co.ProviderComponents == "" {
56-
exitWithHelp(cmd, "Please provide yaml file for provider component definition.")
57+
exitWithHelp(cmd, "Please provide yaml file for provider component definition.\n")
5758
}
59+
fmt.Println(deprecationMsg)
5860
if err := RunCreate(co); err != nil {
5961
klog.Exit(err)
6062
}

cmd/clusterctl/cmd/delete_cluster.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
21+
2022
"github.com/pkg/errors"
2123
"github.com/spf13/cobra"
2224
v1 "k8s.io/api/core/v1"
@@ -44,14 +46,16 @@ var deleteClusterCmd = &cobra.Command{
4446
Long: `Delete a kubernetes cluster with one command`,
4547
Run: func(cmd *cobra.Command, args []string) {
4648
if do.KubeconfigPath == "" {
47-
exitWithHelp(cmd, "Please provide kubeconfig file for cluster to delete.")
49+
exitWithHelp(cmd, "Please provide kubeconfig file for cluster to delete.\n")
4850
}
4951
if do.ProviderComponents == "" {
50-
exitWithHelp(cmd, "Please provide yaml file for provider component definition.")
52+
exitWithHelp(cmd, "Please provide yaml file for provider component definition.\n")
5153
}
54+
fmt.Println(deprecationMsg)
5255
if err := RunDelete(); err != nil {
5356
klog.Exit(err)
5457
}
58+
5559
},
5660
}
5761

0 commit comments

Comments
 (0)