Documentation
¶
Index ¶
- Variables
- type BaseBlueprintHandler
- func (b *BaseBlueprintHandler) GetKustomizations() []blueprintv1alpha1.Kustomization
- func (b *BaseBlueprintHandler) GetMetadata() blueprintv1alpha1.Metadata
- func (b *BaseBlueprintHandler) GetRepository() blueprintv1alpha1.Repository
- func (b *BaseBlueprintHandler) GetSources() []blueprintv1alpha1.Source
- func (b *BaseBlueprintHandler) GetTerraformComponents() []blueprintv1alpha1.TerraformComponent
- func (b *BaseBlueprintHandler) Initialize() error
- func (b *BaseBlueprintHandler) Install() error
- func (b *BaseBlueprintHandler) LoadConfig(path ...string) error
- func (b *BaseBlueprintHandler) SetKustomizations(kustomizations []blueprintv1alpha1.Kustomization) error
- func (b *BaseBlueprintHandler) SetMetadata(metadata blueprintv1alpha1.Metadata) error
- func (b *BaseBlueprintHandler) SetRepository(repository blueprintv1alpha1.Repository) error
- func (b *BaseBlueprintHandler) SetSources(sources []blueprintv1alpha1.Source) error
- func (b *BaseBlueprintHandler) SetTerraformComponents(terraformComponents []blueprintv1alpha1.TerraformComponent) error
- func (b *BaseBlueprintHandler) WriteConfig(path ...string) error
- type BlueprintHandler
- type MockBlueprintHandler
- func (m *MockBlueprintHandler) GetKustomizations() []blueprintv1alpha1.Kustomization
- func (m *MockBlueprintHandler) GetMetadata() blueprintv1alpha1.Metadata
- func (m *MockBlueprintHandler) GetSources() []blueprintv1alpha1.Source
- func (m *MockBlueprintHandler) GetTerraformComponents() []blueprintv1alpha1.TerraformComponent
- func (m *MockBlueprintHandler) Initialize() error
- func (m *MockBlueprintHandler) Install() error
- func (m *MockBlueprintHandler) LoadConfig(path ...string) error
- func (m *MockBlueprintHandler) SetKustomizations(kustomizations []blueprintv1alpha1.Kustomization) error
- func (m *MockBlueprintHandler) SetMetadata(metadata blueprintv1alpha1.Metadata) error
- func (m *MockBlueprintHandler) SetSources(sources []blueprintv1alpha1.Source) error
- func (m *MockBlueprintHandler) SetTerraformComponents(terraformComponents []blueprintv1alpha1.TerraformComponent) error
- func (m *MockBlueprintHandler) WriteConfig(path ...string) error
- type ResourceOperationConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultBlueprint = blueprintv1alpha1.Blueprint{ Kind: "Blueprint", ApiVersion: "blueprints.windsorcli.dev/v1alpha1", Metadata: blueprintv1alpha1.Metadata{ Name: "default", Description: "A default blueprint", Authors: []string{}, }, Sources: []blueprintv1alpha1.Source{}, TerraformComponents: []blueprintv1alpha1.TerraformComponent{}, }
Functions ¶
This section is empty.
Types ¶
type BaseBlueprintHandler ¶
type BaseBlueprintHandler struct {
// contains filtered or unexported fields
}
BaseBlueprintHandler is a base implementation of the BlueprintHandler interface
func NewBlueprintHandler ¶
func NewBlueprintHandler(injector di.Injector) *BaseBlueprintHandler
NewBlueprintHandler creates a new instance of BaseBlueprintHandler. It initializes the handler with the provided dependency injector.
func (*BaseBlueprintHandler) GetKustomizations ¶ added in v0.3.0
func (b *BaseBlueprintHandler) GetKustomizations() []blueprintv1alpha1.Kustomization
GetKustomizations retrieves the Kustomization configurations for the blueprint. It ensures that default values are set for each Kustomization's specifications, such as interval, prune, and timeout.
func (*BaseBlueprintHandler) GetMetadata ¶
func (b *BaseBlueprintHandler) GetMetadata() blueprintv1alpha1.Metadata
GetMetadata retrieves the metadata for the current blueprint. It returns the metadata information, which includes details such as the name and description of the blueprint.
func (*BaseBlueprintHandler) GetRepository ¶ added in v0.3.0
func (b *BaseBlueprintHandler) GetRepository() blueprintv1alpha1.Repository
GetRepository retrieves the repository configuration for the current blueprint. It returns the repository details, including the URL and reference branch.
func (*BaseBlueprintHandler) GetSources ¶
func (b *BaseBlueprintHandler) GetSources() []blueprintv1alpha1.Source
GetSources retrieves the source configurations for the current blueprint. It returns a list of sources, which define the origins of various components within the blueprint.
func (*BaseBlueprintHandler) GetTerraformComponents ¶
func (b *BaseBlueprintHandler) GetTerraformComponents() []blueprintv1alpha1.TerraformComponent
GetTerraformComponents retrieves the Terraform components defined in the blueprint. It resolves the sources and paths for each component before returning the list of components.
func (*BaseBlueprintHandler) Initialize ¶
func (b *BaseBlueprintHandler) Initialize() error
Initialize sets up the BaseBlueprintHandler by resolving and assigning its dependencies, including the configHandler, contextHandler, and shell, from the provided dependency injector. It also determines the project root directory using the shell and sets the project name in the configuration. If any of these steps fail, it returns an error.
func (*BaseBlueprintHandler) Install ¶ added in v0.3.0
func (b *BaseBlueprintHandler) Install() error
Install initializes the Kubernetes client if not already set, and applies all GitRepositories, Kustomizations, and ConfigMaps defined in the blueprint to the cluster. It first checks for a KUBECONFIG environment variable to configure the client, falling back to in-cluster configuration if not found. The function iterates over the sources, kustomizations, and configmaps, applying each to the cluster using the Kubernetes client.
func (*BaseBlueprintHandler) LoadConfig ¶
func (b *BaseBlueprintHandler) LoadConfig(path ...string) error
LoadConfig reads a blueprint configuration from a given path, supporting both Jsonnet and YAML formats. It first establishes the base path for the blueprint configuration and attempts to load data from Jsonnet and YAML files. The function processes the configuration context, evaluates Jsonnet if present, and integrates the resulting blueprint with any local blueprint data.
func (*BaseBlueprintHandler) SetKustomizations ¶ added in v0.3.0
func (b *BaseBlueprintHandler) SetKustomizations(kustomizations []blueprintv1alpha1.Kustomization) error
SetKustomizations updates the Kustomizations for the current blueprint. It replaces the existing Kustomizations with the provided list of Kustomizations. If the provided list is nil, it clears the existing Kustomizations.
func (*BaseBlueprintHandler) SetMetadata ¶
func (b *BaseBlueprintHandler) SetMetadata(metadata blueprintv1alpha1.Metadata) error
SetMetadata updates the metadata for the current blueprint. It replaces the existing metadata with the provided metadata information.
func (*BaseBlueprintHandler) SetRepository ¶ added in v0.3.0
func (b *BaseBlueprintHandler) SetRepository(repository blueprintv1alpha1.Repository) error
SetRepository updates the repository for the current blueprint. It replaces the existing repository with the provided repository information.
func (*BaseBlueprintHandler) SetSources ¶
func (b *BaseBlueprintHandler) SetSources(sources []blueprintv1alpha1.Source) error
SetSources updates the source configurations for the current blueprint. It replaces the existing sources with the provided list of sources.
func (*BaseBlueprintHandler) SetTerraformComponents ¶
func (b *BaseBlueprintHandler) SetTerraformComponents(terraformComponents []blueprintv1alpha1.TerraformComponent) error
SetTerraformComponents updates the Terraform components for the current blueprint. It replaces the existing components with the provided list of Terraform components.
func (*BaseBlueprintHandler) WriteConfig ¶
func (b *BaseBlueprintHandler) WriteConfig(path ...string) error
WriteConfig saves the current blueprint configuration to a specified file path. It determines the final path for the blueprint file, creates necessary directories, and writes the blueprint data to the file in YAML format. The function ensures that any Terraform component variables and values are excluded from the saved configuration.
type BlueprintHandler ¶
type BlueprintHandler interface { Initialize() error LoadConfig(path ...string) error WriteConfig(path ...string) error Install() error GetMetadata() blueprintv1alpha1.Metadata GetSources() []blueprintv1alpha1.Source GetTerraformComponents() []blueprintv1alpha1.TerraformComponent GetKustomizations() []blueprintv1alpha1.Kustomization SetMetadata(metadata blueprintv1alpha1.Metadata) error SetSources(sources []blueprintv1alpha1.Source) error SetTerraformComponents(terraformComponents []blueprintv1alpha1.TerraformComponent) error SetKustomizations(kustomizations []blueprintv1alpha1.Kustomization) error }
BlueprintHandler defines the interface for handling blueprint operations
type MockBlueprintHandler ¶
type MockBlueprintHandler struct { InitializeFunc func() error LoadConfigFunc func(path ...string) error GetMetadataFunc func() blueprintv1alpha1.Metadata GetSourcesFunc func() []blueprintv1alpha1.Source GetTerraformComponentsFunc func() []blueprintv1alpha1.TerraformComponent GetKustomizationsFunc func() []blueprintv1alpha1.Kustomization SetMetadataFunc func(metadata blueprintv1alpha1.Metadata) error SetSourcesFunc func(sources []blueprintv1alpha1.Source) error SetTerraformComponentsFunc func(terraformComponents []blueprintv1alpha1.TerraformComponent) error SetKustomizationsFunc func(kustomizations []blueprintv1alpha1.Kustomization) error WriteConfigFunc func(path ...string) error InstallFunc func() error }
MockBlueprintHandler is a mock implementation of the BlueprintHandler interface for testing purposes
func NewMockBlueprintHandler ¶
func NewMockBlueprintHandler(injector di.Injector) *MockBlueprintHandler
NewMockBlueprintHandler creates a new instance of MockBlueprintHandler
func (*MockBlueprintHandler) GetKustomizations ¶ added in v0.3.0
func (m *MockBlueprintHandler) GetKustomizations() []blueprintv1alpha1.Kustomization
GetKustomizations calls the mock GetKustomizationsFunc if set, otherwise returns a reasonable default slice of kustomizev1.Kustomization
func (*MockBlueprintHandler) GetMetadata ¶
func (m *MockBlueprintHandler) GetMetadata() blueprintv1alpha1.Metadata
GetMetadata calls the mock GetMetadataFunc if set, otherwise returns a reasonable default MetadataV1Alpha1
func (*MockBlueprintHandler) GetSources ¶
func (m *MockBlueprintHandler) GetSources() []blueprintv1alpha1.Source
GetSources calls the mock GetSourcesFunc if set, otherwise returns a reasonable default slice of SourceV1Alpha1
func (*MockBlueprintHandler) GetTerraformComponents ¶
func (m *MockBlueprintHandler) GetTerraformComponents() []blueprintv1alpha1.TerraformComponent
GetTerraformComponents calls the mock GetTerraformComponentsFunc if set, otherwise returns a reasonable default slice of TerraformComponentV1Alpha1
func (*MockBlueprintHandler) Initialize ¶
func (m *MockBlueprintHandler) Initialize() error
Initialize initializes the blueprint handler
func (*MockBlueprintHandler) Install ¶ added in v0.3.0
func (m *MockBlueprintHandler) Install() error
Install calls the mock InstallFunc if set, otherwise returns nil
func (*MockBlueprintHandler) LoadConfig ¶
func (m *MockBlueprintHandler) LoadConfig(path ...string) error
LoadConfig calls the mock LoadConfigFunc if set, otherwise returns nil
func (*MockBlueprintHandler) SetKustomizations ¶ added in v0.3.0
func (m *MockBlueprintHandler) SetKustomizations(kustomizations []blueprintv1alpha1.Kustomization) error
SetKustomizations calls the mock SetKustomizationsFunc if set, otherwise returns nil
func (*MockBlueprintHandler) SetMetadata ¶
func (m *MockBlueprintHandler) SetMetadata(metadata blueprintv1alpha1.Metadata) error
SetMetadata calls the mock SetMetadataFunc if set, otherwise returns nil
func (*MockBlueprintHandler) SetSources ¶
func (m *MockBlueprintHandler) SetSources(sources []blueprintv1alpha1.Source) error
SetSources calls the mock SetSourcesFunc if set, otherwise returns nil
func (*MockBlueprintHandler) SetTerraformComponents ¶
func (m *MockBlueprintHandler) SetTerraformComponents(terraformComponents []blueprintv1alpha1.TerraformComponent) error
SetTerraformComponents calls the mock SetTerraformComponentsFunc if set, otherwise returns nil
func (*MockBlueprintHandler) WriteConfig ¶
func (m *MockBlueprintHandler) WriteConfig(path ...string) error
WriteConfig calls the mock WriteConfigFunc if set, otherwise returns nil
type ResourceOperationConfig ¶ added in v0.3.0
type ResourceOperationConfig struct { ApiPath string Namespace string ResourceName string ResourceInstanceName string ResourceObject runtime.Object ResourceType func() runtime.Object }
ResourceOperationConfig is a configuration object that specifies the parameters for the resource operations.