Skip to content

Commit

Permalink
Corrected version for kn create kafka channel (#1886)
Browse files Browse the repository at this point in the history
* Corrected version for kn create kafka channel

* Correct message

* Fix missing import

---------

Co-authored-by: David Simansky <dsimansk@redhat.com>
  • Loading branch information
MeenuyD and dsimansk authored Nov 30, 2023
1 parent cef926d commit 5b33d70
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/cmd/kn_channel_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ kn channel create NAME
kn channel create imc1 --type messaging.knative.dev:v1:InMemoryChannel
# Create a channel 'k1' of type KafkaChannel
kn channel create k1 --type messaging.knative.dev:v1alpha1:KafkaChannel
kn channel create k1 --type messaging.knative.dev:v1beta1:KafkaChannel
```

### Options

```
-h, --help help for create
-n, --namespace string Specify the namespace to operate in.
--type string Override channel type to create, in the format '--type Group:Version:Kind'. If flag is not specified, it uses default messaging layer settings for channel type, cluster wide or specific namespace. You can configure aliases for channel types in kn config and refer the aliases with this flag. You can also refer inbuilt channel type InMemoryChannel using an alias 'imc' like '--type imc'. Examples: '--type messaging.knative.dev:v1alpha1:KafkaChannel' for specifying explicit Group:Version:Kind.
--type string Override channel type to create, in the format '--type Group:Version:Kind'. If flag is not specified, it uses default messaging layer settings for channel type, cluster wide or specific namespace. You can configure aliases for channel types in kn config and refer the aliases with this flag. You can also refer inbuilt channel type InMemoryChannel using an alias 'imc' like '--type imc'. Examples: '--type messaging.knative.dev:v1beta1:KafkaChannel' for specifying explicit Group:Version:Kind.
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/cmd/kn_subscription_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ kn subscription create NAME
kn subscription create sub0 --channel imcv1beta1:pipe0 --sink ksvc:receiver
# Create a subscription 'sub1' from KafkaChannel 'k1' to ksvc 'mirror', reply to a broker 'nest' and DeadLetterSink to a ksvc 'bucket'
kn subscription create sub1 --channel messaging.knative.dev:v1alpha1:KafkaChannel:k1 --sink mirror --sink-reply broker:nest --sink-dead-letter bucket
kn subscription create sub1 --channel messaging.knative.dev:v1beta1:KafkaChannel:k1 --sink mirror --sink-reply broker:nest --sink-dead-letter bucket
```

### Options

```
--channel string Specify the channel to subscribe to. For the default channel, just use the name (e.g. 'mychannel'). A mapped channel type like 'imc' can be used as a prefix (e.g. 'imc:mychannel'). Finally you can specify the full coordinates to the referenced channel with Group:Version:Kind:Name (e.g. 'messaging.knative.dev:v1alpha1:KafkaChannel:mychannel').
--channel string Specify the channel to subscribe to. For the default channel, just use the name (e.g. 'mychannel'). A mapped channel type like 'imc' can be used as a prefix (e.g. 'imc:mychannel'). Finally you can specify the full coordinates to the referenced channel with Group:Version:Kind:Name (e.g. 'messaging.knative.dev:v1beta1:KafkaChannel:mychannel').
-h, --help help for create
-n, --namespace string Specify the namespace to operate in.
-s, --sink string Addressable sink for events. You can specify a broker, channel, Knative service or URI. Examples: '--sink broker:nest' for a broker 'nest', '--sink channel:pipe' for a channel 'pipe', '--sink ksvc:mysvc:mynamespace' for a Knative service 'mysvc' in another namespace 'mynamespace', '--sink https://event.receiver.uri' for an HTTP URI, '--sink ksvc:receiver' or simply '--sink receiver' for a Knative service 'receiver' in the current namespace. '--sink special.eventing.dev/v1alpha1/channels:pipe' for GroupVersionResource of v1alpha1 'pipe'. If a prefix is not provided, it is considered as a Knative service in the current namespace.
Expand Down
2 changes: 1 addition & 1 deletion pkg/kn/commands/channel/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewChannelCreateCommand(p *commands.KnParams) *cobra.Command {
kn channel create imc1 --type messaging.knative.dev:v1:InMemoryChannel
# Create a channel 'k1' of type KafkaChannel
kn channel create k1 --type messaging.knative.dev:v1alpha1:KafkaChannel`,
kn channel create k1 --type messaging.knative.dev:v1beta1:KafkaChannel`,

RunE: func(cmd *cobra.Command, args []string) (err error) {
if len(args) != 1 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kn/commands/subscription/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewSubscriptionCreateCommand(p *commands.KnParams) *cobra.Command {
kn subscription create sub0 --channel imcv1beta1:pipe0 --sink ksvc:receiver
# Create a subscription 'sub1' from KafkaChannel 'k1' to ksvc 'mirror', reply to a broker 'nest' and DeadLetterSink to a ksvc 'bucket'
kn subscription create sub1 --channel messaging.knative.dev:v1alpha1:KafkaChannel:k1 --sink mirror --sink-reply broker:nest --sink-dead-letter bucket`,
kn subscription create sub1 --channel messaging.knative.dev:v1beta1:KafkaChannel:k1 --sink mirror --sink-reply broker:nest --sink-dead-letter bucket`,

RunE: func(cmd *cobra.Command, args []string) (err error) {
if len(args) != 1 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/kn/flags/channel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (i *ChannelTypeFlags) Add(f *pflag.FlagSet) {
"If flag is not specified, it uses default messaging layer settings for channel type, cluster wide or specific namespace. "+
"You can configure aliases for channel types in kn config and refer the aliases with this flag. "+
"You can also refer inbuilt channel type InMemoryChannel using an alias 'imc' like '--type imc'. "+
"Examples: '--type messaging.knative.dev:v1alpha1:KafkaChannel' for specifying explicit Group:Version:Kind.")
"Examples: '--type messaging.knative.dev:v1beta1:KafkaChannel' for specifying explicit Group:Version:Kind.")

for _, p := range config.GlobalConfig.ChannelTypeMappings() {
//user configuration might override the default configuration
Expand Down Expand Up @@ -94,7 +94,7 @@ func (i *ChannelRef) Add(f *pflag.FlagSet) {
"just use the name (e.g. 'mychannel'). A mapped channel type like 'imc' "+
"can be used as a prefix (e.g. 'imc:mychannel'). "+
"Finally you can specify the full coordinates to the referenced channel "+
"with Group:Version:Kind:Name (e.g. 'messaging.knative.dev:v1alpha1:KafkaChannel:mychannel').")
"with Group:Version:Kind:Name (e.g. 'messaging.knative.dev:v1beta1:KafkaChannel:mychannel').")
}

// Parse parses the CLI value for channel ref flag and populates object reference or return error
Expand Down

0 comments on commit 5b33d70

Please sign in to comment.