config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SharedConfigurationDirName = ".pipe"
)

Variables

View Source
var DefaultKubernetesCloudProvider = PipedCloudProvider{
	Name:             "kubernetes-default",
	Type:             model.CloudProviderKubernetes,
	KubernetesConfig: &CloudProviderKubernetesConfig{},
}

Functions

func ParseVariantResourceReference added in v0.1.5

func ParseVariantResourceReference(ref string) (kind, name string, ok bool)

ParseVariantResourceReference parses the given reference name and returns the resource Kind, Name. If the reference is malformed, empty kind, empty name and false will be returned. Reference format: - kind/name - name

func ToApplicationKind

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

ToApplicationKind converts configuration kind to application kind.

Types

type AnalysisDynamic

type AnalysisDynamic struct {
	Metrics []AnalysisDynamicMetrics `json:"metrics"`
	Logs    []AnalysisDynamicLog     `json:"logs"`
	Https   []AnalysisDynamicHTTP    `json:"https"`
}

AnalysisDynamic contains settings for analysis by comparing with dynamic data.

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 AnalysisDynamicMetrics

type AnalysisDynamicMetrics 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.

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"`
	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"`
	// 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 {
	Query    string           `json:"query"`
	Expected AnalysisExpected `json:"expected"`
	Interval Duration         `json:"interval"`
	// Maximum number of failed checks before the query result is considered as failure.
	// For instance, If 1 is set, the analysis will be considered a failure after 2 failures.
	FailureLimit int `json:"failureLimit"`
	// How long after which the query times out.
	Timeout  Duration `json:"timeout"`
	Provider string   `json:"provider"`
}

AnalysisMetrics contains common configurable values for deployment analysis with metrics.

type AnalysisProviderDatadogConfig

type AnalysisProviderDatadogConfig struct {
	Address string `json:"address"`
	// The path to the api key file.
	APIKeyFile string `json:"apiKeyFile"`
	// The path to the application key file.
	ApplicationKeyFile string `json:"applicationKeyFile"`
}

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"`
}

type AnalysisProviderStackdriverConfig

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

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"`
	Dynamic          AnalysisDynamic              `json:"dynamic"`
}

AnalysisStageOptions contains all configurable values for a K8S_ANALYSIS stage.

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, bool, error)

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

func (*AnalysisTemplateSpec) Validate

func (s *AnalysisTemplateSpec) Validate() error

type BaselineVariant

type BaselineVariant struct {
	// Suffix that should be used when naming the BASELINE variant's resources.
	// Default is "baseline".
	Suffix   string               `json:"suffix"`
	Service  K8sVariantService    `json:"service"`
	Workload K8sResourceReference `json:"workload"`
}

type CanaryVariant

type CanaryVariant struct {
	// Suffix that should be used when naming the CANARY variant's resources.
	// Default is "canary".
	Suffix   string               `json:"suffix"`
	Service  K8sVariantService    `json:"service"`
	Workload K8sResourceReference `json:"workload"`
}

type CloudProviderCloudRunConfig

type CloudProviderCloudRunConfig struct {
	Project         string `json:"project"`
	Region          string `json:"region"`
	Platform        string `json:"platform"`
	CredentialsFile string `json:"credentialsFile"`
}

type CloudProviderKubernetesConfig

type CloudProviderKubernetesConfig struct {
	AppStateInformer KubernetesAppStateInformer `json:"appStateInformer"`
	MasterURL        string                     `json:"masterURL"`
	KubeConfigPath   string                     `json:"kubeConfigPath"`
}

type CloudProviderLambdaConfig

type CloudProviderLambdaConfig struct {
	Region string `json:"region"`
}

type CloudProviderTerraformAWS

type CloudProviderTerraformAWS struct {
	Region string `json:"region"`
}

type CloudProviderTerraformConfig

type CloudProviderTerraformConfig struct {
	GCP *CloudProviderTerraformGCP `json:"gcp"`
	AWS *CloudProviderTerraformAWS `json:"aws"`
}

type CloudProviderTerraformGCP

type CloudProviderTerraformGCP struct {
	Project         string `json:"project"`
	Region          string `json:"region"`
	CredentialsFile string `json:"credentialsFile"`
}

type Config

type Config struct {
	Kind       Kind
	APIVersion string

	// Deployment specs.
	KubernetesDeploymentSpec *KubernetesDeploymentSpec
	TerraformDeploymentSpec  *TerraformDeploymentSpec

	PipedSpec            *PipedSpec
	ControlPlaneSpec     *ControlPlaneSpec
	AnalysisTemplateSpec *AnalysisTemplateSpec
	// 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) GetPipelineable

func (c *Config) GetPipelineable() (Pipelineable, 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"`
}

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 Amazon DynamoDB.
	DynamoDBConfig *DataStoreDynamoDBConfig
	// The configuration in the case of general MongoDB.
	MongoDBConfig *DataStoreMongoDBConfig
}

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 ControlPlaneProject

type ControlPlaneProject struct {
	ID          string            `json:"id"`
	Desc        string            `json:"desc"`
	StaticAdmin ProjectStaticUser `json:"staticAdmin"`
}

type ControlPlaneSpec

type ControlPlaneSpec struct {
	// 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"`
	// List of debugging/quickstart projects defined in Control Plane configuration.
	// Please do not use this to configure the projects running the production mode.
	Projects []ControlPlaneProject `json:"projects"`
	// The address to the API of PipeCD control plane.
	APIURL string `json:"apiUrl"`
	// The seed to generate oauth state paramater.
	StateSeed string `json:"stateSeed"`
}

func (*ControlPlaneSpec) GetProject added in v0.1.1

func (s *ControlPlaneSpec) GetProject(id string) (*model.Project, bool)

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

func (*ControlPlaneSpec) Validate

func (s *ControlPlaneSpec) Validate() error

type DataStoreDynamoDBConfig

type DataStoreDynamoDBConfig struct {
}

type DataStoreFireStoreConfig

type DataStoreFireStoreConfig struct {
	// The identifier that logically separates the root path of the datastore.
	Namespace string `json:"namespace"`
	// The identifier that logically separates directly under the namespace of the datastore.
	Environment string `json:"environment"`
	// The identifier of the GCP project which host the firestore.
	Project string `json:"project"`
	// The path to the credentials file for accessing firestore.
	CredentialsFile string `json:"credentialsFile"`
}

type DataStoreMongoDBConfig

type DataStoreMongoDBConfig struct {
}

type DeploymentCommitMatcher added in v0.1.6

type DeploymentCommitMatcher struct {
	// It makes sure to perform syncing if the commit message matches this regular expression.
	Sync string `json:"sync"`
	// 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, StatefullSet) - ConfigMaps, Secrets that are mounted as volumes or envs in the deployment.

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 FileStoreGCSConfig

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

type FileStoreMinioConfig

type FileStoreMinioConfig struct {
}

type FileStoreS3Config

type FileStoreS3Config struct {
}

type HelmChartRepository added in v0.1.2

type HelmChartRepository struct {
	Name     string `json:"name"`
	Address  string `json:"address"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type InputHelmChart

type InputHelmChart struct {
	// Empty means current 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"`
}

type InputHelmOptions added in v0.1.2

type InputHelmOptions struct {
	// 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"`
	SetFiles   map[string]string
}

type IstioTrafficRouting added in v0.1.5

type IstioTrafficRouting struct {
	EditableRoutes []string `json:"editableRoutes"`
	// TODO: Add a validate to ensure this was configured or using the default value by service name.
	Host           string               `json:"host"`
	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"`
}

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"`
}

K8sCanaryRolloutStageOptions contains all configurable values for a K8S_CANARY_ROLLOUT stage.

type K8sPrimaryRolloutStageOptions added in v0.1.5

type K8sPrimaryRolloutStageOptions struct {
	Manifests []string `json:"manifests"`
	// Whether the resources that are no longer defined in Git will be removed.
	Prune bool `json:"prune"`
}

K8sPrimaryRolloutStageOptions contains all configurable values for a K8S_PRIMARY_ROLLOUT stage.

type K8sResourceReference added in v0.1.5

type K8sResourceReference struct {
	Reference string `json:"reference"`
}

type K8sSyncStageOptions added in v0.1.6

type K8sSyncStageOptions struct {
	// Whether the resources that are no longer defined in Git will be removed.
	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.
	All string `json:"all"`
	// The percentage of traffic should be routed to PRIMARY variant.
	Primary int `json:"primary"`
	// The percentage of traffic should be routed to CANARY variant.
	Canary int `json:"canary"`
	// The percentage of traffic should be routed to BASELINE variant.
	Baseline int `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 K8sVariantService added in v0.1.5

type K8sVariantService struct {
	K8sResourceReference
	Create bool `json:"create"`
}

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"
	// KindCrossplaneApp represents deployment configuration for a Crossplane application.
	KindCrossplaneApp Kind = "CrossplaneApp"
	// KindLambdaApp represents deployment configuration for an AWS Lambda application.
	KindLambdaApp Kind = "LambdaApp"
	// KindCloudRunApp represents deployment configuration for a CloudRun application.
	KindCloudRunApp Kind = "CloudRunApp"
)
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"
)

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 {
	Manifests      []string `json:"manifests"`
	KubectlVersion string   `json:"kubectlVersion"`

	KustomizeVersion string `json:"kustomizeVersion"`

	HelmChart   *InputHelmChart   `json:"helmChart"`
	HelmOptions *InputHelmOptions `json:"helmOptions"`
	HelmVersion string            `json:"helmVersion"`

	// The namespace where manifests will be applied.
	Namespace string `json:"namespace"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is true.
	AutoRollback bool     `json:"autoRollback"`
	Dependencies []string `json:"dependencies,omitempty"`
}

type KubernetesDeploymentSpec

type KubernetesDeploymentSpec struct {
	Input         KubernetesDeploymentInput `json:"input"`
	CommitMatcher DeploymentCommitMatcher   `json:"commitMatcher"`
	Sync          K8sSyncStageOptions       `json:"sync"`
	Pipeline      *DeploymentPipeline       `json:"pipeline"`

	PrimaryVariant  *PrimaryVariant  `json:"primaryVariant"`
	CanaryVariant   *CanaryVariant   `json:"canaryVariant"`
	BaselineVariant *BaselineVariant `json:"baselineVariant"`
	TrafficRouting  *TrafficRouting  `json:"trafficRouting"`
}

KubernetesDeploymentSpec represents a deployment configuration for Kubernetes application.

func (*KubernetesDeploymentSpec) GetStage

func (s *KubernetesDeploymentSpec) GetStage(index int32) (PipelineStage, bool)

func (*KubernetesDeploymentSpec) Validate

func (s *KubernetesDeploymentSpec) Validate() error

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

type KubernetesResourceMatcher

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

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"`
	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"`
	Receiver     string   `json:"receiver"`
}

type Notifications added in v0.1.7

type Notifications struct {
	Routes    []NotificationRoute    `json:"routes"`
	Receivers []NotificationReceiver `json:"receivers"`
}

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

type PipedCloudProvider

type PipedCloudProvider struct {
	Name string
	Type model.CloudProviderType

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

func (*PipedCloudProvider) UnmarshalJSON

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

type PipedGit

type PipedGit struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	// Where to write ssh config file.
	// Default is "/etc/ssh/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 git repositories.
	SSHKeyFile string `json:"sshKeyFile"`
}

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.
	// e.g. git@github.com:org/repo1.git
	Remote string `json:"remote"`
	// The branch should be tracked.
	Branch string `json:"branch"`
}

type PipedSpec

type PipedSpec struct {
	// The identifier of the project which this piped belongs to.
	ProjectID string
	// The unique identifier generated for this piped.
	PipedID string
	// The path to the key generated for this piped.
	PipedKeyFile string
	WebURL       string `json:"webURL"`
	// How often to check whether an application should be synced.
	// Default is 1m.
	SyncInterval Duration `json:"syncInterval"`
	// 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"`
	CloudProviders    []PipedCloudProvider    `json:"cloudProviders"`
	AnalysisProviders []PipedAnalysisProvider `json:"analysisProviders"`
	Notifications     Notifications           `json:"notifications"`
}

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) 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) HasCloudProvider

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

HasCloudProvider checks whether the given provider is configured or not.

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
	TerraformPlanStageOptions      *TerraformPlanStageOptions
	TerraformApplyStageOptions     *TerraformApplyStageOptions
}

PiplineStage 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 Pipelineable

type Pipelineable interface {
	GetStage(index int32) (PipelineStage, bool)
}

type PodTrafficRouting added in v0.1.5

type PodTrafficRouting struct {
	Service K8sResourceReference `json:"service"`
}

type PrimaryVariant added in v0.1.5

type PrimaryVariant struct {
	// Suffix that should be used when naming the PRIMARY variant's resources.
	// Default is "primary".
	Suffix  string            `json:"suffix"`
	Service K8sVariantService `json:"service"`
}

type ProjectStaticUser added in v0.1.1

type ProjectStaticUser struct {
	Username     string `json:"username"`
	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 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 K8S_TERRAFORM_APPLY stage.

type TerraformDeploymentInput

type TerraformDeploymentInput struct {
	Workspace        string `json:"workspace,omitempty"`
	TerraformVersion string `json:"terraformVersion,omitempty"`
	// Automatically reverts all changes from all stages when one of them failed.
	// Default is false.
	AutoRollback bool     `json:"autoRollback"`
	Dependencies []string `json:"dependencies,omitempty"`
}

type TerraformDeploymentSpec

type TerraformDeploymentSpec struct {
	Input    TerraformDeploymentInput `json:"input"`
	Pipeline *DeploymentPipeline      `json:"pipeline"`
}

TerraformDeploymentSpec represents a deployment configuration for Terraform application.

func (*TerraformDeploymentSpec) GetStage

func (s *TerraformDeploymentSpec) GetStage(index int32) (PipelineStage, bool)

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 K8S_TERRAFORM_PLAN stage.

type TrafficRouting added in v0.1.5

type TrafficRouting struct {
	Method TrafficRoutingMethod `json:"method"`
	Pod    *PodTrafficRouting   `json:"pod"`
	Istio  *IstioTrafficRouting `json:"istio"`
}

type TrafficRoutingMethod added in v0.1.5

type TrafficRoutingMethod string
const (
	TrafficRoutingMethodPod   TrafficRoutingMethod = "pod"
	TrafficRoutingMethodIstio TrafficRoutingMethod = "istio"
)

type WaitApprovalStageOptions

type WaitApprovalStageOptions struct {
	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