Documentation
¶
Index ¶
- Constants
- func APIInt(api string) int
- func CLIRestPort(workspaceName string) uint16
- func CLIServerPort(workspaceName string) uint16
- func Container(endpoint *basev0.Endpoint, port uint16) *basev0.NetworkInstance
- func ContainerInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
- func DNS(_ *resources.ServiceIdentity, endpoint *basev0.Endpoint, dns *basev0.DNS) *basev0.NetworkInstance
- func ExternalInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
- func GetPidUsingPort(port int) (string, error)
- func HashInt(s string, low, high int) int
- func IsPortAvailable(port int) bool
- func KillProcess(pid string) error
- func KillProcessUsingPort(port int) error
- func Native(endpoint *basev0.Endpoint, port uint16) *basev0.NetworkInstance
- func NativeInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
- func PublicDefault(endpoint *basev0.Endpoint, port uint16) *basev0.NetworkInstance
- func PublicInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
- func ToNamedPort(_ context.Context, ws, mod, svc, name, api string) uint16
- type DNSManager
- type FixedStrategy
- type KubernetesService
- type Pairing
- type RemoteManager
- func (m *RemoteManager) Expose(ctx context.Context, env *resources.Environment, ...) error
- func (m *RemoteManager) GenerateNetworkMappings(ctx context.Context, env *resources.Environment, ...) ([]*basev0.NetworkMapping, error)
- func (m *RemoteManager) GetKubernetesService(ctx context.Context, identity *resources.ServiceIdentity, hostname string, ...) (*KubernetesService, error)
- func (m *RemoteManager) GetNamespace(_ context.Context, env *resources.Environment, workspace *resources.Workspace, ...) (string, error)
- func (m *RemoteManager) KubernetesService(service *resources.ServiceIdentity, endpoint *basev0.Endpoint, ...) *basev0.NetworkInstance
- func (m *RemoteManager) StartPairing(ctx context.Context, _ *resources.Environment, _ *resources.Workspace, ...) error
- func (m *RemoteManager) Stop()
- type RuntimeManager
Constants ¶
const Localhost = "localhost"
Variables ¶
This section is empty.
Functions ¶
func CLIRestPort ¶ added in v0.1.155
CLIRestPort is the REST companion port for the CLI gRPC server. Always CLIServerPort + 1 so the pair stays together.
func CLIServerPort ¶ added in v0.1.155
CLIServerPort returns a deterministic TCP port for the codefly CLI gRPC server of a given workspace. Same workspace name → same port across runs (so tools like Postman can hit a stable endpoint). Different workspaces → different ports (so concurrent test runs in unrelated workspaces don't collide on 10000).
The port lives in [20000, 29900] to stay clear of ephemeral ranges and common service ports. The REST companion port lives at +1.
Override with the CODEFLY_CLI_SERVER_PORT environment variable when an explicit port is required.
func ContainerInstance ¶ added in v0.1.69
func ContainerInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
ContainerInstance stamps an instance with Container access.
Used when an instance is built from a DNS record (which unconditionally tags Access=Public) but the mapping needs a Container-accessible variant so agents running inside Docker can resolve it. Mutates and returns the input — callers pass a freshly-constructed instance per wrap.
func DNS ¶ added in v0.1.69
func DNS(_ *resources.ServiceIdentity, endpoint *basev0.Endpoint, dns *basev0.DNS) *basev0.NetworkInstance
func ExternalInstance ¶ added in v0.1.69
func ExternalInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
ExternalInstance marks the instance as externally routable (via DNS).
Externally-exposed endpoints are reached through their DNS entry from outside the cluster, which is Public access in the network model.
func GetPidUsingPort ¶ added in v0.1.64
func IsPortAvailable ¶
func KillProcess ¶ added in v0.1.64
func KillProcessUsingPort ¶ added in v0.1.64
func NativeInstance ¶ added in v0.1.69
func NativeInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
NativeInstance stamps an instance with Native access.
Same rationale as ContainerInstance: covers the case where an instance comes from DNS (Access=Public) but the agent runs natively on the host and looks up by Access=Native when calling FindNetworkInstanceInNetworkMappings.
func PublicDefault ¶ added in v0.1.69
func PublicDefault(endpoint *basev0.Endpoint, port uint16) *basev0.NetworkInstance
func PublicInstance ¶ added in v0.1.69
func PublicInstance(instance *basev0.NetworkInstance) *basev0.NetworkInstance
PublicInstance stamps an instance with Public access.
DNS instances are already Public, so this is often a no-op — but keeping it explicit makes the semantics at the call-site clear and defends against future changes to DNS().
Types ¶
type DNSManager ¶
type FixedStrategy ¶
type FixedStrategy struct {
}
type KubernetesService ¶ added in v0.1.65
type KubernetesService struct {
Namespace string
Name string
Port uint16
*resources.ServiceIdentity
}
type Pairing ¶ added in v0.1.139
type Pairing struct {
Local *basev0.NetworkMapping
Remote *basev0.NetworkMapping
}
type RemoteManager ¶ added in v0.1.139
type RemoteManager struct {
// contains filtered or unexported fields
}
func NewRemoteManager ¶ added in v0.1.139
func NewRemoteManager(_ context.Context, dnsManager DNSManager) (*RemoteManager, error)
func (*RemoteManager) Expose ¶ added in v0.1.139
func (m *RemoteManager) Expose(ctx context.Context, env *resources.Environment, workspace *resources.Workspace, service *resources.ServiceIdentity, endpoints []*basev0.Endpoint, localNetworkMappings []*basev0.NetworkMapping, output wool.LogProcessorWithSource) error
func (*RemoteManager) GenerateNetworkMappings ¶ added in v0.1.139
func (m *RemoteManager) GenerateNetworkMappings(ctx context.Context, env *resources.Environment, workspace *resources.Workspace, service *resources.ServiceIdentity, endpoints []*basev0.Endpoint) ([]*basev0.NetworkMapping, error)
GenerateNetworkMappings generates network mappings for a service endpoints
func (*RemoteManager) GetKubernetesService ¶ added in v0.1.139
func (m *RemoteManager) GetKubernetesService(ctx context.Context, identity *resources.ServiceIdentity, hostname string, port uint16) (*KubernetesService, error)
func (*RemoteManager) GetNamespace ¶ added in v0.1.139
func (m *RemoteManager) GetNamespace(_ context.Context, env *resources.Environment, workspace *resources.Workspace, service *resources.ServiceIdentity) (string, error)
func (*RemoteManager) KubernetesService ¶ added in v0.1.139
func (m *RemoteManager) KubernetesService(service *resources.ServiceIdentity, endpoint *basev0.Endpoint, namespace string, port uint16) *basev0.NetworkInstance
func (*RemoteManager) StartPairing ¶ added in v0.1.139
func (m *RemoteManager) StartPairing(ctx context.Context, _ *resources.Environment, _ *resources.Workspace, service *resources.ServiceIdentity, pairing *Pairing, output wool.LogProcessorWithSource) error
func (*RemoteManager) Stop ¶ added in v0.1.155
func (m *RemoteManager) Stop()
Stop blocks until every pairing goroutine has exited. The caller is expected to have cancelled the context passed to StartPairing first (or all pairing contexts are children of one that just got cancelled). Safe to call multiple times.
type RuntimeManager ¶
type RuntimeManager struct {
// contains filtered or unexported fields
}
func NewRuntimeManager ¶ added in v0.1.64
func NewRuntimeManager(_ context.Context, dnsManager DNSManager) (*RuntimeManager, error)
func (*RuntimeManager) GenerateNetworkMappings ¶
func (m *RuntimeManager) GenerateNetworkMappings(ctx context.Context, env *resources.Environment, workspace *resources.Workspace, service *resources.ServiceIdentity, endpoints []*basev0.Endpoint) ([]*basev0.NetworkMapping, error)
GenerateNetworkMappings generates network mappings for a service endpoints
func (*RuntimeManager) GetFreePort ¶ added in v0.1.89
func (m *RuntimeManager) GetFreePort() uint16
GetFreePort returns the next free port after lastRandomPort
func (*RuntimeManager) WithTemporaryPorts ¶ added in v0.1.89
func (m *RuntimeManager) WithTemporaryPorts()
WithTemporaryPorts will use random ports instead of "named" ports. Uses a random starting point to avoid collisions between parallel tests.