Skip to content

Commit c575f22

Browse files
committed
Address Review comments
1 parent 00ca523 commit c575f22

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
@@ -567,12 +567,11 @@ func (r *CRD) ReconcileRequeuOnSuccessSeconds() int {
567567
return 0
568568
}
569569
reconcile := resGenConfig.Reconcile
570-
// handles the default case
571-
if reconcile == nil {
572-
return 0
573-
} else {
570+
if reconcile != nil {
574571
return reconcile.RequeueOnSuccessSeconds
575572
}
573+
// handles the default case
574+
return 0
576575
}
577576

578577
// 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
@@ -254,13 +254,13 @@ func (rm *resourceManager) updateConditions (
254254
if syncCondition == nil && onSuccess {
255255
syncCondition = &ackv1alpha1.Condition{
256256
Type: ackv1alpha1.ConditionTypeResourceSynced,
257+
Status: corev1.ConditionTrue,
257258
}
258-
syncCondition.Status = corev1.ConditionTrue
259259
ko.Status.Conditions = append(ko.Status.Conditions, syncCondition)
260260
}
261261
{{- else }}
262262
// Required to avoid the "declared but not used" error in the default case
263-
syncCondition = nil
263+
_ = syncCondition
264264
{{- end }}
265265

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

0 commit comments

Comments
 (0)