Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitKubernetesClient ¶
func InitKubernetesClient(ctx context.Context, cfg K8sConfig, scheme *runtime.Scheme) (client.WithWatch, *rest.Config, error)
InitKubernetesClient creates a controller-runtime WithWatch client. It tries in-cluster config first, then falls back to the default kubeconfig. If namespace is non-empty and Scheme is provided, it ensures the namespace exists.
Types ¶
type App ¶
type App struct {
// Name is the cobra command name (e.g. "flyte", "runs-service").
Name string
// Short is the short description shown in --help.
Short string
// Setup is called after config initialisation. It should populate the
// SetupContext with shared resources and register HTTP handlers / workers.
Setup func(ctx context.Context, sc *SetupContext) error
}
App is the shared entry-point skeleton for Flyte services.
type K8sConfig ¶
type K8sConfig struct {
KubeConfig string // path to kubeconfig (empty → in-cluster → default)
Namespace string // namespace to ensure exists
QPS int // API server QPS limit
Burst int // API server burst limit
Timeout string // API server request timeout (e.g. "30s")
}
K8sConfig holds Kubernetes connection options used by InitKubernetesClient.
type ReadyCheckFunc ¶
ReadyCheckFunc is called on /readyz requests. Return nil for healthy.
type SetupContext ¶
type SetupContext struct {
// Server address. Defaults to "0.0.0.0" and 8080.
Host string
Port int
// Mux is the HTTP serve mux to register handlers on.
Mux *http.ServeMux
// DB is the shared database connection (may be nil if service doesn't need it).
DB *gorm.DB
// K8sClient is the Kubernetes client with watch support (may be nil).
K8sClient client.WithWatch
// K8sConfig is the Kubernetes REST config (may be nil).
K8sConfig *rest.Config
// DataStore is the object storage client (may be nil).
DataStore *storage.DataStore
// Namespace is the Kubernetes namespace for CRs.
Namespace string
// BaseURL is the base URL for intra-service calls (e.g. "http://localhost:8090").
// In unified mode the manager sets this so all services call each other
// via the same mux. Standalone binaries leave it empty and use their own
// per-service config for remote URLs.
BaseURL string
// Scope is the metrics scope.
Scope promutils.Scope
// Middleware wraps the final HTTP handler (e.g. CORS).
Middleware func(http.Handler) http.Handler
// contains filtered or unexported fields
}
SetupContext carries shared resources to service Setup functions. New fields can be added here without changing any Setup() signature.
func (*SetupContext) AddReadyCheck ¶
func (sc *SetupContext) AddReadyCheck(fn ReadyCheckFunc)
AddReadyCheck registers a readiness check invoked on /readyz.
func (*SetupContext) AddWorker ¶
func (sc *SetupContext) AddWorker(name string, fn WorkerFunc)
AddWorker registers a background goroutine that runs alongside the HTTP server. The worker should block until ctx is cancelled.
type WorkerFunc ¶
WorkerFunc is a long-running function (e.g. controller-runtime manager) that runs alongside the HTTP server. It should block until ctx is cancelled.