Skip to content

Commit 83ea480

Browse files
committed
Skip not A Target related labels
* Otherwise it would lead to unwanted deletion of etcd keys * Inline func comment fix
1 parent 3602c47 commit 83ea480

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

provider/coredns.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func findEp(slice []*endpoint.Endpoint, dnsName string) (int, bool) {
269269
return -1, false
270270
}
271271

272-
// Find takes a EndpointLabels map and looks for an element in it. If found it will
272+
// Find takes a ep.Targets string slice and looks for an element in it. If found it will
273273
// return it's key, otherwise it will return -1 and a bool of false.
274274
func findLabelInTargets(targets []string, label string) (string, bool) {
275275
for _, target := range targets {
@@ -376,6 +376,12 @@ func (p coreDNSProvider) ApplyChanges(ctx context.Context, changes *plan.Changes
376376

377377
// Clean outdated targets
378378
for label, labelPrefix := range ep.Labels {
379+
// Skip non Target related labels
380+
labelsToSkip := []string{"originalText", "prefix", "resource"}
381+
if _, ok := findLabelInTargets(labelsToSkip, label); ok {
382+
continue
383+
}
384+
379385
log.Debugf("Finding label (%s) in targets(%v)", label, ep.Targets)
380386
if _, ok := findLabelInTargets(ep.Targets, label); !ok {
381387
log.Debugf("Found non existing label(%s) in targets(%v)", label, ep.Targets)

0 commit comments

Comments
 (0)