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

Bug 1925534: Add proxy to oc #751

Merged
merged 1 commit into from Jun 27, 2021

Conversation

zerodayz
Copy link
Contributor

We can use existing Proxy field.

Without patch:

➜  oc git:(add-proxy-to-oc) ✗ cat ~/.kube/config | grep 8080
    proxy-url: http://127.0.0.1:8080
➜  oc git:(add-proxy-to-oc) ✗ ./oc project default
Already on project "default" on server "https://example.com:6443".
➜  oc git:(add-proxy-to-oc) ✗ cat ~/.kube/config | grep 8080
➜  oc git:(add-proxy-to-oc) ✗

With patch:

➜  oc git:(add-proxy-to-oc) ✗ cat ~/.kube/config | grep 8080
    proxy-url: http://127.0.0.1:8080
➜  oc git:(add-proxy-to-oc) ✗ ./oc project default
Already on project "default" on server "https://example.com:6443".
➜  oc git:(add-proxy-to-oc) ✗ cat ~/.kube/config | grep 8080
    proxy-url: http://127.0.0.1:8080

With Login option --proxy added oc will use that during login and will save the proxy as proxy-url for any subsequent requests against that cluster.

➜  oc git:(add-proxy-to-oc) ✗ rm ~/.kube/config
➜  oc git:(add-proxy-to-oc) ✗ ./oc login --token=sha256~XXX --server=https://example.com6443 --proxy=http://127.0.0.1:8080
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y

Logged into "https://example.com:6443" as "kube:admin" using the token provided.

You have access to 58 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
Welcome! See 'oc help' to get started.
➜  oc git:(add-proxy-to-oc) ✗ cat ~/.kube/config | grep 8080
    proxy-url: http://127.0.0.1:8080

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zerodayz
To complete the pull request process, please assign smarterclayton after the PR has been reviewed.
You can assign the PR to them by writing /assign @smarterclayton in a comment when ready.

The full list of commands accepted by this bot can be found 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

@zerodayz zerodayz force-pushed the add-proxy-to-oc branch 2 times, most recently from 1fb35ff to 477b7a8 Compare February 28, 2021 03:10
@zerodayz zerodayz changed the title Add proxy to oc Bug 1925534: Add proxy to oc Feb 28, 2021
@openshift-ci-robot
Copy link

@zerodayz: This pull request references Bugzilla bug 1925534, which is invalid:

  • expected the bug to target the "4.8.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1925534: Add proxy to oc

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-robot openshift-ci-robot added bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Feb 28, 2021
@zerodayz
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Feb 28, 2021
@openshift-ci-robot
Copy link

@zerodayz: This pull request references Bugzilla bug 1925534, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.8.0) matches configured target release for branch (4.8.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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-robot openshift-ci-robot removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Feb 28, 2021
@zerodayz zerodayz force-pushed the add-proxy-to-oc branch 3 times, most recently from 0a48771 to d31ea19 Compare February 28, 2021 23:33
@zerodayz
Copy link
Contributor Author

zerodayz commented Mar 1, 2021

/retest

4 similar comments
@zerodayz
Copy link
Contributor Author

zerodayz commented Mar 2, 2021

/retest

@zerodayz
Copy link
Contributor Author

zerodayz commented Mar 6, 2021

/retest

@zerodayz
Copy link
Contributor Author

/retest

@zerodayz
Copy link
Contributor Author

/retest

@zerodayz
Copy link
Contributor Author

@soltysh or @deads2k can you review and let me know? Thank you:)

@@ -83,6 +83,9 @@ func NewCmdLogin(f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra
cmds.Flags().StringVarP(&o.Username, "username", "u", o.Username, "Username for server")
cmds.Flags().StringVarP(&o.Password, "password", "p", o.Password, "Password for server")

// Proxy is the proxy to be used for the cluster requests
cmds.Flags().StringVar(&o.Proxy, "proxy", o.Proxy, "Proxy for the cluster")
Copy link
Member

Choose a reason for hiding this comment

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

I'm very cautious about adding new flags, so I'd prefer we don't fix that bit. https://github.com/kubernetes/client-go/blob/release-1.21/tools/clientcmd/api/types.go#L85-L94 explicitly states that http_proxy or https_proxy environment variables are being used if it's empty.
For config modifications we always have oc config set command.

Although, it does make sense to copy proxyURL once it's set when invoking oc project. @zerodayz can you change your PR such that it only does the last bit mentioned? We did a similar improvement in #692

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @soltysh is this what you have meant? Please check. Thank you.

@zerodayz zerodayz force-pushed the add-proxy-to-oc branch 3 times, most recently from 1c35d3b to 5eed4f0 Compare June 14, 2021 10:38
Copy link
Member

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/retest

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 21, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh, zerodayz

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 21, 2021
@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.

@zerodayz
Copy link
Contributor Author

/test e2e-aws-upgrade

@openshift-bot
Copy link
Contributor

/retest

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

11 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.

@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.

@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.

@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.

@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.

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit 94ca4c4 into openshift:master Jun 27, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 27, 2021

@zerodayz: All pull requests linked via external trackers have merged:

Bugzilla bug 1925534 has been moved to the MODIFIED state.

In response to this:

Bug 1925534: Add proxy to oc

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.

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. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. 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