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

OADP-659 Avoid overwriting good hostname. #1177

Merged
merged 1 commit into from Oct 10, 2023

Conversation

mrnold
Copy link
Contributor

@mrnold mrnold commented Oct 10, 2023

Fix an issue with StripDefaultPorts that breaks a new test case being added for #1169.

SanitizeHostForHeader puts the stripped host name into the Host field of
the HTTP request, but only if it actually needed to strip the port. If
there is already no port, that Host field can be blank, and there is no
reason to overwrite the URL's host field.

Signed-off-by: Matthew Arnold <marnold@redhat.com>
@@ -213,6 +213,8 @@ func StripDefaultPorts(fromUrl string) (string, error) {
URL: u,
}
request.SanitizeHostForHeader(&r)
r.URL.Host = r.Host
if r.Host != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add unit tests to some scenarios (IBM, Noobaa, etc) here https://github.com/openshift/oadp-operator/blob/master/pkg/common/common_test.go to avoid regressions

Copy link
Member

Choose a reason for hiding this comment

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

+1 but not blocking. could be follow up issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tested, and this fixes my use case 😄

Only concern I have with follow up PR is that we need this in 1.2 branch right? then will be 3 cherry-picks

Copy link
Member

Choose a reason for hiding this comment

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

3 cherry-picks to oadp-1.2 and oadp 1.1 and what's the other one?

But yeah follow up pr is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh no, I think no need to 1.1, only for 1.2

it would be form this PR, the previous (#1169) and the follow up (3, but for the same branch)

@kaovilai
Copy link
Member

INFO[2023-10-10T15:20:47Z] Running step operator-e2e-aws-e2e.           
INFO[2023-10-10T16:16:45Z] Step operator-e2e-aws-e2e succeeded after 55m58s. 

https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/openshift_oadp-operator/1177/pull-ci-openshift-oadp-operator-master-4.12-operator-e2e-aws/1711749018561810432#1:build-log.txt%3A76
/override ci/prow/4.12-operator-e2e-aws

/test 4.13-operator-e2e-azure

@openshift-ci
Copy link

openshift-ci bot commented Oct 10, 2023

@kaovilai: Overrode contexts on behalf of kaovilai: ci/prow/4.12-operator-e2e-aws

In response to this:

INFO[2023-10-10T15:20:47Z] Running step operator-e2e-aws-e2e.           
INFO[2023-10-10T16:16:45Z] Step operator-e2e-aws-e2e succeeded after 55m58s. 

https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/openshift_oadp-operator/1177/pull-ci-openshift-oadp-operator-master-4.12-operator-e2e-aws/1711749018561810432#1:build-log.txt%3A76
/override ci/prow/4.12-operator-e2e-aws

/test 4.13-operator-e2e-azure

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.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 10, 2023
Copy link
Member

@kaovilai kaovilai left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Oct 10, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaovilai, mrnold, shubham-pampattiwar, sseago

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:
  • OWNERS [kaovilai,shubham-pampattiwar,sseago]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kaovilai
Copy link
Member

/cherry-pick oadp-1.2

@openshift-cherrypick-robot
Copy link
Contributor

@kaovilai: once the present PR merges, I will cherry-pick it on top of oadp-1.2 in a new PR and assign it to you.

In response to this:

/cherry-pick oadp-1.2

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.

@kaovilai
Copy link
Member

/retest

@openshift-ci
Copy link

openshift-ci bot commented Oct 10, 2023

@mrnold: 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-ci openshift-ci bot merged commit d80550a into openshift:master Oct 10, 2023
16 checks passed
@openshift-cherrypick-robot
Copy link
Contributor

@kaovilai: #1177 failed to apply on top of branch "oadp-1.2":

Applying: OADP-659 Avoid overwriting good hostname.
Using index info to reconstruct a base tree...
M	pkg/common/common.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/common/common.go
CONFLICT (content): Merge conflict in pkg/common/common.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 OADP-659 Avoid overwriting good hostname.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick oadp-1.2

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.

@kaovilai
Copy link
Member

@mrnold cherrypick #1169 and #1177 into oadp-1.2 :) and move https://issues.redhat.com/browse/OADP-659 status accordingly.

mrnold added a commit to mrnold/oadp-operator that referenced this pull request Oct 11, 2023
SanitizeHostForHeader puts the stripped host name into the Host field of
the HTTP request, but only if it actually needed to strip the port. If
there is already no port, that Host field can be blank, and there is no
reason to overwrite the URL's host field.

Signed-off-by: Matthew Arnold <marnold@redhat.com>
openshift-ci bot pushed a commit that referenced this pull request Oct 25, 2023
… AWS S3 URLs. (#1180)

* OADP-659 Remove HTTP/HTTPS port numbers from AWS S3 URLs. (#1169)

* OADP-659 Remove port numbers if HTTP or HTTPS.

Avoids a signature mismatch from S3-compatible services.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* OADP-659 Move StripDefaultPorts to pkg/common.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* OADP-659 Fix port number in comment.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

---------

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* OADP-659 Avoid overwriting good hostname. (#1177)

SanitizeHostForHeader puts the stripped host name into the Host field of
the HTTP request, but only if it actually needed to strip the port. If
there is already no port, that Host field can be blank, and there is no
reason to overwrite the URL's host field.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

---------

Signed-off-by: Matthew Arnold <marnold@redhat.com>
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

6 participants