Documentation
¶
Overview ¶
Package clusterconfig parses and resolves Podplane cluster configuration files.
Index ¶
- func Validate(cfg *ClusterConfig) error
- func ValidateClusterID(id string) error
- func ValidateComponents(components Components) error
- func ValidateSeed(seed Seed) error
- func Write(path string, cfg *ClusterConfig) error
- type ACME
- type Cluster
- type ClusterConfig
- type Components
- type ComponentsSource
- type ComponentsSourceRef
- type Domain
- type DomainProvider
- type Kubernetes
- type Listener
- type LoadBalancer
- type OIDC
- type Pool
- type Provider
- type Role
- type Seed
- type Subnet
- type VPC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(cfg *ClusterConfig) error
Validate validates the cluster config fields that are required for managed OpenTofu/Terraform generation.
func ValidateClusterID ¶
ValidateClusterID validates a cluster ID using Netsy's identifier rules.
func ValidateComponents ¶
func ValidateComponents(components Components) error
ValidateComponents validates the optional components configuration.
func ValidateSeed ¶
ValidateSeed validates the optional seed configuration.
func Write ¶
func Write(path string, cfg *ClusterConfig) error
Write writes a formatted cluster configuration file to disk.
Types ¶
type Cluster ¶
type Cluster struct {
ID string `json:"id"`
Name string `json:"name"`
OIDC OIDC `json:"oidc"`
ACME *ACME `json:"acme,omitempty"`
Domains []Domain `json:"domains,omitempty"`
Pools map[string]Pool `json:"pools,omitempty"`
Providers []Provider `json:"providers,omitempty"`
Kubernetes Kubernetes `json:"kubernetes"`
Seed Seed `json:"seed,omitempty"`
Components Components `json:"components,omitempty"`
}
Cluster groups everything under a top-level "cluster" object, to assist with differentiating from a Podplane OIDC configuration file (which typicaly has a .oidc.json suffix)
type ClusterConfig ¶
type ClusterConfig struct {
Cluster Cluster `json:"cluster"`
}
ClusterConfig represents a cluster configuration file Typically files are named podplane.cluster.jsonc or have a .cluster.jsonc suffix.
func Load ¶
func Load(path string) (*ClusterConfig, error)
Load reads a .cluster.jsonc file from disk, strips comments, and unmarshals it into a ClusterConfig.
func NewDraftConfig ¶
func NewDraftConfig(providerKind string) *ClusterConfig
NewDraftConfig returns a mutable draft cluster config for the requested provider.
func (*ClusterConfig) ResolvedClientID ¶
func (c *ClusterConfig) ResolvedClientID() string
ResolvedClientID returns the configured OIDC client_id, defaulting to the cluster ID.
func (*ClusterConfig) ResolvedKubernetesAPIURL ¶
func (c *ClusterConfig) ResolvedKubernetesAPIURL() string
ResolvedKubernetesAPIURL builds the https URL for the cluster's API server. Defaults to port 6443 if api_port is unset. Returns "" if api_hostname is not set.
func (*ClusterConfig) ResolvedUsernameClaim ¶
func (c *ClusterConfig) ResolvedUsernameClaim() string
ResolvedUsernameClaim returns the configured username_claim, defaulting to "email".
type Components ¶
type Components struct {
Source *ComponentsSource `json:"source,omitempty"`
}
Components describes optional platform-components configuration.
type ComponentsSource ¶
type ComponentsSource struct {
URL string `json:"url"`
Ref ComponentsSourceRef `json:"ref,omitempty"`
}
ComponentsSource overrides the Git repository used by platform-components.
type ComponentsSourceRef ¶
type ComponentsSourceRef struct {
Branch string `json:"branch,omitempty"`
Tag string `json:"tag,omitempty"`
Semver string `json:"semver,omitempty"`
Commit string `json:"commit,omitempty"`
}
ComponentsSourceRef selects a Git ref for the components source. At most one field should be set.
type Domain ¶
type Domain struct {
Zone string `json:"zone"`
Provider DomainProvider `json:"provider"`
}
Domain is one entry in cluster.domains.
type DomainProvider ¶
type DomainProvider struct {
Kind string `json:"kind"`
Account string `json:"account,omitempty"`
Profile string `json:"profile,omitempty"`
Region string `json:"region,omitempty"`
HostedZoneID string `json:"hosted_zone_id,omitempty"`
RoleARN string `json:"role_arn,omitempty"`
SecretProviderClassName string `json:"secret_provider_class_name,omitempty"`
SecretName string `json:"secret_name,omitempty"`
SecretKey string `json:"secret_key,omitempty"`
Project string `json:"project,omitempty"`
HostedZoneName string `json:"hosted_zone_name,omitempty"`
}
DomainProvider is the DNS provider for a Domain.
type Kubernetes ¶
type Kubernetes struct {
APIHostname string `json:"api_hostname,omitempty"`
APIPort int `json:"api_port,omitempty"`
ClusterCIDR []string `json:"cluster_cidr,omitempty"`
ServiceCIDR []string `json:"service_cidr,omitempty"`
}
Kubernetes describes how the API server is reached and configured.
type Listener ¶
type Listener struct {
Port int `json:"port"`
Pool string `json:"pool"`
TargetPort int `json:"target_port,omitempty"`
}
Listener is one entry in cluster.providers[].load_balancer.listeners[].
type LoadBalancer ¶
type LoadBalancer struct {
Public bool `json:"public"`
Listeners []Listener `json:"listeners,omitempty"`
}
LoadBalancer describes the provider's external load balancer.
type OIDC ¶
type OIDC struct {
IssuerURL string `json:"issuer_url"`
ClientID string `json:"client_id,omitempty"`
UsernameClaim string `json:"username_claim,omitempty"`
GroupsClaim string `json:"groups_claim,omitempty"`
SigningAlgs []string `json:"signing_algs,omitempty"`
// CACert may be: an inline PEM (string starts with "-----BEGIN"), an
// http(s):// URL, or a path on disk.
CACert string `json:"ca_cert,omitempty"`
}
OIDC describes the issuer the cluster's API server trusts.
type Pool ¶
type Pool struct {
Arch string `json:"arch"`
InstanceType string `json:"instance_type"`
Size int `json:"size"`
DiskSize int `json:"disk_size,omitempty"`
}
Pool is one entry in cluster.pools.<name>.
type Provider ¶
type Provider struct {
Kind string `json:"kind"`
Region string `json:"region,omitempty"`
Account string `json:"account,omitempty"`
Profile string `json:"profile,omitempty"`
Project string `json:"project,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
VPC VPC `json:"vpc"`
Zones map[string][]Subnet `json:"zones,omitempty"`
LoadBalancer LoadBalancer `json:"load_balancer"`
Buckets []string `json:"buckets,omitempty"`
Roles map[string]Role `json:"roles,omitempty"`
}
Provider is one entry in cluster.providers[].
type Role ¶
type Role struct {
Buckets []string `json:"buckets"`
Permissions string `json:"permissions,omitempty"`
}
Role is one entry in cluster.providers[].roles.<name>.
type Subnet ¶
type Subnet struct {
Pool string `json:"pool,omitempty"`
Services []string `json:"services,omitempty"`
Public bool `json:"public,omitempty"`
ID string `json:"id,omitempty"`
V4CIDR string `json:"v4cidr,omitempty"`
V6CIDR string `json:"v6cidr,omitempty"`
}
Subnet is one entry in cluster.providers[].zones.<zone>[].