Skip to content

Commit 10f3afd

Browse files
authored
fix: kbcli kb install failed (#605)
1 parent f11c22d commit 10f3afd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pkg/cmd/kubeblocks/install.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,17 @@ func (o *InstallOptions) checkNamespace() error {
534534
// target namespace is not specified, use default namespace
535535
if o.HelmCfg.Namespace() == "" {
536536
o.HelmCfg.SetNamespace(o.Namespace)
537+
}
538+
if o.Namespace == types.DefaultNamespace {
537539
o.CreateNamespace = true
538540
}
539541
fmt.Fprintf(o.Out, "KubeBlocks will be installed to namespace \"%s\"\n", o.HelmCfg.Namespace())
540542
// check if namespace exists
541543
if !o.CreateNamespace {
542544
_, err := o.Client.CoreV1().Namespaces().Get(context.TODO(), o.Namespace, metav1.GetOptions{})
545+
if apierrors.IsNotFound(err) {
546+
return fmt.Errorf("namespace %s not found, please use --create-namespace to create it", o.Namespace)
547+
}
543548
return err
544549
}
545550
return nil

0 commit comments

Comments
 (0)