diff --git a/bootstrap/kubeadm/api/v1alpha4/condition_consts.go b/bootstrap/kubeadm/api/v1alpha4/condition_consts.go index ff48dd6cdc23..6ee694b4c966 100644 --- a/bootstrap/kubeadm/api/v1alpha4/condition_consts.go +++ b/bootstrap/kubeadm/api/v1alpha4/condition_consts.go @@ -35,16 +35,6 @@ const ( // the KubeadmConfig controller ensure this pre-condition is satisfied. WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure" - // WaitingForControlPlaneAvailableReason (Severity=Info) document a bootstrap secret generation process - // waiting for the control plane machine to be available. - // - // NOTE: Having the control plane machine available is a pre-condition for joining additional control planes - // or workers nodes. - // DEPRECATED: This has been deprecated in v1alpha3 and will be removed in a future version. - // Switch to WaitingForControlPlaneAvailableReason constant from the `sigs.k8s.io/cluster-api/api/v1alpha3` - // package. - WaitingForControlPlaneAvailableReason = clusterv1.WaitingForControlPlaneAvailableReason - // DataSecretGenerationFailedReason (Severity=Warning) documents a KubeadmConfig controller detecting // an error while generating a data secret; those kind of errors are usually due to misconfigurations // and user intervention is required to get them fixed. diff --git a/controllers/machinehealthcheck_targets.go b/controllers/machinehealthcheck_targets.go index 5493b54ef2e7..940ef7de281e 100644 --- a/controllers/machinehealthcheck_targets.go +++ b/controllers/machinehealthcheck_targets.go @@ -37,18 +37,6 @@ import ( const ( // Event types - // EventSkippedControlPlane is emitted in case an unhealthy node (or a machine - // associated with the node) has the `control-plane` role - // Deprecated: no longer in use - EventSkippedControlPlane string = "SkippedControlPlane" - // EventMachineDeletionFailed is emitted in case remediation of a machine - // is required but deletion of its Machine object failed - // Deprecated: no longer in use - EventMachineDeletionFailed string = "MachineDeletionFailed" - // EventMachineDeleted is emitted when machine was successfully remediated - // by deleting its Machine object - // Deprecated: no longer in use - EventMachineDeleted string = "MachineDeleted" // EventMachineMarkedUnhealthy is emitted when machine was successfully marked as unhealthy EventMachineMarkedUnhealthy string = "MachineMarkedUnhealthy" // EventDetectedUnhealthy is emitted in case a node associated with a diff --git a/hack/tools/release/notes.go b/hack/tools/release/notes.go index f6593e6e92ea..2dd5ce00896d 100644 --- a/hack/tools/release/notes.go +++ b/hack/tools/release/notes.go @@ -142,11 +142,6 @@ func run() int { key = warning body = strings.TrimPrefix(body, ":warning:") body = strings.TrimPrefix(body, "⚠️") - case strings.HasPrefix(body, ":running:"), strings.HasPrefix(body, "🏃"): - // This has been deprecated in favor of :seedling: - key = other - body = strings.TrimPrefix(body, ":running:") - body = strings.TrimPrefix(body, "🏃") default: key = unknown } diff --git a/test/helpers/envtest.go b/test/helpers/envtest.go index e3d1ae762680..e839d1a55eb8 100644 --- a/test/helpers/envtest.go +++ b/test/helpers/envtest.go @@ -295,7 +295,7 @@ func (t *TestEnvironment) Stop() error { } func (t *TestEnvironment) CreateKubeconfigSecret(ctx context.Context, cluster *clusterv1.Cluster) error { - return kubeconfig.CreateEnvTestSecret(ctx, t.Client, t.Config, cluster) + return t.Create(ctx, kubeconfig.GenerateSecret(cluster, kubeconfig.FromEnvTestConfig(t.Config, cluster))) } func (t *TestEnvironment) Cleanup(ctx context.Context, objs ...client.Object) error { diff --git a/util/kubeconfig/testing.go b/util/kubeconfig/testing.go index 8d9a4e826b20..3685750b2bbe 100644 --- a/util/kubeconfig/testing.go +++ b/util/kubeconfig/testing.go @@ -17,21 +17,14 @@ limitations under the License. package kubeconfig import ( - "context" "fmt" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd/api" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/controller-runtime/pkg/client" ) -// Deprecated: use test/helpers/envtest -func CreateEnvTestSecret(ctx context.Context, client client.Client, cfg *rest.Config, cluster *clusterv1.Cluster) error { - return client.Create(ctx, GenerateSecret(cluster, FromEnvTestConfig(cfg, cluster))) -} - func FromEnvTestConfig(cfg *rest.Config, cluster *clusterv1.Cluster) []byte { contextName := fmt.Sprintf("%s@%s", cfg.Username, cluster.Name) c := api.Config{ diff --git a/util/secret/certificates.go b/util/secret/certificates.go index cecbace3862b..b7bec6ea729d 100644 --- a/util/secret/certificates.go +++ b/util/secret/certificates.go @@ -112,14 +112,6 @@ func NewCertificatesForInitialControlPlane(config *v1beta1.ClusterConfiguration) return certificates } -// NewCertificatesForJoiningControlPlane gets any certs that exist and writes them to disk -// -// Deprecated: this method is deprecated in favor of NewControlPlaneJoinCerts that -// provides full support for the external etcd scenario. -func NewCertificatesForJoiningControlPlane() Certificates { - return NewControlPlaneJoinCerts(nil) -} - // NewControlPlaneJoinCerts gets any certs that exist and writes them to disk func NewControlPlaneJoinCerts(config *v1beta1.ClusterConfiguration) Certificates { certificatesDir := DefaultCertificatesDir diff --git a/util/secret/certificates_test.go b/util/secret/certificates_test.go index fd493d7fff3f..616e19cc7ba7 100644 --- a/util/secret/certificates_test.go +++ b/util/secret/certificates_test.go @@ -25,13 +25,6 @@ import ( "sigs.k8s.io/cluster-api/util/secret" ) -func TestNewCertificatesForJoiningControlPlane_Stacked(t *testing.T) { - g := NewWithT(t) - - certs := secret.NewCertificatesForJoiningControlPlane() - g.Expect(certs.GetByPurpose(secret.EtcdCA).KeyFile).NotTo(BeEmpty()) -} - func TesNewControlPlaneJoinCerts_Stacked(t *testing.T) { g := NewWithT(t) diff --git a/util/util.go b/util/util.go index be402af7195d..3c3d93f6e95c 100644 --- a/util/util.go +++ b/util/util.go @@ -39,19 +39,14 @@ import ( k8sversion "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/metadata" "k8s.io/client-go/rest" - "k8s.io/klog/klogr" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4" - "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/container" - "sigs.k8s.io/cluster-api/util/predicates" "sigs.k8s.io/cluster-api/util/version" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" - "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "sigs.k8s.io/controller-runtime/pkg/source" ) const ( @@ -141,18 +136,6 @@ func GetMachinesForCluster(ctx context.Context, c client.Client, cluster *cluste return &machines, nil } -// SemverToOCIImageTag is a helper function that replaces all -// non-allowed symbols in tag strings with underscores. -// Image tag can only contain lowercase and uppercase letters, digits, -// underscores, periods and dashes. -// Current usage is for CI images where all of symbols except '+' are valid, -// but function is for generic usage where input can't be always pre-validated. -// Taken from k8s.io/cmd/kubeadm/app/util -// Deprecated: Please use the functions in util/container -func SemverToOCIImageTag(version string) string { - return container.SemverToOCIImageTag(version) -} - // GetControlPlaneMachines returns a slice containing control plane machines. func GetControlPlaneMachines(machines []*clusterv1.Machine) (res []*clusterv1.Machine) { for _, machine := range machines { @@ -403,17 +386,6 @@ func indexOwnerRef(ownerReferences []metav1.OwnerReference, ref metav1.OwnerRefe return -1 } -// PointsTo returns true if any of the owner references point to the given target -// Deprecated: Use IsOwnedByObject to cover differences in API version or backup/restore that changed UIDs. -func PointsTo(refs []metav1.OwnerReference, target *metav1.ObjectMeta) bool { - for _, ref := range refs { - if ref.UID == target.UID { - return true - } - } - return false -} - // IsOwnedByObject returns true if any of the owner references point to the given target. func IsOwnedByObject(obj metav1.Object, target client.Object) bool { for _, ref := range obj.GetOwnerReferences() { @@ -506,16 +478,6 @@ func HasOwner(refList []metav1.OwnerReference, apiVersion string, kinds []string return false } -var ( - // IsPaused returns true if the Cluster is paused or the object has the `paused` annotation. - // Deprecated: use util/annotations/IsPaused instead - IsPaused = annotations.IsPaused - - // HasPausedAnnotation returns true if the object has the `paused` annotation. - // Deprecated: use util/annotations/HasPausedAnnotation instead - HasPausedAnnotation = annotations.HasPausedAnnotation -) - // GetCRDWithContract retrieves a list of CustomResourceDefinitions from using controller-runtime Client, // filtering with the `contract` label passed in. // Returns the first CRD in the list that matches the GroupVersionKind, otherwise returns an error. @@ -591,20 +553,6 @@ func (o MachinesByCreationTimestamp) Less(i, j int) bool { return o[i].CreationTimestamp.Before(&o[j].CreationTimestamp) } -// WatchOnClusterPaused adds a conditional watch to the controlled given as input -// that sends watch notifications on any create or delete, and only updates -// that toggle Cluster.Spec.Cluster. -// Deprecated: Instead add the Watch directly and use predicates.ClusterUnpaused or -// predicates.ClusterUnpausedAndInfrastructureReady depending on your use case. -func WatchOnClusterPaused(c controller.Controller, fn handler.MapFunc) error { - log := klogr.New().WithName("WatchOnClusterPaused") - return c.Watch( - &source.Kind{Type: &clusterv1.Cluster{}}, - handler.EnqueueRequestsFromMapFunc(fn), - predicates.ClusterUnpaused(log), - ) -} - // ClusterToObjectsMapper returns a mapper function that gets a cluster and lists all objects for the object passed in // and returns a list of requests. // NB: The objects are required to have `clusterv1.ClusterLabelName` applied.