cluster

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cluster implements backend.Backend by submitting PipelineRuns to a real Tekton install on a local Kubernetes cluster (k3d).

Index

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

func New(opt Options) *Backend

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

func (b *Backend) Cleanup(_ context.Context) error

Cleanup is a no-op: cluster + namespaces persist for 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) Prepare

func (b *Backend) Prepare(ctx context.Context, _ backend.RunSpec) error

Prepare lazily provisions the cluster + Tekton on first use.

func (*Backend) RunPipeline

func (*Backend) RunTask

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.

Jump to

Keyboard shortcuts

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