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

Allow configuring HTTP header name case adjustment #224

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented Nov 26, 2020

Implement the --http-header-name-case-adjustments flag and ROUTER_H1_CASE_ADJUST environment variable to allow specifying case adjustments for HTTP header names.

  • images/router/haproxy/conf/haproxy-config.template: Add option h1-case-adjust-bogus-client and h1-case-adjust settings to the global configuration if any adjustments are specified. Add option h1-case-adjust-bogus-server settings to routes that have the haproxy.router.openshift.io/h1-adjust-case annotation.
  • pkg/cmd/infra/router/template.go (TemplateRouter): Add HTTPHeaderNameCaseAdjustmentsString and HTTPHeaderNameCaseAdjustment fields.
    (Bind): Add --http-header-name-case-adjustments, which defaults to the value of the ROUTER_H1_CASE_ADJUST environment variable.
    (parseHTTPHeaderNameCaseAdjustments): New function. Parse a string value (such as provided with the newly added command-line flag) into a slice of HTTPHeaderNameCaseAdjustment values.
    (Complete): Use parseHTTPHeaderNameCaseAdjustments to parse HTTPHeaderNameCaseAdjustmentsString into HTTPHeaderNameCaseAdjustments.
    (Run): Specify HTTPHeaderNameCaseAdjustments in the plugin config.
  • pkg/router/template/plugin.go (TemplatePluginConfig): Add HTTPHeaderNameCaseAdjustments field.
    (NewTemplatePlugin): Specify HTTPHeaderNameCaseAdjustments in the internal template router config.
  • pkg/router/template/router.go (templateRouter, templateRouterCfg): Add httpHeaderNameCaseAdjustments field.
    (templateData): Add HTTPHeaderNameCaseAdjustments field.
    (newTemplateRouter): Specify httpHeaderNameCaseAdjustments in the template router.
    (writeConfig): Specify HTTPHeaderNameCaseAdjustments in the template parameters.
  • pkg/router/template/types.go (HTTPHeaderNameCaseAdjustments): New type. Specify an HTTP header name adjustment.

@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 Nov 26, 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 Nov 26, 2020
@Miciah Miciah force-pushed the allow-configuring-HTTP-header-name-case-adjustment branch 2 times, most recently from e89d2cb to 415abf3 Compare November 26, 2020 07:06
pkg/router/template/types.go Outdated Show resolved Hide resolved
pkg/router/template/router.go Outdated Show resolved Hide resolved
Implement the --http-header-name-case-adjustments flag and
ROUTER_H1_CASE_ADJUST environment variable to allow specifying case
adjustments for HTTP header names.

* images/router/haproxy/conf/haproxy-config.template: Add "option
h1-case-adjust-bogus-client" and "h1-case-adjust" settings to the global
configuration if any adjustments are specified.  Add "option
h1-case-adjust-bogus-server" settings to routes that have the
haproxy.router.openshift.io/h1-adjust-case annotation.
* pkg/cmd/infra/router/template.go (TemplateRouter): Add
HTTPHeaderNameCaseAdjustmentsString and HTTPHeaderNameCaseAdjustment
fields.
(Bind): Add --http-header-name-case-adjustments, which defaults to the
value of the ROUTER_H1_CASE_ADJUST environment variable.
(parseHTTPHeaderNameCaseAdjustments): New function.  Parse a string
value (such as provided with the newly added command-line flag) into a
slice of HTTPHeaderNameCaseAdjustment values.
(Complete): Use parseHTTPHeaderNameCaseAdjustments to parse
HTTPHeaderNameCaseAdjustmentsString into HTTPHeaderNameCaseAdjustments.
(Run): Specify HTTPHeaderNameCaseAdjustments in the plugin config.
* pkg/router/template/plugin.go (TemplatePluginConfig): Add
HTTPHeaderNameCaseAdjustments field.
(NewTemplatePlugin): Specify HTTPHeaderNameCaseAdjustments in the internal
template router config.
* pkg/router/template/router.go (templateRouter, templateRouterCfg): Add
httpHeaderNameCaseAdjustments field.
(templateData): Add HTTPHeaderNameCaseAdjustments field.
(newTemplateRouter): Specify httpHeaderNameCaseAdjustments in the template
router.
(writeConfig): Specify HTTPHeaderNameCaseAdjustments in the template
parameters.
* pkg/router/template/types.go (HTTPHeaderNameCaseAdjustments): New type.
Specify an HTTP header name adjustment.
@Miciah Miciah force-pushed the allow-configuring-HTTP-header-name-case-adjustment branch from 415abf3 to da09224 Compare November 30, 2020 22:23
@Miciah
Copy link
Contributor Author

Miciah commented Nov 30, 2020

/retitle Allow configuring HTTP header name case adjustment

@openshift-ci-robot openshift-ci-robot changed the title WIP: Allow configuring HTTP header name case adjustment Allow configuring HTTP header name case adjustment Nov 30, 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 Nov 30, 2020
@sgreene570
Copy link

/retest

@sgreene570
Copy link

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah, sgreene570

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

@Miciah
Copy link
Contributor Author

Miciah commented Dec 2, 2020

Uh oh:

  Cannot download Packages/haproxy-2.2.4-1.el8__x86_64/haproxy22-2.2.4-1.el8.x86_64.rpm: All mirrors were tried

/test images
to see if that somehow gets us to haproxy20.

@Miciah
Copy link
Contributor Author

Miciah commented Dec 3, 2020

/test e2e-agnostic

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

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