You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(source): optional exclusion of unschedulable nodes (#5045)
* feat(source/node): Make exclusion of unschedulable Nodes configurable
This fixes a behavioral regression introduced in #4761, where
nodes that were previously added to DNS are removed when they are considered
unschedulable, for example due to automated maintenance tasks.
This change will introduce a new flag called `exclude-unschedulable`, which
defaults to `true` in order to keep in line with the current behavior.
However, it would also be reasonable to restore the initial behavior before
* Allow testing for expected log entries in testNodeSourceEndpoints
This commit adds the required logic to be able to test for
the existence (and absence) of certain log messages
in testNodeSourceEndpoints. As an example, this is implemented
for the tests around excludeUnschedulable.
A side effect of using LogsToBuffer is that tests can't run in
parallel due to the log buffer being shared across all
parallel test cases. As such, these specific tests are now executed
one after another.
* Ensure logging is only hooked for tests that require it
* Document new exclude-unschedulable flag for nodes source
Copy file name to clipboardExpand all lines: docs/flags.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,7 @@
49
49
|`--[no-]traefik-disable-legacy`| Disable listeners on Resources under the traefik.containo.us API Group |
50
50
|`--[no-]traefik-disable-new`| Disable listeners on Resources under the traefik.io API Group |
51
51
|`--nat64-networks=NAT64-NETWORKS`| Adding an A record for each AAAA record in NAT64-enabled networks; specify multiple times for multiple possible nets (optional) |
52
+
|`--[no-]exclude-unschedulable`| Exclude nodes that are considered unschedulable (default: true) |
52
53
|`--[no-]expose-internal-ipv6`| When using the node source, expose internal IPv6 addresses (optional). Default is true. |
53
54
|`--provider=provider`| The DNS provider where the DNS records will be created (required, options: akamai, alibabacloud, aws, aws-sd, azure, azure-dns, azure-private-dns, civo, cloudflare, coredns, digitalocean, dnsimple, exoscale, gandi, godaddy, google, ibmcloud, inmemory, linode, ns1, oci, ovh, pdns, pihole, plural, rfc2136, scaleway, skydns, tencentcloud, transip, ultradns, webhook) |
54
55
|`--provider-cache-time=0s`| The time to cache the DNS provider record list requests. |
Copy file name to clipboardExpand all lines: docs/sources/nodes.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,9 @@ The node source adds an `A` record per each node `externalIP` (if not found, any
7
7
It also adds an `AAAA` record per each node IPv6 `internalIP`. Refer to the [IPv6 Behavior](#ipv6-behavior) section for more details.
8
8
The TTL of the records can be set with the `external-dns.alpha.kubernetes.io/ttl` node annotation.
9
9
10
-
Nodes marked as **Unschedulable** as per [core/v1/NodeSpec](https://pkg.go.dev/k8s.io/[email protected]/core/v1#NodeSpec) are excluded.
11
-
This avoid exposing Unhealthy, NotReady or SchedulingDisabled (cordon) nodes.
10
+
Nodes marked as **Unschedulable** as per [core/v1/NodeSpec](https://pkg.go.dev/k8s.io/[email protected]/core/v1#NodeSpec) are excluded by default.
11
+
As such, no DNS records are created for Unhealthy, NotReady or SchedulingDisabled (cordon) nodes (and existing ones are removed).
12
+
In case you want to override the default, for example if you manage per-host DNS records via ExternalDNS, you can specify `--no-exclude-unschedulable` to always expose nodes no matter their status.
app.Flag("traefik-disable-legacy", "Disable listeners on Resources under the traefik.containo.us API Group").Default(strconv.FormatBool(defaultConfig.TraefikDisableLegacy)).BoolVar(&cfg.TraefikDisableLegacy)
484
486
app.Flag("traefik-disable-new", "Disable listeners on Resources under the traefik.io API Group").Default(strconv.FormatBool(defaultConfig.TraefikDisableNew)).BoolVar(&cfg.TraefikDisableNew)
485
487
app.Flag("nat64-networks", "Adding an A record for each AAAA record in NAT64-enabled networks; specify multiple times for multiple possible nets (optional)").StringsVar(&cfg.NAT64Networks)
488
+
app.Flag("exclude-unschedulable", "Exclude nodes that are considered unschedulable (default: true)").Default(strconv.FormatBool(defaultConfig.ExcludeUnschedulable)).BoolVar(&cfg.ExcludeUnschedulable)
486
489
app.Flag("expose-internal-ipv6", "When using the node source, expose internal IPv6 addresses (optional). Default is true.").BoolVar(&cfg.ExposeInternalIPV6)
Copy file name to clipboardExpand all lines: source/node.go
+16-14Lines changed: 16 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -36,16 +36,17 @@ import (
36
36
constwarningMsg="The default behavior of exposing internal IPv6 addresses will change in the next minor version. Use --no-expose-internal-ipv6 flag to opt-in to the new behavior."
37
37
38
38
typenodeSourcestruct {
39
-
client kubernetes.Interface
40
-
annotationFilterstring
41
-
fqdnTemplate*template.Template
42
-
nodeInformer coreinformers.NodeInformer
43
-
labelSelector labels.Selector
44
-
exposeInternalIPV6bool
39
+
client kubernetes.Interface
40
+
annotationFilterstring
41
+
fqdnTemplate*template.Template
42
+
nodeInformer coreinformers.NodeInformer
43
+
labelSelector labels.Selector
44
+
excludeUnschedulablebool
45
+
exposeInternalIPV6bool
45
46
}
46
47
47
48
// NewNodeSource creates a new nodeSource with the given config.
0 commit comments