config

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStackConfigFileExtension = ".yaml"
	CliConfigFileName               = "atmos.yaml"
	SystemDirConfigFilePath         = "/usr/local/etc/atmos"
	WindowsAppDataEnvVar            = "LOCALAPPDATA"

	// GlobalOptionsFlag is a custom flag to specify helmfile `GLOBAL OPTIONS`
	// https://github.com/roboll/helmfile#cli-reference
	GlobalOptionsFlag = "--global-options"

	TerraformDirFlag     = "--terraform-dir"
	HelmfileDirFlag      = "--helmfile-dir"
	CliConfigDirFlag     = "--config-dir"
	StackDirFlag         = "--stacks-dir"
	BasePathFlag         = "--base-path"
	WorkflowDirFlag      = "--workflows-dir"
	KubeConfigConfigFlag = "--kubeconfig-path"
	JsonSchemaDirFlag    = "--schemas-jsonschema-dir"
	OpaDirFlag           = "--schemas-opa-dir"
	CueDirFlag           = "--schemas-cue-dir"

	DeployRunInitFlag           = "--deploy-run-init"
	AutoGenerateBackendFileFlag = "--auto-generate-backend-file"
	InitRunReconfigure          = "--init-run-reconfigure"

	FromPlanFlag = "--from-plan"
	DryRunFlag   = "--dry-run"
	SkipInitFlag = "--skip-init"

	HelpFlag1 = "-h"
	HelpFlag2 = "--help"

	ComponentConfigFileName = "component.yaml"
)

Variables

This section is empty.

Functions

func FindAllStackConfigsInPaths added in v1.4.13

func FindAllStackConfigsInPaths(
	cliConfig CliConfiguration,
	includeStackPaths []string,
	excludeStackPaths []string,
) ([]string, []string, error)

FindAllStackConfigsInPaths finds all stack config files in the paths specified by globs

func FindAllStackConfigsInPathsForStack added in v1.4.13

func FindAllStackConfigsInPathsForStack(
	cliConfig CliConfiguration,
	stack string,
	includeStackPaths []string,
	excludeStackPaths []string,
) ([]string, []string, bool, error)

FindAllStackConfigsInPathsForStack finds all stack config files in the paths specified by globs for the provided stack

func GetContextPrefix added in v1.3.5

func GetContextPrefix(stack string, context Context, stackNamePattern string, stackFile string) (string, error)

GetContextPrefix calculates context prefix from the context

func GetStackNameFromContextAndStackNamePattern added in v1.4.9

func GetStackNameFromContextAndStackNamePattern(
	namespace string,
	tenant string,
	environment string,
	stage string,
	stackNamePattern string,
) (string, error)

GetStackNameFromContextAndStackNamePattern calculates stack name from the provided context using the provided stack name pattern

func ReplaceContextTokens added in v1.3.5

func ReplaceContextTokens(context Context, pattern string) string

ReplaceContextTokens replaces context tokens in the provided pattern and returns a string with all the tokens replaced

Types

type Affected added in v1.17.0

type Affected struct {
	Stack         string `yaml:"stack" json:"stack" mapstructure:"stack"`
	ComponentType string `yaml:"component_type" json:"component_type" mapstructure:"component_type"`
	Component     string `yaml:"component" json:"component" mapstructure:"component"`
	Affected      string `yaml:"affected" json:"affected" mapstructure:"affected"`
}

type ArgsAndFlagsInfo

type ArgsAndFlagsInfo struct {
	AdditionalArgsAndFlags  []string
	SubCommand              string
	SubCommand2             string
	ComponentFromArg        string
	GlobalOptions           []string
	TerraformDir            string
	HelmfileDir             string
	ConfigDir               string
	StacksDir               string
	WorkflowsDir            string
	BasePath                string
	DeployRunInit           string
	InitRunReconfigure      string
	AutoGenerateBackendFile string
	UseTerraformPlan        bool
	DryRun                  bool
	SkipInit                bool
	NeedHelp                bool
	JsonSchemaDir           string
	OpaDir                  string
	CueDir                  string
}

type Atlantis added in v1.5.0

