Merge pull request #1278 from alisondy/create-alert-es-ns

Change createAlertCmdRun parsing to include namespace
pull/1285/head
Stefan Prodan 4 years ago committed by GitHub
commit fc3a09b5ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,14 +74,15 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error {
eventSources := []notificationv1.CrossNamespaceObjectReference{} eventSources := []notificationv1.CrossNamespaceObjectReference{}
for _, eventSource := range alertArgs.eventSources { for _, eventSource := range alertArgs.eventSources {
kind, name := utils.ParseObjectKindName(eventSource) kind, name, namespace := utils.ParseObjectKindNameNamespace(eventSource)
if kind == "" { if kind == "" {
return fmt.Errorf("invalid event source '%s', must be in format <kind>/<name>", eventSource) return fmt.Errorf("invalid event source '%s', must be in format <kind>/<name>", eventSource)
} }
eventSources = append(eventSources, notificationv1.CrossNamespaceObjectReference{ eventSources = append(eventSources, notificationv1.CrossNamespaceObjectReference{
Kind: kind, Kind: kind,
Name: name, Name: name,
Namespace: namespace,
}) })
} }

Loading…
Cancel
Save