functions

package
v0.39.12 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package functions implements serverless function management for Hanzo Base via OpenFaaS. It provides per-tenant function deployment, invocation, and lifecycle management through the Base API surface.

Example:

functions.MustRegister(app, functions.Config{
	GatewayURL:        "http://openfaas-gateway.hanzo.svc:8080",
	FunctionNamespace: "openfaas-fn",
	RegistryURL:       "registry.hanzo.svc:5000",
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(app core.App, config Config)

MustRegister registers the Functions plugin and panics on failure.

func Register

func Register(app core.App, config Config) error

Register registers the Functions plugin to the provided app instance.

Types

type Config

type Config struct {
	// GatewayURL is the OpenFaaS gateway URL.
	GatewayURL string

	// FunctionNamespace is the K8s namespace for function deployments.
	FunctionNamespace string

	// RegistryURL is the container registry URL for function images.
	RegistryURL string
}

Config holds the Functions plugin configuration.

type DeployRequest

type DeployRequest struct {
	Service     string            `json:"service"`
	Image       string            `json:"image"`
	Namespace   string            `json:"namespace,omitempty"`
	EnvProcess  string            `json:"envProcess,omitempty"`
	EnvVars     map[string]string `json:"envVars,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
	Limits      *FunctionLimits   `json:"limits,omitempty"`
	Requests    *FunctionLimits   `json:"requests,omitempty"`
}

DeployRequest is the request body for deploying a function.

type FunctionLimits

type FunctionLimits struct {
	Memory string `json:"memory,omitempty"`
	CPU    string `json:"cpu,omitempty"`
}

FunctionLimits represents resource limits.

type OpenFaaSFunction

type OpenFaaSFunction struct {
	Name              string            `json:"name"`
	Image             string            `json:"image"`
	Namespace         string            `json:"namespace,omitempty"`
	EnvProcess        string            `json:"envProcess,omitempty"`
	EnvVars           map[string]string `json:"envVars,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	Annotations       map[string]string `json:"annotations,omitempty"`
	Replicas          int               `json:"replicas,omitempty"`
	InvocationCount   int               `json:"invocationCount,omitempty"`
	AvailableReplicas int               `json:"availableReplicas,omitempty"`
}

OpenFaaSFunction represents a function in OpenFaaS.

Jump to

Keyboard shortcuts

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