environment

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetManaged     = "managed"
	TargetExistingEKS = "existing_eks"
)

Variables

View Source
var (
	ErrInvalidName   = errors.New("invalid environment name")
	ErrAlreadyExists = errors.New("environment already exists")
)

Functions

func ClusterName

func ClusterName(doc Document) string

func ConfigureNewEnvironmentScheduling

func ConfigureNewEnvironmentScheduling(doc Document)

ConfigureNewEnvironmentScheduling is called only while a new environment record is being created. It upgrades a cloned legacy layout into the new application/platform split without changing an existing environment.

func ConfigureRegion

func ConfigureRegion(doc Document, region string) error

ConfigureRegion updates the Region and all Region-qualified availability zone references together. Keeping this atomic prevents a newly created environment from carrying ap-south-1 subnet keys into another Region.

func ConfigureTarget

func ConfigureTarget(doc Document, targetType string) error

ConfigureTarget is used while creating an environment. Existing-cluster targets receive project-scoped namespaces so two projects can safely use the same EKS cluster without sharing Helm release ownership.

func GetPath

func GetPath(doc Document, path string) (any, bool)

func IsExistingEKS

func IsExistingEKS(doc Document) bool

func ManageClusterAddons

func ManageClusterAddons(doc Document) bool

func NormalizeDomainBackendProtocols

func NormalizeDomainBackendProtocols(doc Document)

NormalizeDomainBackendProtocols keeps the client-to-gateway protocol separate from the gateway-to-Service protocol. HTTPS/WSS/GRPCS describes edge TLS; the upstream can independently be HTTP, HTTPS, gRPC or gRPCS. Older UI versions inferred HTTPS solely from Service port 443, which is unsafe because Kubernetes commonly maps port 443 to a plaintext named port.

func NormalizeDomainRoutes

func NormalizeDomainRoutes(doc Document)

NormalizeDomainRoutes upgrades the legacy one-domain/one-backend structure to the domain-level routes collection used by the UI and Terraform. The legacy fields are deliberately retained as a first-route mirror so an older platform binary can still read a rolled-back configuration.

func NormalizeManagedNodeGroupTaints

func NormalizeManagedNodeGroupTaints(doc Document)

NormalizeManagedNodeGroupTaints enforces the platform scheduling contract: only business workload nodes use a NoSchedule taint. Gateway and platform workloads are still pinned with workload-class labels and selectors, while keeping those nodes available to EKS system workloads when necessary.

func SameSchedulingPlan

func SameSchedulingPlan(current, next Document) bool

func SetPath

func SetPath(doc Document, path string, value any)

func TargetType

func TargetType(doc Document) string

TargetType returns the environment's infrastructure ownership model. Older documents default to managed so the migration cannot accidentally detach resources that are already owned by this platform.

func ValidName

func ValidName(name string) bool

func Validate

func Validate(doc Document) error

func ValidateTarget

func ValidateTarget(doc Document) error

func WorkloadSchedulingEnabled

func WorkloadSchedulingEnabled(doc Document) bool

Types

type Document

type Document map[string]any

func ApplyDefaults

func ApplyDefaults(doc Document, project, environmentName string) Document

ApplyDefaults upgrades older environment documents without overwriting any user-selected value. This keeps component expansion backward compatible.

func DefaultDocument

func DefaultDocument(project, environmentName string) Document

DefaultDocument is the safe, editable starting point for a newly created project environment. It intentionally enables only the EKS platform prerequisites; paid data services and self-hosted components remain opt-in.

type NodeGroupPlacement

type NodeGroupPlacement struct {
	InstanceTypes     []string
	AvailabilityZones []string
	CapacityType      string
	SubnetType        string
	AMIType           string
	DiskSize          int
	Labels            map[string]string
	Taints            []NodeGroupTaint
}

type NodeGroupSchedulingChanges

type NodeGroupSchedulingChanges struct {
	EnabledChanged bool
	Added          []string
	Removed        []string
	Modified       []string
}

NodeGroupSchedulingChanges describes changes to the immutable placement contract of managed node groups. Capacity is intentionally excluded: an operator may always adjust min/max capacity, while an existing node group's instance/network/scheduling contract remains protected.

func CompareSchedulingPlans

func CompareSchedulingPlans(current, next Document) NodeGroupSchedulingChanges

CompareSchedulingPlans allows callers to implement append-only updates for an existing EKS cluster: new node groups are safe to create, but removing or mutating a provisioned group could evict workloads or destroy capacity.

type NodeGroupSchedulingPlan

type NodeGroupSchedulingPlan struct {
	Enabled bool
	Groups  map[string]NodeGroupPlacement
}

NodeGroupSchedulingPlan contains the immutable part of a managed EKS node group plan. Capacity values are deliberately excluded so operators can keep scaling an existing group without changing its placement contract.

func SchedulingPlan

func SchedulingPlan(doc Document) NodeGroupSchedulingPlan

type NodeGroupTaint

type NodeGroupTaint struct {
	Key    string
	Value  string
	Effect string
}

type Repository

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

func NewRepository

func NewRepository(dir string) (*Repository, error)

func NewRepositoryWithStore

func NewRepositoryWithStore(dir string, store Store) (*Repository, error)

func (*Repository) Clone

func (r *Repository) Clone(name, source string) (Document, error)

func (*Repository) CloneForProject

func (r *Repository) CloneForProject(name, source, project, environment string) (Document, error)

func (*Repository) Delete

func (r *Repository) Delete(name string) error

func (*Repository) List

func (r *Repository) List(componentPaths map[string]string) ([]Summary, error)

func (*Repository) Load

func (r *Repository) Load(name string) (Document, error)

func (*Repository) Path

func (r *Repository) Path(name string) string

func (*Repository) Save

func (r *Repository) Save(name string, doc Document) error

type Store

type Store interface {
	LoadEnvironments(context.Context) (map[string][]byte, error)
	GetEnvironment(context.Context, string) ([]byte, error)
	SaveEnvironment(context.Context, string, []byte) error
	DeleteEnvironment(context.Context, string) error
}

type Summary

type Summary struct {
	Name        string   `json:"target_name"`
	Project     string   `json:"project"`
	Environment string   `json:"environment"`
	Region      string   `json:"region"`
	ClusterName string   `json:"cluster_name"`
	Components  []string `json:"components"`
}

Jump to

Keyboard shortcuts

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