type Atlantis struct {
	Path              string                           `yaml:"path" json:"path" mapstructure:"path"`
	ConfigTemplates   map[string]AtlantisRepoConfig    `yaml:"config_templates" json:"config_templates" mapstructure:"config_templates"`
	ProjectTemplates  map[string]AtlantisProjectConfig `yaml:"project_templates" json:"project_templates" mapstructure:"project_templates"`
	WorkflowTemplates map[string]any                   `yaml:"workflow_templates" json:"workflow_templates" mapstructure:"workflow_templates"`
}

type AtlantisConfigOutput added in v1.5.0

type AtlantisConfigOutput struct {
	Version                   int                     `yaml:"version" json:"version" mapstructure:"version"`
	Automerge                 bool                    `yaml:"automerge" json:"automerge" mapstructure:"automerge"`
	DeleteSourceBranchOnMerge bool                    `yaml:"delete_source_branch_on_merge" json:"delete_source_branch_on_merge" mapstructure:"delete_source_branch_on_merge"`
	ParallelPlan              bool                    `yaml:"parallel_plan" json:"parallel_plan" mapstructure:"parallel_plan"`
	ParallelApply             bool                    `yaml:"parallel_apply" json:"parallel_apply" mapstructure:"parallel_apply"`
	AllowedRegexpPrefixes     []string                `yaml:"allowed_regexp_prefixes" json:"allowed_regexp_prefixes" mapstructure:"allowed_regexp_prefixes"`
	Projects                  []AtlantisProjectConfig `yaml:"projects" json:"projects" mapstructure:"projects"`
	Workflows                 map[string]any          `yaml:"workflows" json:"workflows" mapstructure:"workflows"`
}

type AtlantisProjectAutoplanConfig added in v1.5.0

type AtlantisProjectAutoplanConfig struct {
	Enabled      bool     `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	WhenModified []string `yaml:"when_modified" json:"when_modified" mapstructure:"when_modified"`
}

type AtlantisProjectConfig added in v1.5.0

type AtlantisProjectConfig struct {
	Name                      string                        `yaml:"name" json:"name" mapstructure:"name"`
	Workspace                 string                        `yaml:"workspace" json:"workspace" mapstructure:"workspace"`
	Workflow                  string                        `yaml:"workflow" json:"workflow" mapstructure:"workflow"`
	Dir                       string                        `yaml:"dir" json:"dir" mapstructure:"dir"`
	TerraformVersion          string                        `yaml:"terraform_version" json:"terraform_version" mapstructure:"terraform_version"`
	DeleteSourceBranchOnMerge bool                          `yaml:"delete_source_branch_on_merge" json:"delete_source_branch_on_merge" mapstructure:"delete_source_branch_on_merge"`
	Autoplan                  AtlantisProjectAutoplanConfig `yaml:"autoplan" json:"autoplan" mapstructure:"autoplan"`
	ApplyRequirements         []string                      `yaml:"apply_requirements" json:"apply_requirements" mapstructure:"apply_requirements"`
}

type AtlantisRepoConfig added in v1.5.0

type AtlantisRepoConfig struct {
	Version                   int      `yaml:"version" json:"version" mapstructure:"version"`
	Automerge                 bool     `yaml:"automerge" json:"automerge" mapstructure:"automerge"`
	DeleteSourceBranchOnMerge bool     `yaml:"delete_source_branch_on_merge" json:"delete_source_branch_on_merge" mapstructure:"delete_source_branch_on_merge"`
	ParallelPlan              bool     `yaml:"parallel_plan" json:"parallel_plan" mapstructure:"parallel_plan"`
	ParallelApply             bool     `yaml:"parallel_apply" json:"parallel_apply" mapstructure:"parallel_apply"`
	AllowedRegexpPrefixes     []string `yaml:"allowed_regexp_prefixes" json:"allowed_regexp_prefixes" mapstructure:"allowed_regexp_prefixes"`
}

type AwsEksUpdateKubeconfigContext added in v1.4.9

type AwsEksUpdateKubeconfigContext struct {
	Component   string
	Stack       string
	Profile     string
	ClusterName string
	Kubeconfig  string
	RoleArn     string
	DryRun      bool
	Verbose     bool
	Alias       string
	Namespace   string
	Tenant      string
	Environment string
	Stage       string
	Region      string
}

type CliConfiguration added in v1.10.0

type CliConfiguration struct {
	BasePath                      string       `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	Components                    Components   `yaml:"components" json:"components" mapstructure:"components"`
	Stacks                        Stacks       `yaml:"stacks" json:"stacks" mapstructure:"stacks"`
	Workflows                     Workflows    `yaml:"workflows" json:"workflows" mapstructure:"workflows"`
	Logs                          Logs         `yaml:"logs" json:"logs" mapstructure:"logs"`
	Commands                      []Command    `yaml:"commands" json:"commands" mapstructure:"commands"`
	Integrations                  Integrations `yaml:"integrations" json:"integrations" mapstructure:"integrations"`
	Schemas                       Schemas      `yaml:"schemas" json:"schemas" mapstructure:"schemas"`
	Initialized                   bool         `yaml:"initialized" json:"initialized" mapstructure:"initialized"`
	StacksBaseAbsolutePath        string       `yaml:"stacksBaseAbsolutePath" json:"stacksBaseAbsolutePath"`
	IncludeStackAbsolutePaths     []string     `yaml:"includeStackAbsolutePaths" json:"includeStackAbsolutePaths"`
	ExcludeStackAbsolutePaths     []string     `yaml:"excludeStackAbsolutePaths" json:"excludeStackAbsolutePaths"`
	TerraformDirAbsolutePath      string       `yaml:"terraformDirAbsolutePath" json:"terraformDirAbsolutePath"`
	HelmfileDirAbsolutePath       string       `yaml:"helmfileDirAbsolutePath" json:"helmfileDirAbsolutePath"`
	StackConfigFilesRelativePaths []string     `yaml:"stackConfigFilesRelativePaths" json:"stackConfigFilesRelativePaths"`
	StackConfigFilesAbsolutePaths []string     `yaml:"stackConfigFilesAbsolutePaths" json:"stackConfigFilesAbsolutePaths"`
	StackType                     string       `yaml:"stackType" json:"StackType"`
}

