files

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capitalize added in v0.21.0

func Capitalize(s string) string

Types

type APIConfig added in v0.17.0

type APIConfig struct {
	BaseURL string `yaml:"baseUrl"`
}

type BomConfig

type BomConfig struct {
	Components map[string]ComponentConfig `json:"components"`
	Migrations MigrationsConfig           `json:"migrations"`
}

BomConfig represents the Bill of Materials configuration

func (*BomConfig) GetCodesphereContainerImages

func (b *BomConfig) GetCodesphereContainerImages() (map[string]string, error)

GetCodesphereContainerImages returns all container images from the codesphere component

func (*BomConfig) ParseBomConfig

func (b *BomConfig) ParseBomConfig(filePath string) error

ParseBomConfig reads and parses a BOM JSON file

type CAConfig added in v0.17.0

type CAConfig struct {
	Algorithm   string `yaml:"algorithm"`
	KeySizeBits int    `yaml:"keySizeBits"`
	CertPem     string `yaml:"certPem"`
}

type CephConfig added in v0.17.0

type CephConfig struct {
	CsiKubeletDir string     `yaml:"csiKubeletDir,omitempty"`
	CephAdmSSHKey CephSSHKey `yaml:"cephAdmSshKey"`
	NodesSubnet   string     `yaml:"nodesSubnet"`
	Hosts         []CephHost `yaml:"hosts"`
	OSDs          []CephOSD  `yaml:"osds"`

	SshPrivateKey string `yaml:"-"`
}

type CephDBDevices added in v0.17.0

type CephDBDevices struct {
	Size  string `yaml:"size"`
	Limit int    `yaml:"limit"`
}

type CephDataDevices added in v0.17.0

type CephDataDevices struct {
	Size  string `yaml:"size"`
	Limit int    `yaml:"limit"`
}

type CephHost added in v0.17.0

type CephHost struct {
	Hostname  string `yaml:"hostname"`
	IPAddress string `yaml:"ipAddress"`
	IsMaster  bool   `yaml:"isMaster"`
}

type CephHostConfig added in v0.17.0

type CephHostConfig struct {
	Hostname  string
	IPAddress string
	IsMaster  bool
}

type CephOSD added in v0.17.0

type CephOSD struct {
	SpecID      string          `yaml:"specId"`
	Placement   CephPlacement   `yaml:"placement"`
	DataDevices CephDataDevices `yaml:"dataDevices"`
	DBDevices   CephDBDevices   `yaml:"dbDevices"`
}

type CephPlacement added in v0.17.0

type CephPlacement struct {
	HostPattern string `yaml:"host_pattern"`
}

type CephSSHKey added in v0.17.0

type CephSSHKey struct {
	PublicKey string `yaml:"publicKey"`
}

type ClusterCertificates added in v0.17.0

type ClusterCertificates struct {
	CA CAConfig `yaml:"ca"`
}

type ClusterConfig added in v0.17.0

type ClusterConfig struct {
	Certificates  ClusterCertificates `yaml:"certificates"`
	Monitoring    *MonitoringConfig   `yaml:"monitoring,omitempty"`
	Gateway       GatewayConfig       `yaml:"gateway"`
	PublicGateway GatewayConfig       `yaml:"publicGateway"`

	IngressCAKey string `yaml:"-"`
}

type CodesphereComponent

type CodesphereComponent struct {
	ContainerImages map[string]string  `json:"containerImages"`
	Files           map[string]FileRef `json:"files"`
}

CodesphereComponent represents the codesphere-specific component

type CodesphereConfig

