Skip to content

Commit

Permalink
Merge pull request #29 from ksctl/bump-ksctl-version
Browse files Browse the repository at this point in the history
Bump ksctl version
  • Loading branch information
dipankardas011 authored Jun 21, 2024
2 parents ada7a3e + 647c832 commit bbdd6be
Show file tree
Hide file tree
Showing 22 changed files with 348 additions and 164 deletions.
148 changes: 90 additions & 58 deletions .github/workflows/test-mock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,61 @@ on:
branches: [ main ]

jobs:
ksctl-cli-mongodb-driver:
runs-on: ubuntu-latest
if: |
(
github.event.label.name == 'pr/lgtm' ||
contains(github.event.pull_request.labels.*.name, 'pr/lgtm')
) || (
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
)
env:
MONGODB_URI: "mongodb://root:[email protected]:27017"
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.3

- name: build ksctl linux
run: |
set -x
make install_linux
echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}"
- name: local version
run: |
${{ env.KSCTL_BIN }} version
- name: local create
run: |
docker run -d \
--name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=1234 \
mongo
${{env.KSCTL_BIN}} create local -n demolocal-extmongo -s external-store-mongodb --verbose -1 --yes
${{env.KSCTL_BIN}} info -p local -n demolocal-extmongo -s external-store-mongodb --verbose -1
- name: local get
run: |
${{env.KSCTL_BIN}} get -s external-store-mongodb
- name: local switch
run: |
${{env.KSCTL_BIN}} switch -p local -v -1 -n demolocal-extmongo -s external-store-mongodb
- name: local delete
run: |
${{env.KSCTL_BIN}} delete local -n demolocal-extmongo -v -1 -s external-store-mongodb --yes
ksctl-cli:
strategy:
matrix:
Expand Down Expand Up @@ -51,21 +106,21 @@ jobs:
run: |
Set-PSDebug -Trace 2
cd .\scripts
.\builder.ps1
.\builder-mock.ps1
echo "KSCTL_BIN=$env:LOCALAPPDATA\ksctl\ksctl.exe" >> $env:GITHUB_ENV
- name: build ksctl linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
set -x
make install_linux
make install_linux_mock
echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}"
- name: build ksctl macos
if: ${{ matrix.os == 'macos-latest' }}
run: |
set -x
make install_macos_intel
make install_macos_intel_mock
echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}"
- name: version
Expand All @@ -76,43 +131,48 @@ jobs:
run: |
${{ env.KSCTL_BIN }} create civo -n demo -r LON1 --nodeSizeMP "g4s.kube.small" --version 1.27.1 --verbose -1 -s store-local --yes
${{ env.KSCTL_BIN }} info -p civo -n demo -r LON1 --verbose -1 -s store-local
${{env.KSCTL_BIN}} create ha-civo -n ha-demo-k3s --nodeSizeDS "fake.small" --version 1.27.1 --nodeSizeLB "fake.small" --nodeSizeCP "fake.small" --nodeSizeWP "fake.small" -s store-local -r LON1 --verbose -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} info -p ha-civo -n ha-demo-k3s -s store-local -r LON1 --verbose -1
${{env.KSCTL_BIN}} create ha-civo -n ha-demo-kubeadm --nodeSizeDS "fake.small" --version 1.28 --nodeSizeLB "fake.small" --nodeSizeCP "fake.small" --nodeSizeWP "fake.small" -s store-local -r LON1 --verbose -1 --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-civo -n ha-demo-kubeadm -s store-local -r LON1 --verbose -1
- name: azure create
run: |
${{env.KSCTL_BIN}} create azure -n demo -r fake --nodeSizeMP "fake" -s store-local --version 1.27.1 --verbose -1 --yes
${{env.KSCTL_BIN}} info -p azure -n demo -r fake -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-azure -n ha-demo-k3s --nodeSizeDS "fake" --version 1.27.1 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap k3s
${{env.KSCTL_BIN}} info -p ha-azure -n ha-demo-k3s -r fake -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-azure -n ha-demo-kubeadm --nodeSizeDS "fake" --version 1.28 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-azure -n ha-demo-kubeadm -r fake -s store-local --verbose -1
- name: aws create
run: |
# ${{env.KSCTL_BIN}} create aws -n demo -r fake --nodeSizeMP "fake" --version 1.27.1 -s store-local --verbose -1 --yes
# ${{env.KSCTL_BIN}} create aws -n demo -r fake-region --nodeSizeMP "fake" --version 1.27.1 -s store-local --verbose -1 --yes
#${{env.KSCTL_BIN}} info -p aws -n demo -r fake-region -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-aws -n ha-demo-k3s --nodeSizeDS "fake" --version 1.27.1 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap k3s
${{env.KSCTL_BIN}} create ha-aws -n ha-demo-k3s --nodeSizeDS "fake" --version 1.27.1 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake-region --verbose -1 -s store-local --yes --bootstrap k3s
${{env.KSCTL_BIN}} create ha-aws -n ha-demo-kubeadm --nodeSizeDS "fake" --version 1.28 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-aws -n ha-demo-k3s -r fake-region -s store-local --verbose -1
- name: local create
run: |
${{env.KSCTL_BIN}} create local -n demolocal --version 1.27.1 --verbose -1 -s store-local --yes
${{env.KSCTL_BIN}} create ha-aws -n ha-demo-kubeadm --nodeSizeDS "fake" --version 1.28 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake-region --verbose -1 -s store-local --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-aws -n ha-demo-kubeadm -r fake-region -s store-local --verbose -1
- name: local create mongodb
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: local create
run: |
unset KSCTL_FAKE_FLAG_ENABLED
docker run -d \
--name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=1234 \
mongo
export MONGODB_URI="mongodb://root:[email protected]:27017"
${{env.KSCTL_BIN}} create local -n demolocal-extmongo -s external-store-mongodb --verbose -1 --yes
${{env.KSCTL_BIN}} create local -n demolocal --version 1.27.1 --verbose -1 -s store-local --yes
${{env.KSCTL_BIN}} info -p local -n demolocal -s store-local --verbose -1
- name: civo get
run: |
Expand All @@ -126,25 +186,10 @@ jobs:
run: |
${{env.KSCTL_BIN}} get -s store-local -p aws
- name: local get mongo
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
unset KSCTL_FAKE_FLAG_ENABLED
export MONGODB_URI="mongodb://root:[email protected]:27017"
${{env.KSCTL_BIN}} get -p local -s external-store-mongodb
- name: get all
run: |
${{env.KSCTL_BIN}} get -s store-local
- name: all mongodb
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
unset KSCTL_FAKE_FLAG_ENABLED
export MONGODB_URI="mongodb://root:[email protected]:27017"
${{env.KSCTL_BIN}} get -s external-store-mongodb
- name: civo switch
run: |
${{env.KSCTL_BIN}} switch -p civo -n demo -s store-local -r LON1
Expand All @@ -153,9 +198,9 @@ jobs:
- name: aws switch
run: |
# ${{env.KSCTL_BIN}} switch -p aws -n demo -s store-local -r fake
${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-k3s -s store-local -r fake
${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-kubeadm -s store-local -r fake
# ${{env.KSCTL_BIN}} switch -p aws -n demo -s store-local -r fake-region
${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-k3s -s store-local -r fake-region
${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-kubeadm -s store-local -r fake-region
- name: azure switch
run: |
Expand All @@ -167,13 +212,6 @@ jobs:
run: |
${{env.KSCTL_BIN}} switch -p local -n demolocal -s store-local
- name: local switch mongodb
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
unset KSCTL_FAKE_FLAG_ENABLED
export MONGODB_URI="mongodb://root:[email protected]:27017"
${{env.KSCTL_BIN}} switch -p local -n demolocal-extmongo -s external-store-mongodb
- name: civo scale up and down
run: |
${{env.KSCTL_BIN}} delete ha-civo del-nodes -n ha-demo-k3s --noWP 0 -r LON1 -s store-local --yes -v -1 --bootstrap k3s
Expand All @@ -196,13 +234,13 @@ jobs:
- name: aws scale up and down
run: |
${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-k3s --noWP 0 -r fake -s store-local --yes -v -1 --bootstrap k3s
${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-k3s --noWP 0 -r fake-region -s store-local --yes -v -1 --bootstrap k3s
${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-k3s --noWP 1 --version 1.27.1 --nodeSizeWP "fake" -s store-local -r fake -v -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-k3s --noWP 1 --version 1.27.1 --nodeSizeWP "fake" -s store-local -r fake-region -v -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-kubeadm --noWP 0 -r fake -s store-local --yes -v -1 --bootstrap kubeadm
${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-kubeadm --noWP 0 -r fake-region -s store-local --yes -v -1 --bootstrap kubeadm
${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-kubeadm --noWP 1 --version 1.28 --nodeSizeWP "fake" -s store-local -r fake -v -1 --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-kubeadm --noWP 1 --version 1.28 --nodeSizeWP "fake" -s store-local -r fake-region -v -1 --yes --bootstrap kubeadm
- name: civo delete
run: |
Expand All @@ -218,18 +256,12 @@ jobs:
- name: aws delete
run: |
# ${{env.KSCTL_BIN}} delete aws -n demo -r fake -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-k3s -r fake -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-kubeadm -r fake -s store-local -v -1 --yes
# ${{env.KSCTL_BIN}} delete aws -n demo -r fake-region -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-k3s -r fake-region -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-kubeadm -r fake-region -s store-local -v -1 --yes
- name: local delete
run: |
${{env.KSCTL_BIN}} delete local -n demolocal -s store-local -v -1 --yes
- name: local delete mongodb
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
unset KSCTL_FAKE_FLAG_ENABLED
export MONGODB_URI="mongodb://root:[email protected]:27017"
${{env.KSCTL_BIN}} delete local -n demolocal-extmongo -v -1 -s external-store-mongodb --yes
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ gen-docs: ## Generates docs

##@ Install (Dev)


.PHONY: install_linux_mock
install_linux_mock: ## Install ksctl
@echo "Started to Install ksctl"
cd scripts && \
env GOOS=${GOOS_LINUX} GOARCH=${GOARCH_LINUX} ./builder-mock.sh

.PHONY: install_macos_mock
install_macos_mock: ## Install ksctl on macos m1,m2,..
@echo "Started to Install ksctl"
cd scripts && \
env GOOS=${GOOS_MACOS} GOARCH=${GOARCH_MACOS} ./builder-mock.sh

.PHONY: install_macos_intel_mock
install_macos_intel_mock: ## Install ksctl on macos intel
@echo "Started to Install ksctl"
cd scripts && \
env GOOS=${GOOS_MACOS} GOARCH=${GOARCH_MACOS_INTEL} ./builder-mock.sh

.PHONY: install_linux
install_linux: ## Install ksctl
@echo "Started to Install ksctl"
Expand Down Expand Up @@ -85,4 +104,4 @@ echo "Downloading $${package}" ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv "$$(echo "$(1)" | sed "s/-$(3)$$//")" $(1) ;\
}
endef
endef
6 changes: 3 additions & 3 deletions cli/cmd/addNodesHAAws.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --no
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
log.Error("createApproval", "Reason", err)
os.Exit(1)
}

Expand All @@ -49,13 +49,13 @@ ksctl create ha-aws add-nodes -n demo -r ap-south-1 -s store-local --noWP 3 --no
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to init manager", "Reason", err)
log.Error("Failed to init manager", "Reason", err)
os.Exit(1)
}

err = m.AddWorkerPlaneNodes()
if err != nil {
log.Error(ctx, "Failed to scale up", "Reason", err)
log.Error("Failed to scale up", "Reason", err)
os.Exit(1)
}
log.Success(ctx, "Scale up successful")
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/addNodesHAAzure.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --node
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
log.Error("createApproval", "Reason", err)
os.Exit(1)
}

Expand All @@ -49,13 +49,13 @@ ksctl create ha-azure add-nodes -n demo -r eastus -s store-local --noWP 3 --node
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to init manager", "Reason", err)
log.Error("Failed to init manager", "Reason", err)
os.Exit(1)
}

err = m.AddWorkerPlaneNodes()
if err != nil {
log.Error(ctx, "Failed to scale up", "Reason", err)
log.Error("Failed to scale up", "Reason", err)
os.Exit(1)
}
log.Success(ctx, "Scale up successful")
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/addNodesHACivo.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSiz
cli.Client.Metadata.StateLocation = consts.KsctlStore(storage)

if err := createApproval(ctx, log, cmd.Flags().Lookup("yes").Changed); err != nil {
log.Error(ctx, "createApproval", "Reason", err)
log.Error("createApproval", "Reason", err)
os.Exit(1)
}

Expand All @@ -49,13 +49,13 @@ ksctl create ha-civo add-nodes -n demo -r LON1 -s store-local --noWP 3 --nodeSiz
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to init manager", "Reason", err)
log.Error("Failed to init manager", "Reason", err)
os.Exit(1)
}

err = m.AddWorkerPlaneNodes()
if err != nil {
log.Error(ctx, "Failed to scale up", "Reason", err)
log.Error("Failed to scale up", "Reason", err)
os.Exit(1)
}
log.Success(ctx, "Scale up successful")
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ var credCmd = &cobra.Command{
if provider, ok := cloud[choice]; ok {
cli.Client.Metadata.Provider = consts.KsctlCloud(provider)
} else {
log.Error(ctx, "invalid provider")
log.Error("invalid provider")
}
m, err := controllers.NewManagerClusterKsctl(
ctx,
log,
&cli.Client,
)
if err != nil {
log.Error(ctx, "Failed to initialize", "Reason", err)
log.Error("Failed to initialize", "Reason", err)
os.Exit(1)
}

if err := m.Credentials(); err != nil {
log.Error(ctx, "Failed to added the credential", "Reason", err)
log.Error("Failed to added the credential", "Reason", err)
os.Exit(1)
}
log.Success(ctx, "Credentials added successfully")
Expand Down
Loading

0 comments on commit bbdd6be

Please sign in to comment.