update DNSRecord status
@@ -70,6 +70,7 @@ func (r *DNSRecordReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
}
err := r.dnsMgr.UpsertDNSRecord(record.Spec.DNSType, record.Spec.Domain, record.Spec.DNSTarget)
+ if err != nil {
if err == NoCloudflareZoneIDForDomainError {
log.Error(err, "unknown domain for this dnsManager, ignored")
@@ -79,6 +80,13 @@ func (r *DNSRecordReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return ctrl.Result{}, err
}
+ copied := record.DeepCopy()
+ //todo query to ensure record does exist
+ copied.Status.IsConfigured = true
+
+ return ctrl.Result{}, r.Status().Update(r.ctx, copied)
+}
+
func (r *DNSRecordReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&corev1alpha1.DNSRecord{}).
