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

NE-882: Set ROUTER_DOMAIN to enable route subdomain field #674

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented Nov 3, 2021

Set ROUTER_DOMAIN to the IngressController's domain in the router deployment so that the router can use the domain to construct a default host for routes that specify an empty value for spec.host and a nonempty value for spec.subdomain.

  • pkg/operator/controller/ingress/deployment.go (desiredRouterDeployment): Set ROUTER_DOMAIN.
  • pkg/operator/controller/ingress/deployment_test.go (TestDesiredRouterDeployment): Verify that ROUTER_DOMAIN is set as expected.

@openshift-ci openshift-ci bot requested review from candita and ironcladlou November 3, 2021 00:14
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2021
@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 1, 2022
@openshift-bot
Copy link
Contributor

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle rotten
/remove-lifecycle stale

@openshift-ci openshift-ci bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 3, 2022
@Miciah
Copy link
Contributor Author

Miciah commented Mar 17, 2022

/remove-lifecycle rotten

1 similar comment
@Miciah
Copy link
Contributor Author

Miciah commented Apr 4, 2022

/remove-lifecycle rotten

@openshift-ci openshift-ci bot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Apr 4, 2022
@Miciah Miciah changed the title Set ROUTER_DOMAIN to enable route subdomain field NE-882: Set ROUTER_DOMAIN to enable route subdomain field Apr 13, 2022
@@ -232,6 +232,7 @@ func TestDesiredRouterDeployment(t *testing.T) {

checkDeploymentHasEnvVar(t, deployment, "ROUTER_USE_PROXY_PROTOCOL", false, "")

checkDeploymentHasEnvVar(t, deployment, "ROUTER_DOMAIN", false, "")
Copy link
Contributor

Choose a reason for hiding this comment

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

If you control-f in this function, there are 4 desiredRouterDeployment, so 4 different generations of a deployment object. Looks like you did the private, loadbalancing, but there's another loadbalancing and the hostnetwork ingress controller tests.

To be thorough, would it make sense to just add the checks after the other two new deployment objects on what you expect? Specifically, I remember working a bug in which private and loadbalancing did one thing and hostNetwork did something different.

Copy link
Contributor

@gcs278 gcs278 Apr 20, 2022

Choose a reason for hiding this comment

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

Oh and I'll throw another plug that this function is super confusing and needs to be written into different tests or something more readable (for another day I suppose...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you control-f in this function, there are 4 desiredRouterDeployment, so 4 different generations of a deployment object. Looks like you did the private, loadbalancing, but there's another loadbalancing and the hostnetwork ingress controller tests.

To be thorough, would it make sense to just add the checks after the other two new deployment objects on what you expect? Specifically, I remember working a bug in which private and loadbalancing did one thing and hostNetwork did something different.

I suppose I could check ROUTER_DOMAIN after each call to desiredRouterDeployment. However, the intention with TestDesiredRouterDeployment was really that for each configuration option, we exercise every code path related to that option. In some cases, there are only two possible code paths, so we only need to check the effect of two different settings to cover both code paths (that's the case with status.domain and ROUTER_DOMAIN: either the domain is present or it's empty, and we set the environment variable or omit it accordingly). In other cases, we have one option with many code paths (such as spec.endpointPublishingStrategy.type, which has 4 possible settings with different code paths; we also have some settings that interact in interesting ways, which we need to test). It just happens that we mashed everything into a single test function, so we end up calling desiredRouterDeployment` four times in the same test, which is needed to cover the possible code paths for some options, even if it isn't needed for other code paths and options.

Oh and I'll throw another plug that this function is super confusing and needs to be written into different tests or something more readable (for another day I suppose...)

Coming soon to a Git clone near you (courtesy of Candace): #712

(Which means I'm going to need to rebase once that PR merges. * grin *.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, so you are basically saying you aren't exercising a different code path for the other desiredRouterDeployment. That's fair, I can buy that. I think it comes back to how large and confusing this function is, so I'm excited to see Candace's update.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's merged! I don't know who's more excited, you or me!

Set ROUTER_DOMAIN to the IngressController's domain in the router
deployment so that the router can use the domain to construct a default
host for routes that specify an empty value for spec.host and a nonempty
value for spec.subdomain.

* pkg/operator/controller/ingress/deployment.go (desiredRouterDeployment):
Set ROUTER_DOMAIN.
* pkg/operator/controller/ingress/deployment_test.go
(TestDesiredRouterDeployment): Verify that ROUTER_DOMAIN is not set.
(TestDesiredRouterDeploymentSpecAndNetwork): Verify that ROUTER_DOMAIN is
set to the expected value.
@Miciah Miciah force-pushed the set-ROUTER_DOMAIN-to-enable-route-subdomain-field branch from 9435046 to f8b71b1 Compare April 22, 2022 23:35
@Miciah
Copy link
Contributor Author

Miciah commented Apr 22, 2022

Rebased for #712.

@melvinjoseph86
Copy link

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Apr 25, 2022
@ahardin-rh
Copy link

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Apr 25, 2022
@CFields651
Copy link

/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Apr 25, 2022
@gcs278
Copy link
Contributor

gcs278 commented Apr 26, 2022

/lgtm
🌮

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 26, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gcs278, 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
Copy link
Contributor

openshift-ci bot commented Apr 26, 2022

@Miciah: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit fefd774 into openshift:master Apr 26, 2022
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. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants