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

Release v1.2.0 #25

Merged
merged 8 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
310 changes: 123 additions & 187 deletions .github/workflows/test-mock.yml

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions .github/workflows/testLogger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Testing Logger
on:
push:
paths:
- 'logger/**'
- 'go.mod'
- 'go.sum'
branches: [ main ]
pull_request:
paths:
- 'logger/**'
- 'go.mod'
- 'go.sum'
branches: [ main ]

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.0
- run: go version
- name: testing
working-directory: logger
run: |
go test -v ./...
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ lint: golangci-lint ## Run golangci-lint linter & yamllint
$(GOLANGCI_LINT) run && echo -e "\n=========\n\033[91m✔ PASSED\033[0m\n=========\n" || echo -e "\n=========\n\033[91m✖ FAILED\033[0m\n=========\n"


##@ Dependencies (Controller)
##@ Dependencies

## Location to install dependencies to
LOCALBIN ?= /tmp/bin
Expand Down
44 changes: 25 additions & 19 deletions cli/cmd/addNodesHAAws.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
package cmd

// authors Dipankar <[email protected]>

import (
"context"
"os"

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

"github.com/spf13/cobra"

"github.com/ksctl/ksctl/pkg/helpers/consts"
)

var addMoreWorkerNodesHAAws = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Example: `
ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --nodeSizeWP t2.medium --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Use: "add-nodes",
Short: "Use to add more worker nodes in HA aws k3s cluster",
Long: `It is used to add nodes to worker nodes in cluster with the given name from user. For example:

ksctl create-cluster ha-azure add-nodes <arguments to civo cloud provider>
`,
Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Aws",
Long: "It is used to add nodes to worker nodes in cluster with the given name from user.",
Run: func(cmd *cobra.Command, args []string) {
verbosity, _ := cmd.Flags().GetInt("verbose")
SetRequiredFeatureFlags(cmd)
var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout)
SetRequiredFeatureFlags(ctx, log, cmd)

cli.Client.Metadata.LogVerbosity = verbosity
cli.Client.Metadata.LogWritter = os.Stdout
cli.Client.Metadata.Provider = consts.CloudAws

SetDefaults(consts.CloudAws, consts.ClusterTypeHa)
Expand All @@ -37,23 +37,29 @@ 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 := safeInitializeStorageLoggerFactory(context.WithValue(context.Background(), "USERID", helpers.GetUserName())); err != nil {
log.Error("Failed Initialize Storage Driver", "Reason", err)
if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
os.Exit(1)
}

if err := createApproval(cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(err.Error())
m, err := controllers.NewManagerClusterSelfManaged(
ctx,
log,
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to init manager", "Reason", err)
os.Exit(1)
}

err := controller.AddWorkerPlaneNode(&cli.Client)
err = m.AddWorkerPlaneNodes()
if err != nil {
log.Error("Failed to scale up", "Reason", err)
log.Error(ctx, "Failed to scale up", "Reason", err)
os.Exit(1)
}
log.Success("Scale up successful")
log.Success(ctx, "Scale up successful")
},
}

Expand Down
45 changes: 26 additions & 19 deletions cli/cmd/addNodesHAAzure.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
package cmd

// authors Dipankar <[email protected]>

import (
"context"
"os"

"github.com/ksctl/ksctl/pkg/helpers"
"github.com/fatih/color"

"github.com/ksctl/cli/logger"
"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/types"

"github.com/spf13/cobra"

"github.com/ksctl/ksctl/pkg/helpers/consts"
)

var addMoreWorkerNodesHAAzure = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Example: `
ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --nodeSizeWP Standard_F2s --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Use: "add-nodes",
Short: "Use to add more worker nodes in HA azure k3s cluster",
Long: `It is used to add nodes to worker nodes in cluster with the given name from user. For example:

ksctl create-cluster ha-azure add-nodes <arguments to civo cloud provider>
`,
Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Azure",
Long: "It is used to add nodes to worker nodes in cluster with the given name from user",
Run: func(cmd *cobra.Command, args []string) {
verbosity, _ := cmd.Flags().GetInt("verbose")
SetRequiredFeatureFlags(cmd)
var log types.LoggerFactory = logger.NewLogger(verbosity, os.Stdout)
SetRequiredFeatureFlags(ctx, log, cmd)

cli.Client.Metadata.LogVerbosity = verbosity
cli.Client.Metadata.LogWritter = os.Stdout
cli.Client.Metadata.Provider = consts.CloudAzure

SetDefaults(consts.CloudAzure, consts.ClusterTypeHa)
Expand All @@ -37,23 +38,29 @@ 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 := safeInitializeStorageLoggerFactory(context.WithValue(context.Background(), "USERID", helpers.GetUserName())); err != nil {
log.Error("Failed Inialize Storage Driver", "Reason", err)
if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
os.Exit(1)
}

if err := createApproval(cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(err.Error())
m, err := controllers.NewManagerClusterSelfManaged(
ctx,
log,
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to init manager", "Reason", err)
os.Exit(1)
}

err := controller.AddWorkerPlaneNode(&cli.Client)
err = m.AddWorkerPlaneNodes()
if err != nil {
log.Error("Failed to scale up", "Reason", err)
log.Error(ctx, "Failed to scale up", "Reason", err)
os.Exit(1)
}
log.Success("Scale up successful")
log.Success(ctx, "Scale up successful")
},
}

