@@ -36,6 +36,14 @@ func (d DNSTreeNodeData) String() string {
36
36
return fmt .Sprintf ("targets: %+v, labels: %+v" , d .Targets , d .Labels )
37
37
}
38
38
39
+ func WriteTree (s io.Writer , node * DNSTreeNode , title string ) {
40
+ fmt .Fprintf (s , "\n ====== START TREE: %s ======\n " , title )
41
+ for _ , ep := range * ToEndpoints (node , & []* endpoint.Endpoint {}) {
42
+ fmt .Fprintf (s , " endpoint: %v > %+v with labels: %+v\n " , ep .DNSName , ep .Targets , ep .Labels )
43
+ }
44
+ fmt .Fprintf (s , "====== END TREE: %s ======\n \n " , title )
45
+ }
46
+
39
47
// PropagateStoppableLabel takes a propLabel (and value) to propagate throughout a tree, and a stopLabel
40
48
// whenever the label is propagated to a dataset in a node which also has the stopLabel, this node and
41
49
// all of the children of this node and any parents will have the propLabel removed.
@@ -52,15 +60,6 @@ func (d DNSTreeNodeData) String() string {
52
60
// - Any node with the stopLabel and the propLabel:
53
61
// - Has the propLabel removed from itself and all it's children
54
62
// - Has the propLabel removed from any parent (or parent's parent) that has the label
55
-
56
- func WriteTree (s io.Writer , node * DNSTreeNode , title string ) {
57
- fmt .Fprintf (s , "\n ====== START TREE: %s ======\n " , title )
58
- for _ , ep := range * ToEndpoints (node , & []* endpoint.Endpoint {}) {
59
- fmt .Fprintf (s , " endpoint: %v > %+v with labels: %+v\n " , ep .DNSName , ep .Targets , ep .Labels )
60
- }
61
- fmt .Fprintf (s , "====== END TREE: %s ======\n \n " , title )
62
- }
63
-
64
63
func PropagateStoppableLabel (node * DNSTreeNode , propLabel , value , stopLabel string ) {
65
64
//propagate labels regardless of stop labels
66
65
PropagateLabel (node , propLabel , value )
@@ -386,6 +385,9 @@ func ToEndpoints(node *DNSTreeNode, endpoints *[]*endpoint.Endpoint) *[]*endpoin
386
385
}
387
386
388
387
for _ , data := range node .DataSets {
388
+ if len (data .Labels ) == 0 {
389
+ data .Labels = nil
390
+ }
389
391
* endpoints = append (* endpoints , & endpoint.Endpoint {
390
392
DNSName : node .Name ,
391
393
Targets : data .Targets ,
0 commit comments