type CodesphereConfig struct {
	Domain                     string                 `yaml:"domain"`
	WorkspaceHostingBaseDomain string                 `yaml:"workspaceHostingBaseDomain"`
	PublicIP                   string                 `yaml:"publicIp"`
	CustomDomains              CustomDomainsConfig    `yaml:"customDomains"`
	DNSServers                 []string               `yaml:"dnsServers"`
	Experiments                []string               `yaml:"experiments"`
	ExtraCAPem                 string                 `yaml:"extraCaPem,omitempty"`
	ExtraWorkspaceEnvVars      map[string]string      `yaml:"extraWorkspaceEnvVars,omitempty"`
	ExtraWorkspaceFiles        []ExtraWorkspaceFile   `yaml:"extraWorkspaceFiles,omitempty"`
	WorkspaceImages            *WorkspaceImagesConfig `yaml:"workspaceImages,omitempty"`
	DeployConfig               DeployConfig           `yaml:"deployConfig"`
	Plans                      PlansConfig            `yaml:"plans"`
	UnderprovisionFactors      *UnderprovisionFactors `yaml:"underprovisionFactors,omitempty"`
	GitProviders               *GitProvidersConfig    `yaml:"gitProviders,omitempty"`
	ManagedServices            []ManagedServiceConfig `yaml:"managedServices,omitempty"`

	DomainAuthPrivateKey string `yaml:"-"`
	DomainAuthPublicKey  string `yaml:"-"`
}

type ComponentConfig

type ComponentConfig struct {
	ContainerImages map[string]string  `json:"containerImages,omitempty"`
	Files           map[string]FileRef `json:"files,omitempty"`
}

ComponentConfig represents a component in the BOM

type CustomDomainsConfig added in v0.17.0

type CustomDomainsConfig struct {
	CNameBaseDomain string `yaml:"cNameBaseDomain"`
}

type DatacenterConfig added in v0.17.0

type DatacenterConfig struct {
	ID          int    `yaml:"id"`
	Name        string `yaml:"name"`
	City        string `yaml:"city"`
	CountryCode string `yaml:"countryCode"`
}

type DbMigrationConfig

type DbMigrationConfig struct {
	Path string `json:"path"`
	From string `json:"from"`
}

DbMigrationConfig represents database migration configuration

type DeployConfig

type DeployConfig struct {
	Images map[string]ImageConfig `yaml:"images"`
}

type ExtraWorkspaceFile added in v0.17.0

type ExtraWorkspaceFile struct {
	Path    string `yaml:"path"`
	Content string `yaml:"content"`
}

type FileRef

type FileRef struct {
	SrcPath    string   `json:"srcPath,omitempty"`
	SrcUrl     string   `json:"srcUrl,omitempty"`
	Executable bool     `json:"executable,omitempty"`
	Glob       *GlobRef `json:"glob,omitempty"`
}

FileRef represents a file reference in the BOM

type FlavorConfig

type FlavorConfig struct {
	Image ImageRef    `yaml:"image"`
	Pool  map[int]int `yaml:"pool"`
}

type GatewayConfig added in v0.17.0

