Skip to content

Commit 24b77b8

Browse files
committed
Address Review comments
1 parent fb10242 commit 24b77b8

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

pkg/generate/config/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type ResourceConfig struct {
5656
// very little consistency to the APIs that we can use to instruct the code
5757
// generator :(
5858
UpdateOperation *UpdateOperationConfig `json:"update_operation,omitempty"`
59-
// ReconcileConfig describes options for controlling the reconciliation
59+
// Reconcile describes options for controlling the reconciliation
6060
// logic for a particular resource.
6161
Reconcile *ReconcileConfig `json:"reconcile,omitempty"`
6262
// UpdateConditionsCustomMethodName provides the name of the custom method on the

pkg/model/crd.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,11 @@ func (r *CRD) ReconcileRequeuOnSuccessSeconds() int {
478478
return 0
479479
}
480480
reconcile := resGenConfig.Reconcile
481-
// handles the default case
482-
if reconcile == nil {
483-
return 0
484-
} else {
481+
if reconcile != nil {
485482
return reconcile.RequeueOnSuccessSeconds
486483
}
484+
// handles the default case
485+
return 0
487486
}
488487

489488
// CustomUpdateMethodName returns the name of the custom resourceManager method

templates/pkg/resource/manager_factory.go.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ func (f *resourceManagerFactory) IsAdoptable() bool {
6666
return {{ .CRD.IsAdoptable }}
6767
}
6868

69-
// GetRequeueOnSuccessSeconds returns true if the resource should be requeued after specified seconds
69+
// RequeueOnSuccessSeconds returns true if the resource should be requeued after specified seconds
7070
// Default is false which means resource will not be requeued after success.
71-
func (f *resourceManagerFactory) GetRequeueOnSuccessSeconds() (int, bool) {
71+
func (f *resourceManagerFactory) RequeueOnSuccessSeconds() int {
7272
{{- if $reconcileRequeuOnSuccessSeconds := .CRD.ReconcileRequeuOnSuccessSeconds }}
73-
return {{ $reconcileRequeuOnSuccessSeconds }}, true
73+
return {{ $reconcileRequeuOnSuccessSeconds }}
7474
{{- else }}
75-
return 0, false
75+
return 0
7676
{{- end }}
7777
}
7878

templates/pkg/resource/sdk.go.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ func (rm *resourceManager) updateConditions (
246246
if syncCondition == nil && onSuccess {
247247
syncCondition = &ackv1alpha1.Condition{
248248
Type: ackv1alpha1.ConditionTypeResourceSynced,
249+
Status: corev1.ConditionTrue,
249250
}
250-
syncCondition.Status = corev1.ConditionTrue
251251
ko.Status.Conditions = append(ko.Status.Conditions, syncCondition)
252252
}
253253
{{- else }}
254254
// Required to avoid the "declared but not used" error in the default case
255-
syncCondition = nil
255+
_ = syncCondition
256256
{{- end }}
257257

258258
{{- if $updateConditionsCustomMethodName := .CRD.UpdateConditionsCustomMethodName }}

0 commit comments

Comments
 (0)