review suggestions

This commit is contained in:
Mikhail Rozentsvayg 2025-02-18 14:54:13 -08:00
parent f659f40697
commit 799ec6d2c9
2 changed files with 10 additions and 5 deletions

View File

@ -707,6 +707,9 @@ func groupByNameAndTypeWithCh(records []cloudflare.DNSRecord, chs []cloudflare.C
// create single endpoint with all the targets for each name/type // create single endpoint with all the targets for each name/type
for _, records := range groups { for _, records := range groups {
if len(records) == 0 {
return endpoints
}
targets := make([]string, len(records)) targets := make([]string, len(records))
for i, record := range records { for i, record := range records {
targets[i] = record.Content targets[i] = record.Content
@ -716,7 +719,11 @@ func groupByNameAndTypeWithCh(records []cloudflare.DNSRecord, chs []cloudflare.C
records[0].Type, records[0].Type,
endpoint.TTL(records[0].TTL), endpoint.TTL(records[0].TTL),
targets...) targets...)
ep.WithProviderSpecific(source.CloudflareProxiedKey, strconv.FormatBool(*records[0].Proxied)) proxied := false
if records[0].Proxied != nil {
proxied = *records[0].Proxied
}
ep.WithProviderSpecific(source.CloudflareProxiedKey, strconv.FormatBool(proxied))
if _, ok := customOriginServers[records[0].Name]; ok { if _, ok := customOriginServers[records[0].Name]; ok {
ep.WithProviderSpecific(source.CloudflareCustomHostnameKey, customOriginServers[records[0].Name]) ep.WithProviderSpecific(source.CloudflareCustomHostnameKey, customOriginServers[records[0].Name])
} }

View File

@ -190,15 +190,13 @@ func getAliasFromAnnotations(annotations map[string]string) bool {
func getProviderSpecificAnnotations(annotations map[string]string) (endpoint.ProviderSpecific, string) { func getProviderSpecificAnnotations(annotations map[string]string) (endpoint.ProviderSpecific, string) {
providerSpecificAnnotations := endpoint.ProviderSpecific{} providerSpecificAnnotations := endpoint.ProviderSpecific{}
v, exists := annotations[CloudflareProxiedKey] if v, exists := annotations[CloudflareProxiedKey]; exists {
if exists {
providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{ providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
Name: CloudflareProxiedKey, Name: CloudflareProxiedKey,
Value: v, Value: v,
}) })
} }
v, exists = annotations[CloudflareCustomHostnameKey] if v, exists := annotations[CloudflareCustomHostnameKey]; exists {
if exists {
providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{ providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
Name: CloudflareCustomHostnameKey, Name: CloudflareCustomHostnameKey,
Value: v, Value: v,