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

💝 Extract reusable part of sink flag #1968

Merged
merged 6 commits into from
Sep 25, 2024

Conversation

cardil
Copy link
Contributor

@cardil cardil commented Sep 13, 2024

Description

Changes

  • 💝 Extract reusable part of sink flag

Reference

Fixes #

Copy link

knative-prow bot commented Sep 13, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 13, 2024
Copy link

@knative-prow knative-prow bot left a comment

Choose a reason for hiding this comment

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

@cardil: 0 warnings.

In response to this:

Description

Changes

  • 💝 Extract reusable part of sink flag

Reference

Fixes #

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.

@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 13, 2024
@knative-prow knative-prow 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 Sep 13, 2024
@cardil cardil force-pushed the feature/sink-reuse branch 6 times, most recently from b41d2b2 to 0c0828b Compare September 16, 2024 16:35
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 80.69498% with 50 lines in your changes missing coverage. Please review.

Project coverage is 75.77%. Comparing base (fd0126d) to head (3a2bcba).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/flags/sink/sink.go 82.40% 15 Missing and 7 partials ⚠️
pkg/k8s/params.go 60.97% 15 Missing and 1 partial ⚠️
pkg/output/logging/context.go 63.63% 3 Missing and 1 partial ⚠️
pkg/output/logging/zap.go 0.00% 4 Missing ⚠️
pkg/dynamic/fake/fake.go 77.77% 1 Missing and 1 partial ⚠️
pkg/util/errors/cause.go 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1968      +/-   ##
==========================================
- Coverage   75.78%   75.77%   -0.01%     
==========================================
  Files         228      234       +6     
  Lines       13411    13538     +127     
==========================================
+ Hits        10163    10259      +96     
- Misses       2425     2451      +26     
- Partials      823      828       +5     

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

@cardil
Copy link
Contributor Author

cardil commented Sep 16, 2024

/test all

@cardil
Copy link
Contributor Author

cardil commented Sep 16, 2024

/test all

@cardil
Copy link
Contributor Author

cardil commented Sep 17, 2024

/test all

@knative-prow knative-prow bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 18, 2024
@cardil
Copy link
Contributor Author

cardil commented Sep 18, 2024

/test all

@cardil cardil marked this pull request as ready for review September 19, 2024 15:21
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 19, 2024
@dsimansk
Copy link
Contributor

@cardil thanks for the PR! I'll go trough the PR later today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dsimansk I added changes to the logging package, that I use in knative-extensions/kn-plugin-event#368 (just for the continence of working on that kn-event PR)

I can extract those changes to separate PR if you like.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Last two commits, basically:

  1. a386468
  2. 3a2bcba

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, that's fine. Thanks for highlighting it.

@@ -69,7 +69,7 @@ func TestSubscriptionList(t *testing.T) {
assert.NilError(t, err)
ol := strings.Split(out, "\n")
assert.Check(t, util.ContainsAll(ol[0], "NAME", "CHANNEL", "SUBSCRIBER", "REPLY", "DEAD LETTER SINK", "READY", "REASON"))
assert.Check(t, util.ContainsAll(ol[1], "s0", "InMemoryChannel:imc0", "ksvc:ksvc0", "broker:b00", "broker:b01"))
assert.Check(t, util.ContainsAll(ol[1], "s0", "InMemoryChannel:imc0", "ksvc0", "broker:b00", "broker:b01"))
Copy link
Contributor

@dsimansk dsimansk Sep 24, 2024

Choose a reason for hiding this comment

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

@cardil this ksvc prefix was dropped because of changes in SinkToString -> AsText() functions? It might have been midly useful to have a type reference in this list. But not necessary required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I wrote the AsText method to be as close as possible to the old one, but I thought that if we default to kservice in the input (ksvc:, and kservice: prefixes are optional), maybe we should also be consistent on the output side?

If you think, we should print those prefixes, even for kservice, then I can change it back.

BTW. Maybe we should deprecate the SinkAsString method (in favor of AsText), as it doesn't care about namespaces. If you target something from a different namespace, it will just print it by name, which is confusing to say the least.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, OK let's keep it as optional. Apparently, judging by the test changes we haven't expected a lot of those types prefixes anyway.

Comment on lines -250 to -251
// GetClientConfig gets ClientConfig from KubeCfgPath
func (params *KnParams) GetClientConfig() (clientcmd.ClientConfig, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, for cleaning this part. It seems like a very old piece, that doesn't make a lot of sense here.

Copy link
Contributor Author

@cardil cardil Sep 24, 2024

Choose a reason for hiding this comment

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

Yep. Now, the kubernetes related params are in their own struct, which makes far more sense.

BTW. I love the struct composition in Go. Such a great idea, they had...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ops, in my first comment I thought it's located in different file. I.e. that an isolated command tried to override the config loading. Anyway, it makes sense here, but it's fine to have it extracted as you did. All good here! :)

@dsimansk
Copy link
Contributor

@cardil I have one question in subscription list output, but I'm not sure if it's any valid concern towards backwards compability or not. :)

/lgmt
/hold feel free to unhold if the above seems OK.

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2024
@dsimansk
Copy link
Contributor

/approve

Copy link

knative-prow bot commented Sep 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cardil, dsimansk

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 Sep 24, 2024
@dsimansk
Copy link
Contributor

/lgtm

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

/unhold I'm OK to proceed with the merge.

@cardil
Copy link
Contributor Author

cardil commented Sep 25, 2024

/unhold

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 25, 2024
@knative-prow knative-prow bot merged commit c9f1284 into knative:main Sep 25, 2024
23 checks passed
@cardil cardil deleted the feature/sink-reuse branch September 25, 2024 11:28
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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants