Skip to content

NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM) - #637

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
alebedev87:verifyhost
Nov 21, 2024
Merged

NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM)#637
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
alebedev87:verifyhost

Conversation

@alebedev87

@alebedev87 alebedev87 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

This PR introduces the "verifyhost" configuration setting to dynamic server slots during template rendering. This ensures consistent behavior with static servers.

The "verifyhost" uses the FQDN of the primary service only, as it's not feasible to predict which service endpoint will be used when alternate backends are available.Consequently, dynamic servers for re-encrypt routes are not intended to handle alternate backend endpoints. A reload is forced when endpoint changes occur for alternate backend services in a re-encrypt route.

The commit which added the server certificate verification without verifyhost: 50a330d.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 8, 2024
@openshift-ci-robot

openshift-ci-robot commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: This pull request references NE-1815 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

This PR adds "verifyhost" configuration setting to dynamic server slots during template rendering to ensure consistent behavior with static servers.

The "verifyhost" with the service hostname is added only when:

  • The route does not have a destination CA certificate.
  • The route has a single service.

Limiting "verifyhost" to a single service route is essential, as it's not possible to reliably predict which service’s endpoint will be used when alternate backends are available.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from Miciah and candita November 8, 2024 14:42
@openshift-ci-robot

openshift-ci-robot commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: This pull request references NE-1815 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

This PR adds "verifyhost" configuration setting to dynamic server slots during template rendering to ensure consistent behavior with static servers.

The "verifyhost" with the service hostname is added only when:

  • The route does not have a destination CA certificate.
  • The route has a single service.

Limiting "verifyhost" to a single service route is essential, as it's not possible to reliably predict which service’s endpoint will be used when alternate backends are available.

The commit which added the server certificate verification without verifyhost: 50a330d.

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 openshift-eng/jira-lifecycle-plugin repository.

@Miciah

Miciah commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

This is only part of the solution, right? We need both of the following:

  • Set verifyhost on the pre-allocated server line for a single-service route (this PR). This is necessary to ensure that adding an endpoint to a single-service route behaves the same with DCM as without.
  • Force a reload if the endpoints change for a multi-service route. This is necessary to ensure that we write out server lines with verifyhost and the correct host name for multi-service routes.

@alebedev87

Copy link
Copy Markdown
Contributor Author

Force a reload if the endpoints change for a multi-service route. This is necessary to ensure that we write out server lines with verifyhost and the correct host name for multi-service routes.

This would be the safest, yes. Let me see whether I can find a way to do this.

@alebedev87

Copy link
Copy Markdown
Contributor Author

/retest

@Miciah

Miciah commented Nov 13, 2024

Copy link
Copy Markdown
Contributor

/assign

@alebedev87

alebedev87 commented Nov 13, 2024

Copy link
Copy Markdown
Contributor Author

/retitle [WIP] NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM)

Work In Progress until #637 (comment) is addressed.

@openshift-ci openshift-ci Bot changed the title NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM) [WIP] NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM) Nov 13, 2024
@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 Nov 13, 2024
@alebedev87
alebedev87 force-pushed the verifyhost branch 2 times, most recently from 62e99fc to 430b33c Compare November 14, 2024 10:07
@alebedev87

Copy link
Copy Markdown
Contributor Author

Force a reload if the endpoints change for a multi-service route. This is necessary to ensure that we write out server lines with verifyhost and the correct host name for multi-service routes.

Addressed here.

@openshift-ci-robot

openshift-ci-robot commented Nov 14, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: This pull request references NE-1815 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

This PR adds "verifyhost" configuration setting to dynamic server slots during template rendering to ensure consistent behavior with static servers.

The "verifyhost" with the service hostname is added only when:

  • The route does not have a destination CA certificate.
  • The route has a single active service.

Limiting "verifyhost" to a single service route is essential, as it's not possible to reliably predict which service’s endpoint will be used when alternate backends are available.

Additionally, for the same reason, a reload is triggered when a re-encrypt route has multiple active services.

