8000 oci: Add flag --plain-http to enable working with HTTP registries by aryan9600 · Pull Request #12128 · helm/helm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

oci: Add flag --plain-http to enable working with HTTP registries #12128

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

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

aryan9600
Copy link
Contributor
@aryan9600 aryan9600 commented Jun 8, 2023

What this PR does / why we need it:
Add a new flag --plain-http to the following commands:

  • helm install
  • helm pull
  • helm push
  • helm template
  • helm upgrade
  • helm show

This flag instructs the registry client to use plain HTTP connections,
thus enabling upload/download of charts from OCI registries served at
an HTTP endpoint.

closes #11682

Special notes for your reviewer:

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 8, 2023
Copy link
Contributor
@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

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

@aryan9600 Thank you so much for this much needed enhancement. Started to test various different scenarios. Unfortunately, the following fails:

helm upgrade -i  --plain-http -n plain-http --create-namespace plain-http oci://<registry>/helm/plain-http

Error: Get "https://<registry>/v2/helm/plain-http/tags/list": tls: failed to verify certificate: x509: certificate signed by unknown authority

Specifying the version of the chart does work

@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 9, 2023
Add a new flag `--plain-http` to the following commands:
* `helm install`
* `helm pull`
* `helm push`
* `helm template`
* `helm upgrade`
* `helm show`

This flag instructs the registry client to use plain HTTP connections,
thus enabling upload/download of charts from OCI registries served at
an HTTP endpoint.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
@aryan9600
Copy link
Contributor Author
aryan9600 commented Jun 9, 2023

@sabre1041 this should be fixed, the call to fetch tags also respects this flag now.

@sabre1041
Copy link
Contributor

@aryan9600 indeed the tags listing is working, however unit test Test_3_Tags is failing locally. Can you confirm you are seeing similar results on your end?

@aryan9600 aryan9600 force-pushed the plain-http branch 3 times, most recently from e938e36 to b0a593a Compare June 14, 2023 06:07
@aryan9600 aryan9600 requested a review from sabre1041 June 14, 2023 13:19
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Copy link
Contributor
@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

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

LGTM

@aryan9600
Copy link
Contributor Author

ping @scottrigby

@lindhe
Copy link
Contributor
lindhe commented Jun 27, 2023

I would like to suggest naming this flag something else to make the security implications clearer, e.g. --use-insecure-registry 🙃

This has precedence:

--kube-insecure-skip-tls-verify   if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure

@scottrigby scottrigby self-assigned this Jul 21, 2023
@scottrigby
Copy link
Member

I would like to suggest naming this flag something else to make the security implications clearer, e.g. --use-insecure-registry 🙃

This has precedence:

--kube-insecure-skip-tls-verify   if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure

Hi @lindhe --insecure-skip-tls-verify was already added for OCI registries in #11711.

Just to be clear, --insecure-skip-tls-verify skips validation of a certificate behind HTTPS, self-signed or otherwise. This is different from using an OCI registry behind plain HTTP, which is what --plain-http in this PR allows.

@rstribrn
Copy link

I would like to suggest naming this flag something else to make the security implications clearer, e.g. --use-insecure-registry upside_down_face
This has precedence:

--kube-insecure-skip-tls-verify   if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure

Hi @lindhe --insecure-skip-tls-verify was already added for OCI registries in #11711.

Just to be clear, --insecure-skip-tls-verify skips validation of a certificate behind HTTPS, self-signed or otherwise. This is different from using an OCI registry behind plain HTTP, which is what --plain-http in this PR allows.

Just added comment to #11167 that "--insecure-skip-tls-verify" doesn't work either for "helm dep update":
#11711 (comment)

And of course:
helm dependency update --insecure-skip-tls-verify
Error: unknown flag: --insecure-skip-tls-verify

Copy link
Member
@scottrigby scottrigby left a comment

Choose a reason for hiding this comment

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

@aryan9600 Thanks so much, this PR looks and works great 👏

Without this PR, plain HTTP registries - except for localhost - fail with a message:

http: server gave HTTP response to HTTPS client

With this PR, passing --plain-http flag allows this to succeed.

This PR is good to go 👍

I suggest as a follow-up we update the Helm website/docs to clarify the purpose of --plain-http and --insecure-skip-tls-verify since these seem to get confused.

@@ -39,15 +39,17 @@ func TestOCIGetter(t *testing.T) {
ca, pub, priv := join(cd, "rootca.crt"), join(cd, "crt.pem"), join(cd, "key.pem")
timeout := time.Second * 5
transport := &http.Transport{}
insecureSkipTLSverify := false
insecureSkipVerifyTLS := false
Copy link
Member

Choose a reason for hiding this comment

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

Note for later. This was initially confusing because this var was initially misnamed in #7254. We can make a follow-up PR to address this consistently everywhere else it occurs, but your change is fine here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How can I push chart to an insecure OCI registry with helm v3
5 participants
0