Change createAlertCmdRun parsing to include namespace

Signed-off-by: Alison Dowdney <alison@alisondowdney.com>
pull/1278/head
Alison Dowdney 4 years ago
parent 7dcf884e38
commit b1484f2f24

@ -74,7 +74,7 @@ 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)
} }
@ -82,6 +82,7 @@ func createAlertCmdRun(cmd *cobra.Command, args []string) error {
eventSources = append(eventSources, notificationv1.CrossNamespaceObjectReference{ eventSources = append(eventSources, notificationv1.CrossNamespaceObjectReference{
Kind: kind, Kind: kind,
Name: name, Name: name,
Namespace: namespace,
}) })
} }

Loading…
Cancel
Save