type GatewayConfig struct {
	ServiceType string            `yaml:"serviceType"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
	IPAddresses []string          `yaml:"ipAddresses,omitempty"`
}

type GitProviderConfig added in v0.17.0

type GitProviderConfig struct {
	Enabled bool        `yaml:"enabled"`
	URL     string      `yaml:"url"`
	API     APIConfig   `yaml:"api"`
	OAuth   OAuthConfig `yaml:"oauth"`
}

type GitProvidersConfig added in v0.17.0

type GitProvidersConfig struct {
	GitHub      *GitProviderConfig `yaml:"github,omitempty"`
	GitLab      *GitProviderConfig `yaml:"gitlab,omitempty"`
	Bitbucket   *GitProviderConfig `yaml:"bitbucket,omitempty"`
	AzureDevOps *GitProviderConfig `yaml:"azureDevOps,omitempty"`
}

type GlobRef

type GlobRef struct {
	Cwd     string   `json:"cwd"`
	Include string   `json:"include"`
	Exclude []string `json:"exclude,omitempty"`
}

GlobRef represents a glob-based file reference

type HostingPlan added in v0.17.0

type HostingPlan struct {
	CPUTenth      int `yaml:"cpuTenth"`
	GPUParts      int `yaml:"gpuParts"`
	MemoryMb      int `yaml:"memoryMb"`
	StorageMb     int `yaml:"storageMb"`
	TempStorageMb int `yaml:"tempStorageMb"`
}

type ImageConfig

type ImageConfig struct {
	Name           string                  `yaml:"name"`
	SupportedUntil string                  `yaml:"supportedUntil"`
	Flavors        map[string]FlavorConfig `yaml:"flavors"`
}

type ImageRef

type ImageRef struct {
	BomRef     string `yaml:"bomRef"`
	Dockerfile string `yaml:"dockerfile"`
}

type InstallVault added in v0.17.0

type InstallVault struct {
	Secrets []SecretEntry `yaml:"secrets"`
}

Vault

func (*InstallVault) Marshal added in v0.17.0

func (v *InstallVault) Marshal() ([]byte, error)

func (*InstallVault) Unmarshal added in v0.17.0

func (v *InstallVault) Unmarshal(data []byte) error

type K8sNode added in v0.17.0

type K8sNode struct {
	IPAddress string `yaml:"ipAddress"`
}

type KubernetesConfig added in v0.17.0

type KubernetesConfig struct {
	ManagedByCodesphere bool      `yaml:"managedByCodesphere"`
	APIServerHost       string    `yaml:"apiServerHost,omitempty"`
	ControlPlanes       []K8sNode `yaml:"controlPlanes,omitempty"`
	Workers             []K8sNode `yaml:"workers,omitempty"`
	PodCIDR             string    `yaml:"podCidr,omitempty"`
	ServiceCIDR         string    `yaml:"serviceCidr,omitempty"`

	// Internal flag
	NeedsKubeConfig bool `yaml:"-"`
}

type ManagedServiceAPI added in v0.17.0

type ManagedServiceAPI struct {
	Endpoint string `yaml:"endpoint"`
}

type ManagedServiceBackendsConfig added in v0.17.0

type ManagedServiceBackendsConfig struct {
	Postgres map[string]interface{} `yaml:"postgres,omitempty"`
}

type ManagedServiceConfig added in v0.17.0

type ManagedServiceConfig struct {
	Name          string                 `yaml:"name"`
	API           ManagedServiceAPI      `yaml:"api"`
	Author        string                 `yaml:"author"`
	Category      string                 `yaml:"category"`
	ConfigSchema  map[string]interface{} `yaml:"configSchema"`
	DetailsSchema map[string]interface{} `yaml:"detailsSchema"`
	SecretsSchema map[string]interface{} `yaml:"secretsSchema"`
	Description   string                 `yaml:"description"`
	DisplayName   string                 `yaml:"displayName"`
	IconURL       string                 `yaml:"iconUrl"`
	Plans         []ServicePlan          `yaml:"plans"`
	Version       string                 `yaml:"version"`
}

type ManifestEntry

type ManifestEntry struct {
	MediaType   string            `json:"mediaType"`
	Digest      string            `json:"digest"`
	Size        int64             `json:"size"`
	Annotations map[string]string `json:"annotations,omitempty"` // Use omitempty just in case, though usually present
}

ManifestEntry represents a single manifest entry within the index.

type MetalLBBGP added in v0.17.0

type MetalLBBGP struct {
	Name          string              `yaml:"name"`
	Pools         []string            `yaml:"pools"`
	Config        MetalLBBGPConfig    `yaml:"config"`
	NodeSelectors []map[string]string `yaml:"nodeSelectors,omitempty"`
}

type MetalLBBGPConfig added in v0.17.0

type MetalLBBGPConfig struct {
	MyASN       int    `yaml:"myASN"`
	PeerASN     int    `yaml:"peerASN"`
	PeerAddress string `yaml:"peerAddress"`
	BFDProfile  string `yaml:"bfdProfile,omitempty"`
}

type MetalLBConfig added in v0.17.0

type MetalLBConfig struct {
	Enabled bool             `yaml:"enabled"`
	Pools   []MetalLBPoolDef `yaml:"pools"`
	L2      []MetalLBL2      `yaml:"l2,omitempty"`
	BGP     []MetalLBBGP     `yaml:"bgp,omitempty"`
}

type MetalLBL2 added in v0.17.0

type MetalLBL2 struct {
	Name          string              `yaml:"name"`
	Pools         []string            `yaml:"pools"`
	NodeSelectors []map[string]string `yaml:"nodeSelectors,omitempty"`
}

type MetalLBPool added in v0.17.0

type MetalLBPool struct {
	Name        string
	IPAddresses []string
}

type MetalLBPoolDef added in v0.17.0

type MetalLBPoolDef struct {
	Name        string   `yaml:"name"`
	IPAddresses []string `yaml:"ipAddresses"`
}

type MigrationsConfig

type MigrationsConfig struct {
	Db DbMigrationConfig `json:"db"`
}

MigrationsConfig represents the migrations configuration

type MonitoringConfig added in v0.17.0

type MonitoringConfig struct {
	Prometheus *PrometheusConfig `yaml:"prometheus,omitempty"`
}

type OAuthConfig added in v0.17.0

type OAuthConfig struct {
	Issuer                string `yaml:"issuer"`
	AuthorizationEndpoint string `yaml:"authorizationEndpoint"`
	TokenEndpoint         string `yaml:"tokenEndpoint"`
	ClientAuthMethod      string `yaml:"clientAuthMethod,omitempty"`
	Scope                 string `yaml:"scope,omitempty"`

	ClientID     string `yaml:"-"`
	ClientSecret string `yaml:"-"`
}

type OCIImageIndex

type OCIImageIndex struct {
	SchemaVersion int             `json:"schemaVersion"`
	MediaType     string          `json:"mediaType"`
	Manifests     []ManifestEntry `json:"manifests"`
}

OCIImageIndex represents the top-level structure of an OCI Image Index (manifest list).

func (*OCIImageIndex) ExtractImageNames

func (o *OCIImageIndex) ExtractImageNames() ([]string, error)

ExtractImageNames extracts the image names from the OCI image index file.

func (*OCIImageIndex) ParseOCIImageConfig

func (o *OCIImageIndex) ParseOCIImageConfig(filePath string) error

type PlanParam added in v0.17.0

type PlanParam struct {
	PricedAs string                 `yaml:"pricedAs"`
	Schema   map[string]interface{} `yaml:"schema"`
}

type PlansConfig added in v0.17.0

type PlansConfig struct {
	HostingPlans   map[int]HostingPlan   `yaml:"hostingPlans"`
	WorkspacePlans map[int]WorkspacePlan `yaml:"workspacePlans"`
}

type PostgresConfig added in v0.17.0

type PostgresConfig struct {
	Mode          string                 `yaml:"mode,omitempty"`
	CACertPem     string                 `yaml:"caCertPem,omitempty"`
	Primary       *PostgresPrimaryConfig `yaml:"primary,omitempty"`
	Replica       *PostgresReplicaConfig `yaml:"replica,omitempty"`
	ServerAddress string                 `yaml:"serverAddress,omitempty"`

	// Stored separately in vault
	CaCertPrivateKey  string            `yaml:"-"`
	AdminPassword     string            `yaml:"-"`
	ReplicaPassword   string            `yaml:"-"`
	ReplicaPrivateKey string            `yaml:"-"`
	UserPasswords     map[string]string `yaml:"-"`
}

type PostgresPrimaryConfig added in v0.17.0

type PostgresPrimaryConfig struct {
	SSLConfig SSLConfig `yaml:"sslConfig"`
	IP        string    `yaml:"ip"`
	Hostname  string    `yaml:"hostname"`

	PrivateKey string `yaml:"-"`
}

type PostgresReplicaConfig added in v0.17.0

type PostgresReplicaConfig struct {
	IP        string    `yaml:"ip"`
	Name      string    `yaml:"name"`
	SSLConfig SSLConfig `yaml:"sslConfig"`
}

type PrometheusConfig added in v0.17.0

type PrometheusConfig struct {
	RemoteWrite *RemoteWriteConfig `yaml:"remoteWrite,omitempty"`
}

type RegistryConfig

type RegistryConfig struct {
	Server              string `yaml:"server"`
	ReplaceImagesInBom  bool   `yaml:"replaceImagesInBom"`
	LoadContainerImages bool   `yaml:"loadContainerImages"`

	// Stored separately in vault
	Username string `yaml:"-"`
	Password string `yaml:"-"`
}

type RemoteWriteConfig added in v0.17.0

type RemoteWriteConfig struct {
	Enabled     bool   `yaml:"enabled"`
	ClusterName string `yaml:"clusterName,omitempty"`
}

type RootConfig

type RootConfig struct {
	Datacenter             DatacenterConfig              `yaml:"dataCenter"`
	Secrets                SecretsConfig                 `yaml:"secrets"`
	Registry               RegistryConfig                `yaml:"registry,omitempty"`
	Postgres               PostgresConfig                `yaml:"postgres"`
	Ceph                   CephConfig                    `yaml:"ceph"`
	Kubernetes             KubernetesConfig              `yaml:"kubernetes"`
	Cluster                ClusterConfig                 `yaml:"cluster"`
	MetalLB                *MetalLBConfig                `yaml:"metallb,omitempty"`
	Codesphere             CodesphereConfig              `yaml:"codesphere"`
	ManagedServiceBackends *ManagedServiceBackendsConfig `yaml:"managedServiceBackends,omitempty"`
}

RootConfig represents the relevant parts of the configuration file

func (*RootConfig) ExtractBomRefs

func (c *RootConfig) ExtractBomRefs() []string

func (*RootConfig) ExtractVault added in v0.17.0

func (c *RootConfig) ExtractVault() *InstallVault

func (*RootConfig) ExtractWorkspaceDockerfiles

func (c *RootConfig) ExtractWorkspaceDockerfiles() map[string]string

func (*RootConfig) Marshal added in v0.17.0

func (c *RootConfig) Marshal() ([]byte, error)

Marshal serializes the RootConfig to YAML

func (*RootConfig) Unmarshal added in v0.17.0

func (c *RootConfig) Unmarshal(data []byte) error

Unmarshal deserializes YAML data into the RootConfig

type SSLConfig added in v0.17.0

type SSLConfig struct {
	ServerCertPem string `yaml:"serverCertPem"`
}

type SecretEntry added in v0.17.0

type SecretEntry struct {
	Name   string        `yaml:"name"`
	File   *SecretFile   `yaml:"file,omitempty"`
	Fields *SecretFields `yaml:"fields,omitempty"`
}

type SecretFields added in v0.17.0

type SecretFields struct {
	Password string `yaml:"password"`
}

type SecretFile added in v0.17.0

type SecretFile struct {
	Name    string `yaml:"name"`
	Content string `yaml:"content"`
}

type SecretsConfig added in v0.17.0

type SecretsConfig struct {
	BaseDir string `yaml:"baseDir"`
}

type ServicePlan added in v0.17.0

type ServicePlan struct {
	ID          int                  `yaml:"id"`
	Description string               `yaml:"description"`
	Name        string               `yaml:"name"`
	Parameters  map[string]PlanParam `yaml:"parameters"`
}

type UnderprovisionFactors added in v0.17.0

type UnderprovisionFactors struct {
	CPU    float64 `yaml:"cpu"`
	Memory float64 `yaml:"memory"`
}

type WorkspaceImagesConfig added in v0.17.0

type WorkspaceImagesConfig struct {
	Agent    *ImageRef `yaml:"agent,omitempty"`
	AgentGpu *ImageRef `yaml:"agentGpu,omitempty"`
	Server   *ImageRef `yaml:"server,omitempty"`
	VPN      *ImageRef `yaml:"vpn,omitempty"`
}

type WorkspacePlan added in v0.17.0

type WorkspacePlan struct {
	Name          string `yaml:"name"`
	HostingPlanID int    `yaml:"hostingPlanId"`
	MaxReplicas   int    `yaml:"maxReplicas"`
	OnDemand      bool   `yaml:"onDemand"`
}

Jump to

Keyboard shortcuts

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