squadron

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 1 Imported by: 0

README

POSH squadron provider

Usage

Plugin
package plugin

type Plugin struct {
	l        log.Logger
  cache    cache.Cache
  op       *onepassword.OnePassword
  kubectl  *kubectl.Kubectl
	commands command.Commands
  squadron *squadron.Squadron
}

func New(l log.Logger) (plugin.Plugin, error) {
	var err error
  inst := &Plugin{
		l:        l,
    cache:    cache.MemoryCache{},
		commands: command.Commands{},
	}

	// ...

  inst.op, err = onepassword.New(l, inst.cache)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create onepassword")
  }

  inst.kubectl, err = kubectl.New(l, inst.cache)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create kubectl")
  }

  inst.squadron, err = squadron.New(l, inst.kubectl)
  if err != nil {
    return nil, errors.Wrap(err, "failed to create squadron")
  }

  inst.commands.Add(squadron.NewCommand(l, inst.squadron, inst.kubectl, inst.op, inst.cache))

	// ...

	return inst, nil
}
Config

To install binary locally, add:

squadron:
  path: squadrons
  clusters:
    - name: prod
      fleets: ["default"]
    - name: dev
      fleets: ["default"]
Ownbrew

To install binary locally, add:

ownbrew:
  packages:
    # https://github.com/foomo/squadron/releases
    - name: squadron
      tap: foomo/tap/foomo/squadron
      version: 2.1.5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Name   string   `json:"name" yaml:"name"`
	Fleets []string `json:"fleets" yaml:"fleets"`
}

type Config

type Config struct {
	Path     string    `json:"path" yaml:"path"`
	Clusters []Cluster `json:"clusters" yaml:"clusters"`
}

func (Config) Cluster

func (c Config) Cluster(name string) (Cluster, bool)

func (Config) ClusterNames

func (c Config) ClusterNames() []string

type Squadron

type Squadron interface {
	Cluster(name string) (Cluster, bool)
	Exists(name string) bool
	UnitExists(ctx context.Context, squadron, cluster, fleet, name string, override bool) bool
	List() ([]string, error)
	ListUnits(ctx context.Context, squadron, cluster, fleet string, override bool) ([]string, error)
	UnitDirs(squadron string) []string
	GetFiles(squadron, cluster, fleet string, override bool) []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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