appdeploy

package module
v0.0.0-...-d842628 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2018 License: MIT Imports: 20 Imported by: 0

README

kube-appdeploy

Work-in-progress deployment tool for Kubernetes-hosted applications.

Getting started

First build the command line client. Make sure kubectl is available on your path and a cluster is running.

go install github.com/rubenv/kube-appdeploy/bin/kube-appdeploy

The examples folder contains .yaml files to deploy nginx on your cluster. To do just that, run:

kube-appdeploy ./example/

The appdeploy script will pick up all .yaml files in the folder and process these. You can use text/template syntax to change the computed content of the deploy configuration. This example deploys 2 nodes in production and 1 node in all other environments:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: my-nginx
spec:
{{ if eq .Variables.env "production" }}
  replicas: 2
{{ else }}
  replicas: 1
{{ end }}
  template:
    metadata:
      labels:
    run: my-nginx
    spec:
      containers:
      - name: my-nginx
    image: nginx
    ports:
    - containerPort: 80

The "env" variable is set in "variables.yaml" in yaml syntax as shown here:

env: "development"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CleanTypes = []string{
	"deployment",
	"service",
	"cronjob",
}

Functions

func Process

func Process(src ManifestSource, target Target) error

func ProcessWithFuncs

func ProcessWithFuncs(src ManifestSource, target Target, funcs template.FuncMap) error

Types

type FolderSource

type FolderSource struct {
	Path string
	// contains filtered or unexported fields
}

func NewFolderSource

func NewFolderSource(p string) (*FolderSource, error)

func (*FolderSource) Get

func (s *FolderSource) Get(name string) (io.ReadCloser, error)

func (*FolderSource) Names

func (s *FolderSource) Names() ([]string, error)

func (*FolderSource) SetVariables

func (s *FolderSource) SetVariables(variables *ProcessVariables)

func (*FolderSource) Variables

func (s *FolderSource) Variables() (*ProcessVariables, error)

type FolderTarget

type FolderTarget struct {
	Path string
}

func NewFolderTarget

func NewFolderTarget(path string) *FolderTarget

func (*FolderTarget) Apply

func (t *FolderTarget) Apply(m Manifest, data []byte) error

func (*FolderTarget) Cleanup

func (t *FolderTarget) Cleanup(items []Manifest) error

func (*FolderTarget) Prepare

func (t *FolderTarget) Prepare(vars *ProcessVariables) error

type KubernetesTarget

type KubernetesTarget struct {
	Config *rest.Config
	// contains filtered or unexported fields
}

func NewKubernetesTarget

func NewKubernetesTarget(config *rest.Config) *KubernetesTarget

func (*KubernetesTarget) Apply

func (t *KubernetesTarget) Apply(m Manifest, data []byte) error

func (*KubernetesTarget) Cleanup

func (t *KubernetesTarget) Cleanup(items []Manifest) error

func (*KubernetesTarget) Prepare

func (t *KubernetesTarget) Prepare(vars *ProcessVariables) error

type Manifest

type Manifest struct {
	Kind     string
	Metadata Metadata
}

func (Manifest) Filename

func (m Manifest) Filename(folder string) string

type ManifestSource

type ManifestSource interface {
	Names() ([]string, error)
	Get(name string) (io.ReadCloser, error)
	Variables() (*ProcessVariables, error)
}

type Metadata

type Metadata struct {
	Name string
}

type ProcessVariables

type ProcessVariables struct {
	Namespace        string
	ImagePullSecrets []string
	ManageCronjobs   bool
	Variables        map[string]interface{}
}

func NewProcessVariables

func NewProcessVariables() *ProcessVariables

type Target

type Target interface {
	Prepare(vars *ProcessVariables) error
	Apply(m Manifest, data []byte) error
	Cleanup(items []Manifest) error
}

Directories

Path Synopsis
bin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL