config

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PipelinesFile is the name of the pipelines manifest file
	PipelinesFile = "pipelines.yaml"
)

Variables

This section is empty.

Functions

func PathForApplication

func PathForApplication(env *Environment, app *Application) string

PathForApplication generates a repo-rooted path within a repository.

func PathForArgoCD

func PathForArgoCD() string

PathForArgoCD returns the path for recording ArgoCD configuration.

func PathForEnvironment

func PathForEnvironment(env *Environment) string

PathForEnvironment gives a repo-rooted path within a repository.

func PathForPipelines

func PathForPipelines(pipeline *PipelinesConfig) string

PathForPipelines returns the path only for the CICD environment.

func PathForService

func PathForService(app *Application, env *Environment, serviceName string) string

PathForService gives a repo-rooted path within a repository.

Types

type Application

type Application struct {
	Name       string      `json:"name,omitempty"`
	Services   []*Service  `json:"services,omitempty"`
	ConfigRepo *Repository `json:"config_repo,omitempty"`
}

Application has many services. The ConfigRepo indicates that the configuration for this application lives in another repository.

type ApplicationVisitor

type ApplicationVisitor interface {
	Application(*Environment, *Application) error
}

ApplicationVisitor is an interface for accessing applications from the manifest.

type ArgoCDConfig

type ArgoCDConfig struct {
	Namespace string `json:"namespace,omitempty"`
}

ArgoCDConfig provides configuration for the ArgoCD application generation.

type Config

type Config struct {
	Pipelines *PipelinesConfig `json:"pipelines,omitempty"`
	ArgoCD    *ArgoCDConfig    `json:"argocd,omitempty"`
	Git       *GitConfig       `json:"git,omitempty"`
}

Config represents the configuration for non-application environments.

type Environment

type Environment struct {
	Name      string         `json:"name,omitempty"`
	Cluster   string         `json:"cluster,omitempty"`
	Pipelines *Pipelines     `json:"pipelines,omitempty"`
	Apps      []*Application `json:"apps,omitempty"`
}

Environment is a slice of Apps, these are the named apps in the namespace.

func (Environment) GoString

func (e Environment) GoString() string

GoString return environment name

type EnvironmentVisitor

type EnvironmentVisitor interface {
	Environment(*Environment) error
}

EnvironmentVisitor is an interface for accessing environments from the manifest.

type GitConfig

type GitConfig struct {
	Drivers map[string]string `json:"drivers,omitempty"`
}

GitConfig configures the git drivers.

type Manifest

type Manifest struct {
	GitOpsURL    string         `json:"gitops_url,omitempty"`
	Environments []*Environment `json:"environments,omitempty"`
	Config       *Config        `json:"config,omitempty"`
	Version      int            `json:"version,omitempty"`
}

Manifest describes a set of environments, apps and services for deployment.

func LoadManifest

func LoadManifest(fs afero.Fs, path string) (*Manifest, error)

LoadManifest reads a manifest file, and configures the environment based on the configuration.

func Parse

func Parse(in io.Reader) (*Manifest, error)

Parse decodes YAML describing an environment manifest.

func ParseFile

func ParseFile(fs afero.Fs, filename string) (*Manifest, error)

ParseFile is a wrapper around Parse that accepts a filename, it opens and parses the file, and closes it.

func ParsePipelinesFolder

func ParsePipelinesFolder(fs afero.Fs, folderPath string) (*Manifest, error)

ParsePipelinesFolder will accept the pipelines folder path and appends pipelines file name before parsing it

func (*Manifest) AddService

func (m *Manifest) AddService(envName, appName string, svc *Service) error

AddService adds a new service to a specific environment and creates a reference to it within an Application.

func (*Manifest) GetApplication

func (m *Manifest) GetApplication(environment, application string) *Application

GetApplication returns a named application, within an environment, if it exists.

func (*Manifest) GetArgoCDConfig

func (m *Manifest) GetArgoCDConfig() *ArgoCDConfig

GetArgoCDConfig returns the global ArgoCD configuration, if one exists.

func (*Manifest) GetEnvironment

func (m *Manifest) GetEnvironment(n string) *Environment

GetEnvironment returns a named environment if it exists in the configuration.

func (*Manifest) GetPipelinesConfig

func (m *Manifest) GetPipelinesConfig() *PipelinesConfig

GetPipelinesConfig returns the global Pipelines configuration, if one exists.

func (*Manifest) Validate

func (m *Manifest) Validate() error

Validate validates the Manifest, returning a multi-error representing all the errors that were detected.

func (Manifest) Walk

func (m Manifest) Walk(visitor interface{}) error

Walk implements post-node visiting of each element in the manifest.

Every App, Service and Environment is called once, and any error from the handling function terminates the Walk.

The environments are sorted using a custom sorting mechanism, that orders by name, but, moves CICD environments to the bottom of the list.

type Pipelines

type Pipelines struct {
	Integration *TemplateBinding `json:"integration,omitempty"`
}

Pipelines describes the names for pipelines to be executed for CI and CD.

These pipelines will be executed with a Git clone URL and commit SHA.

type PipelinesConfig

type PipelinesConfig struct {
	Name string `json:"name,omitempty"`
}

PipelinesConfig provides configuration for the CI/CD pipelines.

type Repository

type Repository struct {
	URL string `json:"url,omitempty"`
	// TargetRevision defines the commit, tag, or branch in which to sync the application to.
	// If omitted, will sync to HEAD
	TargetRevision string `json:"target_revision,omitempty"`
	// Path is a directory path within the Git repository.
	Path string `json:"path,omitempty"`
}

Repository refers to an upstream source for reading additional config from.

type Secret

type Secret struct {
	Name      string `json:"name,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

Secret represents a K8s secret in a namespace

type Service

type Service struct {
	Name      string     `json:"name,omitempty"`
	Webhook   *Webhook   `json:"webhook,omitempty"`
	SourceURL string     `json:"source_url,omitempty"`
	Pipelines *Pipelines `json:"pipelines,omitempty"`
}

Service has an upstream source.

type ServiceVisitor

type ServiceVisitor interface {
	Service(*Application, *Environment, *Service) error
}

ServiceVisitor is an interface for accessing services from the manifest.

type TemplateBinding

type TemplateBinding struct {
	Template string   `json:"template,omitempty"`
	Bindings []string `json:"bindings,omitempty"`
}

TemplateBinding is a combination of the template and binding to be used for a pipeline execution.

type Webhook

type Webhook struct {
	Secret *Secret `json:"secret,omitempty"`
}

Webhook provides Github webhook secret for eventlisteners

Jump to

Keyboard shortcuts

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