deploy

package
v0.4.28 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ObservedByLabel = "kdex.dev/observed-by"

ObservedByLabel marks a KDexFunction as a member of a host's observer set. The per-host observer CronJob lists by it, so the observed set stays exactly the adaptor-deployed functions -- service-backed functions never had an observer and still don't. Must match the constant in knative-deployer's cmd/main.go. See kdex-tech/host-manager#156.

Variables

This section is empty.

Functions

func HostObserverName added in v0.4.23

func HostObserverName(host string) string

HostObserverName is the per-host observer CronJob's name.

Types

type Deployer

type Deployer struct {
	Client           client.Client
	FaaSAdaptor      kdexv1alpha1.KDexFaaSAdaptorSpec
	Host             kdexv1alpha1.KDexInternalHost
	ImagePullSecrets []corev1.LocalObjectReference
	Scheme           *runtime.Scheme
	ServiceAccount   string
	// TokenPrefix is the host's resolved white-label PASETO API token prefix
	// (per-host spec or NexusConfiguration default). Injected as
	// PASETO_TOKEN_PREFIX so the function's verifier can restore the
	// "v4.public." header. Empty => bare tokens (no prefixing). It MUST be the
	// same value the host's TokenManager mints with.
	TokenPrefix string
}

func (*Deployer) Deploy

func (d *Deployer) Deploy(ctx context.Context, function *kdexv1alpha1.KDexFunction) (*batchv1.Job, error)

The FaaS adaptor is responsible for deploying the function. Since there are virtually unlimited number of ways to deploy a function, we use a job as a bridge between the Nexus controller and the FaaS adaptor. The workload provided by the FaaS adaptor knows how to deploy the function. Whether the functions are deployed on KNative, AWS Lambda, Google Cloud Functions, Azure Functions, or something else is irrelevant to the Nexus controller. The job is responsible for deploying the function and reporting the status of the deployment back to the Nexus controller. The job must return success or failure along with reasons, and upon success, at least the URL of the function so that the Focal Controller can mount it into the host's service mesh and dispatch requests to it.

func (*Deployer) Observe

func (d *Deployer) Observe(ctx context.Context, function *kdexv1alpha1.KDexFunction) (client.Object, error)

Observe converges the host's observer CronJob onto the current FaaSAdaptor.Observer spec and enrolls the function in its observed set.

Two defects are addressed here.

#143: this used to reconcile only Spec.Schedule on an existing CronJob and apply the full pod template only on the create path, so an adaptor edit (image, tolerations, nodeSelector, env, securityContext) never reached functions that already had an observer. The desired spec is now rebuilt every pass and written whenever it differs, so any triggered reconcile -- including the periodic resync -- heals a stale observer.

#156: observers used to be one CronJob per function, all sharing the adaptor's single schedule, so every observer in a namespace fired in the same second and object count grew with the fleet. There is now one CronJob per host; the function is marked with ObservedByLabel and the observer resolves its set from that label. Any legacy per-function CronJob found is retired.

type Runtime

type Runtime interface {
	// Deploy returns a Job that, when executed, will deploy or update the function.
	// The Job is expected to update the KDexFunction status upon completion.
	Deploy(ctx context.Context, function *kdexv1alpha1.KDexFunction) (*batchv1.Job, error)

	// Observe returns a workload that, when executed, calls the provider API to check status.
	// For external providers, this is likely a CronJob.
	// For K8s-native providers (like Knative), this might return nil (if handled by standard Watch),
	// or a no-op Job for consistency.
	Observe(ctx context.Context, function *kdexv1alpha1.KDexFunction) (client.Object, error)
}

Runtime defines the interface for interacting with a FaaS provider.

Jump to

Keyboard shortcuts

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