Skip to content
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

Add ExternalDNS Operator Enhancement Proposal #786

Conversation

sgreene570
Copy link
Contributor

@sgreene570 sgreene570 commented May 18, 2021

This PR revives and expands upon the original ExternalDNS Operator enhancement (#456).


This is in support of https://issues.redhat.com/browse/NE-303

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 18, 2021
@sgreene570 sgreene570 force-pushed the external-dns-operator-revived branch 14 times, most recently from da9fad6 to bbdf379 Compare May 20, 2021 19:28
@sgreene570
Copy link
Contributor Author

@sgreene570 sgreene570 force-pushed the external-dns-operator-revived branch 2 times, most recently from 71ef92d to 08741e6 Compare May 26, 2021 18:31
@sgreene570 sgreene570 changed the title [WIP] Add ExternalDNS Operator Enhancement Proposal Add ExternalDNS Operator Enhancement Proposal May 26, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 26, 2021
@sgreene570 sgreene570 force-pushed the external-dns-operator-revived branch 6 times, most recently from 180aaac to ab2c65b Compare June 10, 2021 20:12
Copy link
Contributor

@alebedev87 alebedev87 left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just some questions.

surface (common fields on relevant ExternalDNS CRDs, consistent labeling of created resources, etc.), yet is easy to build.
* Build an operator that is suitable for production use of ExternalDNS.
* Focus on supporting the OpenShift Route resource as a source for ExternalDNS.
* Additionally support the Kubernetes [service source](https://github.com/kubernetes-sigs/external-dns/blob/master/source/service.go) (namely LoadBalancer services)
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't services of type LoadBalancer already supported by ExternalDNS? FAQ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, the initial ExternalDNS Operator will only support a subset of the source resources supported by ExternalDNS.


* Create a GitHub repository to host the operator source code in OpenShift's GitHub org,
with the hopes of moving the operator's source code into an upstream k8s-sigs repository in the future.
* Leverage popular frameworks and libraries, e.g. controller-runtime and kubebuilder, to simplify development

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. We polled the openshift networking team, and took @danehans 's experience with Contour operator into account when we decided to go forward with kubebuilder + controller-runtime, as opposed to Operator SDK. Kubebuilder + controller-runtime seems to be the more popular approach upstream.

of the operator and align with upstream communities.
* Manage dependencies through [Go Modules](https://blog.golang.org/using-go-modules).
* Create user and developer documentation for running ExternalDNS operator (on both OpenShift and vanilla Kubernetes).
* Create tooling to simplify building, running, testing, etc. the operator.

This comment was marked as resolved.

proper label selector logic for all source types (instead of label selector based annotations), work may need to be done in the upstream ExternalDNS
community accordingly.

As a side note, ExternalDNS deployments will be configured to run ExternalDNS pods on cluster control-plane nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a small explanation why on the control plane nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See Dane's prior comment:

I think it's common practice for add-on control-plane functionality to use the node roles to run on master nodes only by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll elaborate in the EP. Thanks!

@sgreene570 sgreene570 force-pushed the external-dns-operator-revived branch from ab2c65b to 9fe6d62 Compare June 11, 2021 20:02
@seanmalloy
Copy link

@vinny-sabatini @seegeekrow @sanbornick @trzejos @jaideepbellani please review when you have some time. Thanks!

Comment on lines 164 to 172
- openshift-route:
ignoreHostnameAnnotation: "true"
labelSelector:
foo: bar
- CRD
resource: dnsrecords
- service:
namespace: foo
publishInternal: "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

This will probably change anyway, but syntactically, the union type subfields need to be indented. Also, you're missing a colon (but so was my earlier suggestion—oops!), and the field names should be more jsonny/yamlish.

Suggested change
- openshift-route:
ignoreHostnameAnnotation: "true"
labelSelector:
foo: bar
- CRD
resource: dnsrecords
- service:
namespace: foo
publishInternal: "true"
- openshiftRoute:
ignoreHostnameAnnotation: "true"
labelSelector:
foo: bar
- crd:
resource: dnsrecords
- service:
namespace: foo
publishInternal: "true"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch. Fixed! (for now, at least 😁 )

Comment on lines 142 to 143
* Expand upon the existing OpenShift [ingressoperator/dnsrecord](https://github.com/openshift/api/blob/master/operatoringress/v1/types.go)
CRD to implement the ExternalDNS base [CRD source](https://github.com/kubernetes-sigs/external-dns/blob/master/docs/contributing/crd-source.md).
Copy link
Contributor

Choose a reason for hiding this comment

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

We moved this to non-goals (for 4.9), so we need to be clear here that we are not committing to making this change as part of this specific enhancement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I added a note here that this is work for post 4.9.

[tutorial section of the ExternalDNS docs](https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials).
In general, ExternalDNS needs proper permissions to view, update, and delete DNS resource records in the relevant DNS zones.

Support for OpenShift clusters running AWS that
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just say "Support for AWS clusters that use STS"? The CredentialsRequest API is OpenShift-specific, but given that we'll need some way to provide credentials on vanilla Kubernetes, does support for STS need to be OpenShift-specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, we can. Fixed.

in a cluster, as well as for cluster administrators who want to verify that their requested resources have been created properly.

Currently, the upstream ExternalDNS CRD source only supports record creation for A or CNAME type records. See
[upstream issue 164](https://github.com/kubernetes-sigs/external-dns/issues/164) for more context to that end. Contributions may need to be made to

Choose a reason for hiding this comment

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

Upstream issue 164 seems to be related to leader election. I suspect you are referencing the wrong issue here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like I accidentally dropped the 7 from kubernetes-sigs/external-dns#1647.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Thanks!

Comment on lines 235 to 238
source-specific parameters. In this example, ExternalDNS would create DNS Records for Route resources that match the label (read: annotation, more on this later)
`foo: bar`, and would ignore the ExternalDNS Host Target Override Annotation (See [Implementation Details](#implementation-details) for more details about ExternalDNS
annotations). This example would also instruct ExternalDNS to create DNS Records for CR instances of type `dnsrecords` (not a part of OCP 4.9 implementation).
Finally, this example would instruct ExternalDNS to create DNS Records in the given Private zone for Service resource instances in namespace `foo`.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Records", "See", and "Private" can be lowercase. My memory is bad, and by the time I reach this paragraph, the example has scrolled off the screen, and I've figuratively and literally lost sight of it; two things could help: (1) an introductory sentence at the start of this section, such as, "The following example CR will be used throughout this section to explain the proposed CRD", and (2) a gentle reminder of where the example is when referencing it.

Suggested change
source-specific parameters. In this example, ExternalDNS would create DNS Records for Route resources that match the label (read: annotation, more on this later)
`foo: bar`, and would ignore the ExternalDNS Host Target Override Annotation (See [Implementation Details](#implementation-details) for more details about ExternalDNS
annotations). This example would also instruct ExternalDNS to create DNS Records for CR instances of type `dnsrecords` (not a part of OCP 4.9 implementation).
Finally, this example would instruct ExternalDNS to create DNS Records in the given Private zone for Service resource instances in namespace `foo`.
source-specific parameters. For the example ExternalDNS CR above, the ExternalDNS Operator would create DNS records for Route resources that match the label (read: annotation, more on this later)
`foo: bar`, and would ignore the ExternalDNS Host Target Override Annotation (see [Implementation Details](#implementation-details) for more details about ExternalDNS
annotations). This example would also instruct ExternalDNS to create DNS records for CR instances of type `dnsrecords` (not a part of OCP 4.9 implementation).
Finally, this example would instruct ExternalDNS to create DNS records in the given private zone for Service resource instances in namespace `foo`.

By the way, do you prefer "the ExternalDNS operator" (because that's what it is), "the ExternalDNS Operator", or "ExternalDNS Operator" (without an article because we're using it as a name)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestions! I've gone ahead and settled on the ExternalDNS operator. I've also fixed all of the typos you highlighted, as well as added the requested details from (1) and (2). Thanks!

This commit contains the original externalDNS operator enhancement
proposal create by Daneyon Hansen as a part of
openshift#456 (which was closed due
to inactivity).
@sgreene570 sgreene570 force-pushed the external-dns-operator-revived branch 2 times, most recently from 2b096a4 to 4eade5e Compare June 16, 2021 13:31
This commit relocates and expands upon the original ExternalDNS
Operator enhancement.

This commit is in support of https://issues.redhat.com/browse/NE-303.
@sgreene570 sgreene570 force-pushed the external-dns-operator-revived branch from 4eade5e to b0f67e9 Compare June 16, 2021 15:36
@Miciah
Copy link
Contributor

Miciah commented Jun 16, 2021

Thanks! Let's merge and iterate.
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 16, 2021
@Miciah
Copy link
Contributor

Miciah commented Jun 16, 2021

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 16, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 16, 2021
@openshift-merge-robot openshift-merge-robot merged commit c723451 into openshift:master Jun 16, 2021
@sgreene570
Copy link
Contributor Author

sgreene570 commented Jun 16, 2021

We are up to 200 comments so we decided to merge this enhancement as is and create follow up PRs as needed. Thanks for the input all! Please feel free to comment here or reach out to me offline with any further comments.

@seanmalloy
Copy link

@sgreene570 I reviewed the proposal and it looks pretty good. I have two point below that you may want to consider in the future.

For excluding domains external-dns provides several different options. I'm leaning towards using --regex-domain-filter or --regex-domain-exclusion, but we haven't tested these yet in our environment. What I want to avoid is having to list out a large list of domains to filter. Also, in our environment the list of sub-domains may change, so I don't want to keep the list updated. I'm hoping one of the regex options accomplish this.

  --domain-filter= ...           Limit possible target zones by a domain suffix; specify multiple times for multiple domains (optional)
  --exclude-domains= ...         Exclude subdomains (optional)
  --regex-domain-filter=         Limit possible domains and target zones by a Regex filter; Overrides domain-filter (optional)
  --regex-domain-exclusion=      Regex filter that excludes domains and target zones matched by regex-domain-filter (optional)
  --zone-name-filter= ...        Filter target zones by zone domain (For now, only AzureDNS provider is using this flag); specify multiple times for multiple zones (optional)
  --zone-id-filter= ...          Filter target zones by hosted zone id; specify multiple times for multiple zones (optional)

Also, it would be nice to handle DNS for applications deployed across multiple clusters at some point in the future. We have not done any testing with this in our environment, but we think k8s external-dns might help us automate this in the future. It would be super cool if OpenShift could make it easy to automate this in the future.

@sgreene570
Copy link
Contributor Author

For excluding domains external-dns provides several different options. I'm leaning towards using --regex-domain-filter or --regex-domain-exclusion...

@seanmalloy thank you for pointing this out to me! After talking with my team, sounds like we will come up with a way to pass either a slice of domains, or a domain regex, to the domains and excludeDomains fields, or at least something along those lines. I'll be sure to open another PR (and cc you) to update this enhancement document once we have a better idea of what the ExternalDNS operator API will look like.

Also, it would be nice to handle DNS for applications deployed across multiple clusters at some point in the future. We have not done any testing with this in our environment, but we think k8s external-dns might help us automate this in the future. It would be super cool if OpenShift could make it easy to automate this in the future.

This is an interesting use case that I had not thought about. @seanmalloy, could you maybe help me understand what future work in this space would look like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants