@@ -87,7 +87,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
87
87
zones := & cloudflareoperatoriov1.ZoneList {}
88
88
if err := r .List (ctx , zones ); err != nil {
89
89
if errors .IsNotFound (err ) {
90
- if err := r .markFailed (dnsrecord , ctx , "Failed to fetch Zones" ); err != nil {
90
+ if err := r .markFailed (ctx , dnsrecord , "Failed to fetch Zones" ); err != nil {
91
91
log .Error (err , "Failed to update DNSRecord status" )
92
92
return ctrl.Result {}, err
93
93
}
@@ -106,7 +106,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
106
106
}
107
107
108
108
if zone .Spec .Name == "" {
109
- if err := r .markFailed (dnsrecord , ctx , "Zone not found" ); err != nil {
109
+ if err := r .markFailed (ctx , dnsrecord , "Zone not found" ); err != nil {
110
110
log .Error (err , "Failed to update DNSRecord status" )
111
111
return ctrl.Result {}, err
112
112
}
@@ -139,7 +139,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
139
139
if ! dnsrecord .DeletionTimestamp .IsZero () {
140
140
if controllerutil .ContainsFinalizer (dnsrecord , common .CloudflareOperatorFinalizer ) {
141
141
if err := r .finalizeDNSRecord (ctx , zone .Status .ID , log , dnsrecord ); err != nil && err .Error () != "Record does not exist. (81044)" {
142
- if err := r .markFailed (dnsrecord , ctx , err .Error ()); err != nil {
142
+ if err := r .markFailed (ctx , dnsrecord , err .Error ()); err != nil {
143
143
log .Error (err , "Failed to update DNSRecord status" )
144
144
return ctrl.Result {}, err
145
145
}
@@ -163,7 +163,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
163
163
Content : dnsrecord .Spec .Content ,
164
164
})
165
165
if err != nil {
166
- if err := r .markFailed (dnsrecord , ctx , err .Error ()); err != nil {
166
+ if err := r .markFailed (ctx , dnsrecord , err .Error ()); err != nil {
167
167
log .Error (err , "Failed to update DNSRecord status" )
168
168
return ctrl.Result {}, err
169
169
}
@@ -178,7 +178,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
178
178
if (dnsrecord .Spec .Type == "A" || dnsrecord .Spec .Type == "AAAA" ) && dnsrecord .Spec .IPRef .Name != "" {
179
179
ip := & cloudflareoperatoriov1.IP {}
180
180
if err := r .Get (ctx , client.ObjectKey {Name : dnsrecord .Spec .IPRef .Name }, ip ); err != nil {
181
- if err := r .markFailed (dnsrecord , ctx , "IP object not found" ); err != nil {
181
+ if err := r .markFailed (ctx , dnsrecord , "IP object not found" ); err != nil {
182
182
log .Error (err , "Failed to update DNSRecord status" )
183
183
return ctrl.Result {}, err
184
184
}
@@ -194,7 +194,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
194
194
}
195
195
196
196
if * dnsrecord .Spec .Proxied && dnsrecord .Spec .TTL != 1 {
197
- if err := r .markFailed (dnsrecord , ctx , "TTL must be 1 when proxied" ); err != nil {
197
+ if err := r .markFailed (ctx , dnsrecord , "TTL must be 1 when proxied" ); err != nil {
198
198
log .Error (err , "Failed to update DNSRecord status" )
199
199
return ctrl.Result {}, err
200
200
}
@@ -212,7 +212,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
212
212
Data : dnsrecord .Spec .Data ,
213
213
})
214
214
if err != nil {
215
- if err := r .markFailed (dnsrecord , ctx , err .Error ()); err != nil {
215
+ if err := r .markFailed (ctx , dnsrecord , err .Error ()); err != nil {
216
216
log .Error (err , "Failed to update DNSRecord status" )
217
217
return ctrl.Result {}, err
218
218
}
@@ -244,7 +244,7 @@ func (r *DNSRecordReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
244
244
Priority : dnsrecord .Spec .Priority ,
245
245
Data : dnsrecord .Spec .Data ,
246
246
}); err != nil {
247
- if err := r .markFailed (dnsrecord , ctx , err .Error ()); err != nil {
247
+ if err := r .markFailed (ctx , dnsrecord , err .Error ()); err != nil {
248
248
log .Error (err , "Failed to update DNSRecord status" )
249
249
return ctrl.Result {}, err
250
250
}
@@ -293,7 +293,7 @@ func (r *DNSRecordReconciler) finalizeDNSRecord(ctx context.Context, dnsRecordZo
293
293
}
294
294
295
295
// markFailed marks the reconciled object as failed
296
- func (r * DNSRecordReconciler ) markFailed (dnsrecord * cloudflareoperatoriov1. DNSRecord , ctx context. Context , message string ) error {
296
+ func (r * DNSRecordReconciler ) markFailed (ctx context. Context , dnsrecord * cloudflareoperatoriov1. DNSRecord , message string ) error {
297
297
metrics .DnsRecordFailureCounter .WithLabelValues (dnsrecord .Namespace , dnsrecord .Name , dnsrecord .Spec .Name ).Set (1 )
298
298
apimeta .SetStatusCondition (& dnsrecord .Status .Conditions , metav1.Condition {
299
299
Type : "Ready" ,
0 commit comments