Documentation
¶
Overview ¶
Package config provides configuration loading for the nstance-operator from Kubernetes secrets and environment.
Index ¶
- func BuildTLSConfig(certPEM, keyPEM, caCertPEM []byte) (*tls.Config, error)
- func GetEnv(key, fallback string) string
- type Config
- type Loader
- func (l *Loader) LoadCertificate(ctx context.Context, secretName string, caCert []byte) (*tls.Config, ed25519.PrivateKey, error)
- func (l *Loader) LoadNonce(ctx context.Context, secretName string) (string, error)
- func (l *Loader) LoadOrGenerateKeypair(ctx context.Context, secretName string) (ed25519.PrivateKey, bool, error)
- func (l *Loader) LoadShardCA(ctx context.Context, configMapName string) ([]byte, error)
- func (l *Loader) StoreCertificate(ctx context.Context, secretName string, certPEM, keyPEM []byte) error
- type OperatorConfig
- type ShardEndpoints
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTLSConfig ¶
BuildTLSConfig builds a TLS config from certificate and key PEM data with CA verification
Types ¶
type Config ¶
type Config struct {
// ShardEndpoints maps zone shard IDs to gRPC endpoints
// Example: {"us-west-2a": "[2600::a]:8992"}
ShardEndpoints map[string]string
// TLSConfig for mTLS with nstance-server
TLSConfig *tls.Config
// PrivateKey is the operator's Ed25519 private key
PrivateKey ed25519.PrivateKey
// Namespace where the operator is running
Namespace string
}
Config holds the operator configuration loaded from ConfigMap and Secrets
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles loading operator configuration from Kubernetes resources
func (*Loader) LoadCertificate ¶
func (l *Loader) LoadCertificate(ctx context.Context, secretName string, caCert []byte) (*tls.Config, ed25519.PrivateKey, error)
LoadCertificate loads the client certificate from Secret and builds TLS config with CA verification
func (*Loader) LoadOrGenerateKeypair ¶
func (l *Loader) LoadOrGenerateKeypair(ctx context.Context, secretName string) (ed25519.PrivateKey, bool, error)
LoadOrGenerateKeypair loads existing keypair from Secret or generates a new one
func (*Loader) LoadShardCA ¶
LoadShardCA loads the cluster CA certificate from ConfigMap
type OperatorConfig ¶
type OperatorConfig struct {
ClusterID string `json:"cluster_id" yaml:"cluster_id"`
Tenant string `json:"tenant" yaml:"tenant"`
Shards map[string]ShardEndpoints `json:"shards" yaml:"shards"`
}
OperatorConfig represents the structure of the configuration file
func LoadConfigFromFile ¶
func LoadConfigFromFile(path string) (*OperatorConfig, error)
LoadConfigFromFile reads the operator configuration from a local file
func (*OperatorConfig) CAPIClusterName ¶
func (c *OperatorConfig) CAPIClusterName() string
CAPIClusterName returns the CAPI Cluster resource name for this operator, combining the cluster ID and tenant with a double-hyphen separator.
type ShardEndpoints ¶
type ShardEndpoints struct {
RegistrationAddr string `json:"registration_addr" yaml:"registration_addr"`
OperatorAddr string `json:"operator_addr" yaml:"operator_addr"`
}
ShardEndpoints contains the endpoints for a single shard