Giter Club home page Giter Club logo

kubestorm's Introduction

Go Codecov Go Report Card Release

kubestorm

  • A RESTful API to interact with Kubernetes resources
  • Easy to customize and integrate with UI/Chatbot/Automation

It consists of 3 main components:

  • Backend - Rest API (Go)
  • Frontend (Vue.js) (BEING DEVELOPED)
  • Persistent Layer to store configurations

Docs

swag init

Development

Contributions are welcome via PRs with Issues!

Use Go Module

export GO111MODULE=on

Start the API locally

# Clone the repository
git clone https://github.com/supernova106/kubestorm.git
cd kubestorm/
go run main.go

Or using the pre-built binary

./kubestorm

Usage

Generate Auth TOKEN for your Kubernetes cluster

  • create the following kubestorm.yaml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: kubestorm-role
rules:
  - apiGroups: ["", "extensions", "apps", "batch", "events", "resourcequotas"]
    resources: ["*"]
    verbs: ["list", "watch", "get"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: kubestorm-user
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: kubestorm-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kubestorm-role
subjects:
  - kind: ServiceAccount
    name: kubestorm-user
    namespace: kube-system
kubectl apply -f kubestorm.yaml

Get server URL

export CURRENT_CONTEXT=$(kubectl config current-context) && export CURRENT_CLUSTER=$(kubectl config view -o go-template="{{\$curr_context := \"$CURRENT_CONTEXT\" }}{{range .contexts}}{{if eq .name \$curr_context}}{{.context.cluster}}{{end}}{{end}}") && echo $(kubectl config view -o go-template="{{\$cluster_context := \"$CURRENT_CLUSTER\"}}{{range .clusters}}{{if eq .name \$cluster_context}}{{.cluster.server}}{{end}}{{end}}")

Get serverCADataString

echo $(kubectl get secret -n kube-system -o go-template='{{index .data "ca.crt" }}' $(kubectl get sa kubestorm-user -n kube-system -o go-template="{{range .secrets}}{{.name}}{{end}}"))

Get token

echo $(kubectl get secret -n kube-system -o go-template='{{index .data "token" }}' $(kubectl get sa kubestorm-user -n kube-system -o go-template="{{range .secrets}}{{.name}}{{end}}")) | base64 --decode

CRUD cluster auth

Execute the following script to add cluster

export CLUSTER_NAME="foo"

# replace with actual URL of kubestorm
./scripts/add_cluster.sh "${CLUSTER_NAME}" http://localhost:8080

# get auth
curl --location --request GET "http://localhost:8080/api/v1/auth/${CLUSTER_NAME}"

# delete
curl --location --request DELETE "http://localhost:8080/api/v1/auth/${CLUSTER_NAME}"

GET Kubernetes resources from a cluster

curl --location --request GET "http://localhost:8080/api/v1/resources?cluster=${CLUSTER_NAME}&type=nodes"

Release

  • The release process is automated via git tagging.
  • Check out the .github/workflows/goreleaser.yml

Todo

  • Add more unit testings
  • Develop Simple Dashboard for Kubernetes
  • Support S3 to store configurations
  • Slack Chatbot integration

Contributors

  • Binh Nguyen

kubestorm's People

Contributors

rr-binh-nguyen avatar supernova106 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.