CliConfiguration structure represents schema for `atmos.yaml` CLI config

func InitCliConfig added in v1.10.0

func InitCliConfig(configAndStacksInfo ConfigAndStacksInfo, processStacks bool) (CliConfiguration, error)

InitCliConfig finds and merges CLI configurations in the following order: system dir, home dir, current dir, ENV vars, command-line arguments https://dev.to/techschoolguru/load-config-from-file-environment-variables-in-golang-with-viper-2j2d https://medium.com/@bnprashanth256/reading-configuration-files-and-environment-variables-in-go-golang-c2607f912b63

type Command added in v1.4.22

type Command struct {
	Name            string                 `yaml:"name" json:"name" mapstructure:"name"`
	Description     string                 `yaml:"description" json:"description" mapstructure:"description"`
	Env             []CommandEnv           `yaml:"env" json:"env" mapstructure:"env"`
	Arguments       []CommandArgument      `yaml:"arguments" json:"arguments" mapstructure:"arguments"`
	Flags           []CommandFlag          `yaml:"flags" json:"flags" mapstructure:"flags"`
	ComponentConfig CommandComponentConfig `yaml:"component_config" json:"component_config" mapstructure:"component_config"`
	Steps           []string               `yaml:"steps" json:"steps" mapstructure:"steps"`
	Commands        []Command              `yaml:"commands" json:"commands" mapstructure:"commands"`
	Verbose         bool                   `yaml:"verbose" json:"verbose" mapstructure:"verbose"`
}

type CommandArgument added in v1.4.22

type CommandArgument struct {
	Name        string `yaml:"name" json:"name" mapstructure:"name"`
	Description string `yaml:"description" json:"description" mapstructure:"description"`
}

type CommandComponentConfig added in v1.11.0

type CommandComponentConfig struct {
	Component string `yaml:"component" json:"component" mapstructure:"component"`
	Stack     string `yaml:"stack" json:"stack" mapstructure:"stack"`
}

type CommandEnv added in v1.4.22

type CommandEnv struct {
	Key          string `yaml:"key" json:"key" mapstructure:"key"`
	Value        string `yaml:"value" json:"value" mapstructure:"value"`
	ValueCommand string `yaml:"valueCommand" json:"valueCommand" mapstructure:"valueCommand"`
}

type CommandFlag added in v1.4.22

