-
Notifications
You must be signed in to change notification settings - Fork 23
[kn-source-kafka] Add kafka source command group #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
@daisy-ycguo: you cannot LGTM your own PR. In response to this:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried building locally and noticed the auto generated README is out of sync with the PR, also added a few suggestions in README
Please address @navidshaikh comments. Once done LGTM |
/approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try and bump the client dep to master and see how that goes? This should help use broker
at v1beta1
in sink prefixes for addressable of kafka source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
plugins/source-kafka/vendor/github.com/maximilien/kn-source-pkg/pkg/util/docs_generator.go
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
plugins/source-kafka/vendor/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go
Show resolved
Hide resolved
plugins/source-kafka/vendor/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go
Show resolved
Hide resolved
@navidshaikh thank you for the review. I have addressed your comments. |
@navidshaikh LGTM so feel free to check @daisy-ycguo’s changes and merge when you feel ready. Best. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested multiple changes, IMO there are a few important changes we should address, for example error handling, client dependency, command help messages, etc. We may also look at doing these fixes in next iteration(s) as well.
|
||
func (f *kafkaSourceCommandFactory) CreateCommand() *cobra.Command { | ||
createCmd := f.defaultCommandFactory.CreateCommand() | ||
createCmd.Short = "create NAME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be createCmd.Use
with signature for mandatory flags.
See https://github.com/knative/client/blob/master/pkg/kn/commands/source/ping/create.go#L35-L36 for reference.
sourceCmd := f.defaultCommandFactory.SourceCommand() | ||
sourceCmd.Use = "kafka" | ||
sourceCmd.Short = "Knative eventing Kafka source plugin" | ||
sourceCmd.Long = "Manage your Knative Kafka eventing sources" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sourceCmd.Long = "Manage your Knative Kafka eventing sources" | |
sourceCmd.Long = "Manage Knative Kafka eventing sources" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or remove sourceCmd.Long
if its same as .Short
text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I removed Long
but use Short
instead. I also changed short
to use
. Thank you.
gotest.tools v2.2.0+incompatible | ||
k8s.io/apimachinery v0.17.4 | ||
k8s.io/client-go v0.17.4 | ||
knative.dev/client v0.14.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we should try to keep to client's dep on the latest release (or even master) to make sure the latest fixes, eventing/serving API support is up-to-date. For example: client v0.14.0 refers brokers at v1alpha1
, client master refers brokers at v1beta1
in sink prefixes; this could bring uncertain behavior. Also, IMO plugins should declare the deps and support on its root README for API support.
// NewKafkaSourceClient is to create a KafkaSourceClient | ||
func NewKafkaSourceClient(kafkaParams *types.KafkaSourceParams, c clientv1alpha1.SourcesV1alpha1Interface, ns string) types.KafkaSourceClient { | ||
if c == nil { | ||
c, _ = kafkaParams.NewSourcesClient() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not handling error here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws stacktrace in absence of kubeconfig
kn source kafka create mykafkasrc --servers my-cluster-kafka-bootstrap.kafka.svc:9092 --topics test-topic --consumergroup test-consumer-group --sink svc:event-display
panic: Could not create Kn source client, error: no kubeconfig has been provided, please use a valid configuration to connect to the cluster
goroutine 1 [running]:
github.com/maximilien/kn-source-pkg/pkg/client.NewKnSourceClient(0xc0000f7c80, 0x160ef5d, 0x7, 0xc00078f200, 0x180ab60)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/vendor/github.com/maximilien/kn-source-pkg/pkg/client/client.go:35 +0x193
knative.dev/client-contrib/plugins/source-kafka/pkg/client.NewKafkaSourceClient(0xc000057000, 0x1818a40, 0x0, 0x160ef5d, 0x7, 0xc00078e1a0, 0x0)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/pkg/client/client.go:46 +0x63
knative.dev/client-contrib/plugins/source-kafka/pkg/factories.(*kafkaClientFactory).initKafkaSourceClient(0xc0003e1740, 0x160ef5d, 0x7)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/pkg/factories/source_factory.go:99 +0x65
knative.dev/client-contrib/plugins/source-kafka/pkg/factories.(*kafkaClientFactory).CreateKafkaSourceClient(0xc0003e1740, 0x160ef5d, 0x7, 0x7, 0x0)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/pkg/factories/source_factory.go:51 +0x62
knative.dev/client-contrib/plugins/source-kafka/pkg/factories.(*kafkaSourceRunEFactory).KafkaSourceClient(...)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/pkg/factories/rune_factory.go:62
knative.dev/client-contrib/plugins/source-kafka/pkg/factories.(*kafkaSourceRunEFactory).CreateRunE.func1(0xc0000cedc0, 0xc00018e2d0, 0x1, 0x9, 0x0, 0x0)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/pkg/factories/rune_factory.go:81 +0xaf
github.com/spf13/cobra.(*Command).execute(0xc0000cedc0, 0xc00018e1b0, 0x9, 0x9, 0xc0000cedc0, 0xc00018e1b0)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/vendor/github.com/spf13/cobra/command.go:832 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000ceb00, 0xc0003e1740, 0x7f9ef81c2180, 0xc0005110a0)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/vendor/github.com/spf13/cobra/command.go:920 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/vendor/github.com/spf13/cobra/command.go:870
main.main()
/home/nshaikh/go/src/github.com/knative/client-contrib/plugins/source-kafka/cmd/main.go:34 +0x40c
Error: exit status 2
Run 'kn --help' for usage
@@ -0,0 +1,222 @@ | |||
// Copyright © 2018 The Knative Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_factory.go instead of rune_factory.go ?
return nil | ||
} | ||
|
||
//GetKafkaSource is used to create an instance of KafkaSource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//GetKafkaSource is used to create an instance of KafkaSource | |
//GetKafkaSource to get an instance of Kafka source by given name |
func (f *kafkaSourceCommandFactory) DescribeCommand() *cobra.Command { | ||
describeCmd := f.defaultCommandFactory.DescribeCommand() | ||
describeCmd.Short = "describe NAME" | ||
describeCmd.Long = "update a Kafka source" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describeCmd.Long = "update a Kafka source" | |
describeCmd.Long = "describe a Kafka source" |
ref := sink.Ref | ||
if ref != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref := sink.Ref | |
if ref != nil { | |
if sink.Ref != nil { |
if err.Error() != "subcommand is required" { | ||
fmt.Fprintln(os.Stderr, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if err.Error() != "subcommand is required" { | |
fmt.Fprintln(os.Stderr, err) | |
} | |
fmt.Fprintln(os.Stderr, err) |
/lgtm lets get this in and work on
in next iterations. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: daisy-ycguo, maximilien, navidshaikh 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 |
|
Including: