Documentation ¶
Index ¶
- Constants
- Variables
- func ClusterIngress(cluster *Cluster) (kubedef.IngressClass, error)
- func DeleteAllRecursively(ctx context.Context, cli *kubernetes.Clientset, wait bool, progress io.Writer, ...) (bool, error)
- func IngressOwnedBy(allFragments []*fnschema.IngressFragment, srv fnschema.PackageName) []*fnschema.IngressFragment
- func MakeNamespace(env *schema.Environment, ns string) *applycorev1.NamespaceApplyConfiguration
- func ModuleNamespace(ws *schema.Workspace, env *schema.Environment) string
- func PrepareProvisionWith(env *schema.Environment, ns string, systemInfo *kubedef.SystemInfo) (*rtypes.RuntimeProvisionProps, error)
- func Register()
- func RegisterOverrideClass(name string, p ProvideOverrideFunc)
- func WatchDeployable[V any](ctx context.Context, actionName string, cli *k8s.Clientset, namespace string, ...) (V, error)
- type BoundNamespace
- type Cluster
- func (r *Cluster) AttachTerminal(ctx context.Context, reference *runtimepb.ContainerReference, ...) error
- func (u *Cluster) Bind(ctx context.Context, env cfg.Context) (runtime.ClusterNamespace, error)
- func (u *Cluster) Class() runtime.Class
- func (r *Cluster) DeleteAllRecursively(ctx context.Context, wait bool, progress io.Writer) (bool, error)
- func (r *Cluster) EnsureKeyedState(ctx context.Context, key, secondary string) (any, error)
- func (r *Cluster) EnsureState(ctx context.Context, key string) (any, error)
- func (r *Cluster) FetchDiagnostics(ctx context.Context, reference *runtimepb.ContainerReference) (*runtimepb.Diagnostics, error)
- func (r *Cluster) FetchLogsTo(ctx context.Context, reference *runtimepb.ContainerReference, ...) error
- func (r *Cluster) ForwardIngress(ctx context.Context, localAddrs []string, localPort int, ...) (io.Closer, error)
- func (u *Cluster) KubernetesCluster() *Cluster
- func (u *Cluster) PreparedClient() client.Prepared
- func (u *Cluster) RESTConfig() *rest.Config
- func (u *Cluster) RawDialServer(ctx context.Context, ns string, podLabels map[string]string, ...) (net.Conn, error)
- func (u *Cluster) RawForwardPort(ctx context.Context, desc, ns string, podLabels map[string]string, ...) (io.Closer, error)
- func (r *Cluster) RunAttachedOpts(ctx context.Context, ns, name string, runOpts runtime.ContainerRunOpts, ...) error
- func (r *Cluster) StartAndBlockPortFwd(ctx context.Context, args StartAndBlockPortFwdArgs) error
- func (r *Cluster) SystemInfo(ctx context.Context) (*kubedef.SystemInfo, error)
- func (r *Cluster) UnmatchedTargetPlatforms(ctx context.Context) ([]specs.Platform, error)
- type ClusterAttachedState
- type ClusterNamespace
- func (cn *ClusterNamespace) Cluster() runtime.Cluster
- func (r *ClusterNamespace) DeleteDeployable(ctx context.Context, deployable runtime.Deployable) error
- func (r *ClusterNamespace) DeleteRecursively(ctx context.Context, wait bool) (bool, error)
- func (r *ClusterNamespace) DeployedConfigImageID(ctx context.Context, deployable runtime.Deployable) (oci.ImageID, error)
- func (r *ClusterNamespace) DialServer(ctx context.Context, server runtime.Deployable, port *schema.Endpoint_Port) (net.Conn, error)
- func (r *ClusterNamespace) FetchEnvironmentDiagnostics(ctx context.Context) (*storage.EnvironmentDiagnostics, error)
- func (r *ClusterNamespace) ForwardPort(ctx context.Context, server runtime.Deployable, containerPort int32, ...) (io.Closer, error)
- func (r *ClusterNamespace) KubeConfig() kubedef.KubeConfig
- func (r *ClusterNamespace) Observe(ctx context.Context, srv runtime.Deployable, opts runtime.ObserveOpts, ...) error
- func (r *ClusterNamespace) ResolveContainers(ctx context.Context, object runtime.Deployable) ([]*runtimepb.ContainerReference, error)
- func (r *ClusterNamespace) StartTerminal(ctx context.Context, server runtime.Deployable, rio runtime.TerminalIO, ...) error
- func (r *ClusterNamespace) WaitForTermination(ctx context.Context, object runtime.Deployable) ([]runtime.ContainerStatus, error)
- func (r *ClusterNamespace) WaitUntilReady(ctx context.Context, srv runtime.Deployable) error
- type FetchSystemInfoFunc
- type NewClusterOpts
- type Planner
- func (r Planner) ClusterNamespaceFor(parent runtime.Cluster, underlying *Cluster) *ClusterNamespace
- func (r Planner) ComputeBaseNaming(*fnschema.Naming) (*fnschema.ComputedNaming, error)
- func (r Planner) EnsureClusterNamespace(ctx context.Context) (runtime.ClusterNamespace, error)
- func (r Planner) Ingress() runtime.IngressClass
- func (r Planner) KubernetesNamespace() string
- func (r Planner) MakeServiceName(name string) (string, string)
- func (r Planner) PlanDeployment(ctx context.Context, d runtime.DeploymentSpec) (*runtime.DeploymentPlan, error)
- func (r Planner) PlanIngress(ctx context.Context, stack *fnschema.Stack, ...) (*runtime.DeploymentPlan, error)
- func (r Planner) PrepareProvision(ctx context.Context) (*rtypes.RuntimeProvisionProps, error)
- func (r Planner) Registry() registry.Manager
- func (r Planner) TargetPlatforms(ctx context.Context) ([]specs.Platform, error)
- type PodResolver
- type ProvideOverrideFunc
- type ServiceReadiness
- type StartAndBlockPortFwdArgs
- type UnwrapCluster
Constants ¶
View Source
const ( DiscoveryStateKey = "kubernetes.discovery" RestmapperStateKey = "kubernetes.restmapper" )
View Source
const PortForwardProtocolV1Name = "portforward.k8s.io"
Variables ¶
View Source
var ( UseNodePlatformsForProduction = true ProductionPlatforms = []string{"linux/amd64", "linux/arm64"} )
View Source
var DeployAsPodsInTests = true
View Source
var (
ObserveInitContainerLogs = false
)
Functions ¶
func ClusterIngress ¶ added in v0.0.151
func ClusterIngress(cluster *Cluster) (kubedef.IngressClass, error)
func DeleteAllRecursively ¶
func IngressOwnedBy ¶ added in v0.0.124
func IngressOwnedBy(allFragments []*fnschema.IngressFragment, srv fnschema.PackageName) []*fnschema.IngressFragment
func MakeNamespace ¶
func MakeNamespace(env *schema.Environment, ns string) *applycorev1.NamespaceApplyConfiguration
func ModuleNamespace ¶
func ModuleNamespace(ws *schema.Workspace, env *schema.Environment) string
We use namespaces to isolate deployments per workspace and environment. Using the path base plus a digest provides short, memorable names and avoids collision. TODO add knob to allow namespace overwrites if the need arises.
func PrepareProvisionWith ¶
func PrepareProvisionWith(env *schema.Environment, ns string, systemInfo *kubedef.SystemInfo) (*rtypes.RuntimeProvisionProps, error)
func RegisterOverrideClass ¶
func RegisterOverrideClass(name string, p ProvideOverrideFunc)
Types ¶
type BoundNamespace ¶ added in v0.0.137
type BoundNamespace struct {
// contains filtered or unexported fields
}
type Cluster ¶
type Cluster struct { Prepared client.Prepared Configuration cfg.Configuration FetchSystemInfo FetchSystemInfoFunc ClusterAttachedState // contains filtered or unexported fields }
func ConnectToCluster ¶
func NewCluster ¶ added in v0.0.104
func NewCluster(cli *client.Prepared, config cfg.Configuration, opts NewClusterOpts) (*Cluster, error)
func (*Cluster) AttachTerminal ¶
func (r *Cluster) AttachTerminal(ctx context.Context, reference *runtimepb.ContainerReference, rio runtime.TerminalIO) error
func (*Cluster) DeleteAllRecursively ¶
func (*Cluster) EnsureKeyedState ¶ added in v0.0.143
func (*Cluster) EnsureState ¶
func (*Cluster) FetchDiagnostics ¶
func (r *Cluster) FetchDiagnostics(ctx context.Context, reference *runtimepb.ContainerReference) (*runtimepb.Diagnostics, error)
func (*Cluster) FetchLogsTo ¶
func (r *Cluster) FetchLogsTo(ctx context.Context, reference *runtimepb.ContainerReference, opts runtime.FetchLogsOpts, callback func(runtime.ContainerLogLine)) error
func (*Cluster) ForwardIngress ¶
func (*Cluster) KubernetesCluster ¶ added in v0.0.96
func (*Cluster) PreparedClient ¶
func (*Cluster) RESTConfig ¶
func (*Cluster) RawDialServer ¶
func (*Cluster) RawForwardPort ¶
func (*Cluster) RunAttachedOpts ¶
func (r *Cluster) RunAttachedOpts(ctx context.Context, ns, name string, runOpts runtime.ContainerRunOpts, io runtime.TerminalIO, onStart func()) error
func (*Cluster) StartAndBlockPortFwd ¶
func (r *Cluster) StartAndBlockPortFwd(ctx context.Context, args StartAndBlockPortFwdArgs) error
func (*Cluster) SystemInfo ¶
type ClusterAttachedState ¶
type ClusterAttachedState struct {
// contains filtered or unexported fields
}
func (*ClusterAttachedState) EnsureState ¶
type ClusterNamespace ¶
type ClusterNamespace struct {
// contains filtered or unexported fields
}
func ConnectToNamespace ¶
func NewClusterNamespace ¶ added in v0.0.103
func (*ClusterNamespace) Cluster ¶
func (cn *ClusterNamespace) Cluster() runtime.Cluster
func (*ClusterNamespace) DeleteDeployable ¶
func (r *ClusterNamespace) DeleteDeployable(ctx context.Context, deployable runtime.Deployable) error
func (*ClusterNamespace) DeleteRecursively ¶
func (*ClusterNamespace) DeployedConfigImageID ¶
func (r *ClusterNamespace) DeployedConfigImageID(ctx context.Context, deployable runtime.Deployable) (oci.ImageID, error)
func (*ClusterNamespace) DialServer ¶
func (r *ClusterNamespace) DialServer(ctx context.Context, server runtime.Deployable, port *schema.Endpoint_Port) (net.Conn, error)
func (*ClusterNamespace) FetchEnvironmentDiagnostics ¶
func (r *ClusterNamespace) FetchEnvironmentDiagnostics(ctx context.Context) (*storage.EnvironmentDiagnostics, error)
func (*ClusterNamespace) ForwardPort ¶
func (r *ClusterNamespace) ForwardPort(ctx context.Context, server runtime.Deployable, containerPort int32, localAddrs []string, callback runtime.SinglePortForwardedFunc) (io.Closer, error)
func (*ClusterNamespace) KubeConfig ¶
func (r *ClusterNamespace) KubeConfig() kubedef.KubeConfig
func (*ClusterNamespace) Observe ¶
func (r *ClusterNamespace) Observe(ctx context.Context, srv runtime.Deployable, opts runtime.ObserveOpts, onInstance func(runtime.ObserveEvent) (bool, error)) error
Return true on the callback to signal you're done observing.
func (*ClusterNamespace) ResolveContainers ¶
func (r *ClusterNamespace) ResolveContainers(ctx context.Context, object runtime.Deployable) ([]*runtimepb.ContainerReference, error)
func (*ClusterNamespace) StartTerminal ¶
func (r *ClusterNamespace) StartTerminal(ctx context.Context, server runtime.Deployable, rio runtime.TerminalIO, command string, rest ...string) error
func (*ClusterNamespace) WaitForTermination ¶
func (r *ClusterNamespace) WaitForTermination(ctx context.Context, object runtime.Deployable) ([]runtime.ContainerStatus, error)
func (*ClusterNamespace) WaitUntilReady ¶ added in v0.0.75
func (r *ClusterNamespace) WaitUntilReady(ctx context.Context, srv runtime.Deployable) error
type FetchSystemInfoFunc ¶ added in v0.0.104
type FetchSystemInfoFunc func(context.Context) (*kubedef.SystemInfo, error)
type NewClusterOpts ¶ added in v0.0.124
type NewClusterOpts struct {
FetchSystemInfo FetchSystemInfoFunc
}
type Planner ¶
type Planner struct { Configuration cfg.Configuration // contains filtered or unexported fields }
func NewPlanner ¶
func NewPlanner(ctx context.Context, env cfg.Context, fetch FetchSystemInfoFunc, ingressClass kubedef.IngressClass) (Planner, error)
func NewPlannerWithRegistry ¶ added in v0.0.94
func NewPlannerWithRegistry(env cfg.Context, registry registry.Manager, fetch FetchSystemInfoFunc, ingressClass kubedef.IngressClass) Planner
func (Planner) ClusterNamespaceFor ¶ added in v0.0.104
func (r Planner) ClusterNamespaceFor(parent runtime.Cluster, underlying *Cluster) *ClusterNamespace
func (Planner) ComputeBaseNaming ¶
func (Planner) EnsureClusterNamespace ¶ added in v0.0.104
func (Planner) Ingress ¶ added in v0.0.113
func (r Planner) Ingress() runtime.IngressClass
func (Planner) KubernetesNamespace ¶
func (Planner) MakeServiceName ¶ added in v0.0.176
func (Planner) PlanDeployment ¶
func (r Planner) PlanDeployment(ctx context.Context, d runtime.DeploymentSpec) (*runtime.DeploymentPlan, error)
func (Planner) PlanIngress ¶
func (r Planner) PlanIngress(ctx context.Context, stack *fnschema.Stack, allFragments []*fnschema.IngressFragment) (*runtime.DeploymentPlan, error)
func (Planner) PrepareProvision ¶
type ProvideOverrideFunc ¶
type ServiceReadiness ¶ added in v0.0.157
func AreServicesReady ¶ added in v0.0.157
func AreServicesReady(ctx context.Context, cli *kubernetes.Clientset, namespace string, srv runtime.Deployable) (ServiceReadiness, error)
type StartAndBlockPortFwdArgs ¶
type StartAndBlockPortFwdArgs struct { Namespace string Identifier string LocalAddrs []string LocalPort int // 0 to be dynamically allocated. ContainerPort int PodResolver PodResolver ReportPorts func(runtime.ForwardedPort) }
type UnwrapCluster ¶ added in v0.0.96
type UnwrapCluster interface {
KubernetesCluster() *Cluster
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.