fix: incorrect deploy namespace warnings (#1257)

This commit is contained in:
Luke Kingland 2022-09-19 16:34:09 -10:00 committed by GitHub
parent e1e33370d3
commit 4b2bdc9b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -690,10 +690,16 @@ func namespace(cfg deployConfig, f fn.Function, stderr io.Writer) (namespace str
}
}
// If the Function is not yet deployed, then immediately return the chosen
// final namespace
if f.Namespace == "" {
return
}
// Warn if in a different namespace than active
active, err := k8s.GetNamespace("")
if err == nil && namespace != active {
fmt.Fprintf(stderr, "Warning: Function is in namespace '%s', but currently active namespace is '%s'. Continuing with redeployment to '%s'.\n", f.Namespace, active, f.Namespace)
fmt.Fprintf(stderr, "Warning: Function is in namespace '%s', but currently active namespace is '%s'. Continuing with redeployment to '%s'.\n", f.Namespace, active, namespace)
}
// Warn if potentially creating an orphan