namespace

package
v0.13.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDenyCIDRs

func ParseDenyCIDRs(s string) []string

ParseDenyCIDRs splits a comma-separated CIDR string into a slice.

Types

type Config

type Config struct {
	Prefix        string
	NetworkPolicy NetworkPolicyConfig
}

Config holds configuration for the namespace manager.

type Manager

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

Manager handles per-workspace K8s namespace lifecycle.

func NewManager

func NewManager(clientset kubernetes.Interface, config Config) *Manager

NewManager creates a new namespace Manager.

func (*Manager) ApplyNetworkPolicy

func (m *Manager) ApplyNetworkPolicy(ctx context.Context, namespace string) error

ApplyNetworkPolicy creates or updates the sandbox egress NetworkPolicy in the given namespace.

func (*Manager) DeleteNamespace

func (m *Manager) DeleteNamespace(ctx context.Context, namespace string) error

DeleteNamespace deletes the namespace. K8s cascades all resources within it.

func (*Manager) EnsureNamespace

func (m *Manager) EnsureNamespace(ctx context.Context, workspaceID string) (string, error)

EnsureNamespace creates the namespace if it does not exist, applies labels and NetworkPolicy. Returns the namespace name. Idempotent.

func (*Manager) NamespaceName

func (m *Manager) NamespaceName(workspaceID string) string

NamespaceName returns the K8s namespace name for a workspace ID.

type NetworkPolicyConfig

type NetworkPolicyConfig struct {
	Enabled              bool
	DenyCIDRs            []string
	AgentserverNamespace string // Allow egress to agentserver namespace (for Anthropic API proxy).
}

NetworkPolicyConfig holds NetworkPolicy settings applied to each workspace namespace.

Jump to

Keyboard shortcuts

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