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

Move DNS provider initialization to DNS controller #417

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented Jun 23, 2020

  • cmd/ingress-operator/start.go (NewStartCommand): Delete initialization of the DNS provider.
    (cloudCredentialsSecretName, createDNSProvider, getPlatformStatus): Move from here...
  • pkg/operator/controller/dns/controller.go: ...to here.
    (New): Delete parameter for DNS provider; the controller now initializes it. Add config parameter. Add watches on the DNS config and Infrastructure config objects. Use ToDNSRecords mapper function to reconcile all DNSRecord objects when a config object changes.
    (Config): New type to hold the namespace and operator release version, which are needed for initializing the DNS provider.
    (reconciler): Add Config and infraConfig fields.
    (Reconcile): Get the cluster Infrastructure config object, and initialize or re-initialize the DNS provider if it was not already initialized or if the Infrastructure config has changed.
    (ToDNSRecords): New method. Return reconcilation requests for all DNSRecords.
  • pkg/operator/operator.go (New): Update initialization of the DNS controller to pass the controller's config object instead of the DNS provider object.
  • manifests/00-cluster-role.yaml: Allow the operator to list and watch the dnses and infrastructures config resources.
  • pkg/manifests/bindata.go: Regenerate.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 23, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2020
@danehans
Copy link
Contributor

@Miciah thanks for working on this refactor. This will help me with #416.

}

// Initialize or re-initialize the DNS provider.
if r.infraConfig == nil || !reflect.DeepEqual(infraConfig.Spec, r.infraConfig.Spec) || !reflect.DeepEqual(infraConfig.Status, r.infraConfig.Status) {
Copy link
Contributor

@danehans danehans Jun 23, 2020

Choose a reason for hiding this comment

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

@Miciah why is it necessary to compare spec of configv1.Infrastructure? According to the EP, operators should use status:

But since the users are going to be specifying the service endpoints for APIs, there is chance of user error and operators picking up invalid or incorrect information. Therefore, the service endpoints will be mirrored to the status section after basic validations by a [controller][TODO-link-to-section] and the cluster operators will use the information from the status section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've removed the || !reflect.DeepEqual(infraConfig.Spec, r.infraConfig.Spec).

@Miciah Miciah force-pushed the move-DNS-provider-initialization-to-DNS-controller branch 2 times, most recently from b837a23 to a5ef198 Compare June 24, 2020 00:28
* cmd/ingress-operator/start.go (NewStartCommand): Delete initialization of
the DNS provider.
(cloudCredentialsSecretName, createDNSProvider, getPlatformStatus): Move
from here...
* pkg/operator/controller/dns/controller.go: ...to here.
(New): Delete parameter for DNS provider; the controller now initializes
it.  Add config parameter.  Add watches on the DNS config and
Infrastructure config objects.  Use ToDNSRecords mapper function to
reconcile all DNSRecord objects when a config object changes.
(Config): New type to hold the namespace and operator release version,
which are needed for initializing the DNS provider.
(reconciler): Add Config and infraConfig fields.
(Reconcile): Get the cluster Infrastructure config object, and initialize
or re-initialize the DNS provider if it was not already initialized or if
the Infrastructure config has changed.
(ToDNSRecords): New method.  Return reconcilation requests for all
DNSRecords.
* pkg/operator/operator.go (New): Update initialization of the DNS
controller to pass the controller's config object instead of the DNS
provider object.
* manifests/00-cluster-role.yaml: Allow the operator to list and watch the
dnses and infrastructures config resources.
* pkg/manifests/bindata.go: Regenerate.
@Miciah
Copy link
Contributor Author

Miciah commented Jun 24, 2020

e2e-aws-operator failed on TestRouteAdmissionPolicy; the failure is probably not caused by the changes in this PR (see #400).

@Miciah Miciah force-pushed the move-DNS-provider-initialization-to-DNS-controller branch from a5ef198 to 476710f Compare June 24, 2020 01:39
@Miciah Miciah changed the title WIP: Move DNS provider initialization to DNS controller Move DNS provider initialization to DNS controller Jun 24, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 24, 2020
@Miciah
Copy link
Contributor Author

Miciah commented Jun 24, 2020

Failed to provision the cluster.

/test e2e-aws-operator

@Miciah
Copy link
Contributor Author

Miciah commented Jun 24, 2020

Failed on TestRouteAdmissionPolicy again.

// configuration.
func (r *reconciler) createDNSProvider(dnsConfig *configv1.DNS, platformStatus *configv1.PlatformStatus) (dns.Provider, error) {
// If no DNS configuration is provided, don't try to set up provider clients.
// TODO: the provider configuration can be refactored into the provider
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to work on this TODO now, since the DNS controller is already being moved around? If you think this would be helpful at the moment, I could work on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, I guess it would make sense to wait til #416 is finished to make things less confusing, but that's fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to work on this TODO now, since the DNS controller is already being moved around?

I prefer that the TODO is addressed in a separate PR due to time constraints and to keep this PR focused on the refactor needed for supporting AWS/Azure custom endpoints.

@danehans
Copy link
Contributor

--- FAIL: TestRouteAdmissionPolicy (41.33s)
    operator_test.go:875: failed to observe expected conditions: timed out waiting for the condition
    operator_test.go:1248: deleted ingresscontroller routeadmission

/test e2e-aws-operator

If this continues, we may need to bump the timeout in waitForRouteIngressConditions().

@Miciah
Copy link
Contributor Author

Miciah commented Jun 24, 2020

If this continues, we may need to bump the timeout in waitForRouteIngressConditions().

#400 should fix it. (Hint hint! * grin *.)

@danehans
Copy link
Contributor

Same failure as #417 (comment). Retesting since #400 has yet to merge (waiting for CI to pass) and hopefully we get lucky. If not, hold until #400 merges.

@danehans
Copy link
Contributor

/test e2e-aws-operator

@Miciah
Copy link
Contributor Author

Miciah commented Jun 26, 2020

Failed on TestInternalLoadBalancer because, The DNS provider failed to ensure the record: failed to update alias in zone Z08828212CZGG65VKV5I4: couldn't update DNS record in zone Z08828212CZGG65VKV5I4: Throttling: Rate exceeded\n\tstatus code: 400, request id: aa5754ee-ef4a-4e3d-b775-b87fdbdc45d8. It looks like the DNS controller did not retry after that.

@danehans
Copy link
Contributor

Now that #400 has merged, let's try again.

/test e2e-aws-operator

@danehans
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danehans, 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-merge-robot openshift-merge-robot merged commit 07b4a56 into openshift:master Jun 26, 2020
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.

None yet

5 participants