type CommandFlag struct {
	Name        string `yaml:"name" json:"name" mapstructure:"name"`
	Shorthand   string `yaml:"shorthand" json:"shorthand" mapstructure:"shorthand"`
	Type        string `yaml:"type" json:"type" mapstructure:"type"`
	Description string `yaml:"description" json:"description" mapstructure:"description"`
	Usage       string `yaml:"usage" json:"usage" mapstructure:"usage"`
	Required    bool   `yaml:"required" json:"required" mapstructure:"required"`
}

type Components

type Components struct {
	Terraform Terraform `yaml:"terraform" json:"terraform" mapstructure:"terraform"`
	Helmfile  Helmfile  `yaml:"helmfile" json:"helmfile" mapstructure:"helmfile"`
}

type ConfigAndStacksInfo

type ConfigAndStacksInfo struct {
	StackFromArg              string
	Stack                     string
	StackFile                 string
	ComponentType             string
	ComponentFromArg          string
	Component                 string
	ComponentFolderPrefix     string
	BaseComponentPath         string
	BaseComponent             string
	FinalComponent            string
	Command                   string
	SubCommand                string
	SubCommand2               string
	ComponentSection          map[string]any
	ComponentVarsSection      map[any]any
	ComponentEnvSection       map[any]any
	ComponentEnvList          []string
	ComponentBackendSection   map[any]any
	ComponentBackendType      string
	AdditionalArgsAndFlags    []string
	GlobalOptions             []string
	BasePath                  string
	TerraformDir              string
	HelmfileDir               string
	ConfigDir                 string
	StacksDir                 string
	WorkflowsDir              string
	Context                   Context
	ContextPrefix             string
	DeployRunInit             string
	InitRunReconfigure        string
	AutoGenerateBackendFile   string
	UseTerraformPlan          bool
	DryRun                    bool
	SkipInit                  bool
	ComponentInheritanceChain []string
	NeedHelp                  bool
	ComponentIsAbstract       bool
	ComponentMetadataSection  map[any]any
	TerraformWorkspace        string
	JsonSchemaDir             string
	OpaDir                    string
	CueDir                    string
	AtmosCliConfigPath        string
	AtmosBasePath             string
}

type Context

type Context struct {
	Namespace     string
	Tenant        string
	Environment   string
	Stage         string
	Region        string
	Component     string
	BaseComponent string
	ComponentPath string
	Workspace     string
	Attributes    []string
}

func GetContextFromVars added in v1.3.5

func GetContextFromVars(vars map[any]any) Context

GetContextFromVars creates a context object from the provided variables

type Cue added in v1.9.0

type Cue struct {
	BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
}

type Helmfile

type Helmfile struct {
	BasePath              string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	UseEKS                bool   `yaml:"use_eks" json:"use_eks" mapstructure:"use_eks"`
	KubeconfigPath        string `yaml:"kubeconfig_path" json:"kubeconfig_path" mapstructure:"kubeconfig_path"`
	HelmAwsProfilePattern string `yaml:"helm_aws_profile_pattern" json:"helm_aws_profile_pattern" mapstructure:"helm_aws_profile_pattern"`
	ClusterNamePattern    string `yaml:"cluster_name_pattern" json:"cluster_name_pattern" mapstructure:"cluster_name_pattern"`
}

type Integrations added in v1.5.0

type Integrations struct {
	Atlantis Atlantis `yaml:"atlantis" json:"atlantis" mapstructure:"atlantis"`
}

type JsonSchema added in v1.9.0

type JsonSchema struct {
	BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
}

type Logs

type Logs struct {
	Verbose bool `yaml:"verbose" json:"verbose" mapstructure:"verbose"`
	Colors  bool `yaml:"colors" json:"colors" mapstructure:"colors"`
}

type Opa added in v1.9.0

type Opa struct {
	BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
}

type Schemas added in v1.9.0

type Schemas struct {
	JsonSchema JsonSchema `yaml:"jsonschema" json:"jsonschema" mapstructure:"jsonschema"`
	Cue        Cue        `yaml:"cue" json:"cue" mapstructure:"cue"`
	Opa        Opa        `yaml:"opa" json:"opa" mapstructure:"opa"`
}

type Stacks

