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

Implement HTTP header case adjustment API #496

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented Nov 26, 2020

  • pkg/operator/controller/ingress/deployment.go (RouterHTTPHeaderNameCaseAdjustments): New constant for the related router environment variable.
    (desiredRouterDeployment): Set the ROUTER_H1_CASE_ADJUST environment variable as appropriate.
  • pkg/operator/controller/ingress/deployment_test.go (TestDesiredRouterDeployment): Verify that spec.httpHeaders.headerNameCaseAdjustments has the expected effect.
  • vendor/github.com/openshift/api/operator/v1/*: Bump.

Depends on the following PRs:

@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 implement-HTTP-header-case-adjustment-API branch from 828810b to 80ce602 Compare November 26, 2020 04:30
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 26, 2020
@Miciah Miciah force-pushed the implement-HTTP-header-case-adjustment-API branch from 80ce602 to 9e20a17 Compare November 26, 2020 04:45
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 26, 2020
@Miciah Miciah force-pushed the implement-HTTP-header-case-adjustment-API branch from 9e20a17 to b027e25 Compare November 26, 2020 08:16
@@ -319,6 +325,11 @@ func TestDesiredRouterDeployment(t *testing.T) {

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

checkDeploymentHasEnvVar(t, deployment, "ROUTER_UNIQUE_ID_HEADER_NAME", true, "unique-id")
Copy link
Contributor

Choose a reason for hiding this comment

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

The env checks for ROUTER_UNIQUE_ID_HEADER_NAME and ROUTER_UNIQUE_ID_FORMAT were missing, and this PR just adds them independent of the header case changes, right?

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, I snuck that in (sorry!).

Copy link
Contributor

Choose a reason for hiding this comment

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

No worries! Just wanted to make sure that was the case.

for _, v := range ci.Spec.HTTPHeaders.HeaderNameCaseAdjustments {
adjustments = append(adjustments, string(v))
}
v := strings.Join(adjustments, ",")
Copy link
Contributor

Choose a reason for hiding this comment

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

If Spec.HTTPHeaders.HeaderNameCaseAdjustments has a length of 1, the extra comma after the single entry won't break anything, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, never mind, strings.Join handles that case 😄

@Miciah Miciah force-pushed the implement-HTTP-header-case-adjustment-API branch from b027e25 to 834421e Compare December 1, 2020 23:24
Bump to github.com/openshift/api@c6debb38648fa2094d36ef7dd2ffc0dca97da879
to get the HTTP header case adjustment API.

* go.mod: Bump.
* go.sum:
* manifests/00-custom-resource-definition.yaml:
* manifests/00-custom-resource-definition-internal.yaml:
* pkg/manifests/bindata.go:
* vendor/github.com/openshift/api/*:
* vendor/modules.txt: Regenerate.
* pkg/operator/controller/ingress/deployment.go
(RouterHTTPHeaderNameCaseAdjustments): New constant for the related router
environment variable.
(desiredRouterDeployment): Set the ROUTER_H1_CASE_ADJUST environment variable as
appropriate.
* pkg/operator/controller/ingress/deployment_test.go
(TestDesiredRouterDeployment): Verify that
spec.httpHeaders.headerNameCaseAdjustments has the expected effect.
* test/e2e/http_header_name_case_adjustment_test.go: New file.
(TestHeaderNameCaseAdjustment): New test.  Verify that
spec.httpHeaders.headerNameCaseAdjustments has the expected effect.
* vendor/github.com/openshift/api/*: Bump.
* manifests/00-custom-resource-definition.yaml:
* pkg/manifests/bindata.go: Regenerate.
@Miciah Miciah force-pushed the implement-HTTP-header-case-adjustment-API branch from 834421e to a49c989 Compare December 2, 2020 17:53
@Miciah
Copy link
Contributor Author

Miciah commented Dec 2, 2020

Rebased.

@Miciah
Copy link
Contributor Author

Miciah commented Dec 3, 2020

/retitle Implement HTTP header case adjustment API
now that openshift/router#224 has merged. The CI test that this PR adds should now pass; I'll keep an eye on e2e-aws-operator...

@openshift-ci-robot openshift-ci-robot changed the title WIP: Implement HTTP header case adjustment API Implement HTTP header case adjustment API Dec 3, 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 Dec 3, 2020
@Miciah
Copy link
Contributor Author

Miciah commented Dec 3, 2020

/test e2e-aws-operator

@Miciah
Copy link
Contributor Author

Miciah commented Dec 4, 2020

/retest

@Miciah
Copy link
Contributor Author

Miciah commented Dec 4, 2020

TestUniqueIdHeader and TestHTTPHeaderCapture failed.
/test e2e-aws-operator

@Miciah
Copy link
Contributor Author

Miciah commented Dec 4, 2020

=== RUN   TestHTTPCookieCapture
    operator_test.go:1603: failed to observe the expected log message: timed out waiting for the condition
    operator_test.go:1561: failed to delete pod openshift-ingress/cookietest: pods "cookietest" not found
    operator_test.go:2007: deleted ingresscontroller cookiecapture
--- FAIL: TestHTTPCookieCapture (93.33s)

/test e2e-aws-operator

@frobware
Copy link
Contributor

frobware commented Dec 4, 2020

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: frobware, 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

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