config

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnalysisStrategyThreshold      = "THRESHOLD"
	AnalysisStrategyPrevious       = "PREVIOUS"
	AnalysisStrategyCanaryBaseline = "CANARY_BASELINE"
	AnalysisStrategyCanaryPrimary  = "CANARY_PRIMARY"

	AnalysisDeviationEither = "EITHER"
	AnalysisDeviationHigh   = "HIGH"
	AnalysisDeviationLow    = "LOW"
)
View Source
const (
	K8sResourcePatchOpYAMLReplace = "yaml-replace"
)
View Source
const (
	SharedConfigurationDirName = ".pipe"
)

Variables

View Source
var DefaultKubernetesCloudProvider = PipedCloudProvider{
	Name:             "kubernetes-default",
	Type:             model.CloudProviderKubernetes,
	KubernetesConfig: &CloudProviderKubernetesConfig{},
}
View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func ToApplicationKind

func ToApplicationKind(k Kind) (model.ApplicationKind, bool)

ToApplicationKind converts configuration kind to application kind.

Types

type AnalysisDynamicHTTP

type AnalysisDynamicHTTP struct {
	URL              string           `json:"url"`
	Method           string           `json:"method"`
	Headers          []AnalysisHeader `json:"headers"`
	ExpectedCode     int              `json:"expectedCode"`
	ExpectedResponse string           `json:"expectedResponse"`
	Interval         Duration         `json:"interval"`
	Timeout          Duration         `json:"timeout"`
}

type AnalysisDynamicLog

type AnalysisDynamicLog struct {
	Query    string   `json:"query"`
	Provider string   `json:"provider"`
	Timeout  Duration `json:"timeout"`
}

type AnalysisExpected

type AnalysisExpected struct {
	Min *float64 `json:"min"`
	Max *float64 `json:"max"`
}

AnalysisExpected defines the range used for metrics analysis.

func (*AnalysisExpected) InRange added in v0.9.8

func (e *AnalysisExpected) InRange(value float64) bool

InRange returns true if the given value is within the range.

func (*AnalysisExpected) String added in v0.9.8

func (e *AnalysisExpected) String() string

func (*AnalysisExpected) Validate added in v0.9.8

func (e *AnalysisExpected) Validate() error

type AnalysisHTTP

type AnalysisHTTP struct {
	URL    string `json:"url"`
	Method string `json:"method"`
	// Custom headers to set in the request. HTTP allows repeated headers.
	Headers          []AnalysisHeader `json:"headers"`
	ExpectedCode     int              `json:"expectedCode"`
	ExpectedResponse string           `json:"expectedResponse"`
	Interval         Duration         `json:"interval"`
	// Maximum number of failed checks before the response is considered as failure.
	FailureLimit int `json:"failureLimit"`
	// If true, it considers as success when no data returned from the analysis provider.
	// Default is false.
	SkipOnNoData bool     `json:"skipOnNoData"`
	Timeout      Duration `json:"timeout"`
}

AnalysisHTTP contains common configurable values for deployment analysis with http.

type AnalysisHeader

type AnalysisHeader struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type AnalysisLog

type AnalysisLog struct {
	Query    string   `json:"query"`
	Interval Duration `json:"interval"`
	// Maximum number of failed checks before the query result is considered as failure.
	FailureLimit int `json:"failureLimit"`
	// If true, it considers as success when no data returned from the analysis provider.
	// Default is false.
	SkipOnNoData bool `json:"skipOnNoData"`
	// How long after which the query times out.
	Timeout  Duration `json:"timeout"`
	Provider string   `json:"provider"`
}

AnalysisLog contains common configurable values for deployment analysis with log.

type AnalysisMetrics

type AnalysisMetrics struct {
	// The unique name of provider defined in the Piped Configuration.
	// Required field.
	Provider string `json:"provider"`
	// A query performed against the Analysis Provider.
	// Required field.
	Query string `json:"query"`
	// The expected query result.
	// Required field.
	Expected AnalysisExpected `json:"expected"`
	// Run a query at this intervals.
	// Required field.
	Interval Duration `json:"interval"`
	// Acceptable number of failures. For instance, If 1 is set,
	// the analysis will be considered a failure after 2 failures.
	// Default is 0.
	FailureLimit int `json:"failureLimit"`
	// If true, it considers as a success when no data returned from the analysis provider.
	// Default is false.
	SkipOnNoData bool `json:"skipOnNoData"`
	// How long after which the query times out.
	// Default is 30s.
	Timeout Duration `json:"timeout"`

	// The strategy name. One of THRESHOLD or PREVIOUS or CANARY_BASELINE or CANARY_PRIMARY is available.
	// Defaults to THRESHOLD.
	Strategy string `json:"strategy" default:"THRESHOLD"`
	// The stage fails on deviation in the specified direction. One of LOW or HIGH or EITHER is available.
	// This can be used only for PREVIOUS, CANARY_BASELINE or CANARY_PRIMARY. Defaults to EITHER.
	Deviation string `json:"deviation" default:"EITHER"`
	// The custom arguments to be populated for the Canary query.
	// They can be reffered as {{ .VariantArgs.xxx }}.
	CanaryArgs map[string]string `json:"canaryArgs"`
	// The custom arguments to be populated for the Baseline query.
	// They can be reffered as {{ .VariantArgs.xxx }}.
	BaselineArgs map[string]string `json:"baselineArgs"`
	// The custom arguments to be populated for the Primary query.
	// They can be reffered as {{ .VariantArgs.xxx }}.
	PrimaryArgs map[string]string `json:"primaryArgs"`
}

AnalysisMetrics contains common configurable values for deployment analysis with metrics.

func (*AnalysisMetrics) Validate added in v0.9.12

func (m *AnalysisMetrics) Validate() error

type AnalysisProviderDatadogConfig

type AnalysisProviderDatadogConfig struct {
	// The address of Datadog API server.
	// Only "datadoghq.com", "us3.datadoghq.com", "datadoghq.eu", "ddog-gov.com" are available.
	// Defaults to "datadoghq.com"
	Address string `json:"address"`
	// Required: The path to the api key file.
	APIKeyFile string `json:"apiKeyFile"`
	// Required: The path to the application key file.
	ApplicationKeyFile string `json:"applicationKeyFile"`
}

func (*AnalysisProviderDatadogConfig) Validate added in v0.9.8

func (a *AnalysisProviderDatadogConfig) Validate() error

type AnalysisProviderPrometheusConfig

type AnalysisProviderPrometheusConfig struct {
	Address string `json:"address"`
	// The path to the username file.
	UsernameFile string `json:"usernameFile"`
	// The path to the password file.
	PasswordFile string `json:"passwordFile"`
}

func (*AnalysisProviderPrometheusConfig) Validate added in v0.9.8

type AnalysisProviderStackdriverConfig

type AnalysisProviderStackdriverConfig struct {
	// The path to the service account file.
	ServiceAccountFile string `json:"serviceAccountFile"`
}

func (*AnalysisProviderStackdriverConfig) Validate added in v0.9.8

type AnalysisStageOptions

type AnalysisStageOptions struct {
	// How long the analysis process should be executed.
	Duration Duration `json:"duration"`
	// TODO: Consider about how to handle a pod restart
	// possible count of pod restarting
	RestartThreshold int                          `json:"restartThreshold"`
	Metrics          []TemplatableAnalysisMetrics `json:"metrics"`
	Logs             []TemplatableAnalysisLog     `json:"logs"`
	Https            []TemplatableAnalysisHTTP    `json:"https"`
}

AnalysisStageOptions contains all configurable values for a K8S_ANALYSIS stage.

func (*AnalysisStageOptions) Validate added in v0.9.8

func (a *AnalysisStageOptions) Validate() error

type AnalysisTemplateRef