The commit which added the server certificate verification without verifyhost: 50a330d.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot

openshift-ci-robot commented Nov 14, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: This pull request references NE-1815 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

This PR adds "verifyhost" configuration setting to dynamic server slots during template rendering to ensure consistent behavior with static servers.

The "verifyhost" with the service hostname is added only when:

  • The route does not have a destination CA certificate.
  • The route has a single active service.

Limiting "verifyhost" to a single service route is essential, as it's not possible to reliably predict which service’s endpoint will be used when alternate backends are available. Additionally, for the same reason, a reload is triggered when a re-encrypt route has multiple active services.

The commit which added the server certificate verification without verifyhost: 50a330d.

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 openshift-eng/jira-lifecycle-plugin repository.

@alebedev87 alebedev87 changed the title [WIP] NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM) NE-1815: Add verifyhost to dynamic server slots for re-encrypt routes (DCM) Nov 14, 2024
@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 Nov 14, 2024
@alebedev87

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci-robot

openshift-ci-robot commented Nov 14, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: This pull request references NE-1815 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

This PR adds "verifyhost" configuration setting to dynamic server slots during template rendering to ensure consistent behavior with static servers.

The "verifyhost" with the service hostname is added only when:

  • The route does not have a destination CA certificate.
  • The route has a single active service.

Limiting "verifyhost" to a single service route is essential, as it's not possible to reliably predict which service’s endpoint will be used when alternate backends are available. Additionally, for the same reason, a reload is forced when an endpoint change happens for a re-encrypt route which has multiple active services.

The commit which added the server certificate verification without verifyhost: 50a330d.

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 openshift-eng/jira-lifecycle-plugin repository.

@alebedev87

alebedev87 commented Nov 14, 2024

Copy link
Copy Markdown
Contributor Author

Changed TestConfigTemplate test to converge to the approach from #627.

@alebedev87

Copy link
Copy Markdown
Contributor Author

Rebased from master after #627 was merged.

@alebedev87

Copy link
Copy Markdown
Contributor Author

/retest

@alebedev87

Copy link
Copy Markdown
Contributor Author

/assign @gcs278

@alebedev87

Copy link
Copy Markdown
Contributor Author

Your recent updates look good to me, just one last minor comment. You will need to update your PR description if you plan to keep the commit (and presumably squash if you want to keep it clean).

Thanks a lot! The commits are fixed up, the description is updated.

@openshift-ci-robot

openshift-ci-robot commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: This pull request references NE-1815 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

Details

In response to this:

This PR introduces the "verifyhost" configuration setting to dynamic server slots during template rendering. This ensures consistent behavior with static servers.

The "verifyhost" uses the FQDN of the primary service only, as it's not feasible to predict which service endpoint will be used when alternate backends are available.Consequently, dynamic servers for re-encrypt routes are not intended to handle alternate backend endpoints. A reload is forced when endpoint changes occur for alternate backend services in a re-encrypt route.

The commit which added the server certificate verification without verifyhost: 50a330d.

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 openshift-eng/jira-lifecycle-plugin repository.

@alebedev87

Copy link
Copy Markdown
Contributor Author

/label docs-approved
/label px-approved

Technical gap, no need to ping the docs people.

@openshift-ci openshift-ci Bot added docs-approved Signifies that Docs has signed off on this PR px-approved Signifies that Product Support has signed off on this PR labels Nov 20, 2024
@alebedev87

Copy link
Copy Markdown
Contributor Author

/label acknowledge-critical-fixes-only

This change impacts only the DCM enabled router which is not the case by default. The featuregate needs to be enabled to activate DCM.

@openshift-ci openshift-ci Bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Nov 20, 2024
@alebedev87

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-serial

e2e-aws-serial passed the test but the whole job took too long and timed out:

