-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Clean up around make lint command
Signed-off-by: Mateus Oliveira <[email protected]>
- Loading branch information
1 parent
011383c
commit 075ec12
Showing
15 changed files
with
61 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,13 +45,13 @@ import ( | |
Next, we'll need a Clock, which will allow us to fake timing in our tests. | ||
*/ | ||
|
||
|
||
// CronJobReconciler reconciles a CronJob object | ||
type CronJobReconciler struct { | ||
client.Client | ||
Scheme *runtime.Scheme | ||
Clock | ||
} | ||
|
||
/* | ||
We'll mock out the clock to make it easier to jump around in time while testing, | ||
the "real" clock just calls `time.Now`. | ||
|
@@ -74,6 +74,7 @@ managing jobs now, we'll need permissions for those, which means adding | |
a couple more [markers](/reference/markers/rbac.md). | ||
*/ | ||
|
||
|
||
//+kubebuilder:rbac:groups=batch.tutorial.kubebuilder.io,resources=cronjobs,verbs=get;list;watch;create;update;patch;delete | ||
//+kubebuilder:rbac:groups=batch.tutorial.kubebuilder.io,resources=cronjobs/status,verbs=get;update;patch | ||
//+kubebuilder:rbac:groups=batch.tutorial.kubebuilder.io,resources=cronjobs/finalizers,verbs=update | ||
|
@@ -87,6 +88,7 @@ var ( | |
scheduledTimeAnnotation = "batch.tutorial.kubebuilder.io/scheduled-at" | ||
) | ||
|
||
|
||
// Reconcile is part of the main kubernetes reconciliation loop which aims to | ||
// move the current state of the cluster closer to the desired state. | ||
// TODO(user): Modify the Reconcile function to compare the state specified by | ||
|
@@ -97,7 +99,7 @@ var ( | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
log := log.FromContext(ctx) | ||
log := log.FromContext(ctx) | ||
|
||
/* | ||
### 1: Load the CronJob by name | ||
|
@@ -461,15 +463,15 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct | |
*/ | ||
|
||
/* | ||
We need to construct a job based on our CronJob's template. We'll copy over the spec | ||
from the template and copy some basic object meta. | ||
We need to construct a job based on our CronJob's template. We'll copy over the spec | ||
from the template and copy some basic object meta. | ||
Then, we'll set the "scheduled time" annotation so that we can reconstitute our | ||
`LastScheduleTime` field each reconcile. | ||
Then, we'll set the "scheduled time" annotation so that we can reconstitute our | ||
`LastScheduleTime` field each reconcile. | ||
Finally, we'll need to set an owner reference. This allows the Kubernetes garbage collector | ||
to clean up jobs when we delete the CronJob, and allows controller-runtime to figure out | ||
which cronjob needs to be reconciled when a given job changes (is added, deleted, completes, etc). | ||
Finally, we'll need to set an owner reference. This allows the Kubernetes garbage collector | ||
to clean up jobs when we delete the CronJob, and allows controller-runtime to figure out | ||
which cronjob needs to be reconciled when a given job changes (is added, deleted, completes, etc). | ||
*/ | ||
constructJobForCronJob := func(cronJob *batchv1.CronJob, scheduledTime time.Time) (*kbatch.Job, error) { | ||
// We want job names for a given nominal start time to have a deterministic name to avoid the same job being created twice | ||
|
@@ -546,6 +548,7 @@ var ( | |
apiGVStr = batchv1.GroupVersion.String() | ||
) | ||
|
||
|
||
// SetupWithManager sets up the controller with the Manager. | ||
func (r *CronJobReconciler) SetupWithManager(mgr ctrl.Manager) error { | ||
// set up a real clock, since we're not in a test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.