Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,73 @@ spec:
DNS.
type: object
properties:
nodePlacement:
description: "nodePlacement provides explicit control over the scheduling
of DNS pods. \n Generally, it is useful to run a DNS pod on every
node so that DNS queries are always handled by a local DNS pod instead
of going over the network to a DNS pod on another node. However,
security policies may require restricting the placement of DNS pods
to specific nodes. For example, if a security policy prohibits pods
on arbitrary nodes from communicating with the API, a node selector
can be specified to restrict DNS pods to nodes that are permitted
to communicate with the API. Conversely, if running DNS pods on
nodes with a particular taint is desired, a toleration can be specified
for that taint. \n If unset, defaults are used. See nodePlacement
for more details."
type: object
properties:
nodeSelector:
description: "nodeSelector is the node selector applied to DNS
pods. \n If empty, the default is used, which is currently the
following: \n beta.kubernetes.io/os: linux \n This default
is subject to change. \n If set, the specified selector is used
and replaces the default."
type: object
additionalProperties:
type: string
tolerations:
description: "tolerations is a list of tolerations applied to
DNS pods. \n The default is an empty list. This default is
subject to change. \n See https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/"
type: array
items:
description: The pod this Toleration is attached to tolerates
any taint that matches the triple <key,value,effect> using
the matching operator <operator>.
type: object
properties:
effect:
description: Effect indicates the taint effect to match.
Empty means match all taint effects. When specified, allowed
values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: Key is the taint key that the toleration applies
to. Empty means match all taint keys. If the key is empty,
operator must be Exists; this combination means to match
all values and all keys.
type: string
operator:
description: Operator represents a key's relationship to
the value. Valid operators are Exists and Equal. Defaults
to Equal. Exists is equivalent to wildcard for value,
so that a pod can tolerate all taints of a particular
category.
type: string
tolerationSeconds:
description: TolerationSeconds represents the period of
time the toleration (which must be of effect NoExecute,
otherwise this field is ignored) tolerates the taint.
By default, it is not set, which means tolerate the taint
forever (do not evict). Zero and negative values will
be treated as 0 (evict immediately) by the system.
type: integer
format: int64
value:
description: Value is the taint value the toleration matches
to. If the operator is Exists, the value should be empty,
otherwise just a regular string.
type: string
servers:
description: "servers is a list of DNS resolvers that provide name
query delegation for one or more subdomains outside the scope of
Expand Down
45 changes: 45 additions & 0 deletions operator/v1/types_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package v1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

corev1 "k8s.io/api/core/v1"
)

// +genclient
Expand Down Expand Up @@ -42,6 +44,24 @@ type DNSSpec struct {
//
// +optional
Servers []Server `json:"servers,omitempty"`

// nodePlacement provides explicit control over the scheduling of DNS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you provide examples of why this may be needed and the tradeoffs such a change will bring?

Off the top of my head, this has the potential to negatively impact availability by not having a local DNS authority on each node. I could see a reason for doing this as some kind of corporate standard that wishes to restrict where DNS pods may land in a datacenter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the top of your head is right. Not having a local pod has its drawbacks, but some users really don't want DNS on certain nodes, for security or compliance reasons. I'll add a comment to that effect.

// pods.
//
// Generally, it is useful to run a DNS pod on every node so that DNS
// queries are always handled by a local DNS pod instead of going over
// the network to a DNS pod on another node. However, security policies
// may require restricting the placement of DNS pods to specific nodes.
// For example, if a security policy prohibits pods on arbitrary nodes
// from communicating with the API, a node selector can be specified to
// restrict DNS pods to nodes that are permitted to communicate with the
// API. Conversely, if running DNS pods on nodes with a particular
// taint is desired, a toleration can be specified for that taint.
//
// If unset, defaults are used. See nodePlacement for more details.
//
// +optional
NodePlacement DNSNodePlacement `json:"nodePlacement,omitempty"`
}

// Server defines the schema for a server that runs per instance of CoreDNS.
Expand Down Expand Up @@ -73,6 +93,31 @@ type ForwardPlugin struct {
Upstreams []string `json:"upstreams"`
}

// DNSNodePlacement describes the node scheduling configuration for DNS pods.
type DNSNodePlacement struct {
// nodeSelector is the node selector applied to DNS pods.
//
// If empty, the default is used, which is currently the following:
//
// beta.kubernetes.io/os: linux
//
// This default is subject to change.
//
// If set, the specified selector is used and replaces the default.
//
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

// tolerations is a list of tolerations applied to DNS pods.
//
// The default is an empty list. This default is subject to change.
//
// See https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
//
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

const (
// Available indicates the DNS controller daemonset is available.
DNSAvailable = "Available"
Expand Down
31 changes: 31 additions & 0 deletions operator/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.