Skip to content

Commit

Permalink
Update Deprecated comments to correctly trigger staticcheck linter
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <[email protected]>
  • Loading branch information
killianmuldoon committed Oct 17, 2022
1 parent 5774dcc commit 752b975
Show file tree
Hide file tree
Showing 39 changed files with 2,021 additions and 28 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ issues:
# changes in PRs and avoid nitpicking.
exclude-use-default: false
exclude-rules:
# Specific exclude rules for deprecated fields that are still part of the codebase. These should be removed as the referenced deprecated item is removed from the project.
- linters:
- staticcheck
text: "SA1019: (bootstrapv1.ClusterStatus|clusterv1.ClusterTopologyManagedFieldsAnnotation|scope.Config.Spec.UseExperimentalRetryJoin|DockerMachine.Spec.Bootstrapped|machineStatus.Bootstrapped) is deprecated"
- linters:
- revive
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha4/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
ClusterLabelName = "cluster.x-k8s.io/cluster-name"

// ClusterTopologyLabelName is the label set on all the object which are managed as part of a ClusterTopology.
//
// Deprecated: use ClusterTopologyOwnedLabel instead.
ClusterTopologyLabelName = "cluster.x-k8s.io/topology"

Expand Down Expand Up @@ -117,11 +118,13 @@ var (

const (
// MachineNodeNameIndex is used by the Machine Controller to index Machines by Node name, and add a watch on Nodes.
//
// Deprecated: Use api/v1alpha4/index.MachineNodeNameField instead.
MachineNodeNameIndex = "status.nodeRef.name"

// MachineProviderIDIndex is used to index Machines by ProviderID. It's useful to find Machines
// in a management cluster from Nodes in a workload cluster.
//
// Deprecated: Use api/v1alpha4/index.MachineProviderIDField instead.
MachineProviderIDIndex = "spec.providerID"
)
Expand Down
2 changes: 2 additions & 0 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const (
// to easily discover which fields have been set by templates + patches/variables at a given reconcile;
// instead, it is not necessary to store managed paths for typed objets (e.g. Cluster, MachineDeployments)
// given that the topology controller explicitly sets a well-known, immutable list of fields at every reconcile.
//
// Deprecated: Topology controller is now using server side apply and this annotation will be removed in a future release.
// When removing also remove from staticcheck exclude-rules for SA1019 in golangci.yml.
ClusterTopologyManagedFieldsAnnotation = "topology.cluster.x-k8s.io/managed-field-paths"

// ClusterTopologyMachineDeploymentLabelName is the label set on the generated MachineDeployment objects
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const (

// MachineHealthCheckSuccededCondition is set on machines that have passed a healthcheck by the MachineHealthCheck controller.
// In the event that the health check fails it will be set to False.
//
// Deprecated: This const is going to be removed in a next release. Use MachineHealthCheckSucceededCondition instead.
MachineHealthCheckSuccededCondition ConditionType = "HealthCheckSucceeded"

Expand Down
1 change: 1 addition & 0 deletions bootstrap/kubeadm/api/v1alpha4/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ type ImageMeta struct {

// ClusterStatus contains the cluster status. The ClusterStatus will be stored in the kubeadm-config
// ConfigMap in the cluster, and then updated by kubeadm when additional control plane instance joins or leaves the cluster.
//
// Deprecated: ClusterStatus has been removed from kubeadm v1beta3 API; This type is preserved only to support
// conversion to older versions of the kubeadm API.
type ClusterStatus struct {
Expand Down
1 change: 1 addition & 0 deletions bootstrap/kubeadm/api/v1beta1/kubeadm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ type ImageMeta struct {

// ClusterStatus contains the cluster status. The ClusterStatus will be stored in the kubeadm-config
// ConfigMap in the cluster, and then updated by kubeadm when additional control plane instance joins or leaves the cluster.
//
// Deprecated: ClusterStatus has been removed from kubeadm v1beta3 API; This type is preserved only to support
// conversion to older versions of the kubeadm API.
type ClusterStatus struct {
Expand Down
2 changes: 2 additions & 0 deletions bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ type KubeadmConfigSpec struct {
//
// For more information, refer to https://github.com/kubernetes-sigs/cluster-api/pull/2763#discussion_r397306055.
// +optional
//
// Deprecated: This experimental fix is no longer needed and this field will be removed in a future release.
// When removing also remove from staticcheck exclude-rules for SA1019 in golangci.yml
UseExperimentalRetryJoin bool `json:"useExperimentalRetryJoin,omitempty"`

// Ignition contains Ignition specific configuration.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/clusterctl/api/v1alpha3/provider_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Provider struct {

// WatchedNamespace indicates the namespace where the provider controller is watching.
// If empty the provider controller is watching for objects in all namespaces.
//
// Deprecated: in clusterctl v1alpha4 all the providers watch all the namespaces; this field will be removed in a future version of this API
// +optional
WatchedNamespace string `json:"watchedNamespace,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions cmd/clusterctl/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ type Client interface {
Move(options MoveOptions) error

// Backup saves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target management cluster.
//
// Deprecated: This will be dropped in a future release. Please use Move.
Backup(options BackupOptions) error

// Restore restores all the Cluster API objects existing in a configured directory based on a glob to a target management cluster.
//
// Deprecated: This will be dropped in a future release. Please use Move.
Restore(options RestoreOptions) error

Expand Down
3 changes: 2 additions & 1 deletion cmd/clusterctl/client/cluster/cert_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ const (

certManagerNamespace = "cert-manager"

// Deprecated: Use clusterctlv1.CertManagerVersionAnnotation instead.
// This is maintained only for supporting upgrades from cluster created with clusterctl v1alpha3.
//
// Deprecated: Use clusterctlv1.CertManagerVersionAnnotation instead.
// TODO: Remove once upgrades from v1alpha3 are no longer supported.
certManagerVersionAnnotation = "certmanager.clusterctl.cluster.x-k8s.io/version"
)
Expand Down
2 changes: 2 additions & 0 deletions cmd/clusterctl/client/cluster/mover.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ type ObjectMover interface {
FromDirectory(toCluster Client, directory string) error

// Backup saves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target directory.
//
// Deprecated: This will be dropped in a future release. Please use ToDirectory.
Backup(namespace string, directory string) error

// Restore restores all the Cluster API objects existing in a configured directory to a target management cluster.
//
// Deprecated: This will be dropped in a future release. Please use FromDirectory.
Restore(toCluster Client, directory string) error
}
Expand Down
10 changes: 8 additions & 2 deletions cmd/clusterctl/client/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type MoveOptions struct {
}

// BackupOptions holds options supported by backup.
//
// Deprecated: This will be dropped in a future release. Please use MoveOptions.
type BackupOptions struct {
// FromKubeconfig defines the kubeconfig to use for accessing the source management cluster. If empty,
Expand All @@ -64,6 +65,7 @@ type BackupOptions struct {
}

// RestoreOptions holds options supported by restore.
//
// Deprecated: This will be dropped in a future release. Please use MoveOptions.
type RestoreOptions struct {
// FromKubeconfig defines the kubeconfig to use for accessing the target management cluster. If empty,
Expand Down Expand Up @@ -158,7 +160,9 @@ func (c *clusterctlClient) toDirectory(options MoveOptions) error {
return fromCluster.ObjectMover().ToDirectory(options.Namespace, options.ToDirectory)
}

// Deprecated: This will be dropped in a future release. Please use Move.
// Backup saves all the Cluster API objects existing in a namespace (or from all the namespaces if empty) to a target directory.
//
// Deprecated: This will be dropped in a future release. Please use ToDirectory.
func (c *clusterctlClient) Backup(options BackupOptions) error {
return c.Move(MoveOptions{
FromKubeconfig: options.FromKubeconfig,
Expand All @@ -167,7 +171,9 @@ func (c *clusterctlClient) Backup(options BackupOptions) error {
})
}

// Deprecated: This will be dropped in a future release. Please use Move.
// Restore restores all the Cluster API objects existing in a configured directory to a target management cluster.
//
// Deprecated: This will be dropped in a future release. Please use FromDirectory.
func (c *clusterctlClient) Restore(options RestoreOptions) error {
return c.Move(MoveOptions{
ToKubeconfig: options.ToKubeconfig,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/clusterctl/config/manifest/clusterctl-api.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions controllers/external/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func Delete(ctx context.Context, c client.Writer, ref *corev1.ObjectReference) e
}

// CloneTemplateInput is the input to CloneTemplate.
//
// Deprecated: use CreateFromTemplateInput instead. This type will be removed in a future release.
type CloneTemplateInput struct {
// Client is the controller runtime client.
Expand Down Expand Up @@ -88,6 +89,7 @@ type CloneTemplateInput struct {
}

// CloneTemplate uses the client and the reference to create a new object from the template.
//
// Deprecated: use CreateFromTemplate instead. This function will be removed in a future release.
func CloneTemplate(ctx context.Context, in *CloneTemplateInput) (*corev1.ObjectReference, error) {
from, err := Get(ctx, in.Client, in.TemplateRef, in.Namespace)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 752b975

Please sign in to comment.