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

feat(cli): implement cluster create and delete commands #446

Merged
merged 16 commits into from
Oct 26, 2023

Conversation

leninmehedy
Copy link
Member

@leninmehedy leninmehedy commented Oct 24, 2023

Description

This pull request changes the following:

  • implemented the following commands
    • cluster create
    • cluster delete
    • cluster list
    • cluster info
  • create a custom logger and use colored messages
  • polish up previously implemented init command to show status message to user

Note that the default cluster name is fst-<USER>. For example, on my machine it was defaulted to fst-leninmehedy

Usage

➜  fsnetman cluster create -h
fsnetman cluster create

Create a cluster

Options:
  -n, --name     Name of the cluster       [string] [default: "fst-leninmehedy"]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]
➜  fsnetman cluster info -h
fsnetman cluster info

Get cluster info

Options:
  -n, --name     Name of the cluster       [string] [default: "fst-leninmehedy"]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]
➜  fsnetman cluster list -h
fsnetman cluster list

List all clusters

Options:
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]
➜  fsnetman cluster delete -h
fsnetman cluster delete

Delete a cluster

Options:
  -n, --name     Name of the cluster       [string] [default: "fst-leninmehedy"]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]


Example Output

➜ fsnetman cluster create -n lenin1
Created cluster 'lenin1'

List of clusters
----------------
lenin
lenin1

Kubernetes control plane is running at https://127.0.0.1:61667
CoreDNS is running at https://127.0.0.1:61667/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

➜  fsnetman cluster create
Created cluster 'fst-leninmehedy'

List of clusters
----------------
fst-leninmehedy
lenin
lenin1

Kubernetes control plane is running at https://127.0.0.1:61669
CoreDNS is running at https://127.0.0.1:61669/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

➜ fsnetman cluster list

List of clusters
----------------
fst-leninmehedy
lenin
lenin1

➜ fsnetman cluster info
Kubernetes control plane is running at https://127.0.0.1:61669
CoreDNS is running at https://127.0.0.1:61669/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

➜  fsnetman cluster info -n lenin
Kubernetes control plane is running at https://127.0.0.1:61661
CoreDNS is running at https://127.0.0.1:61661/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

➜  fsnetman cluster delete
Deleting cluster 'fst-leninmehedy'

List of clusters
----------------
lenin
lenin1

Deleted cluster 'fst-leninmehedy'
➜  fsnetman cluster delete -n lenin
Deleting cluster 'lenin'

List of clusters
----------------
lenin1

Deleted cluster 'lenin'

Related Issues

Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
@leninmehedy leninmehedy linked an issue Oct 24, 2023 that may be closed by this pull request
@leninmehedy leninmehedy changed the title feat(cli): implement create and delete cluster commands feat(cli): initial implementation of create and delete cluster commands Oct 24, 2023
@github-actions
Copy link

github-actions bot commented Oct 24, 2023

Unit Test Results

  26 files  ±0    26 suites  ±0   1m 0s ⏱️ +3s
109 tests ±0  105 ✔️ ±0  4 💤 ±0  0 ±0 
110 runs  ±0  106 ✔️ ±0  4 💤 ±0  0 ±0 

Results for commit a4c4140. ± Comparison against base commit b69dd99.

♻️ This comment has been updated with latest results.

Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
@leninmehedy leninmehedy changed the title feat(cli): initial implementation of create and delete cluster commands feat(cli): initial implementation of cluster commands Oct 24, 2023
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
This is because even if a wrong cluster name is provided kind does not return error

Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
…-zero exit code for errors

Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
Signed-off-by: Lenin Mehedy <lenin.mehedy@swirldslabs.com>
@sonarcloud
Copy link

sonarcloud bot commented Oct 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@leninmehedy leninmehedy changed the title feat(cli): initial implementation of cluster commands feat(cli): implement cluster create and delete commands Oct 25, 2023
@leninmehedy leninmehedy merged commit 78be823 into main Oct 26, 2023
11 checks passed
@leninmehedy leninmehedy deleted the 432-create-and-delete-cluster-commands branch October 26, 2023 00:40
swirlds-automation added a commit that referenced this pull request Nov 3, 2023
## [0.12.0](v0.11.0...v0.12.0) (2023-11-03)

### Features

