Skip to content

Commit b59bca9

Browse files
authored
Merge pull request #11295 from sbueringer/pr-remove-dep
🌱 Remove Go dependencies on k8s.io/kubectl, k8s.io/metrics, sigs.k8s.io/kustomize, ...
2 parents ff13a64 + 3f1b79b commit b59bca9

23 files changed

+241
-172
lines changed

cmd/clusterctl/cmd/completion.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030

3131
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
3232
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
33+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
3334
)
3435

3536
const completionBoilerPlate = `# Copyright 2021 The Kubernetes Authors.
@@ -48,13 +49,13 @@ const completionBoilerPlate = `# Copyright 2021 The Kubernetes Authors.
4849
`
4950

5051
var (
51-
completionLong = LongDesc(`
52+
completionLong = templates.LongDesc(`
5253
Output shell completion code for the specified shell (bash, zsh or fish).
5354
The shell code must be evaluated to provide interactive completion of
5455
clusterctl commands. This can be done by sourcing it from the
5556
.bash_profile.`)
5657

57-
completionExample = Examples(`
58+
completionExample = templates.Examples(`
5859
Bash:
5960
# Install bash completion on macOS using Homebrew
6061
brew install bash-completion
@@ -87,7 +88,7 @@ var (
8788
Use: "completion [bash|zsh|fish]",
8889
GroupID: groupOther,
8990
Short: "Output shell completion code for the specified shell (bash, zsh or fish)",
90-
Long: LongDesc(completionLong),
91+
Long: templates.LongDesc(completionLong),
9192
Example: completionExample,
9293
Args: func(_ *cobra.Command, args []string) error {
9394
if len(args) != 1 {

cmd/clusterctl/cmd/config_repositories.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"sigs.k8s.io/yaml"
3030

3131
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
32+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
3233
)
3334

3435
const (
@@ -53,13 +54,13 @@ var configRepositoryCmd = &cobra.Command{
5354
Use: "repositories",
5455
Args: cobra.NoArgs,
5556
Short: "Display the list of providers and their repository configurations",
56-
Long: LongDesc(`
57+
Long: templates.LongDesc(`
5758
Display the list of providers and their repository configurations.
5859
5960
clusterctl ships with a list of known providers; if necessary, edit
6061
$XDG_CONFIG_HOME/cluster-api/clusterctl.yaml file to add a new provider or to customize existing ones.`),
6162

62-
Example: Examples(`
63+
Example: templates.Examples(`
6364
# Displays the list of available providers.
6465
clusterctl config repositories
6566

cmd/clusterctl/cmd/delete.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/spf13/cobra"
2424

2525
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
26+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2627
)
2728

2829
type deleteOptions struct {
@@ -46,10 +47,10 @@ var deleteCmd = &cobra.Command{
4647
Use: "delete [providers]",
4748
GroupID: groupManagement,
4849
Short: "Delete one or more providers from the management cluster",
49-
Long: LongDesc(`
50+
Long: templates.LongDesc(`
5051
Delete one or more providers from the management cluster.`),
5152

52-
Example: Examples(`
53+
Example: templates.Examples(`
5354
# Deletes the AWS provider
5455
# Please note that this implies the deletion of all provider components except the hosting namespace
5556
# and the CRDs.

cmd/clusterctl/cmd/describe_cluster.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
3737
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
3838
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/tree"
39+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
3940
)
4041

4142
const (
@@ -73,12 +74,12 @@ var dc = &describeClusterOptions{}
7374
var describeClusterClusterCmd = &cobra.Command{
7475
Use: "cluster NAME",
7576
Short: "Describe workload clusters",
76-
Long: LongDesc(`
77+
Long: templates.LongDesc(`
7778
Provide an "at glance" view of a Cluster API cluster designed to help the user in quickly
7879
understanding if there are problems and where.
7980
.`),
8081

81-
Example: Examples(`
82+
Example: templates.Examples(`
8283
# Describe the cluster named test-1.
8384
clusterctl describe cluster test-1
8485

cmd/clusterctl/cmd/generate_cluster.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/spf13/cobra"
2525

2626
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
27+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2728
)
2829

2930
type generateClusterOptions struct {
@@ -52,7 +53,7 @@ var gc = &generateClusterOptions{}
5253
var generateClusterClusterCmd = &cobra.Command{
5354
Use: "cluster NAME",
5455
Short: "Generate templates for creating workload clusters",
55-
Long: LongDesc(`
56+
Long: templates.LongDesc(`
5657
Generate templates for creating workload clusters.
5758
5859
clusterctl ships with a list of known providers; if necessary, edit
@@ -61,7 +62,7 @@ var generateClusterClusterCmd = &cobra.Command{
6162
Each provider configuration links to a repository; clusterctl uses this information
6263
to fetch templates when creating a new cluster.`),
6364

64-
Example: Examples(`
65+
Example: templates.Examples(`
6566
# Generates a yaml file for creating workload clusters using
6667
# the pre-installed infrastructure and bootstrap providers.
6768
clusterctl generate cluster my-cluster

cmd/clusterctl/cmd/generate_provider.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
2626
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
27+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2728
)
2829

2930
type generateProvidersOptions struct {
@@ -46,15 +47,15 @@ var generateProviderCmd = &cobra.Command{
4647
Use: "provider",
4748
Args: cobra.NoArgs,
4849
Short: "Generate templates for provider components",
49-
Long: LongDesc(`
50+
Long: templates.LongDesc(`
5051
Generate templates for provider components.
5152
5253
clusterctl fetches the provider components from the provider repository and performs variable substitution.
5354
5455
Variable values are either sourced from the clusterctl config file or
5556
from environment variables`),
5657

57-
Example: Examples(`
58+
Example: templates.Examples(`
5859
# Generates a yaml file for creating provider with variable values using
5960
# components defined in the provider repository.
6061
clusterctl generate provider --infrastructure aws

cmd/clusterctl/cmd/generate_yaml.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/spf13/cobra"
2626

2727
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
28+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2829
)
2930

3031
type generateYAMLOptions struct {
@@ -37,7 +38,7 @@ var gyOpts = &generateYAMLOptions{}
3738
var generateYamlCmd = &cobra.Command{
3839
Use: "yaml",
3940
Short: "Process yaml using clusterctl's yaml processor",
40-
Long: LongDesc(`
41+
Long: templates.LongDesc(`
4142
Process yaml using clusterctl's yaml processor.
4243
4344
clusterctl ships with a simple yaml processor that performs variable
@@ -46,7 +47,7 @@ var generateYamlCmd = &cobra.Command{
4647
Variable values are either sourced from the clusterctl config file or
4748
from environment variables`),
4849

49-
Example: Examples(`
50+
Example: templates.Examples(`
5051
# Generates a configuration file with variable values using
5152
a template from a specific URL.
5253
clusterctl generate yaml --from https://github.com/foo-org/foo-repository/blob/main/cluster-template.yaml

cmd/clusterctl/cmd/get_kubeconfig.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
2727
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
28+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2829
)
2930

3031
type getKubeconfigOptions struct {
@@ -38,10 +39,10 @@ var gk = &getKubeconfigOptions{}
3839
var getKubeconfigCmd = &cobra.Command{
3940
Use: "kubeconfig NAME",
4041
Short: "Gets the kubeconfig file for accessing a workload cluster",
41-
Long: LongDesc(`
42+
Long: templates.LongDesc(`
4243
Gets the kubeconfig file for accessing a workload cluster`),
4344

44-
Example: Examples(`
45+
Example: templates.Examples(`
4546
# Get the workload cluster's kubeconfig.
4647
clusterctl get kubeconfig <name of workload cluster>
4748

cmd/clusterctl/cmd/init.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/spf13/cobra"
2424

2525
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
26+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2627
)
2728

2829
type initOptions struct {
@@ -47,7 +48,7 @@ var initCmd = &cobra.Command{
4748
Use: "init",
4849
GroupID: groupManagement,
4950
Short: "Initialize a management cluster",
50-
Long: LongDesc(`
51+
Long: templates.LongDesc(`
5152
Initialize a management cluster.
5253
5354
Installs Cluster API core components, the kubeadm bootstrap provider,
@@ -65,7 +66,7 @@ var initCmd = &cobra.Command{
6566
6667
See https://cluster-api.sigs.k8s.io for more details.`),
6768

68-
Example: Examples(`
69+
Example: templates.Examples(`
6970
# Initialize a management cluster, by installing the given infrastructure provider.
7071
#
7172
# Note: when this command is executed on an empty management cluster,

cmd/clusterctl/cmd/init_list_images.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ import (
2323
"github.com/spf13/cobra"
2424

2525
"sigs.k8s.io/cluster-api/cmd/clusterctl/client"
26+
"sigs.k8s.io/cluster-api/cmd/clusterctl/cmd/internal/templates"
2627
)
2728

2829
var initListImagesCmd = &cobra.Command{
2930
Use: "list-images",
3031
Short: "Lists the container images required for initializing the management cluster",
31-
Long: LongDesc(`
32+
Long: templates.LongDesc(`
3233
Lists the container images required for initializing the management cluster.
3334
3435
See https://cluster-api.sigs.k8s.io for more details.`),
3536

36-
Example: Examples(`
37+
Example: templates.Examples(`
3738
# Lists the container images required for initializing the management cluster.
3839
#
3940
# Note: This command is a dry-run; it won't perform any action other than printing to screen.

0 commit comments

Comments
 (0)