GithubHelp home page GithubHelp logo

classicvalues / swinch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adobe/swinch

1.0 1.0 0.0 1.76 MB

Manage your Spinnaker pipelines with Kubernetes manifest and Helm Charts like object.

License: Apache License 2.0

Go 100.00%

swinch's Introduction

Swinch

Swinch is a CLI tool that aims at functionality similar to kubectl and helm, but for Spinnaker.

Our goal is to make using Spinnaker friendly for users already familiar with the Kubernetes way of deploying by provide the same language and format used for managing Kubernetes asset. Manage your Spinnaker pipelines with Kubernetes manifest and object, programmatically and sourced controlled, from templated Charts, with built-in support for dry-run and validation.

Swinch is at an alpha stage and under active development

High Level Design

Swinch uses the Kubernetes manifest structure to define Spinnaker objects, and these manifest can be templated and structured like a Helm Chart.
There are several ways to interact with manifest to manage Spinnaker applications and pipelines:

  • generating manifests from the chart (helm template equivalent), and then running the apply command on the resulting manifests (kubectl apply equivalent)
  • installing the chart with the default or a custom values.yaml file (helm install equivalent)

Helm like chart and templating support:

swinch template -c samples/charts/application -o samples/manifests/application

Application Chart template:

---
apiVersion: spinnaker.adobe.com/alpha1
kind: Application
metadata:
  name:  {{ .Values.application.name }}
spec:
  email: {{ .Values.application.email }}
  cloudProviders: ""
  permissions:
    EXECUTE:
      - {{ .Values.application.ldap }}
    READ:
      - {{ .Values.application.ldap }}
    WRITE:
      - {{ .Values.application.ldap }}

Values file:

application:
  name: swinchuuidtest
  email: [email protected]
  ldap: "add_spinnaker_team_ldap"

Output:

---
apiVersion: spinnaker.adobe.com/alpha1
kind: Application
metadata:
  name:  swinchuuidtest
spec:
  email: [email protected]
  cloudProviders: ""
  permissions:
    EXECUTE:
      - add_spinnaker_team_ldap
    READ:
      - add_spinnaker_team_ldap
    WRITE:
      - add_spinnaker_team_ldap

Some sample charts for pipelines are available as-well:

swinch template -c samples/charts/pipeline  -o samples/manifests/pipeline

Basic usage

Install

Download latest swinch release and unpack it:

tar zxvf swinch-*
chmod +x
mv swinch /usr/local/bin/swinch

On macOS allow swinch in System Preferences -> Security and Privacy

Usage

swinch help

Available Commands:
  apply       Apply or sync an Application or Pipeline from a manifest
  completion  Generate shell completion script
  config      Tweak swinch config
  delete      Delete the Application or Pipeline form a manifest
  help        Help about any command
  import      Import a chart from spinnaker
  install     Installs a swinch chart
  plan        Plan
  template    Generate manifests from chart domain
  uninstall   Uninstalls a swinch chart
  version     Print swinch version

Configuration file

In the swinch config file you will set up the spinnaker endpoint and authentication method.
Run swinch config to get the full list of options and instructions.

swinch config generate
swinch config add-context

Example configuration file located in cd ${HOME}/.swinch:

contexts:
- auth: ldap
  endpoint: https://spinnaker-dev-api.example.com
  name: spinnaker-dev
  password: eW91Y2hlZWt5YmFzdGFyZAo=
  username: username
- auth: basic
  endpoint: https://spinnaker-prod-api.example.com
  name: spinnaker-prod
  password: eW91Y2hlZWt5YmFzdGFyZAo=
  username: username
current-context:
  name: spinnaker-dev

Shell completion

To get shell completion instructions for bash and zsh run:

swinch completion -h

Template Charts and render manifests

Generate manifest from the Chart and apply the resulting manifests:

swinch template -c samples/charts/application -o samples/manifests/application 
swinch template -c samples/charts/pipeline  -o samples/manifests/pipeline

Apply manifests

swinch apply -f samples/manifests/application
swinch apply -f samples/manifests/pipeline

Chart install

Directly install a Chart without rendering the manifests from a Chart template:

swinch install samples/charts/application 
swinch install samples/charts/pipeline 

Dev setup

Build locally

Install go for your platform
Set up your GO env, example:

SWINCH_REPO=git/swinch
export GOPATH=$HOME/go:$HOME/SWINCH_REPO
export GOBIN=$HOME/go/bin
export PATH=${PATH}:$GOBIN

Install swinch:

SWINCH_REPO=$HOME/git/swinch
go install

Release

Install bump2version.
Push a release commit:

bump2version patch
git push upstream master  --follow-tags  

Run test

go test ./... -v

If Spinnaker parameters change you'll need to update known chart manifest samples used in test:

swinch template -c test/charts/test_template/ -o test/manifests/test_template_full_render -f test/values/test_template_full_render.yaml -r

swinch's People

Contributors

danielcoman avatar sfarosu avatar

Stargazers

 avatar

Watchers

 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.