Expand Down
46 changes: 27 additions & 19 deletions cli/cmd/addNodesHACivo.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
package cmd

// authors Dipankar <[email protected]>

import (
"context"
"os"

"github.com/ksctl/ksctl/pkg/helpers"
"github.com/fatih/color"

"github.com/ksctl/ksctl/pkg/controllers"
"github.com/ksctl/ksctl/pkg/logger"
"github.com/ksctl/ksctl/pkg/types"

"github.com/ksctl/ksctl/pkg/helpers/consts"
"github.com/spf13/cobra"
)

var addMoreWorkerNodesHACivo = &cobra.Command{
Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Example: `
ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSizeWP g3.medium --bootstrap kubeadm # Here the noWP is the desired count of workernodes
`,
Use: "add-nodes",
Short: "Use to add more worker nodes in HA CIVO k3s cluster",
Long: `It is used to add nodes to worker nodes in cluster with the given name from user. For example:

ksctl create-cluster ha-civo add-nodes <arguments to civo cloud provider>
`,
Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Civo",
Long: "It is used to add nodes to worker nodes in cluster with the given name from user.",
Run: func(cmd *cobra.Command, args []string) {
verbosity, _ := cmd.Flags().GetInt("verbose")
SetRequiredFeatureFlags(cmd)

cli.Client.Metadata.LogVerbosity = verbosity
cli.Client.Metadata.LogWritter = os.Stdout
var log types.LoggerFactory = logger.NewGeneralLogger(verbosity, os.Stdout)
SetRequiredFeatureFlags(ctx, log, cmd)

cli.Client.Metadata.Provider = consts.CloudCivo

SetDefaults(consts.CloudCivo, consts.ClusterTypeHa)
Expand All @@ -36,23 +38,29 @@ 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 := safeInitializeStorageLoggerFactory(context.WithValue(context.Background(), "USERID", helpers.GetUserName())); err != nil {
log.Error("Failed Inialize Storage Driver", "Reason", err)
if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
os.Exit(1)
}

if err := createApproval(cmd.Flags().Lookup("approve").Changed); err != nil {
log.Error(err.Error())
m, err := controllers.NewManagerClusterSelfManaged(
ctx,
log,
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to init manager", "Reason", err)
os.Exit(1)
}

err := controller.AddWorkerPlaneNode(&cli.Client)
err = m.AddWorkerPlaneNodes()
if err != nil {
log.Error("Failed to scale up", "Reason", err)
log.Error(ctx, "Failed to scale up", "Reason", err)
os.Exit(1)
}
log.Success("Scale up successful")
log.Success(ctx, "Scale up successful")
},
}

Expand Down
Loading
Loading