Documentation
¶
Index ¶
- Constants
- type HelmChartRegistry
- type HelmChartRegistryType
- type HelmChartRepository
- type HelmChartRepositoryType
- type InputHelmChart
- type InputHelmOptions
- type IstioTrafficRouting
- type K8sBaselineCleanStageOptions
- type K8sBaselineRolloutStageOptions
- type K8sCanaryCleanStageOptions
- type K8sCanaryRolloutStageOptions
- type K8sPrimaryRolloutStageOptions
- type K8sResourcePatch
- type K8sResourcePatchOp
- type K8sResourcePatchOpName
- type K8sResourcePatchTarget
- type K8sResourceReference
- type K8sSyncStageOptions
- type K8sTrafficRoutingStageOptions
- type KubernetesAppStateInformer
- type KubernetesApplicationSpec
- type KubernetesDeployTargetConfig
- type KubernetesDeploymentInput
- type KubernetesPluginConfig
- type KubernetesResourceMatcher
- type KubernetesTrafficRouting
- type KubernetesTrafficRoutingMethod
- type KubernetesVariantLabel
Constants ¶
const (
// K8sResourcePatchOpYAMLReplace is the name of the patch operation that replaces the target with a new YAML document.
K8sResourcePatchOpYAMLReplace = "yaml-replace"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HelmChartRegistry ¶
type HelmChartRegistry struct {
// The registry type. Currently, only OCI is supported.
Type HelmChartRegistryType `json:"type" default:"OCI"`
// The address to the Helm chart registry.
Address string `json:"address"`
// Username used for the registry authentication.
Username string `json:"username,omitempty"`
// Password used for the registry authentication.
Password string `json:"password,omitempty"`
}
HelmChartRegistry represents the configuration for a Helm chart registry.
func (*HelmChartRegistry) IsOCI ¶
func (r *HelmChartRegistry) IsOCI() bool
IsOCI checks if the registry is an OCI registry.
type HelmChartRegistryType ¶
type HelmChartRegistryType string
HelmChartRegistryType represents the type of Helm chart registry.
const (
OCIHelmChartRegistry HelmChartRegistryType = "OCI"
)
The registry types that hosts Helm charts.
type HelmChartRepository ¶
type HelmChartRepository struct {
// The repository type. Only HTTP is supported.
Type HelmChartRepositoryType `json:"type" default:"HTTP"`
// Configuration for HTTP type.
// The name of the Helm chart repository.
Name string `json:"name,omitempty"`
// The address to the Helm chart repository.
Address string `json:"address,omitempty"`
// Username used for the repository backed by HTTP basic authentication.
Username string `json:"username,omitempty"`
// Password used for the repository backed by HTTP basic authentication.
Password string `json:"password,omitempty"`
// Whether to skip TLS certificate checks for the repository or not.
Insecure bool `json:"insecure"`
}
func (*HelmChartRepository) IsHTTPRepository ¶
func (r *HelmChartRepository) IsHTTPRepository() bool
type HelmChartRepositoryType ¶
type HelmChartRepositoryType string
const (
HTTPHelmChartRepository HelmChartRepositoryType = "HTTP"
)
type InputHelmChart ¶
type InputHelmChart struct {
// 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"`
// 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"`
}
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 an 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.
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 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
}
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.
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".
// TODO: support "yaml-add", "yaml-remove", "json-replace" and "text-regex".
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.
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 ¶
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" or "canary" or "baseline" can be populated.
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 the display string for the K8sTrafficRoutingStageOptions. This is used to display the traffic routing configuration in the UI.
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 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"`
// The label will be configured to variant manifests used to distinguish them.
VariantLabel KubernetesVariantLabel `json:"variantLabel"`
// Which method should be used for traffic routing.
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"`
}
KubernetesDeployTargetConfig represents the configuration for a Kubernetes deployment target.
func (*KubernetesDeployTargetConfig) UnmarshalJSON ¶
func (k *KubernetesDeployTargetConfig) UnmarshalJSON(data []byte) error
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"`
}
KubernetesDeploymentInput represents needed input for triggering a Kubernetes deployment.
type KubernetesPluginConfig ¶
type KubernetesPluginConfig struct {
// List of helm chart repositories that should be added while starting up.
ChartRepositories []HelmChartRepository `json:"chartRepositories,omitempty"`
// List of helm chart registries that should be logged in while starting up.
ChartRegistries []HelmChartRegistry `json:"chartRegistries,omitempty"`
}
func (*KubernetesPluginConfig) HTTPHelmChartRepositories ¶
func (c *KubernetesPluginConfig) HTTPHelmChartRepositories() []HelmChartRepository
func (*KubernetesPluginConfig) UnmarshalJSON ¶
func (c *KubernetesPluginConfig) UnmarshalJSON(data []byte) error
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"`
}