Documentation
¶
Index ¶
- Constants
- func KServiceName(id *flyteapp.Identifier) string
- type AppK8sClient
- func (c *AppK8sClient) Delete(ctx context.Context, appID *flyteapp.Identifier) error
- func (c *AppK8sClient) DeleteReplica(ctx context.Context, replicaID *flyteapp.ReplicaIdentifier) error
- func (c *AppK8sClient) Deploy(ctx context.Context, app *flyteapp.App) error
- func (c *AppK8sClient) GetApp(ctx context.Context, appID *flyteapp.Identifier) (*flyteapp.App, error)
- func (c *AppK8sClient) GetReplicas(ctx context.Context, appID *flyteapp.Identifier) ([]*flyteapp.Replica, error)
- func (c *AppK8sClient) List(ctx context.Context, project, domain string, limit uint32, token string) ([]*flyteapp.App, string, error)
- func (c *AppK8sClient) PublicIngress(id *flyteapp.Identifier) *flyteapp.Ingress
- func (c *AppK8sClient) StartWatching(ctx context.Context) error
- func (c *AppK8sClient) Stop(ctx context.Context, appID *flyteapp.Identifier) error
- func (c *AppK8sClient) StopWatching()
- func (c *AppK8sClient) Subscribe(appName string) chan *flyteapp.WatchResponse
- func (c *AppK8sClient) Unsubscribe(appName string, ch chan *flyteapp.WatchResponse)
- type AppK8sClientInterface
Constants ¶
const AppNamespace = "flyte"
AppNamespace is the fixed Kubernetes namespace where all KService objects are deployed.
Variables ¶
This section is empty.
Functions ¶
func KServiceName ¶ added in v2.0.14
func KServiceName(id *flyteapp.Identifier) string
KServiceName returns the KService name for an app. All apps share the "flyte" namespace, so the name must be unique across all (project, domain, name) triples — we encode all three in the name. Lower-cased and capped at 63 chars (K8s DNS label limit); names exceeding the cap fall back to a deterministic 8-char SHA256 suffix to guarantee uniqueness without exceeding the limit.
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.InternalAppConfig) *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) GetApp ¶ added in v2.0.14
func (c *AppK8sClient) GetApp(ctx context.Context, appID *flyteapp.Identifier) (*flyteapp.App, error)
GetApp reads the KService and returns the full App including reconstructed Spec and live Status.
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. When the KService has a latest ready revision, only pods from that revision are returned — old revision pods terminating during a rollout are filtered out. If the KService has no ready revision yet (initial rollout), all pods for the service are returned.
func (*AppK8sClient) List ¶
func (c *AppK8sClient) List(ctx context.Context, project, domain string, limit uint32, token string) ([]*flyteapp.App, string, error)
List returns apps for the given project/domain scope with optional pagination.
func (*AppK8sClient) PublicIngress ¶ added in v2.0.14
func (c *AppK8sClient) PublicIngress(id *flyteapp.Identifier) *flyteapp.Ingress
PublicIngress returns the deterministic public URL for an app.
func (*AppK8sClient) StartWatching ¶ added in v2.0.14
func (c *AppK8sClient) StartWatching(ctx context.Context) error
StartWatching starts the KService informer and begins dispatching events to subscriber channels. Must be called once during setup.
func (*AppK8sClient) Stop ¶
func (c *AppK8sClient) Stop(ctx context.Context, appID *flyteapp.Identifier) error
Stop makes the app unreachable from the public gateway and scales it to zero without deleting the KService.
func (*AppK8sClient) StopWatching ¶ added in v2.0.14
func (c *AppK8sClient) StopWatching()
StopWatching stops the KService informer.
func (*AppK8sClient) Subscribe ¶ added in v2.0.14
func (c *AppK8sClient) Subscribe(appName string) chan *flyteapp.WatchResponse
Subscribe creates a channel that receives WatchResponse events for the given app name.
func (*AppK8sClient) Unsubscribe ¶ added in v2.0.14
func (c *AppK8sClient) Unsubscribe(appName string, ch chan *flyteapp.WatchResponse)
Unsubscribe removes the given channel from the subscription list.
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 and makes it cluster-local (not published to external gateway).
// The KService CRD is kept so the app can be restarted later.
Stop(ctx context.Context, appID *flyteapp.Identifier) error
// GetApp reads the KService and returns the full App including reconstructed Spec and live Status.
// Returns a not-found error (checkable with k8serrors.IsNotFound) if the KService does not exist.
GetApp(ctx context.Context, appID *flyteapp.Identifier) (*flyteapp.App, error)
// List returns apps for the given project/domain scope with optional pagination.
// 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 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
// StartWatching starts the KService informer and begins dispatching events
// to subscribers. Must be called before Subscribe.
StartWatching(ctx context.Context) error
// StopWatching stops the KService informer.
StopWatching()
// Subscribe creates a channel that receives WatchResponse events for the
// given app name. Use empty string to receive events for all apps.
Subscribe(appName string) chan *flyteapp.WatchResponse
// Unsubscribe removes a subscription channel previously returned by Subscribe.
Unsubscribe(appName string, ch chan *flyteapp.WatchResponse)
// PublicIngress returns the deterministic public Ingress URL for the given app,
// matching Knative's domain-template so Kourier routes traffic correctly.
// Returns nil if BaseDomain is not configured.
PublicIngress(id *flyteapp.Identifier) *flyteapp.Ingress
}
AppK8sClientInterface defines the KService lifecycle operations for the App service.