From 3d87349536d122bfa26c078008c8c44cf13636cb Mon Sep 17 00:00:00 2001 From: Sunny Date: Fri, 27 Sep 2024 13:29:44 +0000 Subject: [PATCH] Update Bucket API to v1 Signed-off-by: Sunny --- docs/spec/v1/kustomizations.md | 2 +- internal/controller/kustomization_controller.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/spec/v1/kustomizations.md b/docs/spec/v1/kustomizations.md index 9c7af00e..5ba55c44 100644 --- a/docs/spec/v1/kustomizations.md +++ b/docs/spec/v1/kustomizations.md @@ -116,7 +116,7 @@ Artifact containing the YAML manifests. It has two required fields: - `kind`: The Kind of the referred Source object. Supported Source types: + [GitRepository](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1/gitrepositories.md) + [OCIRepository](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1beta2/ocirepositories.md) - + [Bucket](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1beta2/buckets.md) + + [Bucket](https://github.com/fluxcd/source-controller/blob/main/docs/spec/v1/buckets.md) - `name`: The Name of the referred Source object. #### Cross-namespace references diff --git a/internal/controller/kustomization_controller.go b/internal/controller/kustomization_controller.go index a6c52b5f..9a99bcc1 100644 --- a/internal/controller/kustomization_controller.go +++ b/internal/controller/kustomization_controller.go @@ -132,7 +132,7 @@ func (r *KustomizationReconciler) SetupWithManager(ctx context.Context, mgr ctrl // Index the Kustomizations by the Bucket references they (may) point at. if err := mgr.GetCache().IndexField(ctx, &kustomizev1.Kustomization{}, bucketIndexKey, - r.indexBy(sourcev1b2.BucketKind)); err != nil { + r.indexBy(sourcev1.BucketKind)); err != nil { return fmt.Errorf("failed setting index fields: %w", err) } @@ -155,7 +155,7 @@ func (r *KustomizationReconciler) SetupWithManager(ctx context.Context, mgr ctrl builder.WithPredicates(SourceRevisionChangePredicate{}), ). Watches( - &sourcev1b2.Bucket{}, + &sourcev1.Bucket{}, handler.EnqueueRequestsFromMapFunc(r.requestsForRevisionChangeOf(bucketIndexKey)), builder.WithPredicates(SourceRevisionChangePredicate{}), ). @@ -561,8 +561,8 @@ func (r *KustomizationReconciler) getSource(ctx context.Context, return src, fmt.Errorf("unable to get source '%s': %w", namespacedName, err) } src = &repository - case sourcev1b2.BucketKind: - var bucket sourcev1b2.Bucket + case sourcev1.BucketKind: + var bucket sourcev1.Bucket err := r.Client.Get(ctx, namespacedName, &bucket) if err != nil { if apierrors.IsNotFound(err) {