* add a Gradle task for downloading executable for Kubernetes Kind ([#425](#425)) ([aaa9660](aaa9660))
* add fullstack-gradle-plugin project to GitHub workflow ([#421](#421)) ([7b717ab](7b717ab))
* add Gateway API route for Hedera Explorer ([#466](#466)) ([c53943c](c53943c))
* add Gradle build docker image tasks ([#408](#408)) ([338cf40](338cf40))
* add gradle Helm dependency update task  ([#393](#393)) ([8e3ead5](8e3ead5))
* add gradle Helm release exists task ([#389](#389)) ([0b7ae17](0b7ae17))
* add gradle Helm test task ([#403](#403)) ([591cebb](591cebb))
* add helm chart tests for gateway api routes ([#345](#345)) ([3936a64](3936a64))
* add helm dependency update subcommand ([#377](#377)) ([2b3609d](2b3609d))
* add helm execution gradle task: HelmInstallChartTask ([#304](#304)) ([6a29222](6a29222))
* add helm execution gradle task: HelmUninstallChartTask ([#375](#375)) ([ba6cc63](ba6cc63))
* add helm list releases subcommand ([#380](#380)) ([53d092f](53d092f))
* add helm test subcommand with options ([#376](#376)) ([5d08a32](5d08a32))
* add ifExists option to Gradle Helm uninstall task ([#405](#405)) ([0726725](0726725))
* add minio operator to fullstack-cluster-setup chart ([#453](#453)) ([bf7f6ff](bf7f6ff))
* add prometheus operator to fullstack-cluster-setup ([#460](#460)) ([0313c3a](0313c3a))
* add skipIfExists option for Gradle Helm install task ([#406](#406)) ([ccfbabf](ccfbabf))
* add support for scheduling pods based on node labels, taints, and affinity ([#352](#352)) ([5dd625a](5dd625a))
* Adding fabric8 k8s library and helm client for use in Infra API ([#386](#386)) ([3049fe4](3049fe4))
* Adding topology model classes and junit annotation processing ([#383](#383)) ([9c6930e](9c6930e))
* apply nodeSelector and tolerations to all pods including proxies ([#384](#384)) ([40e737a](40e737a))
* **cli:** add traceId in CLI logs for easier debugging ([#449](#449)) ([a1693c7](a1693c7))
* **cli:** implement chart install, uninstall and upgrade commands ([#454](#454)) ([70fd199](70fd199))
* **cli:** implement cluster create and delete commands ([#446](#446)) ([78be823](78be823))
* **cli:** implement cluster setup command ([#452](#452)) ([89c2662](89c2662))
* **cli:** implement tests and dependency checks for init command ([#438](#438)) ([b69dd99](b69dd99))
* enhance Helm Install to support multiple set and values parameters ([#367](#367)) ([05444df](05444df))
* implement fullstack-cluster-setup chart for shared resources ([#363](#363)) ([e91f465](e91f465))
* parameterize the helm chart namespace value ([#351](#351)) ([6d1c0a5](6d1c0a5))
* scaffold fsnetman CLI with ES6 support ([#424](#424)) ([65e06d9](65e06d9))
* upgrade to gradle 8.4 ([#404](#404)) ([69e769d](69e769d))
* upgrade to org.gradlex:java-module-dependencies:1.4.1 ([#365](#365)) ([ba7c32b](ba7c32b))

### Bug Fixes

* avoid hardcoding mirror-node-explorer rest API in values.yaml ([#413](#413)) ([0fe58c7](0fe58c7))
* **cli:** encapsulate helm and kubectl commands and code cleanup ([#476](#476)) ([1b8c499](1b8c499))
* **cli:** encapsulate Kind commands in a separate wrapper class ([#468](#468)) ([6dc6025](6dc6025))
* store hedera-explorer chart as dependency until next official version is released ([#436](#436)) ([201bda5](201bda5))
* support deploying the chart with custom release name ([#412](#412)) ([619b42b](619b42b))
* uninstall envoy-gateway should also remove gateway-system namespace that it created ([#350](#350)) ([8a2f6e1](8a2f6e1))
* update KeyValuePair.equals to only compare key (not value) ([#347](#347)) ([28222e0](28222e0))
@swirlds-automation
Copy link
Contributor

🎉 This PR is included in version 0.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI[Cluster]: Implement create and delete cluster commands
3 participants