Documentation
¶
Overview ¶
Package cluster implements backend.Backend by submitting PipelineRuns to a real Tekton install on a local Kubernetes cluster (k3d).
Index ¶
- type Backend
- func (b *Backend) ApplyVolumeSourcesForTest(ctx context.Context, in backend.PipelineRunInvocation, ns string) error
- func (b *Backend) BuildPipelineRunObject(in backend.PipelineRunInvocation, namespace string) (any, error)
- func (b *Backend) Cleanup(_ context.Context) error
- func (b *Backend) CollectTaskOutcomesForTest(ctx context.Context, in backend.PipelineRunInvocation, ns string) map[string]backend.TaskOutcomeOnCluster
- func (b *Backend) Prepare(ctx context.Context, _ backend.RunSpec) error
- func (b *Backend) RunPipeline(ctx context.Context, in backend.PipelineRunInvocation) (backend.PipelineRunResult, error)
- func (b *Backend) RunTask(ctx context.Context, inv backend.TaskInvocation) (backend.TaskResult, error)
- func (b *Backend) WaitForDefaultServiceAccountForTest(ctx context.Context, ns string, timeout time.Duration) error
- type ClientBundle
- type Options
- type SidecarStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func New ¶
New is the production constructor: it does not connect — Prepare lazily ensures the cluster, installs Tekton, and builds the kube clients.
func NewWithClients ¶
func NewWithClients(cb ClientBundle) *Backend
NewWithClients is a test constructor that injects a pre-built ClientBundle.
func NewWithClientsAndStores ¶ added in v1.2.0
func NewWithClientsAndStores(cb ClientBundle, cm, sec *volumes.Store) *Backend
NewWithClientsAndStores is the same, plus the configMap/secret stores the volumes-apply path needs. Production code uses New + Options.
func (*Backend) ApplyVolumeSourcesForTest ¶ added in v1.2.0
func (b *Backend) ApplyVolumeSourcesForTest(ctx context.Context, in backend.PipelineRunInvocation, ns string) error
ApplyVolumeSourcesForTest re-exposes the package-private apply path so the volumes_test can inspect the resulting kube ConfigMap/Secret without driving the full RunPipeline watch loop.
func (*Backend) BuildPipelineRunObject ¶
func (b *Backend) BuildPipelineRunObject(in backend.PipelineRunInvocation, namespace string) (any, error)
BuildPipelineRunObject constructs the PipelineRun unstructured (exposed for unit-test inspection).
func (*Backend) CollectTaskOutcomesForTest ¶ added in v1.2.0
func (b *Backend) CollectTaskOutcomesForTest(ctx context.Context, in backend.PipelineRunInvocation, ns string) map[string]backend.TaskOutcomeOnCluster
CollectTaskOutcomesForTest re-exposes collectTaskOutcomes so the retries_test can drive the per-TaskRun walk against pre-seeded fake objects without going through Create+Watch.
func (*Backend) RunPipeline ¶
func (b *Backend) RunPipeline(ctx context.Context, in backend.PipelineRunInvocation) (backend.PipelineRunResult, error)
func (*Backend) RunTask ¶
func (b *Backend) RunTask(ctx context.Context, inv backend.TaskInvocation) (backend.TaskResult, error)
RunTask delegates to RunPipeline by wrapping the single TaskRun call into a trivial one-task pipeline. The engine should prefer RunPipeline directly.
func (*Backend) WaitForDefaultServiceAccountForTest ¶ added in v1.7.0
func (b *Backend) WaitForDefaultServiceAccountForTest(ctx context.Context, ns string, timeout time.Duration) error
WaitForDefaultServiceAccountForTest re-exposes the package-private SA wait used by ensureNamespace so the run_namespace_test can drive it against a fake client.
type ClientBundle ¶
type ClientBundle struct {
Dynamic dynamic.Interface
Kube kubernetes.Interface
Apiext apiextclient.Interface
}
type Options ¶
type Options struct {
CacheDir string // base path for kubeconfig and other state
Driver cluster.Driver
Runner cmdrunner.Runner
TektonVersion string
// ConfigMaps and Secrets back the per-Task volumes the docker side
// resolves locally. The cluster backend reads bytes from these stores
// and projects them into ephemeral kube ConfigMap/Secret resources in
// the run namespace before submitting the PipelineRun. Nil stores mean
// "no volume sources configured" and a fixture that references one
// will fail at submit time, mirroring docker behavior.
ConfigMaps *volumes.Store
Secrets *volumes.Store
}
type SidecarStatus ¶ added in v1.6.0
type SidecarStatus struct {
Name string
Container string
Running bool
Terminated bool
ExitCode int32
}
SidecarStatus is a tkn-act-internal projection of one entry from taskRun.status.sidecars[]. Mirrors the subset of corev1.ContainerStatus fields the watch-loop needs to emit sidecar-start / sidecar-end.