Skip to content

Commit

Permalink
fixes to cli
Browse files Browse the repository at this point in the history
Signed-off-by: Dipankar Das <[email protected]>
  • Loading branch information
dipankardas011 committed May 31, 2024
1 parent cc1cecb commit 2f2ea29
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 7 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/test-mock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ jobs:
run: |
set -xe
ksctl create local -n demolocal -s store-local --verbose -1 --approve
- name: local create mongodb
run: |
set -xe
unset KSCTL_FAKE_FLAG_ENABLED
docker run -d \
--name mongodb \
-p 27017:27017 \
Expand Down Expand Up @@ -238,18 +243,34 @@ jobs:
- name: local get
run: |
set -xe
ksctl get -p local -s external-store-mongodb
ksctl get -p local -s store-local
- name: local get mongo
run: |
set -xe
unset KSCTL_FAKE_FLAG_ENABLED
ksctl get -p local -s external-store-mongodb
- name: all
run: |
set -xe
ksctl get -s store-local
- name: all mongodb
run: |
set -xe
unset KSCTL_FAKE_FLAG_ENABLED
ksctl get -s external-store-mongodb
- name: local switch
run: |
set -xe
ksctl switch -p local -n demolocal -s store-local
- name: local switch mongodb
run: |
set -xe
unset KSCTL_FAKE_FLAG_ENABLED
ksctl switch -p local -n demolocal-extmongo -s external-store-mongodb
- name: civo switch
Expand Down Expand Up @@ -310,6 +331,11 @@ jobs:
run: |
set -xe
ksctl delete local -n demolocal -v -1 -s store-local --approve
- name: local delete mongodb
run: |
set -xe
unset KSCTL_FAKE_FLAG_ENABLED
ksctl delete local -n demolocal-extmongo -v -1 -s external-store-mongodb --approve
- name: storage provider
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/addNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cmd
// authors Dipankar <[email protected]>

import (
"os"

"github.com/fatih/color"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
"os"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -38,6 +39,7 @@ ksctl create-cluster ha-azure add-nodes <arguments to civo cloud provider>
cli.Client.Metadata.IsHA = true
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.K8sVersion = k8sVer
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/addNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cmd
// authors Dipankar <[email protected]>

import (
"github.com/fatih/color"
"os"

"github.com/fatih/color"

"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
Expand Down Expand Up @@ -39,6 +40,7 @@ ksctl create-cluster ha-azure add-nodes <arguments to civo cloud provider>
cli.Client.Metadata.IsHA = true
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.K8sVersion = k8sVer
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/addNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cmd
// authors Dipankar <[email protected]>

import (
"github.com/fatih/color"
"os"

"github.com/fatih/color"

"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
Expand Down Expand Up @@ -39,6 +40,7 @@ ksctl create-cluster ha-civo add-nodes <arguments to civo cloud provider>
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.K8sVersion = k8sVer
cli.Client.Metadata.IsHA = true
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
Expand Down
5 changes: 5 additions & 0 deletions cli/cmd/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var credCmd = &cobra.Command{
if len(storage) == 0 {
storage = string(consts.StoreLocal)
}
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

SetRequiredFeatureFlags(ctx, log, cmd)

Expand All @@ -51,6 +52,10 @@ var credCmd = &cobra.Command{
log,
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to initialize", "Reason", err)
os.Exit(1)
}

if err := m.Credentials(); err != nil {
log.Error(ctx, "Failed to added the credential", "Reason", err)
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/deleteNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cmd
// authors Dipankar <[email protected]>

import (
"os"

"github.com/fatih/color"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
"os"

"github.com/ksctl/ksctl/pkg/helpers/consts"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -35,6 +36,7 @@ ksctl delete-cluster ha-aws delete-nodes <arguments to cloud provider>
cli.Client.Metadata.ClusterName = clusterName
cli.Client.Metadata.Region = region
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := deleteApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(ctx, "deleteApproval", "Reason", err)
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/deleteNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cmd
// authors Dipankar <[email protected]>

import (
"os"

"github.com/fatih/color"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
"os"

"github.com/ksctl/ksctl/pkg/helpers/consts"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -35,6 +36,7 @@ ksctl delete-cluster ha-azure delete-nodes <arguments to cloud provider>
cli.Client.Metadata.ClusterName = clusterName
cli.Client.Metadata.Region = region
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := deleteApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(ctx, "deleteApproval", "Reason", err)
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/deleteNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cmd
// authors Dipankar <[email protected]>

import (
"os"

"github.com/fatih/color"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"
"os"

"github.com/ksctl/ksctl/pkg/helpers/consts"
"github.com/spf13/cobra"
Expand All @@ -33,6 +34,7 @@ ksctl delete-cluster ha-civo delete-nodes <arguments to cloud provider>
cli.Client.Metadata.ClusterName = clusterName
cli.Client.Metadata.Region = region
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := deleteApproval(ctx, log, cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(ctx, "deleteApproval", "Reason", err)
Expand Down

0 comments on commit 2f2ea29

Please sign in to comment.