INFO[2024-11-20T13:41:05Z] Step phase test succeeded after 2h29m19s.    
INFO[2024-11-20T13:41:05Z] Running multi-stage phase post               
INFO[2024-11-20T13:41:05Z] Running step e2e-aws-serial-gather-aws-console. 
{"component":"entrypoint","file":"sigs.k8s.io/prow/pkg/entrypoint/run.go:169","func":"sigs.k8s.io/prow/pkg/entrypoint.Options.ExecuteProcess","level":"error","msg":"Process did not finish before 4h0m0s timeout","severity":"error","time":"2024-11-20T13:41:22Z"}

@gcs278

gcs278 commented Nov 20, 2024

Copy link
Copy Markdown
Contributor

Thanks for the updates & the responses.
/lgtm

Will let @Miciah approve.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2024
Comment thread pkg/router/router_test.go
name: "q",
host: "qexample.com",
targetServiceName: "serviceq",
weight: int32(100),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is weight needed in this test case? Is it used just to verify that the dynamic server does not start with the route weight?

@alebedev87 alebedev87 Nov 21, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I think I did it for consistency with the alternate backend case which I wanted to look "real". None of them really influence the template rendering: weight is always 0. Upd: Which indeed looks like what you said - it now verifies that the dynamic slot is created without the service weight taken into account.

Comment thread pkg/router/router_test.go Outdated
Weight: &fifty,
},
}
weight = &fifty

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this assignment correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What you think is not correct? I wanted the 50-50 balance between 2 services.

@Miciah Miciah Nov 21, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The godoc for the weight field says, "weight is the spec.to.weight of the route." It seems contradictory to the godoc and surprising to me that the value in the weight field would be ignored.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a dedicated field for the alternate backend weight.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see, I didn't understand your intention before, so I'm glad I asked. Thanks for changing the test expectation to be more explicit!

… (DCM)

This commit introduces the "verifyhost" configuration setting to dynamic server slots during template rendering.
This ensures consistent behavior with static servers.

The "verifyhost" uses the FQDN of the primary service only,
as it's not feasible to predict which service endpoint will be used when alternate backends are available.
Consequently, dynamic servers for re-encrypt routes are not intended to handle alternate backend endpoints.
A reload is forced when endpoint changes occur for alternate backend services in a re-encrypt route.
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 21, 2024
Comment thread pkg/router/router_test.go
if e.targetServiceName != "" {
serviceName = e.targetServiceName
}
weight := new(int32)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a big deal, but is there a reason you use weight := new(int32) instead of using var weight int32?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I was just inspired by the previous code which did this: Weight: new(int32).

@Miciah

Miciah commented Nov 21, 2024

Copy link
Copy Markdown
Contributor

Thanks!
/approve
/lgtm

@openshift-ci openshift-ci Bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 21, 2024
@alebedev87

Copy link
Copy Markdown
Contributor Author

/retest

Tests are not starting for an hour.

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 7832237 and 2 for PR HEAD 68f0e2c in total

@Miciah

Miciah commented Nov 21, 2024

Copy link
Copy Markdown
Contributor

Thanks!
/approve
/lgtm
(Hm, I thought I already posted this comment.)
Edit: Ah, now I see my previous comment. ¯\_(ツ)_/¯.

@openshift-ci

openshift-ci Bot commented Nov 21, 2024

Copy link
Copy Markdown
Contributor

[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

Details 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

@alebedev87

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-serial

@alebedev87

Copy link
Copy Markdown
Contributor Author

/test e2e-upgrade

@openshift-ci

openshift-ci Bot commented Nov 21, 2024

Copy link
Copy Markdown
Contributor

@alebedev87: all tests passed!

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit be319d0 into openshift:master Nov 21, 2024
@openshift-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-haproxy-router-base
This PR has been included in build ose-haproxy-router-base-container-v4.19.0-202411220208.p0.gbe319d0.assembly.stream.el9.
All builds following this will include this PR.

@openshift-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: openshift-enterprise-haproxy-router
This PR has been included in build openshift-enterprise-haproxy-router-container-v4.19.0-202411220208.p0.gbe319d0.assembly.stream.el9.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. 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 jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants