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

Mark --inject-broker flag as deprecated #1661

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/cmd/kn_trigger_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ kn trigger create NAME --sink SINK
--broker string Name of the Broker which the trigger associates with. (default "default")
--filter strings Key-value pair for exact CloudEvent attribute matching against incoming events, e.g type=dev.knative.foo
-h, --help help for create
--inject-broker Create new broker with name default through common annotation
-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 URI with an 'http://' or 'https://' schema, '--sink ksvc:receiver' or simply '--sink receiver' for a Knative service 'receiver' in the current namespace. If a prefix is not provided, it is considered as a Knative service in the current namespace. If referring to a Knative service in another namespace, 'ksvc:name:namespace' combination must be provided explicitly.
```
Expand Down
1 change: 0 additions & 1 deletion docs/cmd/kn_trigger_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ kn trigger update NAME
--broker string Name of the Broker which the trigger associates with. (default "default")
--filter strings Key-value pair for exact CloudEvent attribute matching against incoming events, e.g type=dev.knative.foo
-h, --help help for update
--inject-broker Create new broker with name default through common annotation
-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 URI with an 'http://' or 'https://' schema, '--sink ksvc:receiver' or simply '--sink receiver' for a Knative service 'receiver' in the current namespace. If a prefix is not provided, it is considered as a Knative service in the current namespace. If referring to a Knative service in another namespace, 'ksvc:name:namespace' combination must be provided explicitly.
```
Expand Down
6 changes: 6 additions & 0 deletions pkg/kn/commands/trigger/update_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ func (f *TriggerUpdateFlags) GetUpdateFilters() (map[string]string, []string, er
//Add is to set parameters
func (f *TriggerUpdateFlags) Add(cmd *cobra.Command) {
cmd.Flags().StringVar(&f.Broker, "broker", "default", "Name of the Broker which the trigger associates with.")
// The Sugar controller was integrated into main Eventing controller. With that the default behavior was changed as well.
// Users need to configure 'Automatic Broker Creation' per linked docs.
// Deprecated in 1.4, remove in 1.6.
cmd.Flags().BoolVar(&f.InjectBroker, "inject-broker", false, "Create new broker with name default through common annotation")
cmd.Flags().MarkDeprecated("inject-broker", "effective since 1.4 and will be removed in 1.6 release. \n"+
"Please refer to 'Automatic Broker Creation' section for configuration options, "+
"https://knative.dev/docs/eventing/sugar/#automatic-broker-creation.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add the recommendation to create a Broker directly via kn broker create, because that is what a user can do. I think we shouldn't really think about automatic broker creation on this level.

So maybe this a description:

Automatic broker creation is deprecated and might not work anymore for Knative >= 1.4 (depending on server-side configuration). Please manage brokers directly with the `kn broker` commands.

I wouldn't mention that this is deprecated since client 1.4, I think its good enough to know that it's deprecated for the currently used version ;-). Also wouldn't put in links in the help message if not absolutely needed as we can't be sure that this link will stay stable over time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I was thinking about how stable those links might be.

Does it look better? (the prefix is part of cobra MarkDeprecated function)

Flag --inject-broker has been deprecated, automatic broker creation might not work anymore for Knative >= 1.4 (depending on server-side configuration). 
Please manage brokers directly with the `kn broker` commands.

Copy link
Contributor

Choose a reason for hiding this comment

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

looks good, thanks !

/approve
/lgtm

cmd.Flags().StringSliceVar(&f.Filters, "filter", nil, "Key-value pair for exact CloudEvent attribute matching against incoming events, e.g type=dev.knative.foo")
}