config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: GPL-3.0, LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package config handles parsing and validation of sind cluster configuration.

Index

Constants

View Source
const (
	DefaultImage   = "ghcr.io/gsi-hpc/sind-node:latest"
	DefaultCPUs    = 1
	DefaultMemory  = "512m"
	DefaultTmpSize = "256m"
)

Default resource values for cluster nodes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Kind     string   `json:"kind"`
	Name     string   `json:"name,omitempty"`
	Realm    string   `json:"realm,omitempty"`
	Defaults Defaults `json:"defaults,omitempty"`
	Storage  Storage  `json:"storage,omitempty"`
	Nodes    []Node   `json:"nodes,omitempty"`

	// Pull is a runtime flag (not part of the config file) that forces
	// fresh image pulls when creating containers.
	Pull bool `json:"-" yaml:"-"`
}

Cluster represents a sind cluster configuration.

func Parse

func Parse(data []byte) (*Cluster, error)

Parse parses a YAML cluster configuration and returns a Cluster.

func (*Cluster) ApplyDefaults

func (c *Cluster) ApplyDefaults()

ApplyDefaults populates missing fields with defaults. If no nodes are defined, creates a minimal cluster (1 controller + 1 worker). Node-level fields inherit from the Defaults section, which in turn falls back to built-in defaults.

func (*Cluster) Validate

func (c *Cluster) Validate() error

Validate checks that the cluster configuration satisfies all constraints. It should be called after ApplyDefaults.

type DataStorage

type DataStorage struct {
	Type      string `json:"type,omitempty"`
	HostPath  string `json:"hostPath,omitempty"`
	MountPath string `json:"mountPath,omitempty"`
}

DataStorage configures the shared data volume.

type Defaults

type Defaults struct {
	Image   string `json:"image,omitempty"`
	CPUs    int    `json:"cpus,omitempty"`
	Memory  string `json:"memory,omitempty"`
	TmpSize string `json:"tmpSize,omitempty"`
}

Defaults holds default settings applied to all nodes unless overridden.

type Node

type Node struct {
	Role    string `json:"role"`
	Count   int    `json:"count,omitempty"`
	Image   string `json:"image,omitempty"`
	CPUs    int    `json:"cpus,omitempty"`
	Memory  string `json:"memory,omitempty"`
	TmpSize string `json:"tmpSize,omitempty"`
	Managed *bool  `json:"managed,omitempty"`
}

Node represents a single node or node group in the cluster configuration.

func (*Node) UnmarshalJSON

func (n *Node) UnmarshalJSON(data []byte) error

UnmarshalJSON supports three YAML forms:

  • bare string: "controller"
  • shorthand map: "worker: 3" (role: count)
  • full object: "role: worker\n count: 3\n cpus: 4"

type Storage

type Storage struct {
	DataStorage DataStorage `json:"dataStorage,omitempty"`
}

Storage configures cluster storage options.

Jump to

Keyboard shortcuts

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