@@ -52,7 +52,6 @@ import (
5252	rreconcile "github.com/fluxcd/pkg/runtime/reconcile" 
5353	"github.com/fluxcd/pkg/sourceignore" 
5454
55- 	bucketv1 "github.com/fluxcd/source-controller/api/v1" 
5655	sourcev1 "github.com/fluxcd/source-controller/api/v1" 
5756	intdigest "github.com/fluxcd/source-controller/internal/digest" 
5857	serror "github.com/fluxcd/source-controller/internal/error" 
@@ -159,7 +158,7 @@ type BucketProvider interface {
159158// bucketReconcileFunc is the function type for all the v1beta2.Bucket 
160159// (sub)reconcile functions. The type implementations are grouped and 
161160// executed serially to perform the complete reconcile of the object. 
162- type  bucketReconcileFunc  func (ctx  context.Context , sp  * patch.SerialPatcher , obj  * bucketv1 .Bucket , index  * index.Digester , dir  string ) (sreconcile.Result , error )
161+ type  bucketReconcileFunc  func (ctx  context.Context , sp  * patch.SerialPatcher , obj  * sourcev1 .Bucket , index  * index.Digester , dir  string ) (sreconcile.Result , error )
163162
164163func  (r  * BucketReconciler ) SetupWithManager (mgr  ctrl.Manager ) error  {
165164	return  r .SetupWithManagerAndOptions (mgr , BucketReconcilerOptions {})
@@ -169,7 +168,7 @@ func (r *BucketReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager, opts Buc
169168	r .patchOptions  =  getPatchOptions (bucketReadyCondition .Owned , r .ControllerName )
170169
171170	return  ctrl .NewControllerManagedBy (mgr ).
172- 		For (& bucketv1 .Bucket {}).
171+ 		For (& sourcev1 .Bucket {}).
173172		WithEventFilter (predicate .Or (predicate.GenerationChangedPredicate {}, predicates.ReconcileRequestedPredicate {})).
174173		WithOptions (controller.Options {
175174			RateLimiter : opts .RateLimiter ,
@@ -182,7 +181,7 @@ func (r *BucketReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
182181	log  :=  ctrl .LoggerFrom (ctx )
183182
184183	// Fetch the Bucket 
185- 	obj  :=  & bucketv1 .Bucket {}
184+ 	obj  :=  & sourcev1 .Bucket {}
186185	if  err  :=  r .Get (ctx , req .NamespacedName , obj ); err  !=  nil  {
187186		return  ctrl.Result {}, client .IgnoreNotFound (err )
188187	}
@@ -255,7 +254,7 @@ func (r *BucketReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
255254// reconcile iterates through the bucketReconcileFunc tasks for the 
256255// object. It returns early on the first call that returns 
257256// reconcile.ResultRequeue, or produces an error. 
258- func  (r  * BucketReconciler ) reconcile (ctx  context.Context , sp  * patch.SerialPatcher , obj  * bucketv1 .Bucket , reconcilers  []bucketReconcileFunc ) (sreconcile.Result , error ) {
257+ func  (r  * BucketReconciler ) reconcile (ctx  context.Context , sp  * patch.SerialPatcher , obj  * sourcev1 .Bucket , reconcilers  []bucketReconcileFunc ) (sreconcile.Result , error ) {
259258	oldObj  :=  obj .DeepCopy ()
260259
261260	rreconcile .ProgressiveStatus (false , obj , meta .ProgressingReason , "reconciliation in progress" )
@@ -326,7 +325,7 @@ func (r *BucketReconciler) reconcile(ctx context.Context, sp *patch.SerialPatche
326325}
327326
328327// notify emits notification related to the reconciliation. 
329- func  (r  * BucketReconciler ) notify (ctx  context.Context , oldObj , newObj  * bucketv1 .Bucket , index  * index.Digester , res  sreconcile.Result , resErr  error ) {
328+ func  (r  * BucketReconciler ) notify (ctx  context.Context , oldObj , newObj  * sourcev1 .Bucket , index  * index.Digester , res  sreconcile.Result , resErr  error ) {
330329	// Notify successful reconciliation for new artifact and recovery from any 
331330	// failure. 
332331	if  resErr  ==  nil  &&  res  ==  sreconcile .ResultSuccess  &&  newObj .Status .Artifact  !=  nil  {
@@ -364,7 +363,7 @@ func (r *BucketReconciler) notify(ctx context.Context, oldObj, newObj *bucketv1.
364363// condition is added. 
365364// The hostname of any URL in the Status of the object are updated, to ensure 
366365// they match the Storage server hostname of current runtime. 
367- func  (r  * BucketReconciler ) reconcileStorage (ctx  context.Context , sp  * patch.SerialPatcher , obj  * bucketv1 .Bucket , _  * index.Digester , _  string ) (sreconcile.Result , error ) {
366+ func  (r  * BucketReconciler ) reconcileStorage (ctx  context.Context , sp  * patch.SerialPatcher , obj  * sourcev1 .Bucket , _  * index.Digester , _  string ) (sreconcile.Result , error ) {
368367	// Garbage collect previous advertised artifact(s) from storage 
369368	_  =  r .garbageCollect (ctx , obj )
370369
@@ -423,7 +422,7 @@ func (r *BucketReconciler) reconcileStorage(ctx context.Context, sp *patch.Seria
423422// When a SecretRef is defined, it attempts to fetch the Secret before calling 
424423// the provider. If this fails, it records v1beta2.FetchFailedCondition=True on 
425424// the object and returns early. 
426- func  (r  * BucketReconciler ) reconcileSource (ctx  context.Context , sp  * patch.SerialPatcher , obj  * bucketv1 .Bucket , index  * index.Digester , dir  string ) (sreconcile.Result , error ) {
425+ func  (r  * BucketReconciler ) reconcileSource (ctx  context.Context , sp  * patch.SerialPatcher , obj  * sourcev1 .Bucket , index  * index.Digester , dir  string ) (sreconcile.Result , error ) {
427426	secret , err  :=  r .getSecret (ctx , obj .Spec .SecretRef , obj .GetNamespace ())
428427	if  err  !=  nil  {
429428		e  :=  serror .NewGeneric (err , sourcev1 .AuthenticationFailedReason )
@@ -441,7 +440,7 @@ func (r *BucketReconciler) reconcileSource(ctx context.Context, sp *patch.Serial
441440	// Construct provider client 
442441	var  provider  BucketProvider 
443442	switch  obj .Spec .Provider  {
444- 	case  bucketv1 .BucketProviderGoogle :
443+ 	case  sourcev1 .BucketProviderGoogle :
445444		if  err  =  gcp .ValidateSecret (secret ); err  !=  nil  {
446445			e  :=  serror .NewGeneric (err , sourcev1 .AuthenticationFailedReason )
447446			conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
@@ -459,7 +458,7 @@ func (r *BucketReconciler) reconcileSource(ctx context.Context, sp *patch.Serial
459458			conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
460459			return  sreconcile .ResultEmpty , e 
461460		}
462- 	case  bucketv1 .BucketProviderAzure :
461+ 	case  sourcev1 .BucketProviderAzure :
463462		if  err  =  azure .ValidateSecret (secret ); err  !=  nil  {
464463			e  :=  serror .NewGeneric (err , sourcev1 .AuthenticationFailedReason )
465464			conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
@@ -545,7 +544,7 @@ func (r *BucketReconciler) reconcileSource(ctx context.Context, sp *patch.Serial
545544
546545	// Fetch etag index 
547546	if  err  =  fetchEtagIndex (ctx , provider , obj , index , dir ); err  !=  nil  {
548- 		e  :=  serror .NewGeneric (err , bucketv1 .BucketOperationFailedReason )
547+ 		e  :=  serror .NewGeneric (err , sourcev1 .BucketOperationFailedReason )
549548		conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
550549		return  sreconcile .ResultEmpty , e 
551550	}
@@ -577,7 +576,7 @@ func (r *BucketReconciler) reconcileSource(ctx context.Context, sp *patch.Serial
577576		}()
578577
579578		if  err  =  fetchIndexFiles (ctx , provider , obj , index , dir ); err  !=  nil  {
580- 			e  :=  serror .NewGeneric (err , bucketv1 .BucketOperationFailedReason )
579+ 			e  :=  serror .NewGeneric (err , sourcev1 .BucketOperationFailedReason )
581580			conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
582581			return  sreconcile .ResultEmpty , e 
583582		}
@@ -596,7 +595,7 @@ func (r *BucketReconciler) reconcileSource(ctx context.Context, sp *patch.Serial
596595// early. 
597596// On a successful archive, the Artifact in the Status of the object is set, 
598597// and the symlink in the Storage is updated to its path. 
599- func  (r  * BucketReconciler ) reconcileArtifact (ctx  context.Context , sp  * patch.SerialPatcher , obj  * bucketv1 .Bucket , index  * index.Digester , dir  string ) (sreconcile.Result , error ) {
598+ func  (r  * BucketReconciler ) reconcileArtifact (ctx  context.Context , sp  * patch.SerialPatcher , obj  * sourcev1 .Bucket , index  * index.Digester , dir  string ) (sreconcile.Result , error ) {
600599	// Calculate revision 
601600	revision  :=  index .Digest (intdigest .Canonical )
602601
@@ -689,7 +688,7 @@ func (r *BucketReconciler) reconcileArtifact(ctx context.Context, sp *patch.Seri
689688// reconcileDelete handles the deletion of the object. 
690689// It first garbage collects all Artifacts for the object from the Storage. 
691690// Removing the finalizer from the object if successful. 
692- func  (r  * BucketReconciler ) reconcileDelete (ctx  context.Context , obj  * bucketv1 .Bucket ) (sreconcile.Result , error ) {
691+ func  (r  * BucketReconciler ) reconcileDelete (ctx  context.Context , obj  * sourcev1 .Bucket ) (sreconcile.Result , error ) {
693692	// Garbage collect the resource's artifacts 
694693	if  err  :=  r .garbageCollect (ctx , obj ); err  !=  nil  {
695694		// Return the error so we retry the failed garbage collection 
@@ -708,7 +707,7 @@ func (r *BucketReconciler) reconcileDelete(ctx context.Context, obj *bucketv1.Bu
708707// It removes all but the current Artifact from the Storage, unless the 
709708// deletion timestamp on the object is set. Which will result in the 
710709// removal of all Artifacts for the objects. 
711- func  (r  * BucketReconciler ) garbageCollect (ctx  context.Context , obj  * bucketv1 .Bucket ) error  {
710+ func  (r  * BucketReconciler ) garbageCollect (ctx  context.Context , obj  * sourcev1 .Bucket ) error  {
712711	if  ! obj .DeletionTimestamp .IsZero () {
713712		if  deleted , err  :=  r .Storage .RemoveAll (r .Storage .NewArtifactFor (obj .Kind , obj .GetObjectMeta (), "" , "*" )); err  !=  nil  {
714713			return  serror .NewGeneric (
@@ -776,7 +775,7 @@ func (r *BucketReconciler) getTLSConfig(ctx context.Context,
776775
777776// getProxyURL attempts to fetch a proxy URL from the object's proxy secret 
778777// reference. 
779- func  (r  * BucketReconciler ) getProxyURL (ctx  context.Context , obj  * bucketv1 .Bucket ) (* url.URL , error ) {
778+ func  (r  * BucketReconciler ) getProxyURL (ctx  context.Context , obj  * sourcev1 .Bucket ) (* url.URL , error ) {
780779	namespace  :=  obj .GetNamespace ()
781780	proxySecret , err  :=  r .getSecret (ctx , obj .Spec .ProxySecretRef , namespace )
782781	if  err  !=  nil  ||  proxySecret  ==  nil  {
@@ -802,7 +801,7 @@ func (r *BucketReconciler) getProxyURL(ctx context.Context, obj *bucketv1.Bucket
802801
803802// getSTSSecret attempts to fetch the secret from the object's STS secret 
804803// reference. 
805- func  (r  * BucketReconciler ) getSTSSecret (ctx  context.Context , obj  * bucketv1 .Bucket ) (* corev1.Secret , error ) {
804+ func  (r  * BucketReconciler ) getSTSSecret (ctx  context.Context , obj  * sourcev1 .Bucket ) (* corev1.Secret , error ) {
806805	if  obj .Spec .STS  ==  nil  {
807806		return  nil , nil 
808807	}
@@ -811,7 +810,7 @@ func (r *BucketReconciler) getSTSSecret(ctx context.Context, obj *bucketv1.Bucke
811810
812811// getSTSTLSConfig attempts to fetch the certificate secret from the object's 
813812// STS configuration. 
814- func  (r  * BucketReconciler ) getSTSTLSConfig (ctx  context.Context , obj  * bucketv1 .Bucket ) (* stdtls.Config , error ) {
813+ func  (r  * BucketReconciler ) getSTSTLSConfig (ctx  context.Context , obj  * sourcev1 .Bucket ) (* stdtls.Config , error ) {
815814	if  obj .Spec .STS  ==  nil  {
816815		return  nil , nil 
817816	}
@@ -848,7 +847,7 @@ func (r *BucketReconciler) annotatedEventLogf(ctx context.Context,
848847// bucket using the given provider, while filtering them using .sourceignore 
849848// rules. After fetching an object, the etag value in the index is updated to 
850849// the current value to ensure accuracy. 
851- func  fetchEtagIndex (ctx  context.Context , provider  BucketProvider , obj  * bucketv1 .Bucket , index  * index.Digester , tempDir  string ) error  {
850+ func  fetchEtagIndex (ctx  context.Context , provider  BucketProvider , obj  * sourcev1 .Bucket , index  * index.Digester , tempDir  string ) error  {
852851	ctxTimeout , cancel  :=  context .WithTimeout (ctx , obj .Spec .Timeout .Duration )
853852	defer  cancel ()
854853
@@ -902,7 +901,7 @@ func fetchEtagIndex(ctx context.Context, provider BucketProvider, obj *bucketv1.
902901// using the given provider, and stores them into tempDir. It downloads in 
903902// parallel, but limited to the maxConcurrentBucketFetches. 
904903// Given an index is provided, the bucket is assumed to exist. 
905- func  fetchIndexFiles (ctx  context.Context , provider  BucketProvider , obj  * bucketv1 .Bucket , index  * index.Digester , tempDir  string ) error  {
904+ func  fetchIndexFiles (ctx  context.Context , provider  BucketProvider , obj  * sourcev1 .Bucket , index  * index.Digester , tempDir  string ) error  {
906905	ctxTimeout , cancel  :=  context .WithTimeout (ctx , obj .Spec .Timeout .Duration )
907906	defer  cancel ()
908907
0 commit comments