k8s

package
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppK8sClient

type AppK8sClient struct {
	// contains filtered or unexported fields
}

AppK8sClient implements AppK8sClientInterface using controller-runtime.

func NewAppK8sClient

func NewAppK8sClient(k8sClient client.WithWatch, cache ctrlcache.Cache, cfg *config.AppConfig) *AppK8sClient

NewAppK8sClient creates a new AppK8sClient.

func (*AppK8sClient) Delete

func (c *AppK8sClient) Delete(ctx context.Context, appID *flyteapp.Identifier) error

Delete removes the KService CRD for the given app entirely.

func (*AppK8sClient) DeleteReplica

func (c *AppK8sClient) DeleteReplica(ctx context.Context, replicaID *flyteapp.ReplicaIdentifier) error

DeleteReplica force-deletes a specific pod. Knative will schedule a replacement automatically.

func (*AppK8sClient) Deploy

func (c *AppK8sClient) Deploy(ctx context.Context, app *flyteapp.App) error

Deploy creates or updates the KService for the given app.

func (*AppK8sClient) GetReplicas

func (c *AppK8sClient) GetReplicas(ctx context.Context, appID *flyteapp.Identifier) ([]*flyteapp.Replica, error)

GetReplicas lists the pods currently backing the given app.

func (*AppK8sClient) GetStatus

func (c *AppK8sClient) GetStatus(ctx context.Context, appID *flyteapp.Identifier) (*flyteapp.Status, error)

GetStatus reads the KService and maps its conditions to a flyteapp.Status proto.

func (*AppK8sClient) List

func (c *AppK8sClient) List(ctx context.Context, project, domain, appName string, limit uint32, token string) ([]*flyteapp.App, string, error)

List returns apps for the given project/domain scope with optional pagination.

func (*AppK8sClient) Stop

func (c *AppK8sClient) Stop(ctx context.Context, appID *flyteapp.Identifier) error

Stop sets max-scale=0 on the KService, scaling it to zero without deleting it.

func (*AppK8sClient) Watch

func (c *AppK8sClient) Watch(ctx context.Context, project, domain, appName string) (<-chan *flyteapp.WatchResponse, error)

Watch returns a channel of WatchResponse events for KServices in the given project/domain scope. If appName is non-empty, only events for that specific app are returned. The channel is closed when ctx is cancelled or the underlying watch terminates.

type AppK8sClientInterface

type AppK8sClientInterface interface {
	// Deploy creates or updates the KService for the given app. Idempotent — skips
	// the update if the spec SHA annotation is unchanged.
	Deploy(ctx context.Context, app *flyteapp.App) error

	// Stop scales the KService to zero by setting max-scale=0. The KService CRD
	// is kept so the app can be restarted later.
	Stop(ctx context.Context, appID *flyteapp.Identifier) error

	// GetStatus reads the KService and maps its conditions to a DeploymentStatus.
	// Returns a not-found error (checkable with k8serrors.IsNotFound) if the KService does not exist.
	GetStatus(ctx context.Context, appID *flyteapp.Identifier) (*flyteapp.Status, error)

	// List returns apps for the given project/domain scope with optional pagination.
	// If appName is non-empty, only the app with that name is returned.
	// limit=0 means no limit. token is the K8s continue token from a previous call.
	// Returns the apps, the continue token for the next page (empty if last page), and any error.
	List(ctx context.Context, project, domain, appName string, limit uint32, token string) ([]*flyteapp.App, string, error)

	// Delete removes the KService CRD entirely. The app must be re-created from scratch.
	// Use Stop to scale to zero while preserving the KService.
	Delete(ctx context.Context, appID *flyteapp.Identifier) error

	// GetReplicas lists the pods (replicas) currently backing the given app.
	GetReplicas(ctx context.Context, appID *flyteapp.Identifier) ([]*flyteapp.Replica, error)

	// DeleteReplica force-deletes a specific pod. Knative will replace it automatically.
	DeleteReplica(ctx context.Context, replicaID *flyteapp.ReplicaIdentifier) error

	// Watch returns a channel of WatchResponse events for KServices matching the
	// given project/domain scope. If appName is non-empty, only events for that
	// specific app are returned. The channel is closed when ctx is cancelled.
	Watch(ctx context.Context, project, domain, appName string) (<-chan *flyteapp.WatchResponse, error)
}

AppK8sClientInterface defines the KService lifecycle operations for the App service.

Jump to

Keyboard shortcuts

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