type AnalysisTemplateRef struct {
	Name string            `json:"name"`
	Args map[string]string `json:"args"`
}

type AnalysisTemplateSpec

type AnalysisTemplateSpec struct {
	Metrics map[string]AnalysisMetrics `json:"metrics"`
	Logs    map[string]AnalysisLog     `json:"logs"`
	HTTPs   map[string]AnalysisHTTP    `json:"https"`
}

func LoadAnalysisTemplate

func LoadAnalysisTemplate(repoRoot string) (*AnalysisTemplateSpec, error)

LoadAnalysisTemplate finds the config file for the analysis template in the .pipe directory first up. And returns parsed config, ErrNotFound is returned if not found.

func (*AnalysisTemplateSpec) Validate

func (s *AnalysisTemplateSpec) Validate() error

type CloudProviderCloudRunConfig

type CloudProviderCloudRunConfig struct {
	// The GCP project hosting the CloudRun service.
	Project string `json:"project"`
	// The region of running CloudRun service.
	Region string `json:"region"`
	// The path to the service account file for accessing CloudRun service.
	CredentialsFile string `json:"credentialsFile"`
}

type CloudProviderECSConfig added in v0.9.8

type CloudProviderECSConfig struct {
	// The region to send requests to. This parameter is required.
	// e.g. "us-west-2"
	// A full list of regions is: https://docs.aws.amazon.com/general/latest/gr/rande.html
	Region string `json:"region"`
	// Path to the shared credentials file.
	CredentialsFile string `json:"credentialsFile"`
	// The IAM role arn to use when assuming an role.
	RoleARN string `json:"roleARN"`
	// Path to the WebIdentity token the SDK should use to assume a role with.
	TokenFile string `json:"tokenFile"`
	// AWS Profile to extract credentials from the shared credentials file.
	// If empty, the environment variable "AWS_PROFILE" is used.
	// "default" is populated if the environment variable is also not set.
	Profile string `json:"profile"`
}

type CloudProviderKubernetesConfig

type CloudProviderKubernetesConfig struct {
	// The master URL of the kubernetes cluster.
	// Empty means in-cluster.
	MasterURL string `json:"masterURL"`
	// The path to the kubeconfig file.
	// Empty means in-cluster.
	KubeConfigPath string `json:"kubeConfigPath"`
	// Configuration for application resource informer.
	AppStateInformer KubernetesAppStateInformer `json:"appStateInformer"`
}

type CloudProviderLambdaConfig

type CloudProviderLambdaConfig struct {
	// The region to send requests to. This parameter is required.
	// e.g. "us-west-2"
	// A full list of regions is: https://docs.aws.amazon.com/general/latest/gr/rande.html
	Region string `json:"region"`
	// Path to the shared credentials file.
	CredentialsFile string `json:"credentialsFile"`
	// The IAM role arn to use when assuming an role.
	RoleARN string `json:"roleARN"`
	// Path to the WebIdentity token the SDK should use to assume a role with.
	TokenFile string `json:"tokenFile"`
	// AWS Profile to extract credentials from the shared credentials file.
	// If empty, the environment variable "AWS_PROFILE" is used.
	// "default" is populated if the environment variable is also not set.
	Profile string `json:"profile"`
}

type CloudProviderTerraformConfig

type CloudProviderTerraformConfig struct {
	// List of variables that will be set directly on terraform commands with "-var" flag.
	// The variable must be formatted by "key=value" as below:
	// "image_id=ami-abc123"
	// 'image_id_list=["ami-abc123","ami-def456"]'
	// 'image_id_map={"us-east-1":"ami-abc123","us-east-2":"ami-def456"}'
	Vars []string `json:"vars"`
}

type CloudRunDeploymentInput added in v0.3.0

type CloudRunDeploymentInput struct {
	// The name of service manifest file placing in application directory.
	// Default is service.yaml
	ServiceManifestFile string `json:"serviceManifestFile"`
	// Automatically reverts to the previous state when the deployment is failed.
	// Default is true.
	AutoRollback bool `json:"autoRollback" default:"true"`
}

type CloudRunDeploymentSpec added in v0.3.0

type CloudRunDeploymentSpec struct {
	GenericDeploymentSpec
	// Input for CloudRun deployment such as docker image...
	Input CloudRunDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync CloudRunSyncStageOptions `json:"quickSync"`
}

CloudRunDeploymentSpec represents a deployment configuration for CloudRun application.

func (*CloudRunDeploymentSpec) Validate added in v0.3.0

