GithubHelp home page GithubHelp logo

polygonhell / kubetool Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 94 KB

Kubetool is designed to be used by developers of Kubernetes services, to incrementally update in development services on a remote cluster.

License: BSD 3-Clause "New" or "Revised" License

Haskell 100.00%
kubernetes k8s

kubetool's Introduction

KubeTool

KubeTool is a tool that can be used for developing services on a remote kubernetes cluster.

It's templates allow you a simple way to incrementally update the service on the target as you develop.

It also supplies some helpers for managing Kubernetes namespaces, rather than having to do it through kubectl.

TODO: Once you are ready to release the project, it will generate a helm chart for you.

Currently supplied templates

  • TSCreateReactApp
    • Typescript template for use with create react app - might work for js version

Known issues

  • Only one template
  • Only supports a single project in the config
  • Only supports ClusterIP services
  • Changing a running project's name leaves the existing projects running when you use push

Quickstart

CreateReactApp Typescript template

Use create-react-app to create a project.

npx create-react-app testproj --template typescript

cd to the project

cd testproj

Initialise the kube tool configuration (config.yaml).

kt init -n testproj -t TSCreateReactApp

Create a namespace for the project in your current kubernetes cluster - this will also set the namespace for the project.

 kt namespace create testproj

Push project to the kubernetes cluster

kt watch

The first time push or watch is called it may take a couple of minutes, it will create the StatefulSet and Service associated with the project, once the Pod is created it will copy the source files to the pod and run the build/launch command. Subsequent invocations to Push will just copy changed files and restart the build/launch command, and should be fast unless many large files have changed.

In a different shell use kubectl port-forward to forward the project service locally

kubectl port-forward service/testproj 3000:3000 --namespace testproj

Check the service is running by connecting a browser - you may have to wait a minute or two as the initial npm i completes.

Overview

all commands have the form

kt <context> <command> [arguments]

Where context is one of

  • config
  • env
  • namespace
  • project
  • push
  • logs

config

Used to control the project configuration, changes are saved in the config.yaml file.

set

kt config set <name>=<value>

Supported names are currently

  • name
    • The name of the project
  • author
    • The author of the project

env

Used to control settings for the current environment, changes are saved to the .kube_env file.

set

kt env set <name>=<value>

Supported names are currently

  • namespace
    • The Kubernetes namespace the project will be deployed to

namespace

A collection of helpers for working with Kubernetes namespaces.

create

Create a new namespace

kt namespace create <name>

delete

Delete an existing namespace and all contained items

kt namespace delete <name>

list

Get a list of all kubernetes namespaces on the current K8's cluster, the current active namespace for kt is preceded by a '*'.

kt namespace list

project

Tools for manipulating projects

list

list projects

set

Supported names are currently

  • name

push

Push and launch a project on the cluster.

Will create or update the projects StatefulSet, Service and Pods, any changed files will be copied to the k8's cluster and the pushCommand will be invoked.

kt push

watch

Push and launch a project on the cluster.

Will create or update the projects StatefulSet, Service and Pods, copy changed files to the cluster and invoke the pushCommand. The files specified in the srcFiles part of the template are then monitored for changes, if any occur, changed files will be copied to the k8's cluster and if a watchCommand is specified it will be invoked on the pod.

kt watch

logs

Display logs for running project

kt logs

Status

Work in progress Usable for simple projects

kubetool's People

Contributors

polygonhell avatar

Watchers

 avatar  avatar

kubetool's Issues

Logs hangs with inactivity

I assume the websocket gets closed, but the client isn't notified, inwhich case I need some sort of keep alive on the connection.

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.