diff --git a/api/interfaces.go b/api/interfaces.go deleted file mode 100644 index ced320f..0000000 --- a/api/interfaces.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2022 Clastix Labs -// SPDX-License-Identifier: Apache-2.0 - -package api - -type KubeadmConfigResourceVersionDependant interface { - GetChecksum() string - SetChecksum(string) -} diff --git a/api/v1alpha1/tenantcontrolplane_interfaces.go b/api/v1alpha1/tenantcontrolplane_interfaces.go new file mode 100644 index 0000000..e70b550 --- /dev/null +++ b/api/v1alpha1/tenantcontrolplane_interfaces.go @@ -0,0 +1,12 @@ +// Copyright 2022 Clastix Labs +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +// KubeadmConfigChecksumDependant is the interface used to retrieve the checksum of the kubeadm phases and addons +// configuration, required to validate the changes and, upon from that, perform the required reconciliation. +// +kubebuilder:object:generate=false +type KubeadmConfigChecksumDependant interface { + GetChecksum() string + SetChecksum(string) +} diff --git a/internal/resources/kubeadm_addons.go b/internal/resources/kubeadm_addons.go index 208ef9c..a4ac5ce 100644 --- a/internal/resources/kubeadm_addons.go +++ b/internal/resources/kubeadm_addons.go @@ -14,7 +14,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - kamajiapi "github.com/clastix/kamaji/api" kamajiv1alpha1 "github.com/clastix/kamaji/api/v1alpha1" "github.com/clastix/kamaji/internal/kubeadm" "github.com/clastix/kamaji/internal/utilities" @@ -148,7 +147,7 @@ func (r *KubeadmAddonResource) UpdateTenantControlPlaneStatus(ctx context.Contex return nil } -func (r *KubeadmAddonResource) GetStatus(tenantControlPlane *kamajiv1alpha1.TenantControlPlane) (kamajiapi.KubeadmConfigResourceVersionDependant, error) { +func (r *KubeadmAddonResource) GetStatus(tenantControlPlane *kamajiv1alpha1.TenantControlPlane) (kamajiv1alpha1.KubeadmConfigChecksumDependant, error) { switch r.KubeadmAddon { case AddonCoreDNS: return &tenantControlPlane.Status.Addons.CoreDNS, nil diff --git a/internal/resources/kubeadm_phases.go b/internal/resources/kubeadm_phases.go index 8942884..91f4b55 100644 --- a/internal/resources/kubeadm_phases.go +++ b/internal/resources/kubeadm_phases.go @@ -14,7 +14,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - kamajiapi "github.com/clastix/kamaji/api" kamajiv1alpha1 "github.com/clastix/kamaji/api/v1alpha1" "github.com/clastix/kamaji/internal/kubeadm" ) @@ -139,7 +138,7 @@ func (r *KubeadmPhase) UpdateTenantControlPlaneStatus(ctx context.Context, tenan return nil } -func (r *KubeadmPhase) GetStatus(tenantControlPlane *kamajiv1alpha1.TenantControlPlane) (kamajiapi.KubeadmConfigResourceVersionDependant, error) { +func (r *KubeadmPhase) GetStatus(tenantControlPlane *kamajiv1alpha1.TenantControlPlane) (kamajiv1alpha1.KubeadmConfigChecksumDependant, error) { switch r.Phase { case PhaseUploadConfigKubeadm: return &tenantControlPlane.Status.KubeadmPhase.UploadConfigKubeadm, nil diff --git a/internal/resources/resource.go b/internal/resources/resource.go index 3ef62cd..bc2d09c 100644 --- a/internal/resources/resource.go +++ b/internal/resources/resource.go @@ -12,7 +12,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" - kamajiapi "github.com/clastix/kamaji/api" kamajiv1alpha1 "github.com/clastix/kamaji/api/v1alpha1" "github.com/clastix/kamaji/internal/kubeadm" ) @@ -42,7 +41,7 @@ type KubeadmPhaseResource interface { KubeadmResource GetClient() client.Client GetKubeadmFunction() (func(clientset.Interface, *kubeadm.Configuration) error, error) - GetStatus(*kamajiv1alpha1.TenantControlPlane) (kamajiapi.KubeadmConfigResourceVersionDependant, error) + GetStatus(*kamajiv1alpha1.TenantControlPlane) (kamajiv1alpha1.KubeadmConfigChecksumDependant, error) SetKubeadmConfigChecksum(string) }