@@ -23,12 +23,9 @@ import (
2323)
2424
2525const (
26- reasonBadConfig = "BadConfig"
27- reasonCreateDNSEndpoint = "CreateDNSEndpoint"
28- reasonUpdateDNSEndpoint = "UpdateDNSEndpoint"
29- recordTypeA = "A"
30- recordTypeAAAA = "AAAA"
31- recordTypeCNAME = "CNAME"
26+ recordTypeA = "A"
27+ recordTypeAAAA = "AAAA"
28+ recordTypeCNAME = "CNAME"
3229)
3330
3431var vsGVK = vsapi .SchemeGroupVersion .WithKind ("VirtualServer" )
@@ -54,7 +51,7 @@ func SyncFnFor(rec record.EventRecorder, client clientset.Interface, ig map[stri
5451 targets , recordType , err := getValidTargets (ctx , vs .Status .ExternalEndpoints )
5552 if err != nil {
5653 nl .Error (l , "Invalid external endpoint" )
57- rec .Eventf (vs , corev1 .EventTypeWarning , reasonBadConfig , "Invalid external endpoint" )
54+ rec .Eventf (vs , corev1 .EventTypeWarning , nl . EventReasonBadConfig , "Invalid external endpoint" )
5855 return err
5956 }
6057
@@ -63,7 +60,7 @@ func SyncFnFor(rec record.EventRecorder, client clientset.Interface, ig map[stri
6360 newDNSEndpoint , updateDNSEndpoint , err := buildDNSEndpoint (ctx , nsi .extdnslister , vs , targets , recordType )
6461 if err != nil {
6562 nl .Errorf (l , "incorrect DNSEndpoint config for VirtualServer resource: %s" , err )
66- rec .Eventf (vs , corev1 .EventTypeWarning , reasonBadConfig , "Incorrect DNSEndpoint config for VirtualServer resource: %s" , err )
63+ rec .Eventf (vs , corev1 .EventTypeWarning , nl . EventReasonBadConfig , "Incorrect DNSEndpoint config for VirtualServer resource: %s" , err )
6764 return err
6865 }
6966
@@ -80,11 +77,11 @@ func SyncFnFor(rec record.EventRecorder, client clientset.Interface, ig map[stri
8077 return fmt .Errorf ("DNSEndpoint has already been created" )
8178 }
8279 nl .Errorf (l , "Error creating DNSEndpoint for VirtualServer resource: %v" , err )
83- rec .Eventf (vs , corev1 .EventTypeWarning , reasonBadConfig , "Error creating DNSEndpoint for VirtualServer resource %s" , err )
80+ rec .Eventf (vs , corev1 .EventTypeWarning , nl . EventReasonBadConfig , "Error creating DNSEndpoint for VirtualServer resource %s" , err )
8481 return err
8582 }
86- rec .Eventf (vs , corev1 .EventTypeNormal , reasonCreateDNSEndpoint , "Successfully created DNSEndpoint %q" , newDNSEndpoint .Name )
87- rec .Eventf (dep , corev1 .EventTypeNormal , reasonCreateDNSEndpoint , "Successfully created DNSEndpoint for VirtualServer %q" , vs .Name )
83+ rec .Eventf (vs , corev1 .EventTypeNormal , nl . EventReasonCreateDNSEndpoint , "Successfully created DNSEndpoint %q" , newDNSEndpoint .Name )
84+ rec .Eventf (dep , corev1 .EventTypeNormal , nl . EventReasonCreateDNSEndpoint , "Successfully created DNSEndpoint for VirtualServer %q" , vs .Name )
8885 }
8986
9087 // Update existing DNSEndpoint object
@@ -93,11 +90,11 @@ func SyncFnFor(rec record.EventRecorder, client clientset.Interface, ig map[stri
9390 dep , err = client .ExternaldnsV1 ().DNSEndpoints (updateDNSEndpoint .Namespace ).Update (ctx , updateDNSEndpoint , metav1.UpdateOptions {})
9491 if err != nil {
9592 nl .Errorf (l , "Error updating DNSEndpoint endpoint for VirtualServer resource: %v" , err )
96- rec .Eventf (vs , corev1 .EventTypeWarning , reasonBadConfig , "Error updating DNSEndpoint for VirtualServer resource: %s" , err )
93+ rec .Eventf (vs , corev1 .EventTypeWarning , nl . EventReasonBadConfig , "Error updating DNSEndpoint for VirtualServer resource: %s" , err )
9794 return err
9895 }
99- rec .Eventf (vs , corev1 .EventTypeNormal , reasonUpdateDNSEndpoint , "Successfully updated DNSEndpoint %q" , updateDNSEndpoint .Name )
100- rec .Eventf (dep , corev1 .EventTypeNormal , reasonUpdateDNSEndpoint , "Successfully updated DNSEndpoint for VirtualServer %q" , vs .Name )
96+ rec .Eventf (vs , corev1 .EventTypeNormal , nl . EventReasonUpdateDNSEndpoint , "Successfully updated DNSEndpoint %q" , updateDNSEndpoint .Name )
97+ rec .Eventf (dep , corev1 .EventTypeNormal , nl . EventReasonUpdateDNSEndpoint , "Successfully updated DNSEndpoint for VirtualServer %q" , vs .Name )
10198 }
10299 return nil
103100 }
0 commit comments