• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubernetes-sigs / external-dns / 14227387863

02 Apr 2025 06:57PM UTC coverage: 71.996% (-0.07%) from 72.065%
14227387863

Pull #5189

github

ivankatliarchuk
chore(source): code cleanup

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Pull Request #5189: chore(source): code cleanup

206 of 240 new or added lines in 15 files covered. (85.83%)

2 existing lines in 2 files now uncovered.

14613 of 20297 relevant lines covered (72.0%)

694.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.82
/source/annotations/provider_specific.go
1
/*
2
Copyright 2025 The Kubernetes Authors.
3
Licensed under the Apache License, Version 2.0 (the "License");
4
you may not use this file except in compliance with the License.
5
You may obtain a copy of the License at
6
    http://www.apache.org/licenses/LICENSE-2.0
7
Unless required by applicable law or agreed to in writing, software
8
distributed under the License is distributed on an "AS IS" BASIS,
9
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
See the License for the specific language governing permissions and
11
limitations under the License.
12
*/
13

14
package annotations
15

16
import (
17
        "fmt"
18
        "strings"
19

20
        "sigs.k8s.io/external-dns/endpoint"
21
)
22

23
func ProviderSpecificAnnotations(annotations map[string]string) (endpoint.ProviderSpecific, string) {
6✔
24
        providerSpecificAnnotations := endpoint.ProviderSpecific{}
6✔
25

6✔
26
        if hasAliasFromAnnotations(annotations) {
6✔
NEW
27
                providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
×
NEW
28
                        Name:  "alias",
×
NEW
29
                        Value: "true",
×
NEW
30
                })
×
NEW
31
        }
×
32
        setIdentifier := ""
6✔
33
        for k, v := range annotations {
13✔
34
                if k == SetIdentifierKey {
9✔
35
                        setIdentifier = v
2✔
36
                } else if strings.HasPrefix(k, AWSPrefix) {
9✔
37
                        attr := strings.TrimPrefix(k, AWSPrefix)
2✔
38
                        providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
2✔
39
                                Name:  fmt.Sprintf("aws/%s", attr),
2✔
40
                                Value: v,
2✔
41
                        })
2✔
42
                } else if strings.HasPrefix(k, SCWPrefix) {
5✔
NEW
43
                        attr := strings.TrimPrefix(k, SCWPrefix)
×
NEW
44
                        providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
×
NEW
45
                                Name:  fmt.Sprintf("scw/%s", attr),
×
NEW
46
                                Value: v,
×
NEW
47
                        })
×
48
                } else if strings.HasPrefix(k, IBMCloudPrefix) {
3✔
NEW
49
                        attr := strings.TrimPrefix(k, IBMCloudPrefix)
×
NEW
50
                        providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
×
NEW
51
                                Name:  fmt.Sprintf("ibmcloud-%s", attr),
×
NEW
52
                                Value: v,
×
NEW
53
                        })
×
54
                } else if strings.HasPrefix(k, WebhookPrefix) {
3✔
NEW
55
                        // Support for wildcard annotations for webhook providers
×
NEW
56
                        attr := strings.TrimPrefix(k, WebhookPrefix)
×
NEW
57
                        providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
×
NEW
58
                                Name:  fmt.Sprintf("webhook/%s", attr),
×
NEW
59
                                Value: v,
×
NEW
60
                        })
×
61
                } else if strings.HasPrefix(k, CloudflarePrefix) {
6✔
62
                        if strings.Contains(k, CloudflareCustomHostnameKey) {
4✔
63
                                providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
1✔
64
                                        Name:  CloudflareCustomHostnameKey,
1✔
65
                                        Value: v,
1✔
66
                                })
1✔
67
                        } else if strings.Contains(k, CloudflareProxiedKey) {
5✔
68
                                providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{
2✔
69
                                        Name:  CloudflareProxiedKey,
2✔
70
                                        Value: v,
2✔
71
                                })
2✔
72
                        }
2✔
73
                }
74
        }
75
        return providerSpecificAnnotations, setIdentifier
6✔
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc