kubernetes

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 79 Imported by: 0

Documentation

Index

Constants

View Source
const PortForwardProtocolV1Name = "portforward.k8s.io"
View Source
const RestmapperStateKey = "kubernetes.restmapper"

Variables

View Source
var (
	UseNodePlatformsForProduction = false
	ProductionPlatforms           = []string{"linux/amd64", "linux/arm64"}
)
View Source
var DeployAsPodsInTests = true
View Source
var (
	ObserveInitContainerLogs = false
)

Functions

func DeleteAllRecursively

func DeleteAllRecursively(ctx context.Context, cli *kubernetes.Clientset, wait bool, progress io.Writer, namespaces ...string) (bool, error)

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.ProvisionProps, error)

func Register

func Register()

func RegisterOverrideClass

func RegisterOverrideClass(name string, p ProvideOverrideFunc)

Types

type Cluster

type Cluster struct {
	FetchSystemInfo func(context.Context) (*kubedef.SystemInfo, error)

	ClusterAttachedState
	// contains filtered or unexported fields
}

func ConnectToCluster

func ConnectToCluster(ctx context.Context, config cfg.Configuration) (*Cluster, error)

func (*Cluster) AttachTerminal

func (r *Cluster) AttachTerminal(ctx context.Context, reference *runtimepb.ContainerReference, rio runtime.TerminalIO) error

func (*Cluster) Bind

func (u *Cluster) Bind(env cfg.Context) (runtime.ClusterNamespace, error)

func (*Cluster) Class

func (u *Cluster) Class() runtime.Class

func (*Cluster) DeleteAllRecursively

func (r *Cluster) DeleteAllRecursively(ctx context.Context, wait bool, progress io.Writer) (bool, error)

func (*Cluster) EnsureState

func (r *Cluster) EnsureState(ctx context.Context, key string) (any, error)

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, w io.Writer, reference *runtimepb.ContainerReference, opts runtime.FetchLogsOpts) error

func (*Cluster) ForwardIngress

func (r *Cluster) ForwardIngress(ctx context.Context, localAddrs []string, localPort int, notify runtime.PortForwardedFunc) (io.Closer, error)

func (*Cluster) Planner

func (u *Cluster) Planner(env cfg.Context) runtime.Planner

func (*Cluster) PrepareCluster

func (r *Cluster) PrepareCluster(ctx context.Context) (*runtime.DeploymentPlan, error)

func (*Cluster) PreparedClient

func (u *Cluster) PreparedClient() client.Prepared

func (*Cluster) RESTConfig

func (u *Cluster) RESTConfig() *rest.Config

func (*Cluster) RawDialServer

func (u *Cluster) RawDialServer(ctx context.Context, ns string, podLabels map[string]string, containerPort int) (net.Conn, error)

func (*Cluster) RawForwardPort

func (u *Cluster) RawForwardPort(ctx context.Context, desc, ns string, podLabels map[string]string, containerPort int, localAddrs []string, callback runtime.SinglePortForwardedFunc) (io.Closer, error)

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

func (r *Cluster) SystemInfo(ctx context.Context) (*kubedef.SystemInfo, error)

func (*Cluster) UnmatchedTargetPlatforms

func (r *Cluster) UnmatchedTargetPlatforms(ctx context.Context) ([]specs.Platform, error)

type ClusterAttachedState

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

func (*ClusterAttachedState) EnsureState

func (r *ClusterAttachedState) EnsureState(ctx context.Context, stateKey string, config cfg.Configuration, cluster runtime.Cluster, key *string) (any, error)

type ClusterNamespace

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

func ConnectToNamespace

func ConnectToNamespace(ctx context.Context, env cfg.Context) (*ClusterNamespace, error)

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 (r *ClusterNamespace) DeleteRecursively(ctx context.Context, wait bool) (bool, error)

func (*ClusterNamespace) DeployedConfigImageID

func (r *ClusterNamespace) DeployedConfigImageID(ctx context.Context, server runtime.Deployable) (oci.ImageID, error)

func (*ClusterNamespace) DialServer

func (r *ClusterNamespace) DialServer(ctx context.Context, server runtime.Deployable, containerPort int32) (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) Planner

func (cn *ClusterNamespace) Planner() runtime.Planner

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 Planner

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

func NewPlanner

func NewPlanner(env cfg.Context, fetchSystemInfo func(context.Context) (*kubedef.SystemInfo, error)) Planner

func (Planner) ComputeBaseNaming

func (r Planner) ComputeBaseNaming(*fnschema.Naming) (*fnschema.ComputedNaming, error)

func (Planner) KubernetesNamespace

func (r Planner) KubernetesNamespace() string

func (Planner) Namespace

func (r Planner) Namespace() runtime.Namespace

func (Planner) PlanDeployment

func (Planner) PlanIngress

func (r Planner) PlanIngress(ctx context.Context, stack *fnschema.Stack, allFragments []*fnschema.IngressFragment) (*runtime.DeploymentPlan, error)

func (Planner) Planner

func (r Planner) Planner() runtime.Planner

func (Planner) PrepareProvision

func (r Planner) PrepareProvision(ctx context.Context) (*rtypes.ProvisionProps, error)

func (Planner) TargetPlatforms

func (r Planner) TargetPlatforms(ctx context.Context) ([]specs.Platform, error)

func (Planner) UniqueID

func (r Planner) UniqueID() string

type PodResolver

type PodResolver interface {
	Resolve(context.Context) (v1.Pod, error)
}

type ProvideOverrideFunc

type ProvideOverrideFunc func(context.Context, cfg.Configuration) (runtime.Class, 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)
}

Directories

Path Synopsis
networking

Jump to

Keyboard shortcuts

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