func (s *CloudRunDeploymentSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type CloudRunPromoteStageOptions added in v0.4.0

type CloudRunPromoteStageOptions struct {
	// Percentage of traffic should be routed to the new version.
	Percent Percentage `json:"percent"`
}

CloudRunPromoteStageOptions contains all configurable values for a CLOUDRUN_PROMOTE stage.

type CloudRunSyncStageOptions added in v0.3.0

type CloudRunSyncStageOptions struct {
}

CloudRunSyncStageOptions contains all configurable values for a CLOUDRUN_SYNC stage.

type Config

type Config struct {
	Kind       Kind
	APIVersion string

	KubernetesDeploymentSpec *KubernetesDeploymentSpec
	TerraformDeploymentSpec  *TerraformDeploymentSpec
	CloudRunDeploymentSpec   *CloudRunDeploymentSpec
	LambdaDeploymentSpec     *LambdaDeploymentSpec
	ECSDeploymentSpec        *ECSDeploymentSpec

	PipedSpec            *PipedSpec
	ControlPlaneSpec     *ControlPlaneSpec
	AnalysisTemplateSpec *AnalysisTemplateSpec
	EventWatcherSpec     *EventWatcherSpec

	SealedSecretSpec *SealedSecretSpec
	// contains filtered or unexported fields
}

Config represents configuration data load from file. The spec is depend on the kind of configuration.

func DecodeYAML

func DecodeYAML(data []byte) (*Config, error)

DecodeYAML unmarshals config YAML data to config struct. It also validates the configuration after decoding.

func LoadFromYAML

func LoadFromYAML(file string) (*Config, error)

LoadFromYAML reads and decodes a yaml file to construct the Config.

func (*Config) GetGenericDeployment added in v0.8.0

func (c *Config) GetGenericDeployment() (GenericDeploymentSpec, bool)

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the way to unmarshal json data into Config struct. Firstly, this unmarshal to a generic config and then unmarshal the spec which depend on the kind of configuration.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the value of all fields.

type ControlPlaneCache

type ControlPlaneCache struct {
	TTL Duration `json:"ttl"`
}

func (ControlPlaneCache) TTLDuration added in v0.6.0

func (c ControlPlaneCache) TTLDuration() time.Duration

type ControlPlaneDataStore

type ControlPlaneDataStore struct {
	// The datastore type.
	Type model.DataStoreType

	// The configuration in the case of Cloud Firestore.
	FirestoreConfig *DataStoreFireStoreConfig
	// The configuration in the case of general MySQL.
	MySQLConfig *DataStoreMySQLConfig
}

func (*ControlPlaneDataStore) UnmarshalJSON

func (d *ControlPlaneDataStore) UnmarshalJSON(data []byte) error

type ControlPlaneFileStore

type ControlPlaneFileStore struct {
	// The filestore type.
	Type model.FileStoreType

	// The configuration in the case of Google Cloud Storage.
	GCSConfig *FileStoreGCSConfig `json:"gcs"`
	// The configuration in the case of Amazon S3.
	S3Config *FileStoreS3Config `json:"s3"`
	// The configuration in the case of Minio.
	MinioConfig *FileStoreMinioConfig `json:"minio"`
}

func (*ControlPlaneFileStore) UnmarshalJSON

func (f *ControlPlaneFileStore) UnmarshalJSON(data []byte) error

type ControlPlaneInsightCollector added in v0.9.3

type ControlPlaneInsightCollector struct {
	Application InsightCollectorApplication `json:"application"`
	Deployment  InsightCollectorDeployment  `json:"deployment"`
}

type ControlPlaneProject

type ControlPlaneProject struct {
	// The unique identifier of the project.
	Id string `json:"id"`
	// The description about the project.
	Desc string `json:"desc"`
	// Static admin account of the project.
	StaticAdmin ProjectStaticUser `json:"staticAdmin"`
}

type ControlPlaneSpec

type ControlPlaneSpec struct {
	// The address to the control plane.
	// This is required if SSO is enabled.
	Address string `json:"address"`
	// A randomly generated string used to sign oauth state.
	StateKey string `json:"stateKey"`
	// The configuration of datastore for control plane.
	Datastore ControlPlaneDataStore `json:"datastore"`
	// The configuration of filestore for control plane.
	Filestore ControlPlaneFileStore `json:"filestore"`
	// The configuration of cache for control plane.
	Cache ControlPlaneCache `json:"cache"`
	// The configuration of insight collector.
	// TODO: Enable collecting insight by default once this feature reached Beta.
	InsightCollector ControlPlaneInsightCollector `json:"insightCollector"`
	// List of debugging/quickstart projects defined in Control Plane configuration.
	// Please note that do not use this to configure the projects running in the production.
	Projects []ControlPlaneProject `json:"projects"`
	// List of shared SSO configurations that can be used by any projects.
	SharedSSOConfigs []SharedSSOConfig `json:"sharedSSOConfigs"`
}

ControlPlaneSpec defines all configuration for all control-plane components.

func (*ControlPlaneSpec) FindProject added in v0.6.0

func (s *ControlPlaneSpec) FindProject(id string) (ControlPlaneProject, bool)

FindProject finds and returns a specific project in the configured list.

func (*ControlPlaneSpec) ProjectMap added in v0.6.0

func (s *ControlPlaneSpec) ProjectMap() map[string]ControlPlaneProject

func (*ControlPlaneSpec) SharedSSOConfigMap added in v0.6.0

func (s *ControlPlaneSpec) SharedSSOConfigMap() map[string]*model.ProjectSSOConfig

func (*ControlPlaneSpec) Validate

func (s *ControlPlaneSpec) Validate() error

type DataStoreFireStoreConfig

type DataStoreFireStoreConfig struct {
	// The root path element considered as a logical namespace, e.g. `pipecd`.
	Namespace string `json:"namespace"`
	// The second path element considered as a logical environment, e.g. `dev`.
	// All pipecd collections will have path formatted according to `{namespace}/{environment}/{collection-name}`.
	Environment string `json:"environment"`
	// The prefix for collection name.
	// This can be used to avoid conflicts with existing collections in your Firestore database.
	CollectionNamePrefix string `json:"collectionNamePrefix"`
	// The name of GCP project hosting the Firestore.
	Project string `json:"project"`
	// The path to the service account file for accessing Firestores.
	CredentialsFile string `json:"credentialsFile"`
}

type DataStoreMySQLConfig added in v0.9.7

type DataStoreMySQLConfig struct {
	// The url of MySQL. All of credentials can be specified via this field.
	URL string `json:"url"`
	// The name of the database.
	Database string `json:"database"`
	// The path to the username file.
	// For those who don't want to include the username in the URL.
	UsernameFile string `json:"usernameFile"`
	// The path to the password file.
	// For those who don't want to include the password in the URL.
	PasswordFile string `json:"passwordFile"`
}

type DeploymentCommitMatcher added in v0.1.6

type DeploymentCommitMatcher struct {
	// It makes sure to perform syncing if the commit message matches this regular expression.
	QuickSync string `json:"quickSync"`
	// It makes sure to perform pipeline if the commit message matches this regular expression.
	Pipeline string `json:"pipeline"`
}

DeploymentCommitMatcher provides a way to decide how to deploy.

type DeploymentPipeline

type DeploymentPipeline struct {
	Stages []PipelineStage `json:"stages"`
}

DeploymentPipeline represents the way to deploy the application. The pipeline is triggered by changes in any of the following objects: - Target PodSpec (Target can be Deployment, DaemonSet, StatefulSet) - ConfigMaps, Secrets that are mounted as volumes or envs in the deployment.

type DeploymentPlanner added in v0.16.1

type DeploymentPlanner struct {
	// Disable auto-detecting to use QUICK_SYNC or PROGRESSIVE_SYNC.
	// Always use the speficied pipeline for all deployments.
	AlwaysUsePipeline bool `json:"alwaysUsePipeline"`
}

type Duration

type Duration time.Duration

func (Duration) Duration

func (d Duration) Duration() time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type ECSCanaryCleanStageOptions added in v0.10.0

type ECSCanaryCleanStageOptions struct {
}

ECSCanaryCleanStageOptions contains all configurable values for a ECS_CANARY_CLEAN stage.

type ECSCanaryRolloutStageOptions added in v0.9.16

type ECSCanaryRolloutStageOptions struct {
	// Scale represents the amount of desired task that should be rolled out as CANARY variant workload.
	Scale Percentage `json:"scale"`
}

ECSCanaryRolloutStageOptions contains all configurable values for a ECS_CANARY_ROLLOUT stage.

type ECSDeploymentInput added in v0.9.8

type ECSDeploymentInput struct {
	// The name of service definition file placing in application directory.
	// Default is service.json
	ServiceDefinitionFile string `json:"serviceDefinitionFile" default:"service.json"`
	// The name of task definition file placing in application directory.
	// Default is taskdef.json
	TaskDefinitionFile string `json:"taskDefinitionFile" default:"taskdef.json"`
	// ECSTargetGroups
	TargetGroups ECSTargetGroups `json:"targetGroups"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is true.
	AutoRollback bool `json:"autoRollback" default:"true"`
}

type ECSDeploymentSpec added in v0.9.8

type ECSDeploymentSpec struct {
	GenericDeploymentSpec
	// Input for ECS deployment such as where to fetch source code...
	Input ECSDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync ECSSyncStageOptions `json:"quickSync"`
}

ECSDeploymentSpec represents a deployment configuration for ECS application.

func (*ECSDeploymentSpec) Validate added in v0.9.8

func (s *ECSDeploymentSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type ECSPrimaryRolloutStageOptions added in v0.9.16

type ECSPrimaryRolloutStageOptions struct {
}

ECSPrimaryRolloutStageOptions contains all configurable values for a ECS_PRIMARY_ROLLOUT stage.

type ECSSyncStageOptions added in v0.9.8

type ECSSyncStageOptions struct {
}

ECSSyncStageOptions contains all configurable values for a ECS_SYNC stage.

type ECSTargetGroups added in v0.9.16

type ECSTargetGroups struct {
	Primary json.RawMessage `json:"primary"`
	Canary  json.RawMessage `json:"canary"`
}

type ECSTrafficRoutingStageOptions added in v0.9.16

type ECSTrafficRoutingStageOptions struct {
	// Canary represents the amount of traffic that the rolled out CANARY variant will serve.
	Canary Percentage `json:"canary"`
	// Primary represents the amount of traffic that the rolled out CANARY variant will serve.
	Primary Percentage `json:"primary"`
}

ECSTrafficRoutingStageOptions contains all configurable values for ECS_TRAFFIC_ROUTING stage.

func (ECSTrafficRoutingStageOptions) Percentage added in v0.10.0

func (opts ECSTrafficRoutingStageOptions) Percentage() (primary, canary int)

type EventWatcherEvent added in v0.9.5

type EventWatcherEvent struct {
	// The event name.
	Name string `json:"name"`
	// Additional attributes of event. This can make an event definition
	// unique even if the one with the same name exists.
	Labels map[string]string `json:"labels"`
	// List of places where will be replaced when the new event matches.
	Replacements []EventWatcherReplacement `json:"replacements"`
}

EventWatcherEvent defines which file will be replaced when the given event happened.

func (*EventWatcherEvent) Validate added in v0.9.6

func (e *EventWatcherEvent) Validate() error

type EventWatcherReplacement added in v0.9.5

type EventWatcherReplacement struct {
	// The path to the file to be updated.
	File string `json:"file"`
	// The field to be updated. Only one of these can be used.
	//
	// The YAML path to the field to be updated. It requires to start
	// with `$` which represents the root element. e.g. `$.foo.bar[0].baz`.
	YAMLField string `json:"yamlField"`
	// The JSON path to the field to be updated.
	JSONField string `json:"jsonField"`
	// The HCL path to the field to be updated.
	HCLField string `json:"HCLField"`
	// The regex string specifying what should be replaced.
	// Only the first capturing group enclosed by `()` will be replaced with the new value.
	// e.g. "host.xz/foo/bar:(v[0-9].[0-9].[0-9])"
	Regex string `json:"regex"`
}

type EventWatcherSpec added in v0.9.5

type EventWatcherSpec struct {
	Events []EventWatcherEvent `json:"events"`
}

func LoadEventWatcher added in v0.9.5

func LoadEventWatcher(repoRoot string, includePatterns, excludePatterns []string) (*EventWatcherSpec, error)

LoadEventWatcher gives back parsed EventWatcher config after merging config files placed under the .pipe directory. With "includes" and "excludes", you can filter the files included the result. "excludes" are prioritized if both "excludes" and "includes" are given. ErrNotFound is returned if not found.

func (*EventWatcherSpec) Validate added in v0.9.5

func (s *EventWatcherSpec) Validate() error

type FileStoreGCSConfig

type FileStoreGCSConfig struct {
	// The bucket name to store artifacts and logs in the piped.
	Bucket string `json:"bucket"`
	// The path to the credentials file for accessing GCS.
	CredentialsFile string `json:"credentialsFile"`
}

type FileStoreMinioConfig

type FileStoreMinioConfig struct {
	// The address of Minio.
	Endpoint string `json:"endpoint"`
	// The bucket name to store.
	Bucket string `json:"bucket"`
	// The path to the access key file.
	AccessKeyFile string `json:"accessKeyFile"`
	// The path to the secret key file.
	SecretKeyFile string `json:"secretKeyFile"`
	// Whether the given bucket should be made automatically if not exists.
	AutoCreateBucket bool `json:"autoCreateBucket"`
}

type FileStoreS3Config

type FileStoreS3Config struct {
	// The bucket name to store artifacts and logs in the piped.
	Bucket string `json:"bucket"`
	// The aws region of S3 bucket.
	Region string `json:"region"`
	// The aws profile name.
	Profile string `json:"profile"`
	// The path to the credentials file for accessing AWS.
	CredentialsFile string `json:"credentialsFile"`
	// The IAM role arn to use when assuming an role.
	RoleARN string `json:"roleARN"`
	// Path to the WebIdentity token the SDK should use to assume a role with.
	TokenFile string `json:"tokenFile"`
}

type GenericDeploymentSpec added in v0.8.0

type GenericDeploymentSpec struct {
	// Configuration used while planning deployment.
	Planner DeploymentPlanner `json:"planner"`
	// Forcibly use QuickSync or Pipeline when commit message matched the specified pattern.
	CommitMatcher DeploymentCommitMatcher `json:"commitMatcher"`
	// Pipeline for deploying progressively.
	Pipeline *DeploymentPipeline `json:"pipeline"`
	// The list of sealed secrets that should be decrypted.
	SealedSecrets []SealedSecretMapping `json:"sealedSecrets"`
	// List of directories or files where their changes will trigger the deployment.
	// Regular expression can be used.
	TriggerPaths []string `json:"triggerPaths,omitempty"`
	// The maximum length of time to execute deployment before giving up.
	// Default is 6h.
	Timeout Duration `json:"timeout,omitempty" default:"6h"`
	// List of encrypted secrets and targets that should be decoded before using.
	Encryption *SecretEncryption `json:"encryption"`
}

func (GenericDeploymentSpec) GetStage added in v0.8.0

func (s GenericDeploymentSpec) GetStage(index int32) (PipelineStage, bool)

func (GenericDeploymentSpec) HasStage added in v0.9.0

func (s GenericDeploymentSpec) HasStage(stage model.Stage) bool

HasStage checks if the given stage is included in the pipeline.

func (*GenericDeploymentSpec) Validate added in v0.9.5

func (s *GenericDeploymentSpec) Validate() error

type HelmChartRepository added in v0.1.2

type HelmChartRepository struct {
	// The name of the Helm chart repository.
	Name string `json:"name"`
	// The address to the Helm chart repository.
	Address string `json:"address"`
	// Username used for the repository backed by HTTP basic authentication.
	Username string `json:"username"`
	// Password used for the repository backed by HTTP basic authentication.
	Password string `json:"password"`
	// Whether to skip TLS certificate checks for the repository or not.
	Insecure bool `json:"insecure"`
}

type InputHelmChart

type InputHelmChart struct {
	// Git remote address where the chart is placing.
	// Empty means the same repository.
	GitRemote string `json:"gitRemote"`
	// The commit SHA or tag for remote git.
	Ref string `json:"ref"`
	// Relative path from the repository root directory to the chart directory.
	Path string `json:"path"`

	// The name of an added Helm Chart Repository.
	Repository string `json:"repository"`
	Name       string `json:"name"`
	Version    string `json:"version"`
	// Whether to skip TLS certificate checks for the repository or not.
	// This option will automatically set the value of HelmChartRepository.Insecure.
	Insecure bool `json:"-"`
}

type InputHelmOptions added in v0.1.2

type InputHelmOptions struct {
	// The release name of helm deployment.
	// By default the release name is equal to the application name.
	ReleaseName string `json:"releaseName"`
	// List of value files should be loaded.
	ValueFiles []string `json:"valueFiles"`
	// List of file path for values.
	SetFiles map[string]string
}

type InsightCollectorApplication added in v0.9.16

type InsightCollectorApplication struct {
	Enabled  bool   `json:"enabled" default:"true"`
	Schedule string `json:"schedule" default:"0 * * * *"`
}

type InsightCollectorDeployment added in v0.9.16

type InsightCollectorDeployment struct {
	Enabled       bool     `json:"enabled"`
	Schedule      string   `json:"schedule" default:"30 0,12 * * *"`
	Retries       int      `json:"retries" default:"3"`
	RetryInterval Duration `json:"retryInterval" default:"1h"`
}

type IstioTrafficRouting added in v0.1.5

type IstioTrafficRouting struct {
	// List of routes in the VirtualService that can be changed to update traffic routing.
	// Empty means all routes should be updated.
	EditableRoutes []string `json:"editableRoutes"`
	// TODO: Add a validate to ensure this was configured or using the default value by service name.
	// The service host.
	Host string `json:"host"`
	// The reference to VirtualService manifest.
	// Empty means the first VirtualService resource will be used.
	VirtualService K8sResourceReference `json:"virtualService"`
}

type K8sBaselineCleanStageOptions

type K8sBaselineCleanStageOptions struct {
}

K8sBaselineCleanStageOptions contains all configurable values for a K8S_BASELINE_CLEAN stage.

type K8sBaselineRolloutStageOptions

type K8sBaselineRolloutStageOptions struct {
	// How many pods for BASELINE workloads.
	// An integer value can be specified to indicate an absolute value of pod number.
	// Or a string suffixed by "%" to indicate an percentage value compared to the pod number of PRIMARY.
	// Default is 1 pod.
	Replicas Replicas `json:"replicas"`
	// Suffix that should be used when naming the BASELINE variant's resources.
	// Default is "baseline".
	Suffix string `json:"suffix"`
	// Whether the BASELINE service should be created.
	CreateService bool `json:"createService"`
}

K8sBaselineRolloutStageOptions contains all configurable values for a K8S_BASELINE_ROLLOUT stage.

type K8sCanaryCleanStageOptions

type K8sCanaryCleanStageOptions struct {
}

K8sCanaryCleanStageOptions contains all configurable values for a K8S_CANARY_CLEAN stage.

type K8sCanaryRolloutStageOptions

type K8sCanaryRolloutStageOptions struct {
	// How many pods for CANARY workloads.
	// An integer value can be specified to indicate an absolute value of pod number.
	// Or a string suffixed by "%" to indicate an percentage value compared to the pod number of PRIMARY.
	// Default is 1 pod.
	Replicas Replicas `json:"replicas"`
	// Suffix that should be used when naming the CANARY variant's resources.
	// Default is "canary".
	Suffix string `json:"suffix"`
	// Whether the CANARY service should be created.
	CreateService bool `json:"createService"`
	// List of patches used to customize manifests for CANARY variant.
	Patches []K8sResourcePatch
}

K8sCanaryRolloutStageOptions contains all configurable values for a K8S_CANARY_ROLLOUT stage.

type K8sPrimaryRolloutStageOptions added in v0.1.5

type K8sPrimaryRolloutStageOptions struct {
	// Suffix that should be used when naming the PRIMARY variant's resources.
	// Default is "primary".
	Suffix string `json:"suffix"`
	// Whether the PRIMARY service should be created.
	CreateService bool `json:"createService"`
	// Whether the PRIMARY variant label should be added to manifests if they were missing.
	AddVariantLabelToSelector bool `json:"addVariantLabelToSelector"`
	// Whether the resources that are no longer defined in Git should be removed or not.
	Prune bool `json:"prune"`
}

K8sPrimaryRolloutStageOptions contains all configurable values for a K8S_PRIMARY_ROLLOUT stage.

type K8sResourcePatch added in v0.14.0

type K8sResourcePatch struct {
	Target K8sResourcePatchTarget `json:"target"`
	Ops    []K8sResourcePatchOp   `json:"ops"`
}

type K8sResourcePatchOp added in v0.14.0

type K8sResourcePatchOp struct {
	// The operation type.
	// This must be one of "yaml-replace", "yaml-add", "yaml-remove", "json-replace" or "text-regex".
	// Default is "yaml-replace".
	Op K8sResourcePatchOpName `json:"op" default:"yaml-replace"`
	// The path string pointing to the manipulated field.
	// E.g. "$.spec.foos[0].bar"
	Path string `json:"path"`
	// The value string whose content will be used as new value for the field.
	Value string `json:"value"`
}

type K8sResourcePatchOpName added in v0.14.0

type K8sResourcePatchOpName string

type K8sResourcePatchTarget added in v0.14.0

type K8sResourcePatchTarget struct {
	K8sResourceReference
	// In case you want to manipulate the YAML or JSON data specified in a field
	// of the manfiest, specify that field's path. The string value of that field
	// will be used as input for the patch operations.
	// Otherwise, the whole manifest will be the target of patch operations.
	DocumentRoot string `json:"documentRoot"`
}

type K8sResourceReference added in v0.1.5

type K8sResourceReference struct {
	Kind string `json:"kind"`
	Name string `json:"name"`
}

type K8sSyncStageOptions added in v0.1.6

type K8sSyncStageOptions struct {
	// Whether the PRIMARY variant label should be added to manifests if they were missing.
	AddVariantLabelToSelector bool `json:"addVariantLabelToSelector"`
	// Whether the resources that are no longer defined in Git should be removed or not.
	Prune bool `json:"prune"`
}

K8sSyncStageOptions contains all configurable values for a K8S_SYNC stage.

type K8sTrafficRoutingStageOptions added in v0.1.5

type K8sTrafficRoutingStageOptions struct {
	// Which variant should receive all traffic.
	// "primary" or "canary" or "baseline" can be populated.
	All string `json:"all"`
	// The percentage of traffic should be routed to PRIMARY variant.
	Primary Percentage `json:"primary"`
	// The percentage of traffic should be routed to CANARY variant.
	Canary Percentage `json:"canary"`
	// The percentage of traffic should be routed to BASELINE variant.
	Baseline Percentage `json:"baseline"`
}

K8sTrafficRoutingStageOptions contains all configurable values for a K8S_TRAFFIC_ROUTING stage.

func (K8sTrafficRoutingStageOptions) Percentages added in v0.1.5

func (opts K8sTrafficRoutingStageOptions) Percentages() (primary, canary, baseline int)

type Kind

type Kind string

Kind represents the kind of configuration the data contains.

const (
	// KindKubernetesApp represents deployment configuration for a Kubernetes application.
	// This application can be a group of plain-YAML Kubernetes manifests,
	// or kustomization manifests or helm manifests.
	KindKubernetesApp Kind = "KubernetesApp"
	// KindTerraformApp represents deployment configuration for a Terraform application.
	// This application contains a single workspace of a terraform root module.
	KindTerraformApp Kind = "TerraformApp"
	// KindLambdaApp represents deployment configuration for an AWS Lambda application.
	KindLambdaApp Kind = "LambdaApp"
	// KindCloudRunApp represents deployment configuration for a CloudRun application.
	KindCloudRunApp Kind = "CloudRunApp"
	// KindECSApp represents deployment configuration for an AWS ECS.
	KindECSApp Kind = "ECSApp"
	// KindSealedSecret represents a sealed secret.
	KindSealedSecret Kind = "SealedSecret"
)
const (
	// KindPiped represents configuration for piped.
	// This configuration will be loaded while the piped is starting up.
	KindPiped Kind = "Piped"
	// KindControlPlane represents configuration for control plane's services.
	KindControlPlane Kind = "ControlPlane"
	// KindAnalysisTemplate represents shared analysis template for a repository.
	// This configuration file should be placed in .pipe directory
	// at the root of the repository.
	KindAnalysisTemplate Kind = "AnalysisTemplate"
	// KindEventWatcher represents configuration for Event Watcher.
	KindEventWatcher Kind = "EventWatcher"
)

type KubernetesAppStateInformer added in v0.1.1

type KubernetesAppStateInformer struct {
	// Only watches the specified namespace.
	// Empty means watching all namespaces.
	Namespace string `json:"namespace"`
	// List of resources that should be added to the watching targets.
	IncludeResources []KubernetesResourceMatcher `json:"includeResources"`
	// List of resources that should be ignored from the watching targets.
	ExcludeResources []KubernetesResourceMatcher `json:"excludeResources"`
}

type KubernetesDeploymentInput

type KubernetesDeploymentInput struct {
	// List of manifest files in the application directory used to deploy.
	// Empty means all manifest files in the directory will be used.
	Manifests []string `json:"manifests"`
	// Version of kubectl will be used.
	KubectlVersion string `json:"kubectlVersion"`

	// Version of kustomize will be used.
	KustomizeVersion string `json:"kustomizeVersion"`
	// List of options that should be used by Kustomize commands.
	KustomizeOptions map[string]string `json:"kustomizeOptions"`

	// Version of helm will be used.
	HelmVersion string `json:"helmVersion"`
	// Where to fetch helm chart.
	HelmChart *InputHelmChart `json:"helmChart"`
	// Configurable parameters for helm commands.
	HelmOptions *InputHelmOptions `json:"helmOptions"`

	// The namespace where manifests will be applied.
	Namespace string `json:"namespace"`

	// Automatically reverts all deployment changes on failure.
	// Default is true.
	AutoRollback bool `json:"autoRollback" default:"true"`
}

KubernetesDeploymentInput represents needed input for triggering a Kubernetes deployment.

type KubernetesDeploymentSpec

type KubernetesDeploymentSpec struct {
	GenericDeploymentSpec
	// Input for Kubernetes deployment such as kubectl version, helm version, manifests filter...
	Input KubernetesDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync K8sSyncStageOptions `json:"quickSync"`
	// Which resource should be considered as the Service of application.
	// Empty means the first Service resource will be used.
	Service K8sResourceReference `json:"service"`
	// Which resources should be considered as the Workload of application.
	// Empty means all Deployments.
	// e.g.
	// - kind: Deployment
	//   name: deployment-name
	// - kind: ReplicationController
	//   name: replication-controller-name
	Workloads []K8sResourceReference `json:"workloads"`
	// Which method should be used for traffic routing.
	TrafficRouting *KubernetesTrafficRouting `json:"trafficRouting"`
}

KubernetesDeploymentSpec represents a deployment configuration for Kubernetes application.

func (*KubernetesDeploymentSpec) Validate

func (s *KubernetesDeploymentSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type KubernetesResourceMatcher

type KubernetesResourceMatcher struct {
	// The APIVersion of the kubernetes resource.
	APIVersion string `json:"apiVersion"`
	// The kind name of the kubernetes resource.
	// Empty means all kinds are matching.
	Kind string `json:"kind"`
}

type KubernetesTrafficRouting added in v0.3.0

type KubernetesTrafficRouting struct {
	Method KubernetesTrafficRoutingMethod `json:"method"`
	Istio  *IstioTrafficRouting           `json:"istio"`
}

type KubernetesTrafficRoutingMethod added in v0.3.0

type KubernetesTrafficRoutingMethod string
const (
	KubernetesTrafficRoutingMethodPodSelector KubernetesTrafficRoutingMethod = "podselector"
	KubernetesTrafficRoutingMethodIstio       KubernetesTrafficRoutingMethod = "istio"
	KubernetesTrafficRoutingMethodSMI         KubernetesTrafficRoutingMethod = "smi"
)

func DetermineKubernetesTrafficRoutingMethod added in v0.3.0

func DetermineKubernetesTrafficRoutingMethod(cfg *KubernetesTrafficRouting) KubernetesTrafficRoutingMethod

DetermineKubernetesTrafficRoutingMethod determines the routing method should be used based on the TrafficRouting config. The default is PodSelector: the way by updating the selector in Service to switching all of traffic.

type LambdaCanaryRolloutStageOptions added in v0.3.0

type LambdaCanaryRolloutStageOptions struct {
}

LambdaCanaryRolloutStageOptions contains all configurable values for a LAMBDA_CANARY_ROLLOUT stage.

type LambdaDeploymentInput added in v0.3.0

type LambdaDeploymentInput struct {
	// The name of service manifest file placing in application directory.
	// Default is function.yaml
	FunctionManifestFile string `json:"functionManifestFile" default:"function.yaml"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is true.
	AutoRollback bool `json:"autoRollback" default:"true"`
}

type LambdaDeploymentSpec added in v0.3.0

type LambdaDeploymentSpec struct {
	GenericDeploymentSpec
	// Input for Lambda deployment such as where to fetch source code...
	Input LambdaDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync LambdaSyncStageOptions `json:"quickSync"`
}

LambdaDeploymentSpec represents a deployment configuration for Lambda application.

func (*LambdaDeploymentSpec) Validate added in v0.3.0

func (s *LambdaDeploymentSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type LambdaPromoteStageOptions added in v0.5.0

type LambdaPromoteStageOptions struct {
	// Percentage of traffic should be routed to the new version.
	Percent Percentage `json:"percent"`
}

LambdaPromoteStageOptions contains all configurable values for a LAMBDA_PROMOTE stage.

type LambdaSyncStageOptions added in v0.3.0

type LambdaSyncStageOptions struct {
}

LambdaSyncStageOptions contains all configurable values for a LAMBDA_SYNC stage.

type NotificationReceiver added in v0.1.7

type NotificationReceiver struct {
	Name    string                       `json:"name"`
	Slack   *NotificationReceiverSlack   `json:"slack"`
	Webhook *NotificationReceiverWebhook `json:"webhook"`
}

type NotificationReceiverSlack added in v0.1.7

type NotificationReceiverSlack struct {
	HookURL string `json:"hookURL"`
}

type NotificationReceiverWebhook added in v0.1.7

type NotificationReceiverWebhook struct {
	URL string `json:"url"`
}

type NotificationRoute added in v0.1.7

type NotificationRoute struct {
	Name         string   `json:"name"`
	Receiver     string   `json:"receiver"`
	Events       []string `json:"events"`
	IgnoreEvents []string `json:"ignoreEvents"`
	Groups       []string `json:"groups"`
	IgnoreGroups []string `json:"ignoreGroups"`
	Apps         []string `json:"apps"`
	IgnoreApps   []string `json:"ignoreApps"`
	Envs         []string `json:"envs"`
	IgnoreEnvs   []string `json:"ignoreEnvs"`
}

type Notifications added in v0.1.7

type Notifications struct {
	// List of notification routes.
	Routes []NotificationRoute `json:"routes"`
	// List of notification receivers.
	Receivers []NotificationReceiver `json:"receivers"`
}

type Percentage added in v0.10.0

type Percentage struct {
	Number    int
	HasSuffix bool
}

func (Percentage) Int added in v0.10.0

func (p Percentage) Int() int

func (Percentage) MarshalJSON added in v0.10.0

func (p Percentage) MarshalJSON() ([]byte, error)

func (Percentage) String added in v0.10.0

func (p Percentage) String() string

func (*Percentage) UnmarshalJSON added in v0.10.0

func (p *Percentage) UnmarshalJSON(b []byte) error

type PipedAnalysisProvider

type PipedAnalysisProvider struct {
	Name string                     `json:"name"`
	Type model.AnalysisProviderType `json:"type"`

	PrometheusConfig  *AnalysisProviderPrometheusConfig  `json:"prometheus"`
	DatadogConfig     *AnalysisProviderDatadogConfig     `json:"datadog"`
	StackdriverConfig *AnalysisProviderStackdriverConfig `json:"stackdriver"`
}

func (*PipedAnalysisProvider) UnmarshalJSON

func (p *PipedAnalysisProvider) UnmarshalJSON(data []byte) error

func (*PipedAnalysisProvider) Validate added in v0.9.8

func (p *PipedAnalysisProvider) Validate() error

type PipedCloudProvider

type PipedCloudProvider struct {
	Name string
	Type model.CloudProviderType

	KubernetesConfig *CloudProviderKubernetesConfig
	TerraformConfig  *CloudProviderTerraformConfig
	CloudRunConfig   *CloudProviderCloudRunConfig
	LambdaConfig     *CloudProviderLambdaConfig
	ECSConfig        *CloudProviderECSConfig
}

func (*PipedCloudProvider) UnmarshalJSON

func (p *PipedCloudProvider) UnmarshalJSON(data []byte) error

type PipedEventWatcher added in v0.9.5

type PipedEventWatcher struct {
	// Interval to fetch the latest event and compare it with one defined in EventWatcher config files
	CheckInterval Duration `json:"checkInterval"`
	// The configuration list of git repositories to be observed.
	// Only the repositories in this list will be observed by Piped.
	GitRepos []PipedEventWatcherGitRepo `json:"gitRepos"`
}

func (*PipedEventWatcher) Validate added in v0.9.5

func (p *PipedEventWatcher) Validate() error

type PipedEventWatcherGitRepo added in v0.9.5

type PipedEventWatcherGitRepo struct {
	// Id of the git repository. This must be unique within
	// the repos' elements.
	RepoID string `json:"repoId"`
	// The commit message used to push after replacing values.
	// Default message is used if not given.
	CommitMessage string `json:"commitMessage"`
	// The file path patterns to be included.
	// Patterns can be used like "foo/*.yaml".
	Includes []string `json:"includes"`
	// The file path patterns to be excluded.
	// Patterns can be used like "foo/*.yaml".
	// This is prioritized if both includes and this one are given.
	Excludes []string `json:"excludes"`
}

type PipedGit

type PipedGit struct {
	// The username that will be configured for `git` user.
	// Default is "piped".
	Username string `json:"username"`
	// The email that will be configured for `git` user.
	// Default is "pipecd.dev@gmail.com".
	Email string `json:"email"`
	// Where to write ssh config file.
	// Default is "$HOME/.ssh/config".
	SSHConfigFilePath string `json:"sshConfigFilePath"`
	// The host name.
	// e.g. github.com, gitlab.com
	// Default is "github.com".
	Host string `json:"host"`
	// The hostname or IP address of the remote git server.
	// e.g. github.com, gitlab.com
	// Default is the same value with Host.
	HostName string `json:"hostName"`
	// The path to the private ssh key file.
	// This will be used to clone the source code of the specified git repositories.
	SSHKeyFile string `json:"sshKeyFile"`
	// Base64 encoded string of ssh-key.
	SSHKeyData string `json:"sshKeyData"`
}

func (PipedGit) LoadSSHKey added in v0.11.1

func (g PipedGit) LoadSSHKey() ([]byte, error)

func (PipedGit) ShouldConfigureSSHConfig

func (g PipedGit) ShouldConfigureSSHConfig() bool

type PipedRepository

type PipedRepository struct {
	// Unique identifier for this repository.
	// This must be unique in the piped scope.
	RepoID string `json:"repoId"`
	// Remote address of the repository used to clone the source code.
	// e.g. git@github.com:org/repo.git
	Remote string `json:"remote"`
	// The branch will be handled.
	Branch string `json:"branch"`
}

type PipedSpec

type PipedSpec struct {
	// The identifier of the PipeCD project where this piped belongs to.
	ProjectID string
	// The unique identifier generated for this piped.
	PipedID string
	// The path to the file containing the generated Key string for this piped.
	PipedKeyFile string
	// Base64 encoded string of Piped key.
	PipedKeyData string
	// The address used to connect to the control-plane's API.
	APIAddress string `json:"apiAddress"`
	// The address to the control-plane's Web.
	WebAddress string `json:"webAddress"`
	// How often to check whether an application should be synced.
	// Default is 1m.
	SyncInterval Duration `json:"syncInterval" default:"1m"`
	// Git configuration needed for git commands.
	Git PipedGit `json:"git"`
	// List of git repositories this piped will handle.
	Repositories []PipedRepository `json:"repositories"`
	// List of helm chart repositories that should be added while starting up.
	ChartRepositories []HelmChartRepository `json:"chartRepositories"`
	// List of cloud providers can be used by this piped.
	CloudProviders []PipedCloudProvider `json:"cloudProviders"`
	// List of analysis providers can be used by this piped.
	AnalysisProviders []PipedAnalysisProvider `json:"analysisProviders"`
	// Sending notification to Slack, Webhook…
	Notifications Notifications `json:"notifications"`
	// How the sealed secret should be managed.
	// Deprecated.
	// TODO: Remove sealedSecretManagement field in the future.
	SealedSecretManagement *SecretManagement `json:"sealedSecretManagement"`
	// What secret management method should be used.
	SecretManagement *SecretManagement `json:"secretManagement"`
	// Optional settings for event watcher.
	EventWatcher PipedEventWatcher `json:"eventWatcher"`
}

PipedSpec contains configurable data used to while running Piped.

func (*PipedSpec) EnableDefaultKubernetesCloudProvider

func (s *PipedSpec) EnableDefaultKubernetesCloudProvider()

EnableDefaultKubernetesCloudProvider adds the default kubernetes cloud provider if it was not specified.

func (*PipedSpec) FindCloudProvider added in v0.4.0

func (s *PipedSpec) FindCloudProvider(name string, t model.CloudProviderType) (PipedCloudProvider, bool)

FindCloudProvider finds and returns a Cloud Provider by name and type.

func (*PipedSpec) GetAnalysisProvider

func (s *PipedSpec) GetAnalysisProvider(name string) (PipedAnalysisProvider, bool)

GetAnalysisProvider finds and returns an Analysis Provider config whose name is the given string.

func (*PipedSpec) GetRepository

func (s *PipedSpec) GetRepository(id string) (PipedRepository, bool)

GetRepository finds a repository with the given ID from the configured list.

func (*PipedSpec) GetRepositoryMap

func (s *PipedSpec) GetRepositoryMap() map[string]PipedRepository

GetRepositoryMap returns a map of repositories where key is repo id.

func (*PipedSpec) GetSecretManagement added in v0.10.0

func (s *PipedSpec) GetSecretManagement() *SecretManagement

func (*PipedSpec) HasCloudProvider

func (s *PipedSpec) HasCloudProvider(name string, t model.CloudProviderType) bool

HasCloudProvider checks whether the given provider is configured or not.

func (*PipedSpec) IsInsecureChartRepository added in v0.10.0

func (s *PipedSpec) IsInsecureChartRepository(name string) bool

func (*PipedSpec) LoadPipedKey added in v0.11.1

func (s *PipedSpec) LoadPipedKey() ([]byte, error)

func (*PipedSpec) Validate

func (s *PipedSpec) Validate() error

Validate validates configured data of all fields.

type PipelineStage

type PipelineStage struct {
	Id      string
	Name    model.Stage
	Desc    string
	Timeout Duration

	WaitStageOptions         *WaitStageOptions
	WaitApprovalStageOptions *WaitApprovalStageOptions
	AnalysisStageOptions     *AnalysisStageOptions

	K8sPrimaryRolloutStageOptions  *K8sPrimaryRolloutStageOptions
	K8sCanaryRolloutStageOptions   *K8sCanaryRolloutStageOptions
	K8sCanaryCleanStageOptions     *K8sCanaryCleanStageOptions
	K8sBaselineRolloutStageOptions *K8sBaselineRolloutStageOptions
	K8sBaselineCleanStageOptions   *K8sBaselineCleanStageOptions
	K8sTrafficRoutingStageOptions  *K8sTrafficRoutingStageOptions

	TerraformSyncStageOptions  *TerraformSyncStageOptions
	TerraformPlanStageOptions  *TerraformPlanStageOptions
	TerraformApplyStageOptions *TerraformApplyStageOptions

	CloudRunSyncStageOptions    *CloudRunSyncStageOptions
	CloudRunPromoteStageOptions *CloudRunPromoteStageOptions

	LambdaSyncStageOptions          *LambdaSyncStageOptions
	LambdaCanaryRolloutStageOptions *LambdaCanaryRolloutStageOptions
	LambdaPromoteStageOptions       *LambdaPromoteStageOptions

	ECSSyncStageOptions           *ECSSyncStageOptions
	ECSCanaryRolloutStageOptions  *ECSCanaryRolloutStageOptions
	ECSPrimaryRolloutStageOptions *ECSPrimaryRolloutStageOptions
	ECSCanaryCleanStageOptions    *ECSCanaryCleanStageOptions
	ECSTrafficRoutingStageOptions *ECSTrafficRoutingStageOptions
}

PipelineStage represents a single stage of a pipeline. This is used as a generic struct for all stage type.

func (*PipelineStage) UnmarshalJSON

func (s *PipelineStage) UnmarshalJSON(data []byte) error

type ProjectStaticUser added in v0.1.1

type ProjectStaticUser struct {
	// The username string.
	Username string `json:"username"`
	// The bcrypt hashsed value of the password string.
	PasswordHash string `json:"passwordHash"`
}

type Replicas

type Replicas struct {
	Number       int
	IsPercentage bool
}

func (Replicas) Calculate added in v0.1.1

func (r Replicas) Calculate(total, defaultValue int) int

func (Replicas) MarshalJSON

func (r Replicas) MarshalJSON() ([]byte, error)

func (Replicas) String

func (r Replicas) String() string

func (*Replicas) UnmarshalJSON

func (r *Replicas) UnmarshalJSON(b []byte) error

type SealedSecretMapping added in v0.8.0

type SealedSecretMapping struct {
	// Relative path from the application directory to sealed secret file.
	Path string `json:"path"`
	// The filename for the decrypted secret.
	// Empty means the same name with the sealed secret file.
	OutFilename string `json:"outFilename"`
	// The directory name where to put the decrypted secret.
	// Empty means the same directory with the sealed secret file.
	OutDir string `json:"outDir"`
}

type SealedSecretSpec added in v0.8.0

type SealedSecretSpec struct {
	// A string that represents the encrypted data of the original file.
	// When this is configured, the template and encryptedItems fields will be ignored.
	EncryptedData string
	// The template used to restore the original content.
	Template string
	// A list of encrypted items that will be decrypted and inserted to
	// the specified template to render the original content.
	EncryptedItems map[string]string
}

SealedSecretSpec holds the data of a sealed secret.

func (*SealedSecretSpec) RenderOriginalContent added in v0.8.0

func (s *SealedSecretSpec) RenderOriginalContent(dcr sealedSecretDecrypter) ([]byte, error)

func (*SealedSecretSpec) Validate added in v0.8.0

func (s *SealedSecretSpec) Validate() error

type SecretEncryption added in v0.10.0

type SecretEncryption struct {
	// List of encrypted secrets.
	EncryptedSecrets map[string]string `json:"encryptedSecrets"`
	// List of files to be decrypted before using.
	DecryptionTargets []string `json:"decryptionTargets"`
}

func (*SecretEncryption) Validate added in v0.10.0

func (e *SecretEncryption) Validate() error

type SecretManagement added in v0.10.0

type SecretManagement struct {
	// Which management service should be used.
	// Available values: KEY_PAIR, SEALING_KEY, GCP_KMS, AWS_KMS
	Type model.SecretManagementType `json:"type"`

	KeyPair *SecretManagementKeyPair
	GCPKMS  *SecretManagementGCPKMS
}

func (*SecretManagement) UnmarshalJSON added in v0.10.0

func (s *SecretManagement) UnmarshalJSON(data []byte) error

func (*SecretManagement) Validate added in v0.10.0

func (s *SecretManagement) Validate() error

type SecretManagementGCPKMS added in v0.10.0

type SecretManagementGCPKMS struct {
	// Configurable fields when using Google Cloud KMS.
	// The key name used for decrypting the sealed secret.
	KeyName string `json:"keyName"`
	// The path to the service account used to decrypt secret.
	DecryptServiceAccountFile string `json:"decryptServiceAccountFile"`
	// The path to the service account used to encrypt secret.
	EncryptServiceAccountFile string `json:"encryptServiceAccountFile"`
}

func (*SecretManagementGCPKMS) Validate added in v0.10.0

func (s *SecretManagementGCPKMS) Validate() error

type SecretManagementKeyPair added in v0.10.0

type SecretManagementKeyPair struct {
	// Configurable fields for SEALING_KEY.
	// The path to the private RSA key file.
	PrivateKeyFile string `json:"privateKeyFile"`
	// Base64 encoded string of private key.
	PrivateKeyData string `json:"privateKeyData"`
	// The path to the public RSA key file.
	PublicKeyFile string `json:"publicKeyFile"`
	// Base64 encoded string of public key.
	PublicKeyData string `json:"publicKeyData"`
}

func (*SecretManagementKeyPair) LoadPrivateKey added in v0.12.0

func (s *SecretManagementKeyPair) LoadPrivateKey() ([]byte, error)

func (*SecretManagementKeyPair) LoadPublicKey added in v0.12.0

func (s *SecretManagementKeyPair) LoadPublicKey() ([]byte, error)

func (*SecretManagementKeyPair) Validate added in v0.10.0

func (s *SecretManagementKeyPair) Validate() error

type SharedSSOConfig added in v0.5.0

type SharedSSOConfig struct {
	model.ProjectSSOConfig `json:",inline"`
	Name                   string `json:"name"`
}

func (*SharedSSOConfig) UnmarshalJSON added in v0.5.0

func (s *SharedSSOConfig) UnmarshalJSON(data []byte) error

type TemplatableAnalysisHTTP

type TemplatableAnalysisHTTP struct {
	AnalysisHTTP
	Template AnalysisTemplateRef `json:"template"`
}

TemplatableAnalysisHTTP wraps AnalysisHTTP to allow specify template to use.

type TemplatableAnalysisLog

type TemplatableAnalysisLog struct {
	AnalysisLog
	Template AnalysisTemplateRef `json:"template"`
}

TemplatableAnalysisLog wraps AnalysisLog to allow specify template to use.

type TemplatableAnalysisMetrics

type TemplatableAnalysisMetrics struct {
	AnalysisMetrics
	Template AnalysisTemplateRef `json:"template"`
}

TemplatableAnalysisMetrics wraps AnalysisMetrics to allow specify template to use.

type TerraformApplyStageOptions

type TerraformApplyStageOptions struct {
	// How many times to retry applying terraform changes.
	Retries int `json:"retries"`
}

TerraformApplyStageOptions contains all configurable values for a TERRAFORM_APPLY stage.

type TerraformDeploymentInput

type TerraformDeploymentInput struct {
	// The terraform workspace name.
	// Empty means "default" workpsace.
	Workspace string `json:"workspace,omitempty"`
	// The version of terraform should be used.
	// Empty means the pre-installed version will be used.
	TerraformVersion string `json:"terraformVersion,omitempty"`
	// List of variables that will be set directly on terraform commands with "-var" flag.
	// The variable must be formatted by "key=value" as below:
	// "image_id=ami-abc123"
	// 'image_id_list=["ami-abc123","ami-def456"]'
	// 'image_id_map={"us-east-1":"ami-abc123","us-east-2":"ami-def456"}'
	Vars []string `json:"vars,omitempty"`
	// List of variable files that will be set on terraform commands with "-var-file" flag.
	VarFiles []string `json:"varFiles,omitempty"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is false.
	AutoRollback bool `json:"autoRollback"`
}

type TerraformDeploymentSpec

type TerraformDeploymentSpec struct {
	GenericDeploymentSpec
	// Input for Terraform deployment such as terraform version, workspace...
	Input TerraformDeploymentInput `json:"input"`
	// Configuration for quick sync.
	QuickSync TerraformApplyStageOptions `json:"quickSync"`
}

TerraformDeploymentSpec represents a deployment configuration for Terraform application.

func (*TerraformDeploymentSpec) Validate

func (s *TerraformDeploymentSpec) Validate() error

Validate returns an error if any wrong configuration value was found.

type TerraformPlanStageOptions

type TerraformPlanStageOptions struct {
}

TerraformPlanStageOptions contains all configurable values for a TERRAFORM_PLAN stage.

type TerraformSyncStageOptions added in v0.3.0

type TerraformSyncStageOptions struct {
	// How many times to retry applying terraform changes.
	Retries int `json:"retries"`
}

TerraformSyncStageOptions contains all configurable values for a TERRAFORM_SYNC stage.

type WaitApprovalStageOptions

type WaitApprovalStageOptions struct {
	// The maximum length of time to wait before giving up.
	// Defaults to 6h.
	Timeout   Duration `json:"timeout"`
	Approvers []string `json:"approvers"`
}

WaitStageOptions contains all configurable values for a WAIT_APPROVAL stage.

type WaitStageOptions

type WaitStageOptions struct {
	Duration Duration `json:"duration"`
}

WaitStageOptions contains all configurable values for a WAIT stage.

Jump to

Keyboard shortcuts

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