cfg

package
v0.0.0-...-7183293 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfPath             = "config"
	DeployPath           = "deploy"
	ChartsPath           = "charts"
	ResourcesPath        = "resources"
	DefaultConfigFsPerm  = 0655
	DefaultConfigDirPerm = 0755
	Suffix               = ".yml"
	GlobalConfigFile     = "simple-ops.yml"
	LockFileName         = "simple-ops.lock"
)

Variables

This section is empty.

Functions

func DeployIdParts

func DeployIdParts(id string) (string, string, error)

DeployIdParts returns "environment.component" or error

func MergeMaps

func MergeMaps(a, b map[string]interface{}) map[string]interface{}

MergeMaps makes a copy of the first map, overrides the values in the copy that exist in the 2nd map and returns the result. If a value in the 2nd map is nil, the values from the 1st map are used. copied and modified from helm 3 // ok || v == nil

Types

type ChartSource

type ChartSource struct {
	Name       string `json:"chart"`
	Repository string `json:"repository"`
	Version    string `json:"version"`
	Digest     string `json:"digest"`
}

type Conf

type Conf struct {
	Deploy
	Deploys Deploys `json:"deploy"`
}

type Deploy

type Deploy struct {
	Namespace          Namespace                       `json:"namespace"`
	Labels             map[string]string               `json:"labels"`
	Chart              string                          `json:"chart"`
	Disabled           bool                            `json:"disabled"`
	With               Withs                           `json:"with"`
	Values             map[string]interface{}          `json:"values"`
	Kustomizations     map[string]*types.Kustomization `json:"kustomizations"`
	KustomizationPaths []string                        `json:"kustomizationPaths"`
	Jsonnet            map[string]*Jsonnet             `json:"jsonnet"`
	Environment        string                          `json:"-"`
	Component          string                          `json:"-"`
	FsSlice            map[string][]types.FieldSpec    `json:"fsslice"`
	Chain              []string                        `json:"chain"`
}

func (Deploy) Id

func (d Deploy) Id() string

type Deploys

type Deploys []*Deploy

Deploys is a container for different Deployments of a component

type Jsonnet

type Jsonnet struct {
	Values    map[string]string `json:"values"`
	Path      string            `json:"path"`
	PathMulti string            `json:"pathMulti"`
	Inline    string            `json:"inline"`
}

type Labels

type Labels map[string]string

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

func NewLock

func NewLock(fs afero.Fs, wd string, log *logrus.Logger) *Lock

func (*Lock) AddChart

func (l *Lock) AddChart(name string, repository string, version string, digest string) error

func (*Lock) LockFile

func (l *Lock) LockFile() (*LockFile, error)

type LockFile

type LockFile struct {
	Charts []*ChartSource `json:"charts"`
}

type Namespace

type Namespace struct {
	Name   string `json:"name"`
	Create bool   `json:"create"`
	Inject bool   `json:"inject"`
	Labels Labels `json:"labels"`
}

type Svc

type Svc struct {
	// contains filtered or unexported fields
}

func NewSvc

func NewSvc(fs afero.Fs, wd string, log *logrus.Logger) *Svc

func (Svc) ChartPath

func (s Svc) ChartPath(d Deploy) (string, error)

func (Svc) Deploys

func (s Svc) Deploys() (Deploys, error)

Deploys returns configured deploys for a given config path

func (Svc) DeploysForEnvironment

func (s Svc) DeploysForEnvironment(environment string) (Deploys, error)

func (Svc) GetDeploy

func (s Svc) GetDeploy(component string, environment string) (*Deploy, error)

func (Svc) Init

func (s Svc) Init(template string) error

func (Svc) InitIfEmpty

func (s Svc) InitIfEmpty(template string) error

InitIfEmpty creates simple-ops directory and structure in path if directory not exists or empty.

func (Svc) ManifestPath

func (s Svc) ManifestPath(d *Deploy) (string, error)

func (Svc) Set

func (s Svc) Set(path string, value interface{}) error

Set adds or modifies a configuration path value. The first part of the path specifies the config file, e.g. myapp.deploys.staging.imgSrc would target config/myapp.yml and would add or modify the imgSrc value in deploys: staging: imgSrc

type With

type With struct {
	Path   string                 `json:"path"`
	Values map[string]interface{} `json:"values"`
}

type Withs

type Withs map[string]map[string]With

Jump to

Keyboard shortcuts

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