-
Notifications
You must be signed in to change notification settings - Fork 139
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
Honor --registry-insecure flag in deploy command #2335
Honor --registry-insecure flag in deploy command #2335
Conversation
Welcome @norbjd! It looks like this is your first PR to knative/func 🎉 |
Hi @norbjd. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
@norbjd Thanks for your contribution! |
Note: maybe we should rename |
/ok-to-test |
@matejvasek no problem :) btw, I've noticed that the description of
This flag is not really disabling HTTPS, it's just bypassing the certificate check (
To me, something like this would be clearer:
Or, renaming it |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2335 +/- ##
==========================================
+ Coverage 55.61% 62.31% +6.69%
==========================================
Files 128 128
Lines 14891 11531 -3360
==========================================
- Hits 8281 7185 -1096
+ Misses 5762 3435 -2327
- Partials 848 911 +63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
The more I'm testing, the more I think there are also missing parts in the insecure registry management when doing remote builds, and this PR might not be enough 👀 Even with the flag honored, I was sadly not able to get a running function 😕: with
After adding more debug logs on Tekton side, I figured out the real error:
Again! 😄 The error comes from here: https://github.com/buildpacks/lifecycle/blob/v0.19.6/image/registry_handler.go#L77. I'm assuming that the For now, on my side, I think I'm just going to use a HTTPS registry with a valid certificate (something like DockerHub) because initially, I just wanted to test on a I'm wondering if the insecure registry management in Thanks! Side note: with the |
I think so - I used it for the demo in kubecon here https://github.com/salaboy/knative-kubecon-eu-2024/blob/main/setup-cluster.sh |
though I used the env arg - https://github.com/salaboy/knative-kubecon-eu-2024/blob/main/.envrc#L7 |
It would be an improvement to bundle the insecurity settings under a simple Thanks for reporting the issue. |
@dprotaso thanks for the link to the repo, I am indeed doing something very similar with kind. The only difference is that I'm trying to trigger remote (on-cluster) builds with the So, I'm assuming the issue just affects remote builds and insecure registries. |
OK, I might have an idea on what's happening. There seems to be a misunderstanding on the As of today,
Even with That being said, if registry is really speaking HTTPS, but uses self-signed certificates (or more generally, certificates signed by an unknown CA), the previous error will be gone ✨ BUT then, the on-cluster/remote build (tekton pipelinerun) will complain during the "analyze" step:
This is because buildpack is not configured to ignore certificates signed by unknown authorities. One lead I had was to set diff --git a/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml b/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml
index df5d1f7efd..1e40a8dfeb 100644
--- a/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml
+++ b/pkg/pipelines/resources/tekton/task/func-buildpacks/0.2/func-buildpacks.yaml
@@ -72,6 +72,10 @@ spec:
env:
- name: CNB_PLATFORM_API
value: "0.10"
+ - name: CNB_INSECURE_REGISTRIES
+ value: "kind-registry:5000"
+ - name: CNB_LOG_LEVEL
+ value: "debug"
steps:
- name: prepare And build a custom version of make build FUNC_REPO_REF=norbjd/knative-func FUNC_REPO_BRANCH_REF=custom-buildpack-pipeline With this change, the
This is because for buildpack, insecure means "plain HTTP", and not "use TLS without certificate check": https://github.com/buildpacks/imgutil/blob/4af87862ff7e7b14b82a061cf8ec40d56ad054f5/remote/options.go#L23 So, with the current behavior of I'm assuming the best fix would be on From there, we could use a HTTP registry with |
Hello @norbjd Thanks so much for your clear and thorough examination of how the flag works. How about we start off with a small PR which updates the flag's description to be more correct. Then, we can discuss how to enable insecure registries for remote builds. If setting an environment variable for the Pack builder in the on-cluster build creates the correct behavior, that is something that I believe we can set/create when creating the Pipeline-as-Code artifact which is sent to the server for building. Again, thanks for looking into this. I suspected this flag was not thoroughly implemented yet through to remote builds, and now we know what's missing. |
I'm approving this because, while it doesn't completely fix the OP issue, it does get us further down the path towards correctness. Hoping for more! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lkingland, norbjd 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 |
@lkingland thanks!
Here we go: #2348 🥳 |
Changes
--registry-insecure
flag indeploy
command/kind bug
While playing with
func
in a local environment (withkind
), I've noticedcertificate signed by unknown authority
issues when trying to connect to my local registry, despite passing the--registry-insecure
flag:Same result with
FUNC_REGISTRY_INSECURE
; after debugging, it turns out thatRegistryInsecure
was simply not forwarded fromdeployConfig
toInsecureSkipVerify
inClientConfig
😅Looking at the PR that introduced
--registry-insecure
(#2234), it looks like it has never been forwarded. Kind ping to @dprotaso as the author of this PR, maybe I've missed something.Release Note