Documentation
¶
Index ¶
- func ConvertV1Alpha1ToBundle(config *BundleConfig) *stack.Bundle
- func ConvertV1Alpha1ToCluster(config *ClusterConfig) *stack.Cluster
- func ConvertV1Alpha1ToNode(config *NodeConfig) *stack.Node
- func GetRegisteredStackGVKs() []gvk.GVK
- func IsStackConfigRegistered(g gvk.GVK) bool
- func RegisterStackConfig(gvk gvk.GVK, factory StackConfigFactory)
- type ApplicationReference
- type BootstrapConfig
- type BundleConfig
- func (b *BundleConfig) AddApplication(name, apiVersion, kind string)
- func (b *BundleConfig) AddDependency(bundleName string)
- func (b *BundleConfig) ConvertFrom(from interface{}) error
- func (b *BundleConfig) ConvertTo(version string) (interface{}, error)
- func (b *BundleConfig) GetAPIVersion() string
- func (b *BundleConfig) GetKind() string
- func (b *BundleConfig) GetName() string
- func (b *BundleConfig) GetNamespace() string
- func (b *BundleConfig) GetPath() string
- func (b *BundleConfig) SetName(name string)
- func (b *BundleConfig) SetNamespace(namespace string)
- func (b *BundleConfig) SetSourceRef(kind, name, namespace string)
- func (b *BundleConfig) Validate() error
- type BundleReference
- type BundleSpec
- type ClusterConfig
- func (c *ClusterConfig) ConvertFrom(from interface{}) error
- func (c *ClusterConfig) ConvertTo(version string) (interface{}, error)
- func (c *ClusterConfig) GetAPIVersion() string
- func (c *ClusterConfig) GetKind() string
- func (c *ClusterConfig) GetName() string
- func (c *ClusterConfig) GetNamespace() string
- func (c *ClusterConfig) SetName(name string)
- func (c *ClusterConfig) SetNamespace(namespace string)
- func (c *ClusterConfig) Validate() error
- type ClusterSpec
- type GitOpsConfig
- type NodeConfig
- func (n *NodeConfig) AddChild(childName string)
- func (n *NodeConfig) ConvertFrom(from interface{}) error
- func (n *NodeConfig) ConvertTo(version string) (interface{}, error)
- func (n *NodeConfig) GetAPIVersion() string
- func (n *NodeConfig) GetKind() string
- func (n *NodeConfig) GetName() string
- func (n *NodeConfig) GetNamespace() string
- func (n *NodeConfig) GetPath() string
- func (n *NodeConfig) SetBundle(bundleName string)
- func (n *NodeConfig) SetName(name string)
- func (n *NodeConfig) SetNamespace(namespace string)
- func (n *NodeConfig) SetPackageRef(group, version, kind string)
- func (n *NodeConfig) Validate() error
- type NodeReference
- type NodeSpec
- type SourceRef
- type StackConfig
- type StackConfigFactory
- type StackConfigType
- type StackConverter
- type StackRegistry
- type StackWrapper
- func (w *StackWrapper) AsBundle() (*BundleConfig, bool)
- func (w *StackWrapper) AsCluster() (*ClusterConfig, bool)
- func (w *StackWrapper) AsNode() (*NodeConfig, bool)
- func (w *StackWrapper) GetConfig() StackConfig
- func (w *StackWrapper) GetGVK() gvk.GVK
- func (w *StackWrapper) GetType() StackConfigType
- func (w *StackWrapper) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertV1Alpha1ToBundle ¶
func ConvertV1Alpha1ToBundle(config *BundleConfig) *stack.Bundle
ConvertV1Alpha1ToBundle converts a v1alpha1 BundleConfig to an unversioned Bundle
func ConvertV1Alpha1ToCluster ¶
func ConvertV1Alpha1ToCluster(config *ClusterConfig) *stack.Cluster
ConvertV1Alpha1ToCluster converts a v1alpha1 ClusterConfig to an unversioned Cluster
func ConvertV1Alpha1ToNode ¶
func ConvertV1Alpha1ToNode(config *NodeConfig) *stack.Node
ConvertV1Alpha1ToNode converts a v1alpha1 NodeConfig to an unversioned Node
func GetRegisteredStackGVKs ¶
GetRegisteredStackGVKs returns all registered stack configuration GVKs
func IsStackConfigRegistered ¶
IsStackConfigRegistered checks if a GVK is registered for stack configurations
func RegisterStackConfig ¶
func RegisterStackConfig(gvk gvk.GVK, factory StackConfigFactory)
RegisterStackConfig registers a stack configuration factory for a GVK
Types ¶
type ApplicationReference ¶
type ApplicationReference struct {
// Name of the application
Name string `yaml:"name" json:"name"`
// APIVersion of the referenced application
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
// Kind of the referenced application (for supporting different app types)
Kind string `yaml:"kind,omitempty" json:"kind,omitempty"`
}
ApplicationReference references an Application configuration
type BootstrapConfig ¶
type BootstrapConfig struct {
// Common fields
Enabled bool `yaml:"enabled" json:"enabled"`
// Flux-specific
FluxMode string `yaml:"fluxMode,omitempty" json:"fluxMode,omitempty"` // "gitops-toolkit" or "flux-operator"
FluxVersion string `yaml:"fluxVersion,omitempty" json:"fluxVersion,omitempty"`
Components []string `yaml:"components,omitempty" json:"components,omitempty"`
Registry string `yaml:"registry,omitempty" json:"registry,omitempty"`
ImagePullSecret string `yaml:"imagePullSecret,omitempty" json:"imagePullSecret,omitempty"`
// Source configuration
SourceURL string `yaml:"sourceURL,omitempty" json:"sourceURL,omitempty"` // OCI/Git repository URL
SourceRef string `yaml:"sourceRef,omitempty" json:"sourceRef,omitempty"` // Tag/branch/ref
// ArgoCD-specific
ArgoCDVersion string `yaml:"argoCDVersion,omitempty" json:"argoCDVersion,omitempty"`
ArgoCDNamespace string `yaml:"argoCDNamespace,omitempty" json:"argoCDNamespace,omitempty"`
}
BootstrapConfig defines the bootstrap configuration for GitOps tools
type BundleConfig ¶
type BundleConfig struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata gvk.BaseMetadata `yaml:"metadata" json:"metadata"`
Spec BundleSpec `yaml:"spec" json:"spec"`
}
BundleConfig represents a versioned bundle configuration +gvk:group=stack.gokure.dev +gvk:version=v1alpha1 +gvk:kind=Bundle
func ConvertBundleToV1Alpha1 ¶
func ConvertBundleToV1Alpha1(b *stack.Bundle) *BundleConfig
ConvertBundleToV1Alpha1 converts an unversioned Bundle to a v1alpha1 BundleConfig
func NewBundleConfig ¶
func NewBundleConfig(name string) *BundleConfig
NewBundleConfig creates a new BundleConfig with default values
func (*BundleConfig) AddApplication ¶
func (b *BundleConfig) AddApplication(name, apiVersion, kind string)
AddApplication adds an application reference to the bundle
func (*BundleConfig) AddDependency ¶
func (b *BundleConfig) AddDependency(bundleName string)
AddDependency adds a dependency to another bundle
func (*BundleConfig) ConvertFrom ¶
func (b *BundleConfig) ConvertFrom(from interface{}) error
ConvertFrom converts from another version to this bundle config
func (*BundleConfig) ConvertTo ¶
func (b *BundleConfig) ConvertTo(version string) (interface{}, error)
ConvertTo converts this bundle config to another version
func (*BundleConfig) GetAPIVersion ¶
func (b *BundleConfig) GetAPIVersion() string
GetAPIVersion returns the API version of the bundle config
func (*BundleConfig) GetKind ¶
func (b *BundleConfig) GetKind() string
GetKind returns the kind of the bundle config
func (*BundleConfig) GetName ¶
func (b *BundleConfig) GetName() string
GetName returns the name of the bundle
func (*BundleConfig) GetNamespace ¶
func (b *BundleConfig) GetNamespace() string
GetNamespace returns the namespace of the bundle
func (*BundleConfig) GetPath ¶
func (b *BundleConfig) GetPath() string
GetPath returns the full hierarchical path of this bundle
func (*BundleConfig) SetName ¶
func (b *BundleConfig) SetName(name string)
SetName sets the name of the bundle
func (*BundleConfig) SetNamespace ¶
func (b *BundleConfig) SetNamespace(namespace string)
SetNamespace sets the namespace of the bundle
func (*BundleConfig) SetSourceRef ¶
func (b *BundleConfig) SetSourceRef(kind, name, namespace string)
SetSourceRef sets the source reference for the bundle
func (*BundleConfig) Validate ¶
func (b *BundleConfig) Validate() error
Validate performs validation on the bundle configuration
type BundleReference ¶
type BundleReference struct {
// Name of the bundle
Name string `yaml:"name" json:"name"`
// APIVersion of the referenced bundle (for future cross-version references)
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
}
BundleReference references a Bundle configuration
type BundleSpec ¶
type BundleSpec struct {
// ParentPath is the hierarchical path to the parent bundle (e.g., "cluster/infrastructure")
// Empty for root bundles. This avoids circular references while maintaining hierarchy.
ParentPath string `yaml:"parentPath,omitempty" json:"parentPath,omitempty"`
// DependsOn lists other bundles this bundle depends on
DependsOn []BundleReference `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"`
// Interval controls how often Flux reconciles the bundle
// Supports Go duration format (e.g., "5m", "1h", "30s", "1h30m")
// Valid range: 1s to 24h. Empty value uses system defaults.
Interval string `yaml:"interval,omitempty" json:"interval,omitempty"`
// SourceRef specifies the source for the bundle
SourceRef *SourceRef `yaml:"sourceRef,omitempty" json:"sourceRef,omitempty"`
// Applications holds the application configurations that belong to the bundle
Applications []ApplicationReference `yaml:"applications,omitempty" json:"applications,omitempty"`
// Description provides a human-readable description of the bundle
Description string `yaml:"description,omitempty" json:"description,omitempty"`
// Labels are common labels that should be applied to each resource
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
// Annotations are common annotations that should be applied to each resource
Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"`
// Prune specifies whether to prune resources when they are removed from the bundle
Prune bool `yaml:"prune,omitempty" json:"prune,omitempty"`
// Wait specifies whether to wait for resources to be ready before considering the bundle reconciled
Wait bool `yaml:"wait,omitempty" json:"wait,omitempty"`
// Timeout is the maximum time to wait for resources to be ready
// Supports Go duration format (e.g., "10m", "1h", "30s")
// Valid range: 1s to 24h. Empty value uses system defaults.
Timeout string `yaml:"timeout,omitempty" json:"timeout,omitempty"`
// RetryInterval is the interval to retry failed reconciliations
// Supports Go duration format (e.g., "2m", "30s", "5m")
// Valid range: 1s to 24h. Empty value uses system defaults.
RetryInterval string `yaml:"retryInterval,omitempty" json:"retryInterval,omitempty"`
}
BundleSpec defines the specification for a bundle
type ClusterConfig ¶
type ClusterConfig struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata gvk.BaseMetadata `yaml:"metadata" json:"metadata"`
Spec ClusterSpec `yaml:"spec" json:"spec"`
}
ClusterConfig represents a versioned cluster configuration +gvk:group=stack.gokure.dev +gvk:version=v1alpha1 +gvk:kind=Cluster
func ConvertClusterToV1Alpha1 ¶
func ConvertClusterToV1Alpha1(c *stack.Cluster) *ClusterConfig
ConvertClusterToV1Alpha1 converts an unversioned Cluster to a v1alpha1 ClusterConfig
func NewClusterConfig ¶
func NewClusterConfig(name string) *ClusterConfig
NewClusterConfig creates a new ClusterConfig with default values
func (*ClusterConfig) ConvertFrom ¶
func (c *ClusterConfig) ConvertFrom(from interface{}) error
ConvertFrom converts from another version to this cluster config
func (*ClusterConfig) ConvertTo ¶
func (c *ClusterConfig) ConvertTo(version string) (interface{}, error)
ConvertTo converts this cluster config to another version
func (*ClusterConfig) GetAPIVersion ¶
func (c *ClusterConfig) GetAPIVersion() string
GetAPIVersion returns the API version of the cluster config
func (*ClusterConfig) GetKind ¶
func (c *ClusterConfig) GetKind() string
GetKind returns the kind of the cluster config
func (*ClusterConfig) GetName ¶
func (c *ClusterConfig) GetName() string
GetName returns the name of the cluster
func (*ClusterConfig) GetNamespace ¶
func (c *ClusterConfig) GetNamespace() string
GetNamespace returns the namespace of the cluster
func (*ClusterConfig) SetName ¶
func (c *ClusterConfig) SetName(name string)
SetName sets the name of the cluster
func (*ClusterConfig) SetNamespace ¶
func (c *ClusterConfig) SetNamespace(namespace string)
SetNamespace sets the namespace of the cluster
func (*ClusterConfig) Validate ¶
func (c *ClusterConfig) Validate() error
Validate performs validation on the cluster configuration
type ClusterSpec ¶
type ClusterSpec struct {
// Node is the root node of the cluster configuration tree
Node *NodeReference `yaml:"node,omitempty" json:"node,omitempty"`
// GitOps defines the GitOps tool configuration for the cluster
GitOps *GitOpsConfig `yaml:"gitops,omitempty" json:"gitops,omitempty"`
// Description provides a human-readable description of the cluster
Description string `yaml:"description,omitempty" json:"description,omitempty"`
// Labels are key-value pairs for cluster metadata
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
}
ClusterSpec defines the specification for a cluster
type GitOpsConfig ¶
type GitOpsConfig struct {
// Type specifies the GitOps tool: "flux" or "argocd"
Type string `yaml:"type" json:"type"`
// Bootstrap configuration for the GitOps tool
Bootstrap *BootstrapConfig `yaml:"bootstrap,omitempty" json:"bootstrap,omitempty"`
}
GitOpsConfig defines the GitOps tool configuration for the cluster
type NodeConfig ¶
type NodeConfig struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata gvk.BaseMetadata `yaml:"metadata" json:"metadata"`
Spec NodeSpec `yaml:"spec" json:"spec"`
}
NodeConfig represents a versioned node configuration +gvk:group=stack.gokure.dev +gvk:version=v1alpha1 +gvk:kind=Node
func ConvertNodeToV1Alpha1 ¶
func ConvertNodeToV1Alpha1(n *stack.Node) *NodeConfig
ConvertNodeToV1Alpha1 converts an unversioned Node to a v1alpha1 NodeConfig
func NewNodeConfig ¶
func NewNodeConfig(name string) *NodeConfig
NewNodeConfig creates a new NodeConfig with default values
func (*NodeConfig) AddChild ¶
func (n *NodeConfig) AddChild(childName string)
AddChild adds a child node reference
func (*NodeConfig) ConvertFrom ¶
func (n *NodeConfig) ConvertFrom(from interface{}) error
ConvertFrom converts from another version to this node config
func (*NodeConfig) ConvertTo ¶
func (n *NodeConfig) ConvertTo(version string) (interface{}, error)
ConvertTo converts this node config to another version
func (*NodeConfig) GetAPIVersion ¶
func (n *NodeConfig) GetAPIVersion() string
GetAPIVersion returns the API version of the node config
func (*NodeConfig) GetKind ¶
func (n *NodeConfig) GetKind() string
GetKind returns the kind of the node config
func (*NodeConfig) GetName ¶
func (n *NodeConfig) GetName() string
GetName returns the name of the node
func (*NodeConfig) GetNamespace ¶
func (n *NodeConfig) GetNamespace() string
GetNamespace returns the namespace of the node
func (*NodeConfig) GetPath ¶
func (n *NodeConfig) GetPath() string
GetPath returns the full hierarchical path of this node
func (*NodeConfig) SetBundle ¶
func (n *NodeConfig) SetBundle(bundleName string)
SetBundle sets the bundle reference
func (*NodeConfig) SetName ¶
func (n *NodeConfig) SetName(name string)
SetName sets the name of the node
func (*NodeConfig) SetNamespace ¶
func (n *NodeConfig) SetNamespace(namespace string)
SetNamespace sets the namespace of the node
func (*NodeConfig) SetPackageRef ¶
func (n *NodeConfig) SetPackageRef(group, version, kind string)
SetPackageRef sets the package reference
func (*NodeConfig) Validate ¶
func (n *NodeConfig) Validate() error
Validate performs validation on the node configuration
type NodeReference ¶
type NodeReference struct {
// Name of the node
Name string `yaml:"name" json:"name"`
// APIVersion of the referenced node (for future cross-version references)
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
}
NodeReference references a Node configuration
type NodeSpec ¶
type NodeSpec struct {
// ParentPath is the hierarchical path to the parent node (e.g., "cluster/infrastructure")
// Empty for root nodes. This avoids circular references while maintaining hierarchy.
ParentPath string `yaml:"parentPath,omitempty" json:"parentPath,omitempty"`
// Children list child nodes
Children []NodeReference `yaml:"children,omitempty" json:"children,omitempty"`
// PackageRef identifies in which package the tree of resources get bundled together
// If undefined, the PackageRef of the parent is inherited
PackageRef *schema.GroupVersionKind `yaml:"packageRef,omitempty" json:"packageRef,omitempty"`
// Bundle holds the applications that get deployed on this level
Bundle *BundleReference `yaml:"bundle,omitempty" json:"bundle,omitempty"`
// Description provides a human-readable description of the node
Description string `yaml:"description,omitempty" json:"description,omitempty"`
// Labels are key-value pairs for node metadata
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
// Annotations are key-value pairs for node annotations
Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"`
}
NodeSpec defines the specification for a node
type SourceRef ¶
type SourceRef struct {
// Kind of the source (e.g., GitRepository, OCIRepository, Bucket)
Kind string `yaml:"kind" json:"kind"`
// Name of the source
Name string `yaml:"name" json:"name"`
// Namespace of the source
Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"`
// APIVersion of the source (for future cross-version references)
APIVersion string `yaml:"apiVersion,omitempty" json:"apiVersion,omitempty"`
// URL is the repository URL (OCI or Git). When set, the resource generator
// creates the source CRD in addition to referencing it.
URL string `yaml:"url,omitempty" json:"url,omitempty"`
// Tag is the tag or semver reference for OCI/Git sources.
Tag string `yaml:"tag,omitempty" json:"tag,omitempty"`
// Branch is the branch reference for Git sources.
Branch string `yaml:"branch,omitempty" json:"branch,omitempty"`
}
SourceRef defines a reference to a Flux source
type StackConfig ¶
type StackConfig interface {
gvk.VersionedType
gvk.MetadataType
Validate() error
}
StackConfig is a common interface for all stack configuration types
func CreateStackConfig ¶
func CreateStackConfig(gvk gvk.GVK) (StackConfig, error)
CreateStackConfig creates a new stack configuration for the given GVK
type StackConfigFactory ¶
type StackConfigFactory func() StackConfig
StackConfigFactory creates stack configurations from raw data
type StackConfigType ¶
type StackConfigType string
StackConfigType represents the type of stack configuration
const ( // StackConfigTypeCluster represents a Cluster configuration StackConfigTypeCluster StackConfigType = "Cluster" // StackConfigTypeNode represents a Node configuration StackConfigTypeNode StackConfigType = "Node" // StackConfigTypeBundle represents a Bundle configuration StackConfigTypeBundle StackConfigType = "Bundle" )
type StackConverter ¶
type StackConverter struct {
// contains filtered or unexported fields
}
StackConverter provides methods to convert between versioned and unversioned stack types
func NewStackConverter ¶
func NewStackConverter() *StackConverter
NewStackConverter creates a new stack converter
func (*StackConverter) ConvertClusterTreeToV1Alpha1 ¶
func (c *StackConverter) ConvertClusterTreeToV1Alpha1(cluster *stack.Cluster) (*ClusterConfig, []*NodeConfig, []*BundleConfig)
ConvertClusterTreeToV1Alpha1 converts a full cluster tree to versioned configs
func (*StackConverter) ConvertV1Alpha1ToClusterTree ¶
func (c *StackConverter) ConvertV1Alpha1ToClusterTree( clusterConfig *ClusterConfig, nodeConfigs []*NodeConfig, bundleConfigs []*BundleConfig, applications []*stack.Application, ) *stack.Cluster
ConvertV1Alpha1ToClusterTree converts versioned configs back to a cluster tree
type StackRegistry ¶
type StackRegistry struct {
// contains filtered or unexported fields
}
StackRegistry manages registration and creation of stack configurations
type StackWrapper ¶
type StackWrapper struct {
// contains filtered or unexported fields
}
StackWrapper provides a unified wrapper for stack configurations
func CreateStackWrapper ¶
func CreateStackWrapper(g gvk.GVK) (*StackWrapper, error)
CreateStackWrapper creates a new stack wrapper for the given GVK
func NewStackWrapper ¶
func NewStackWrapper(g gvk.GVK, config StackConfig) *StackWrapper
NewStackWrapper creates a new stack wrapper from a GVK and configuration
func (*StackWrapper) AsBundle ¶
func (w *StackWrapper) AsBundle() (*BundleConfig, bool)
AsBundle returns the configuration as a BundleConfig if it is one
func (*StackWrapper) AsCluster ¶
func (w *StackWrapper) AsCluster() (*ClusterConfig, bool)
AsCluster returns the configuration as a ClusterConfig if it is one
func (*StackWrapper) AsNode ¶
func (w *StackWrapper) AsNode() (*NodeConfig, bool)
AsNode returns the configuration as a NodeConfig if it is one
func (*StackWrapper) GetConfig ¶
func (w *StackWrapper) GetConfig() StackConfig
GetConfig returns the wrapped configuration
func (*StackWrapper) GetGVK ¶
func (w *StackWrapper) GetGVK() gvk.GVK
GetGVK returns the GVK of the wrapped configuration
func (*StackWrapper) GetType ¶
func (w *StackWrapper) GetType() StackConfigType
GetType returns the stack configuration type
func (*StackWrapper) Validate ¶
func (w *StackWrapper) Validate() error
Validate validates the wrapped configuration