@@ -10,11 +10,11 @@ import (
1010 "fmt"
1111 "time"
1212
13+ "github.com/fluxcd/pkg/runtime/patch"
1314 corev1 "k8s.io/api/core/v1"
1415 apierrors "k8s.io/apimachinery/pkg/api/errors"
1516 "k8s.io/apimachinery/pkg/runtime"
1617 "k8s.io/apimachinery/pkg/types"
17- "sigs.k8s.io/cluster-api/util/patch"
1818 ctrl "sigs.k8s.io/controller-runtime"
1919 "sigs.k8s.io/controller-runtime/pkg/client"
2020 "sigs.k8s.io/controller-runtime/pkg/log"
@@ -37,7 +37,7 @@ type GitSyncReconciler struct {
3737//+kubebuilder:rbac:groups=delivery.ocm.software,resources=gitsyncs/status,verbs=get;update;patch
3838//+kubebuilder:rbac:groups=delivery.ocm.software,resources=gitsyncs/finalizers,verbs=update
3939//+kubebuilder:rbac:groups=delivery.ocm.software,resources=ocmresources,verbs=get;list;watch;create;update;patch;delete
40- //+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list
40+ //+kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
4141//+kubebuilder:rbac:groups=delivery.ocm.software,resources=snapshots,verbs=get;list;watch;create;update;patch;delete
4242//+kubebuilder:rbac:groups=delivery.ocm.software,resources=snapshots/status,verbs=get;update;patch
4343
@@ -65,32 +65,32 @@ func (r *GitSyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
6565 Namespace : gitSync .Spec .SnapshotRef .Namespace ,
6666 Name : gitSync .Spec .SnapshotRef .Name ,
6767 }, snapshot ); err != nil {
68- return requeue ( gitSync . Spec . Interval ) , fmt .Errorf ("failed to find snapshot: %w" , err )
68+ return ctrl. Result {} , fmt .Errorf ("failed to find snapshot: %w" , err )
6969 }
7070 authSecret := & corev1.Secret {}
7171 if err := r .Get (ctx , types.NamespacedName {
7272 Namespace : gitSync .Spec .AuthRef .Namespace ,
7373 Name : gitSync .Spec .AuthRef .Name ,
7474 }, authSecret ); err != nil {
75- return requeue ( gitSync . Spec . Interval ) , fmt .Errorf ("failed to find authentication secret: %w" , err )
75+ return ctrl. Result {} , fmt .Errorf ("failed to find authentication secret: %w" , err )
7676 }
7777
7878 // trim any trailing `/` and then just add.
79- log .V (4 ).Info ("crafting artifact URL to download from" , "url" , snapshot .Status .Image )
79+ log .V (4 ).Info ("crafting artifact URL to download from" , "url" , snapshot .Status .RepositoryURL )
8080 opts := & providers.PushOptions {
81- URL : gitSync .Spec .URL ,
82- Message : gitSync .Spec .CommitTemplate .Message ,
83- Name : gitSync .Spec .CommitTemplate .Name ,
84- Email : gitSync .Spec .CommitTemplate .Email ,
85- SnapshotURL : snapshot . Status . Image ,
86- Branch : gitSync .Spec .Branch ,
87- SubPath : gitSync .Spec .SubPath ,
81+ URL : gitSync .Spec .URL ,
82+ Message : gitSync .Spec .CommitTemplate .Message ,
83+ Name : gitSync .Spec .CommitTemplate .Name ,
84+ Email : gitSync .Spec .CommitTemplate .Email ,
85+ Snapshot : snapshot ,
86+ Branch : gitSync .Spec .Branch ,
87+ SubPath : gitSync .Spec .SubPath ,
8888 }
8989 r .parseAuthSecret (authSecret , opts )
9090
9191 digest , err := r .Git .Push (ctx , opts )
9292 if err != nil {
93- return requeue ( gitSync . Spec . Interval ) , fmt .Errorf ("failed to push to git repository: %w" , err )
93+ return ctrl. Result {} , fmt .Errorf ("failed to push to git repository: %w" , err )
9494 }
9595 // Initialize the patch helper.
9696 patchHelper , err := patch .NewHelper (gitSync , r .Client )
@@ -111,12 +111,6 @@ func (r *GitSyncReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
111111 return ctrl.Result {}, nil
112112}
113113
114- func requeue (seconds time.Duration ) ctrl.Result {
115- return ctrl.Result {
116- RequeueAfter : seconds * time .Second ,
117- }
118- }
119-
120114// SetupWithManager sets up the controller with the Manager.
121115func (r * GitSyncReconciler ) SetupWithManager (mgr ctrl.Manager ) error {
122116 return ctrl .NewControllerManagedBy (mgr ).
0 commit comments