type Stacks struct {
	BasePath      string   `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	IncludedPaths []string `yaml:"included_paths" json:"included_paths" mapstructure:"included_paths"`
	ExcludedPaths []string `yaml:"excluded_paths" json:"excluded_paths" mapstructure:"excluded_paths"`
	NamePattern   string   `yaml:"name_pattern" json:"name_pattern" mapstructure:"name_pattern"`
}

type Terraform

type Terraform struct {
	BasePath                string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
	ApplyAutoApprove        bool   `yaml:"apply_auto_approve" json:"apply_auto_approve" mapstructure:"apply_auto_approve"`
	DeployRunInit           bool   `yaml:"deploy_run_init" json:"deploy_run_init" mapstructure:"deploy_run_init"`
	InitRunReconfigure      bool   `yaml:"init_run_reconfigure" json:"init_run_reconfigure" mapstructure:"init_run_reconfigure"`
	AutoGenerateBackendFile bool   `yaml:"auto_generate_backend_file" json:"auto_generate_backend_file" mapstructure:"auto_generate_backend_file"`
}

type Validation added in v1.9.0

type Validation map[string]ValidationItem

type ValidationItem added in v1.9.0

type ValidationItem struct {
	SchemaType  string `yaml:"schema_type" json:"schema_type" mapstructure:"schema_type"`
	SchemaPath  string `yaml:"schema_path" json:"schema_path" mapstructure:"schema_path"`
	Description string `yaml:"description" json:"description" mapstructure:"description"`
	Disabled    bool   `yaml:"disabled" json:"disabled" mapstructure:"disabled"`
}

type VendorComponentConfig added in v1.4.12

type VendorComponentConfig struct {
	ApiVersion string `yaml:"apiVersion" json:"apiVersion" mapstructure:"apiVersion"`
	Kind       string `yaml:"kind" json:"kind" mapstructure:"kind"`
	Metadata   VendorComponentMetadata
	Spec       VendorComponentSpec `yaml:"spec" json:"spec" mapstructure:"spec"`
}

type VendorComponentMetadata added in v1.4.12

type VendorComponentMetadata struct {
	Name        string `yaml:"name" json:"name" mapstructure:"name"`
	Description string `yaml:"description" json:"description" mapstructure:"description"`
}

type VendorComponentMixins added in v1.4.12

type VendorComponentMixins struct {
	Type     string `yaml:"type" json:"type" mapstructure:"type"`
	Uri      string `yaml:"uri" json:"uri" mapstructure:"uri"`
	Version  string `yaml:"version" json:"version" mapstructure:"version"`
	Filename string `yaml:"filename" json:"filename" mapstructure:"filename"`
}

type VendorComponentSource added in v1.4.12

type VendorComponentSource struct {
	Type          string   `yaml:"type" json:"type" mapstructure:"type"`
	Uri           string   `yaml:"uri" json:"uri" mapstructure:"uri"`
	Version       string   `yaml:"version" json:"version" mapstructure:"version"`
	IncludedPaths []string `yaml:"included_paths" json:"included_paths" mapstructure:"included_paths"`
	ExcludedPaths []string `yaml:"excluded_paths" json:"excluded_paths" mapstructure:"excluded_paths"`
}

type VendorComponentSpec added in v1.4.12

type VendorComponentSpec struct {
	Source VendorComponentSource
	Mixins []VendorComponentMixins
}

type WorkflowConfig added in v1.4.0

type WorkflowConfig map[string]WorkflowDefinition

type WorkflowDefinition added in v1.4.0

type WorkflowDefinition struct {
	Description string         `yaml:"description" json:"description" mapstructure:"description"`
	Steps       []WorkflowStep `yaml:"steps" json:"steps" mapstructure:"steps"`
	Stack       string         `yaml:"stack" json:"stack" mapstructure:"stack"`
}

type WorkflowFile added in v1.4.0

type WorkflowFile map[string]WorkflowConfig

type WorkflowStep added in v1.4.0

type WorkflowStep struct {
	Command string `yaml:"command" json:"command" mapstructure:"command"`
	Stack   string `yaml:"stack" json:"stack" mapstructure:"stack"`
	Type    string `yaml:"type" json:"type" mapstructure:"type"`
}

type Workflows added in v1.4.0

type Workflows struct {
	BasePath string `yaml:"base_path" json:"base_path" mapstructure:"base_path"`
}

Jump to

Keyboard shortcuts

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