-
Notifications
You must be signed in to change notification settings - Fork 606
OCPBUGS-6829: Add protocolStrategy for upstreams in dnses.operator.openshift.io #1429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -287,6 +287,25 @@ type ForwardPlugin struct { | |||||||||
| // | ||||||||||
| // +optional | ||||||||||
| TransportConfig DNSTransportConfig `json:"transportConfig,omitempty"` | ||||||||||
|
|
||||||||||
|
|
||||||||||
| // protocolStrategy specifies the protocol to use for upstream DNS | ||||||||||
| // requests. | ||||||||||
| // Valid values for protocolStrategy are "TCP" and omitted. | ||||||||||
| // When omitted, this means no opinion and the platform is left to choose | ||||||||||
| // a reasonable default, which is subject to change over time. | ||||||||||
| // The current default is to use the protocol of the original client request. | ||||||||||
| // "TCP" specifies that the platform should use TCP for all upstream DNS requests, | ||||||||||
| // even if the client request uses UDP. | ||||||||||
| // "TCP" is useful for UDP-specific issues such as those created by | ||||||||||
| // non-compliant upstream resolvers, but may consume more bandwidth or | ||||||||||
| // increase DNS response time. Note that protocolStrategy only affects | ||||||||||
| // the protocol of DNS requests that CoreDNS makes to upstream resolvers. | ||||||||||
| // It does not affect the protocol of DNS requests between clients and | ||||||||||
| // CoreDNS. | ||||||||||
| // | ||||||||||
| // +optional | ||||||||||
| ProtocolStrategy ProtocolStrategy `json:"protocolStrategy"` | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // UpstreamResolvers defines a schema for configuring the CoreDNS forward plugin in the | ||||||||||
|
|
@@ -329,6 +348,24 @@ type UpstreamResolvers struct { | |||||||||
| // | ||||||||||
| // +optional | ||||||||||
| TransportConfig DNSTransportConfig `json:"transportConfig,omitempty"` | ||||||||||
|
|
||||||||||
| // protocolStrategy specifies the protocol to use for upstream DNS | ||||||||||
| // requests. | ||||||||||
| // Valid values for protocolStrategy are "TCP" and omitted. | ||||||||||
| // When omitted, this means no opinion and the platform is left to choose | ||||||||||
| // a reasonable default, which is subject to change over time. | ||||||||||
| // The current default is to use the protocol of the original client request. | ||||||||||
| // "TCP" specifies that the platform should use TCP for all upstream DNS requests, | ||||||||||
| // even if the client request uses UDP. | ||||||||||
| // "TCP" is useful for UDP-specific issues such as those created by | ||||||||||
| // non-compliant upstream resolvers, but may consume more bandwidth or | ||||||||||
| // increase DNS response time. Note that protocolStrategy only affects | ||||||||||
| // the protocol of DNS requests that CoreDNS makes to upstream resolvers. | ||||||||||
| // It does not affect the protocol of DNS requests between clients and | ||||||||||
| // CoreDNS. | ||||||||||
| // | ||||||||||
| // +optional | ||||||||||
| ProtocolStrategy ProtocolStrategy `json:"protocolStrategy"` | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // Upstream can either be of type SystemResolvConf, or of type Network. | ||||||||||
|
|
@@ -376,6 +413,23 @@ const ( | |||||||||
| NetworkResolverType UpstreamType = "Network" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| // ProtocolStrategy is a preference for the protocol to use for DNS queries. | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should a consumer of this do if there's a value that they do not recognise? Think about what you'd expect the operator to do if a new value was added to this enum?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. I figured the consumer (cluster-dns-operator) would just do nothing if it received a value it doesn't recognize. That's how I have it coded right now (it's out-of-date with API, but openshift/cluster-dns-operator#359). By nothing, meaning, it will use the default mode of operation (same as "").
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine, I would just add a comment for developers, this is our get out of jail free card for adding a future strategy, as we've already told the consumers what they should be doing if they see a value they don't recognise (which would happen for some consumers on upgrade for example)
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, done. Not sure if you literally wanted
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I did 😅 Sorry, should have explained, the format I put there means that the doc comment will only be visible here, it prevents the doc being picked up in any swagger or openapi copies of the docs. I was wrong though, the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting okay. I pushed up again, let me know if I interpreted you correctly.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, perfect, thanks |
||||||||||
| // + --- | ||||||||||
| // + When consumers observe an unknown value, they should use the default strategy. | ||||||||||
| // +kubebuilder:validation:Enum:=TCP;"" | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sweet. I did not know one can apply the validation directly to a type and have it distributed into both |
||||||||||
| type ProtocolStrategy string | ||||||||||
|
|
||||||||||
| var ( | ||||||||||
| // ProtocolStrategyDefault specifies no opinion for DNS protocol. | ||||||||||
| // If empty, the default behavior of CoreDNS is used. Currently, this means that CoreDNS uses the protocol of the | ||||||||||
| // originating client request as the upstream protocol. | ||||||||||
| // Note that the default behavior of CoreDNS is subject to change. | ||||||||||
| ProtocolStrategyDefault ProtocolStrategy = "" | ||||||||||
|
|
||||||||||
| // ProtocolStrategyTCP instructs CoreDNS to always use TCP, regardless of the originating client's request protocol. | ||||||||||
| ProtocolStrategyTCP ProtocolStrategy = "TCP" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| // DNSNodePlacement describes the node scheduling configuration for DNS pods. | ||||||||||
| type DNSNodePlacement struct { | ||||||||||
| // nodeSelector is the node selector applied to DNS pods. | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this
""needs to be fixed in the kubebuilder statement, see below.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed below.