Skip to content

Commit

Permalink
UPdated the ksctl core deps to v1.2.6
Browse files Browse the repository at this point in the history
Signed-off-by: Dipankar Das <[email protected]>
  • Loading branch information
dipankardas011 committed Aug 24, 2024
1 parent e0d6064 commit b34a691
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 138 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.0
go-version: 1.22.0

- name: Install Cosign
uses: sigstore/cosign-installer@main

- name: Set the value
id: set_environment
run: |
set -xe
sudo apt install jq -y
echo "CURR_DATE=$(date '+%d-%m-%Y')" >> $GITHUB_ENV
echo "CURR_VER=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
ksctl_core=$(curl -sSfL https://api.github.com/repos/ksctl/ksctl/releases/latest)
echo "KSCTL_CORE=$(echo $ksctl_core | jq -r '.tag_name')" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
Expand All @@ -43,3 +47,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DATE: ${{ env.CURR_DATE }}
VERSION: ${{ env.CURR_VER }}
OCIVERSION: ${{ env.KSCTL_CORE }}
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ builds:
ldflags:
- -s -w -X "github.com/ksctl/cli/cli/cmd.BuildDate={{.Env.DATE}}"
- -s -w -X "github.com/ksctl/cli/cli/cmd.Version={{.Env.VERSION}}"
- -s -w -X "github.com/ksctl/ksctl/commons.OCIVersion={{.Env.OCIVERSION}}"
env:
- CGO_ENABLED=0

Expand Down
6 changes: 1 addition & 5 deletions cli/cmd/addNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
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
ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --nodeSizeWP t2.medium # Here the noWP is the desired count of workernodes
`,
Use: "add-nodes",
Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Aws",
Expand All @@ -34,8 +34,6 @@ ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --no
cli.Client.Metadata.ClusterName = clusterName
cli.Client.Metadata.Region = region
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("yes").Changed); err != nil {
Expand Down Expand Up @@ -68,8 +66,6 @@ func init() {
noOfWPFlag(addMoreWorkerNodesHAAws)
nodeSizeWPFlag(addMoreWorkerNodesHAAws)
regionFlag(addMoreWorkerNodesHAAws)
k8sVerFlag(addMoreWorkerNodesHAAws)
distroFlag(addMoreWorkerNodesHAAws)
storageFlag(addMoreWorkerNodesHAAws)

addMoreWorkerNodesHAAws.MarkFlagRequired("name")
Expand Down
6 changes: 1 addition & 5 deletions cli/cmd/addNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
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
ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --nodeSizeWP Standard_F2s # Here the noWP is the desired count of workernodes
`,
Use: "add-nodes",
Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Azure",
Expand All @@ -34,8 +34,6 @@ ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --node
cli.Client.Metadata.ClusterName = clusterName
cli.Client.Metadata.Region = region
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("yes").Changed); err != nil {
Expand Down Expand Up @@ -68,8 +66,6 @@ func init() {
noOfWPFlag(addMoreWorkerNodesHAAzure)
nodeSizeWPFlag(addMoreWorkerNodesHAAzure)
regionFlag(addMoreWorkerNodesHAAzure)
k8sVerFlag(addMoreWorkerNodesHAAzure)
distroFlag(addMoreWorkerNodesHAAzure)
storageFlag(addMoreWorkerNodesHAAzure)

addMoreWorkerNodesHAAzure.MarkFlagRequired("name")
Expand Down
6 changes: 1 addition & 5 deletions cli/cmd/addNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
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
ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSizeWP g3.medium # Here the noWP is the desired count of workernodes
`,
Use: "add-nodes",
Short: "Use to add more worker nodes in self-managed Highly-Available cluster on Civo",
Expand All @@ -33,8 +33,6 @@ ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSiz
cli.Client.Metadata.WorkerPlaneNodeType = nodeSizeWP
cli.Client.Metadata.ClusterName = clusterName
cli.Client.Metadata.Region = region
cli.Client.Metadata.K8sDistro = consts.KsctlKubernetes(distro)
cli.Client.Metadata.K8sVersion = k8sVer
cli.Client.Metadata.IsHA = true
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

Expand Down Expand Up @@ -68,8 +66,6 @@ func init() {
noOfWPFlag(addMoreWorkerNodesHACivo)
nodeSizeWPFlag(addMoreWorkerNodesHACivo)
regionFlag(addMoreWorkerNodesHACivo)
k8sVerFlag(addMoreWorkerNodesHACivo)
distroFlag(addMoreWorkerNodesHACivo)
storageFlag(addMoreWorkerNodesHACivo)

addMoreWorkerNodesHACivo.MarkFlagRequired("name")
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/createCluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ksctl create-cluster local --name demo --storage store-local --noMP 3
var createClusterHAAws = &cobra.Command{
Use: "ha-aws",
Example: `
ksctl create-cluster ha-aws -n demo -r us-east-1 --bootstrap k3s -s store-local --nodeSizeCP t2.medium --nodeSizeWP t2.medium --nodeSizeLB t2.micro --nodeSizeDS t2.small --noWP 1 --noCP 3 --noDS 3
ksctl create-cluster ha-aws -n demo -r us-east-1 --bootstrap k3s -s store-local --nodeSizeCP t2.medium --nodeSizeWP t2.medium --nodeSizeLB t2.micro --nodeSizeDS t2.small --noWP 1 --noCP 3 --noDS 3 --cni [email protected]
`,
Short: "Use to create a self-managed Highly Available cluster on AWS",
Long: LongMessage("It is used to create cluster with the given name from user."),
Expand All @@ -123,7 +123,7 @@ var createClusterHACivo = &cobra.Command{
Use: "ha-civo",
Example: `
ksctl create-cluster ha-civo --name demo --region LON1 --bootstrap k3s --storage store-local --nodeSizeCP g3.small --nodeSizeWP g3.medium --nodeSizeLB g3.small --nodeSizeDS g3.small --noWP 1 --noCP 3 --noDS 3
ksctl create-cluster ha-civo --name demo --region LON1 --bootstrap kubeadm --storage store-local --nodeSizeCP g3.medium --nodeSizeWP g3.large --nodeSizeLB g3.small --nodeSizeDS g3.small --noWP 1 --noCP 3 --noDS 3
ksctl create-cluster ha-civo --name demo --region LON1 --bootstrap kubeadm --storage store-local --nodeSizeCP g3.medium --nodeSizeWP g3.large --nodeSizeLB g3.small --nodeSizeDS g3.small --noWP 1 --noCP 3 --noDS 3 --cni [email protected]
`,
Short: "Use to create a self-managed Highly Available cluster on Civo",
Long: LongMessage("It is used to create cluster with the given name from user"),
Expand All @@ -144,7 +144,7 @@ var createClusterHAAzure = &cobra.Command{
Use: "ha-azure",
Example: `
ksctl create-cluster ha-azure --name demo --region eastus --bootstrap k3s --storage store-local --nodeSizeCP Standard_F2s --nodeSizeWP Standard_F2s --nodeSizeLB Standard_F2s --nodeSizeDS Standard_F2s --noWP 1 --noCP 3 --noDS 3
ksctl create-cluster ha-azure --name demo --region eastus --bootstrap kubeadm --storage store-local --nodeSizeCP Standard_F2s --nodeSizeWP Standard_F4s --nodeSizeLB Standard_F2s --nodeSizeDS Standard_F2s --noWP 1 --noCP 3 --noDS 3
ksctl create-cluster ha-azure --name demo --region eastus --bootstrap kubeadm --storage store-local --nodeSizeCP Standard_F2s --nodeSizeWP Standard_F4s --nodeSizeLB Standard_F2s --nodeSizeDS Standard_F2s --noWP 1 --noCP 3 --noDS 3 --cni [email protected]
`,
Short: "Use to create a self-managed Highly-Available cluster on Azure",
Long: LongMessage("It is used to create cluster with the given name from user"),
Expand Down
4 changes: 1 addition & 3 deletions cli/cmd/deleteNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var deleteNodesHAAws = &cobra.Command{
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
Example: `
ksctl delete ha-aws del-nodes -n demo -r us-east-1 -s store-local --noWP 1 --bootstrap kubeadm # Here the noWP is the desired count of workernodes
ksctl delete ha-aws del-nodes -n demo -r us-east-1 -s store-local --noWP 1 # Here the noWP is the desired count of workernodes
`,
Short: "Use to remove worker nodes in self-managed Highly-Available cluster on Aws",
Long: "It is used to delete cluster with the given name from user",
Expand All @@ -32,7 +32,6 @@ ksctl delete ha-aws del-nodes -n demo -r us-east-1 -s store-local --noWP 1 --boo
cli.Client.Metadata.NoWP = noWP
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("yes").Changed); err != nil {
Expand Down Expand Up @@ -65,7 +64,6 @@ func init() {
clusterNameFlag(deleteNodesHAAws)
noOfWPFlag(deleteNodesHAAws)
regionFlag(deleteNodesHAAws)
distroFlag(deleteNodesHAAws)
storageFlag(deleteNodesHAAws)

deleteNodesHAAws.MarkFlagRequired("name")
Expand Down
4 changes: 1 addition & 3 deletions cli/cmd/deleteNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var deleteNodesHAAzure = &cobra.Command{
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
Example: `
ksctl delete ha-azure del-nodes -n demo -r eastus -s store-local --noWP 1 --bootstrap kubeadm # Here the noWP is the desired count of workernodes
ksctl delete ha-azure del-nodes -n demo -r eastus -s store-local --noWP 1 # Here the noWP is the desired count of workernodes
`,
Short: "Use to remove worker nodes in self-managed Highly-Available cluster on Azure",
Long: "It is used to delete cluster with the given name from user",
Expand All @@ -32,7 +32,6 @@ ksctl delete ha-azure del-nodes -n demo -r eastus -s store-local --noWP 1 --boot
cli.Client.Metadata.NoWP = noWP
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("yes").Changed); err != nil {
Expand Down Expand Up @@ -65,7 +64,6 @@ func init() {
clusterNameFlag(deleteNodesHAAzure)
noOfWPFlag(deleteNodesHAAzure)
regionFlag(deleteNodesHAAzure)
distroFlag(deleteNodesHAAzure)
storageFlag(deleteNodesHAAzure)

deleteNodesHAAzure.MarkFlagRequired("name")
Expand Down
5 changes: 1 addition & 4 deletions cli/cmd/deleteNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var deleteNodesHACivo = &cobra.Command{
//Deprecated: color.HiYellowString("This will be removed in future releases once autoscaling is stable"),
Use: "del-nodes",
Example: `
ksctl delete ha-civo del-nodes -n demo -r LON1 -s store-local --noWP 1 --bootstrap kubeadm # Here the noWP is the desired count of workernodes
ksctl delete ha-civo del-nodes -n demo -r LON1 -s store-local --noWP 1 # Here the noWP is the desired count of workernodes
`,
Short: "Use to remove worker nodes in self-managed Highly-Available cluster on Civo",
Long: "It is used to delete cluster with the given name from user",
Expand All @@ -30,7 +30,6 @@ ksctl delete ha-civo del-nodes -n demo -r LON1 -s store-local --noWP 1 --bootstr
cli.Client.Metadata.NoWP = noWP
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("yes").Changed); err != nil {
Expand Down Expand Up @@ -63,8 +62,6 @@ func init() {
clusterNameFlag(deleteNodesHACivo)
noOfWPFlag(deleteNodesHACivo)
regionFlag(deleteNodesHACivo)
//k8sVerFlag(deleteNodesHACivo)
distroFlag(deleteNodesHACivo)
storageFlag(deleteNodesHACivo)

deleteNodesHACivo.MarkFlagRequired("name")
Expand Down
33 changes: 5 additions & 28 deletions cli/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"compress/gzip"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/ksctl/ksctl/poller"
"github.com/rogpeppe/go-internal/semver"
"io"
"net/http"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"

Expand All @@ -25,37 +25,14 @@ func fetchLatestVersion() ([]string, error) {

logCli.Print(ctx, "Fetching available versions")

type Release struct {
TagName string `json:"tag_name"`
}

resp, err := http.Get("https://api.github.com/repos/ksctl/cli/releases")
if err != nil {
return nil, err
}
defer resp.Body.Close()

var _releases []Release
if err := json.NewDecoder(resp.Body).Decode(&_releases); err != nil {
return nil, err
}

var releases []string
rcRegex := regexp.MustCompile(`.*-rc[0-9]+$`)
for _, release := range _releases {
if rcRegex.MatchString(release.TagName) {
continue
}
releases = append(releases, release.TagName)
}

return releases, nil
poller.InitSharedGithubReleasePoller()
return poller.GetSharedPoller().Get("ksctl", "cli")
}

func filterToUpgradeableVersions(versions []string) []string {
var upgradeableVersions []string
for _, version := range versions {
if version > Version {
if semver.Compare(version, Version) > 0 {
upgradeableVersions = append(upgradeableVersions, version)
}
}
Expand Down
Loading

0 comments on commit b34a691

Please sign in to comment.