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

ignore cluster access with save flag #388

Merged
merged 1 commit into from
Nov 28, 2023
Merged
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
29 changes: 18 additions & 11 deletions install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,12 @@ func K8sInstaller(c *k8s.Client, o Options) error {
if o.Env.Auto {
env = k8s.AutoDetectEnvironment(c)
if env == "none" {
return errors.New("unsupported environment or cluster not configured correctly")
if o.Save {
printMessage("⚠️\tNo env provided with \"--save\", setting env to \"generic\"", true)
env = "generic"
} else {
return errors.New("unsupported environment or cluster not configured correctly")
}
}
printMessage("😄\tAuto Detected Environment : "+env, true)
} else {
Expand All @@ -227,16 +232,18 @@ func K8sInstaller(c *k8s.Client, o Options) error {

// Check if the namespace already exists
ns := o.Namespace
if _, err := c.K8sClientset.CoreV1().Namespaces().Get(context.Background(), ns, metav1.GetOptions{}); err != nil {
// Create namespace when doesn't exist
printMessage("🚀\tCreating namespace "+ns+" ", true)
newns := corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
}
if _, err := c.K8sClientset.CoreV1().Namespaces().Create(context.Background(), &newns, metav1.CreateOptions{}); err != nil {
return fmt.Errorf("failed to create namespace %s: %+v", ns, err)
if !o.Save {
if _, err := c.K8sClientset.CoreV1().Namespaces().Get(context.Background(), ns, metav1.GetOptions{}); err != nil {
// Create namespace when doesn't exist
printMessage("🚀\tCreating namespace "+ns+" ", true)
newns := corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
}
if _, err := c.K8sClientset.CoreV1().Namespaces().Create(context.Background(), &newns, metav1.CreateOptions{}); err != nil {
return fmt.Errorf("failed to create namespace %s: %+v", ns, err)
}
}
}

Expand Down
Loading