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

Clarify --registry-insecure flag description #2348

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

norbjd
Copy link
Contributor

@norbjd norbjd commented Jun 8, 2024

Changes

  • 🧹 Clarify --registry-insecure flag description

/kind documentation

Related to #2335, where we discovered that the description of registry-insecure flag was not really accurate/clear.

After investigation, I've found that enabling this flag just means "skip TLS certificate verification when communicating to the registry", not "allow plain HTTP registries", as the current description ("Disable HTTPS when communicating to the registry") can let users think.


Today, the RegistryInsecure boolean in the config (filled from the flag) is used at two places:

  1. In the build command: https://github.com/knative/func/blob/1e7dd33/cmd/build.go#L389

The value is simply forwarded to the Pusher, and is used to configure InsecureSkipVerify: https://github.com/knative/func/blob/1e7dd33/pkg/oci/pusher.go#L129-L135:

        if p.Insecure {
		t := remote.DefaultTransport.(*http.Transport).Clone()
		t.TLSClientConfig = &tls.Config{
			InsecureSkipVerify: true,
		}
		oo = append(oo, remote.WithTransport(t))
	}
  1. In the deploy command: https://github.com/knative/func/blob/1e7dd33/cmd/deploy.go#L282

The value is simply forwarded to the fn.Client (through NewClient): https://github.com/knative/func/blob/1e7dd33/cmd/client.go#L58, and then used to create the transport with InsecureSkipVerify:

https://github.com/knative/func/blob/1e7dd33/cmd/client.go#L96-L98

func newTransport(insecureSkipVerify bool) fnhttp.RoundTripCloser {
	return fnhttp.NewRoundTripper(fnhttp.WithInsecureSkipVerify(insecureSkipVerify), fnhttp.WithOpenShiftServiceCA())
}

I'm pretty confident it's not used elsewhere, but I'm not familiar with the codebase, so tell me if I've missed something.


Note: To me, a better solution would be to completely rename this flag, to something like --insecure-skip-verify or --registry-insecure-skip-verify, as it's effectively only used to configure the InsecureSkipVerify booleans in HTTP transport-related parts of the code.

However, since renaming is a breaking change, I'm not sure if it can be done easily. Another approach, if we want to rename, would be to just 1) add a new flag --insecure-skip-verify, 2) deprecate the existing --registry-insecure, and 3) eventually sunset --registry-insecure.

Internally changing the variable name from RegistryInsecure to InsecureSkipVerify, without touching the flag name, is also possible though. Tell me what you think of this.

In the meantime, changing the description is a good first step IMO to help users figuring out what this flag really means.

Release Note

/

Docs

/

@knative-prow knative-prow bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 8, 2024
Copy link

knative-prow bot commented Jun 8, 2024

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

Copy link

codecov bot commented Jun 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.11%. Comparing base (1e7dd33) to head (6bf7c8f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2348      +/-   ##
==========================================
+ Coverage   60.22%   63.11%   +2.88%     
==========================================
  Files         128      128              
  Lines       14890    11532    -3358     
==========================================
- Hits         8968     7278    -1690     
+ Misses       5003     3339    -1664     
+ Partials      919      915       -4     
Flag Coverage Δ
e2e-test 38.00% <100.00%> (ø)
e2e-test-oncluster 31.18% <100.00%> (-0.05%) ⬇️
e2e-test-oncluster-runtime 27.12% <100.00%> (?)
e2e-test-runtime-go 26.01% <100.00%> (?)
e2e-test-runtime-node 27.00% <100.00%> (?)
e2e-test-runtime-python 27.00% <100.00%> (?)
e2e-test-runtime-quarkus 27.10% <100.00%> (?)
e2e-test-runtime-rust 26.11% <100.00%> (?)
e2e-test-runtime-springboot 26.15% <100.00%> (?)
e2e-test-runtime-typescript 27.09% <100.00%> (?)
integration-tests ?
unit-tests 49.29% <100.00%> (?)
unit-tests-macos-latest ?
unit-tests-ubuntu-latest ?
unit-tests-windows-latest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@norbjd
Copy link
Contributor Author

norbjd commented Jun 10, 2024

I can't really understand why the integration test is failing (logs seems ok to me, but I have trouble reading the logs).

I'm assuming the test is just flaky and will work after a few retries 🔧

@matejvasek
Copy link
Contributor

@norbjd for some reason tests run out of space in the GH action.

@matejvasek
Copy link
Contributor

@dsimansk would you please override the test?

@jrangelramos
Copy link
Contributor

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2024
@dsimansk
Copy link
Contributor

/override "Integration Test (ubuntu-latest)"

Copy link

knative-prow bot commented Jun 11, 2024

@dsimansk: Overrode contexts on behalf of dsimansk: Integration Test (ubuntu-latest)

In response to this:

/override "Integration Test (ubuntu-latest)"

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.

@matejvasek
Copy link
Contributor

/approve

Copy link

knative-prow bot commented Jun 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matejvasek, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 11, 2024
@knative-prow knative-prow bot merged commit d8793d4 into knative:main Jun 11, 2024
39 of 40 checks passed
@norbjd norbjd deleted the clarify-registry-insecure-flag branch June 16, 2024 08:50
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. kind/documentation lgtm Indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants