config

package
v0.0.0-...-5df1ef3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputHelmChart

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

	// The name of an added Helm Chart Repository.
	Repository string `json:"repository,omitempty"`
	Name       string `json:"name,omitempty"`
	Version    string `json:"version,omitempty"`
	// 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

type InputHelmOptions struct {
	// The release name of helm deployment.
	// By default the release name is equal to the application name.
	ReleaseName string `json:"releaseName,omitempty"`
	// List of values.
	SetValues map[string]string `json:"setValues,omitempty"`
	// List of value files should be loaded.
	ValueFiles []string `json:"valueFiles,omitempty"`
	// List of file path for values.
	SetFiles map[string]string `json:"setFiles,omitempty"`
	// Set of supported Kubernetes API versions.
	APIVersions []string `json:"apiVersions,omitempty"`
	// Kubernetes version used for Capabilities.KubeVersion
	KubeVersion string `json:"kubeVersion,omitempty"`
}

type IstioTrafficRouting

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

IstioTrafficRouting represents the Istio-specific configuration for traffic routing.

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 a percentage value compared to the pod number of PRIMARY.
	// Default is 1 pod.
	Replicas unit.Replicas `json:"replicas"`
	// Suffix that should be used when naming the BASELINE variant's resources.
	// Default is "baseline".
	Suffix string `json:"suffix" default:"baseline"`
	// Whether the BASELINE service should be created.
	CreateService bool `json:"createService"`
}

K8sBaselineRolloutStageOptions contains all configurable values for a K8S_BASELINE_ROLLOUT stage.

func (*K8sBaselineRolloutStageOptions) UnmarshalJSON

func (o *K8sBaselineRolloutStageOptions) UnmarshalJSON(data []byte) error

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 a percentage value compared to the pod number of PRIMARY.
	// Default is 1 pod.
	Replicas unit.Replicas `json:"replicas"`
	// Suffix that should be used when naming the CANARY variant's resources.
	// Default is "canary".
	Suffix string `json:"suffix" default:"canary"`
	// Whether the CANARY service should be created.
	CreateService bool `json:"createService"`
	// List of patches used to customize manifests for CANARY variant.
	Patches []K8sResourcePatch `json:"patches"`
}

K8sCanaryRolloutStageOptions contains all configurable values for a K8S_CANARY_ROLLOUT stage.

type K8sPrimaryRolloutStageOptions

type K8sPrimaryRolloutStageOptions struct {
	// Suffix that should be used when naming the PRIMARY variant's resources.
	// Default is "primary".
	Suffix string `json:"suffix" default:"primary"`
	// 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.

func (*K8sPrimaryRolloutStageOptions) UnmarshalJSON

func (o *K8sPrimaryRolloutStageOptions) UnmarshalJSON(data []byte) error

type K8sResourcePatch

type K8sResourcePatch struct {
	// The target of the patch operation.
	Target K8sResourcePatchTarget `json:"target"`
	// The operations to be performed on the target.
	Ops []K8sResourcePatchOp `json:"ops"`
}

K8sResourcePatch represents a patch operation for a Kubernetes resource.

type K8sResourcePatchOp

type K8sResourcePatchOp struct {
	// The operation type.
	// Currently, only "yaml-replace" is supported.
	// 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"`
}

K8sResourcePatchOp represents a patch operation for a Kubernetes resource.

type K8sResourcePatchOpName

type K8sResourcePatchOpName string

K8sResourcePatchOpName represents the name of a patch operation for a Kubernetes resource.

const (
	// K8sResourcePatchOpYAMLReplace is the name of the patch operation that replaces the target with a new YAML document.
	K8sResourcePatchOpYAMLReplace K8sResourcePatchOpName = "yaml-replace"
)

type K8sResourcePatchTarget

type K8sResourcePatchTarget struct {
	// The reference to the Kubernetes resource.
	K8sResourceReference
	// In case you want to manipulate the YAML or JSON data specified in a field
	// of the manifest, 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"`
}

K8sResourcePatchTarget represents the target of a patch operation for a Kubernetes resource.

type K8sResourceReference

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

K8sResourceReference represents a reference to a Kubernetes resource. It is used to specify the resources which are treated as the workload of an application.

type K8sSyncStageOptions

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

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

K8sTrafficRoutingStageOptions contains all configurable values for a K8S_TRAFFIC_ROUTING stage.

func (K8sTrafficRoutingStageOptions) DisplayString

func (opts K8sTrafficRoutingStageOptions) DisplayString() string

DisplayString returns a human-readable string of the traffic percentages.

func (K8sTrafficRoutingStageOptions) Percentages

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

Percentages returns the primary, canary, and baseline percentages from the K8sTrafficRoutingStageOptions.

type KubernetesAppStateInformer

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

KubernetesAppStateInformer represents the configuration for application resource informer.

type KubernetesApplicationSpec

type KubernetesApplicationSpec struct {
	// 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 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 resource should be considered as the Service of application.
	// Empty means the first Service resource will be used.
	Service K8sResourceReference `json:"service"`

	// The label will be configured to variant manifests used to distinguish them.
	VariantLabel KubernetesVariantLabel `json:"variantLabel"`

	// Traffic routing configuration for this application.
	// If not set, the default PodSelector method is used.
	TrafficRouting *KubernetesTrafficRouting `json:"trafficRouting"`
}

KubernetesApplicationSpec represents an application configuration for Kubernetes application.

func (*KubernetesApplicationSpec) UnmarshalJSON

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

func (*KubernetesApplicationSpec) Validate

func (s *KubernetesApplicationSpec) Validate() error

type KubernetesDeployTargetConfig

type KubernetesDeployTargetConfig struct {
	// The master URL of the kubernetes cluster.
	// Empty means in-cluster.
	MasterURL string `json:"masterURL,omitempty"`
	// The path to the kubeconfig file.
	// Empty means in-cluster.
	KubeConfigPath string `json:"kubeConfigPath,omitempty"`
	// Version of kubectl will be used.
	KubectlVersion string `json:"kubectlVersion"`
	// Configuration for application resource informer.
	AppStateInformer KubernetesAppStateInformer `json:"appStateInformer"`
}

func FindDeployTarget

func FindDeployTarget(cfg *config.PipedPlugin, name string) (KubernetesDeployTargetConfig, error)

FindDeployTarget finds the deploy target configuration by the given name.

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,omitempty"`
	// Version of kubectl will be used.
	KubectlVersion string `json:"kubectlVersion,omitempty"`

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

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

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

	// Automatically create a new namespace if it does not exist.
	// Default is false.
	AutoCreateNamespace bool `json:"autoCreateNamespace,omitempty"`

	MultiTargets []KubernetesMultiTarget `json:"multiTargets,omitempty"`
}

KubernetesDeploymentInput represents needed input for triggering a Kubernetes deployment.

type KubernetesMultiTarget

type KubernetesMultiTarget struct {
	Target         KubernetesMultiTargetDeployTarget `json:"target"`
	Manifests      []string                          `json:"manifests,omitempty"`
	KubectlVersion string                            `json:"kubectlVersion,omitempty"`
	KustomizeDir   string                            `json:"kustomizeDir,omitempty"`
}

type KubernetesMultiTargetDeployTarget

type KubernetesMultiTargetDeployTarget struct {
	Name   string            `json:"name"`
	Labels map[string]string `json:"labels"`
}

type KubernetesResourceMatcher

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

KubernetesResourceMatcher represents the matcher for a Kubernetes resource.

type KubernetesTrafficRouting

type KubernetesTrafficRouting struct {
	// The method to be used for traffic routing.
	// The default is PodSelector: the way by updating the selector in Service to switching all of traffic.
	Method KubernetesTrafficRoutingMethod `json:"method"`
	// The Istio-specific configuration for traffic routing.
	Istio *IstioTrafficRouting `json:"istio"`
}

KubernetesTrafficRouting represents the traffic routing configuration for a Kubernetes application.

type KubernetesTrafficRoutingMethod

type KubernetesTrafficRoutingMethod string
const (
	// KubernetesTrafficRoutingMethodPodSelector is the way by updating the selector in Service to switching all of traffic.
	KubernetesTrafficRoutingMethodPodSelector KubernetesTrafficRoutingMethod = "podselector"
	// KubernetesTrafficRoutingMethodIstio is the way by updating the VirtualService to update traffic routing.
	KubernetesTrafficRoutingMethodIstio KubernetesTrafficRoutingMethod = "istio"
)

func DetermineKubernetesTrafficRoutingMethod

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 KubernetesVariantLabel

type KubernetesVariantLabel struct {
	// The key of the label.
	// Default is pipecd.dev/variant.
	Key string `json:"key" default:"pipecd.dev/variant"`
	// The label value for PRIMARY variant.
	// Default is primary.
	PrimaryValue string `json:"primaryValue" default:"primary"`
	// The label value for CANARY variant.
	// Default is canary.
	CanaryValue string `json:"canaryValue" default:"canary"`
	// The label value for BASELINE variant.
	// Default is baseline.
	BaselineValue string `json:"baselineValue" default:"baseline"`
}

Jump to

Keyboard shortcuts

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