diff --git a/cmd/gotk/reconcile_helmrelease.go b/cmd/gotk/reconcile_helmrelease.go index 7d733eb0..5bce49bf 100644 --- a/cmd/gotk/reconcile_helmrelease.go +++ b/cmd/gotk/reconcile_helmrelease.go @@ -21,7 +21,6 @@ import ( "fmt" "time" - sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1" "github.com/spf13/cobra" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" @@ -29,6 +28,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" helmv2 "github.com/fluxcd/helm-controller/api/v2alpha1" + consts "github.com/fluxcd/pkg/runtime" + sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1" ) var reconcileHrCmd = &cobra.Command{ @@ -95,10 +96,10 @@ func reconcileHrCmdRun(cmd *cobra.Command, args []string) error { logger.Actionf("annotating HelmRelease %s in %s namespace", name, namespace) if helmRelease.Annotations == nil { helmRelease.Annotations = map[string]string{ - helmv2.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), + consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), } } else { - helmRelease.Annotations[helmv2.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) + helmRelease.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) } if err := kubeClient.Update(ctx, &helmRelease); err != nil { return err diff --git a/cmd/gotk/reconcile_kustomization.go b/cmd/gotk/reconcile_kustomization.go index 8d6ab920..3dd5aa9b 100644 --- a/cmd/gotk/reconcile_kustomization.go +++ b/cmd/gotk/reconcile_kustomization.go @@ -21,10 +21,12 @@ import ( "fmt" "time" - kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1" "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" + + kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1alpha1" + consts "github.com/fluxcd/pkg/runtime" ) var reconcileKsCmd = &cobra.Command{ @@ -86,10 +88,10 @@ func reconcileKsCmdRun(cmd *cobra.Command, args []string) error { logger.Actionf("annotating kustomization %s in %s namespace", name, namespace) if kustomization.Annotations == nil { kustomization.Annotations = map[string]string{ - kustomizev1.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), + consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), } } else { - kustomization.Annotations[kustomizev1.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) + kustomization.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) } if err := kubeClient.Update(ctx, &kustomization); err != nil { return err diff --git a/cmd/gotk/reconcile_source_git.go b/cmd/gotk/reconcile_source_git.go index 04739f4d..934c6e1c 100644 --- a/cmd/gotk/reconcile_source_git.go +++ b/cmd/gotk/reconcile_source_git.go @@ -19,11 +19,15 @@ package main import ( "context" "fmt" - sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1" + + "time" + "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "time" + + consts "github.com/fluxcd/pkg/runtime" + sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1" ) var reconcileSourceGitCmd = &cobra.Command{ @@ -68,10 +72,10 @@ func syncSourceGitCmdRun(cmd *cobra.Command, args []string) error { if gitRepository.Annotations == nil { gitRepository.Annotations = map[string]string{ - sourcev1.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), + consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), } } else { - gitRepository.Annotations[sourcev1.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) + gitRepository.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) } if err := kubeClient.Update(ctx, &gitRepository); err != nil { return err diff --git a/cmd/gotk/reconcile_source_helm.go b/cmd/gotk/reconcile_source_helm.go index 0a2afea7..510da6f8 100644 --- a/cmd/gotk/reconcile_source_helm.go +++ b/cmd/gotk/reconcile_source_helm.go @@ -27,6 +27,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "sigs.k8s.io/controller-runtime/pkg/client" + consts "github.com/fluxcd/pkg/runtime" sourcev1 "github.com/fluxcd/source-controller/api/v1alpha1" ) @@ -72,10 +73,10 @@ func syncSourceHelmCmdRun(cmd *cobra.Command, args []string) error { if helmRepository.Annotations == nil { helmRepository.Annotations = map[string]string{ - sourcev1.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), + consts.ReconcileAtAnnotation: time.Now().Format(time.RFC3339Nano), } } else { - helmRepository.Annotations[sourcev1.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) + helmRepository.Annotations[consts.ReconcileAtAnnotation] = time.Now().Format(time.RFC3339Nano) } if err := kubeClient.Update(ctx, &helmRepository); err != nil { return err diff --git a/go.mod b/go.mod index fbb1426e..8c8b34b3 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/fluxcd/helm-controller/api v0.0.8 github.com/fluxcd/kustomize-controller/api v0.0.11 github.com/fluxcd/pkg/git v0.0.7 + github.com/fluxcd/pkg/runtime v0.0.1 github.com/fluxcd/pkg/ssh v0.0.5 github.com/fluxcd/pkg/untar v0.0.5 github.com/fluxcd/source-controller/api v0.0.16 diff --git a/go.sum b/go.sum index 5eae0c16..2fdcd32b 100644 --- a/go.sum +++ b/go.sum @@ -117,6 +117,8 @@ github.com/fluxcd/kustomize-controller/api v0.0.11 h1:uFL0FT0AP+NmHR8upy+Y7AhBqc github.com/fluxcd/kustomize-controller/api v0.0.11/go.mod h1:88m3p6xY3J2pjh5OsL3ANy7PkyA93KiqAJE58JMQyoc= github.com/fluxcd/pkg/git v0.0.7 h1:tFSYPy7tcIYfOt8H5EUERXIRz7fk0id302oQZde1NtU= github.com/fluxcd/pkg/git v0.0.7/go.mod h1:5Vu92x6Q3CpxDUllmB69kAkVY5jAtPpXcY2TSZ/oCJI= +github.com/fluxcd/pkg/runtime v0.0.1 h1:h8jztHVF9UMGD7XBQSfXDdw80bpT6BOkd0xe4kknPL0= +github.com/fluxcd/pkg/runtime v0.0.1/go.mod h1:cU1t0+Ld39pZjMyrrHukw1E++OZFNHxG2qAExfDWQ34= github.com/fluxcd/pkg/ssh v0.0.5 h1:rnbFZ7voy2JBlUfMbfyqArX2FYaLNpDhccGFC3qW83A= github.com/fluxcd/pkg/ssh v0.0.5/go.mod h1:7jXPdXZpc0ttMNz2kD9QuMi3RNn/e0DOFbj0Tij/+Hs= github.com/fluxcd/pkg/untar v0.0.5 h1:UGI3Ch1UIEIaqQvMicmImL1s9npQa64DJ/ozqHKB7gk=