pkg

package
v0.0.0-...-599ae54 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFunctionNamespace is the default containerd namespace functions are created
	DefaultFunctionNamespace = "openfaas-fn"

	// NamespaceLabel indicates that a namespace is managed by faasd
	NamespaceLabel = "openfaas"

	// FaasdNamespace is the containerd namespace services are created
	FaasdNamespace = "openfaas"
)

Variables

View Source
var (
	// GitCommit Git Commit SHA
	GitCommit string
	// Version version of the CLI
	Version string
)

These values will be injected into these variables at the build time.

Functions

func ConnectivityCheck

func ConnectivityCheck() error

ConnectivityCheck checks if the controller can reach the public Internet via HTTPS. A license is required to use OpenFaaS CE for Commercial Use.

func GetArchSuffix

func GetArchSuffix(getClientArch ArchGetter) (suffix string, err error)

GetArchSuffix provides client CPU architecture and client OS from ArchGetter

func GetVersion

func GetVersion() string

GetVersion get latest version

func LoadComposeFile

func LoadComposeFile(wd string, file string) (*compose.Config, error)

LoadComposeFile is a helper method for loading a docker-compose file

func LoadComposeFileWithArch

func LoadComposeFileWithArch(wd string, file string, archGetter ArchGetter) (*compose.Config, error)

LoadComposeFileWithArch is a helper method for loading a docker-compose file

Types

type ArchGetter

type ArchGetter func() (string, string)

ArchGetter provides client CPU architecture and client OS

type LocalResolver

type LocalResolver struct {
	Path  string
	Map   map[string]string
	Mutex *sync.RWMutex
}

LocalResolver provides hostname to IP look-up for faasd core services

func (*LocalResolver) Get

func (l *LocalResolver) Get(upstream string, got chan<- string, timeout time.Duration)

Get resolves a hostname to an IP, or timesout after the duration has passed

func (*LocalResolver) Start

func (l *LocalResolver) Start()

Start polling the disk for the hosts file in Path

type Mount

type Mount struct {
	// Src relative to the working directory for faasd
	Src string

	// Dest is the absolute path within the container
	Dest string

	// ReadOnly when set to true indicates the mount will be set to "ro" instead of "rw"
	ReadOnly bool
}

type Proxy

type Proxy struct {
	Timeout time.Duration

	// Port on which to listen to traffic
	Port uint32

	// Upstream is where to send traffic when received
	Upstream string

	// The IP to use to bind locally
	HostIP string

	Resolver Resolver
}

Proxy for exposing a private container

func NewProxy

func NewProxy(upstream string, listenPort uint32, hostIP string, timeout time.Duration, resolver Resolver) *Proxy

NewProxy creates a HTTP proxy to expose a host

func (*Proxy) Start

func (p *Proxy) Start() error

Start listening and forwarding HTTP to the host

type Resolver

type Resolver interface {
	// Start any polling or connections required to resolve
	Start()

	// Get an IP address using an asynchronous operation
	Get(upstream string, got chan<- string, timeout time.Duration)
}

Resolver resolves an upstream IP address for a given upstream host

func NewLocalResolver

func NewLocalResolver(path string) Resolver

NewLocalResolver creates a new resolver for reading from a hosts file

type Service

type Service struct {
	// Image is the container image registry reference, in an OCI format.
	Image     string
	Env       []string
	Name      string
	Mounts    []Mount
	Caps      []string
	Args      []string
	DependsOn []string
	Ports     []ServicePort

	// User in the docker-compose.yaml spec can set as follows:
	// a user-id, username, userid:groupid or user:group
	User string
}

func ParseCompose

func ParseCompose(config *compose.Config) ([]Service, error)

ParseCompose converts a docker-compose Config into a service list that we can pass to the supervisor client Start.

The only anticipated error is a failure if the value mounts are not of type `bind`.

type ServicePort

type ServicePort struct {
	TargetPort uint32
	Port       uint32
	HostIP     string
}

type Supervisor

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

func NewSupervisor

func NewSupervisor(sock string) (*Supervisor, error)

func (*Supervisor) Close

func (s *Supervisor) Close()

func (*Supervisor) Remove

func (s *Supervisor) Remove(svcs []Service) error

func (*Supervisor) Start

func (s *Supervisor) Start(svcs []Service) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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