spi

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModuleConfigHelmValuesWrapper added in v1.7.0

func NewModuleConfigHelmValuesWrapper(configObject interface{}) (*apiextensionsv1.JSON, error)

NewModuleConfigHelmValuesWrapper Creates a JSON snippet to pass into a Module instance as a well-known Helm value

Takes any object and marshals it into a Helm values hierarchy under "verrazzano.module.spec". This allows conversion of any configuration in the Verrazzano CR needed by a module into a form consumable by that module.

As a result only changes to the values in the passed-in structure should result in a reconile of the underlying Module instance. Eventually this wrapper can be used to divorce the Module impls from the Verrazzano CR and Effective CR.

Types

type Component

Component interface defines the methods implemented by components

type ComponentContext

type ComponentContext interface {
	// Log returns the logger for the context
	Log() vzlog.VerrazzanoLogger
	// GetClient returns the controller client for the context
	Client() clipkg.Client
	// ActualCR returns the actual unmerged v1alpha1.Verrazzano resource
	ActualCR() *v1alpha1.Verrazzano
	// EffectiveCR returns the effective merged v1alpha1.Verrazzano CR
	EffectiveCR() *v1alpha1.Verrazzano
	// ActualCRV1Beta1 returns the actual unmerged v1beta1.Verrazzano resource
	ActualCRV1Beta1() *v1beta1.Verrazzano
	// EffectiveCRV1Beta1 returns the effective merged v1beta1.Verrazzano CR
	EffectiveCRV1Beta1() *v1beta1.Verrazzano
	// IsDryRun indicates the component context is in DryRun mode
	IsDryRun() bool
	// Copy returns a copy of the current context
	Copy() ComponentContext
	// Init returns a copy of the current context with an updated logging component field
	Init(comp string) ComponentContext
	// Operation specifies the logging operation field
	Operation(op string) ComponentContext
	// GetOperation returns the operation object in the context
	GetOperation() string
	// GetComponent returns the component object in the context
	GetComponent() string
}

ComponentContext interface defines the context objects required for Component operations

func NewContext

func NewContext(log vzlog.VerrazzanoLogger, c clipkg.Client, actualCR *v1alpha1.Verrazzano, actualV1beta1CR *v1beta1.Verrazzano, dryRun bool) (ComponentContext, error)

NewContext creates a ComponentContext from a raw CR

func NewFakeContext

func NewFakeContext(c clipkg.Client, actualCR *v1alpha1.Verrazzano, actualV1beta1CR *v1beta1.Verrazzano, dryRun bool, profilesDir ...string) ComponentContext

NewFakeContext creates a fake ComponentContext for unit testing purposes c Kubernetes client actualCR The user-supplied Verrazzano CR dryRun Dry-run indicator profilesDir Optional override to the location of the profiles dir; if not provided, EffectiveCR == ActualCR

func NewMinimalContext added in v1.5.0

func NewMinimalContext(c clipkg.Client, log vzlog.VerrazzanoLogger) (ComponentContext, error)

NewMinimalContext creates a ComponentContext limited to kubernetes client interactions and logging

type ComponentInfo

type ComponentInfo interface {
	// Name returns the name of the Verrazzano component
	Name() string
	// Namespace returns the namespace of the Verrazzano component
	Namespace() string
	// ShouldInstallBeforeUpgrade returns true if component can be installed before upgrade is done, default false
	ShouldInstallBeforeUpgrade() bool
	// GetDependencies returns the dependencies of this component
	GetDependencies() []string
	// IsReady Indicates whether a component is Ready for dependency components
	IsReady(context ComponentContext) bool
	// IsAvailable Indicates whether a component is Available for end users
	IsAvailable(context ComponentContext) (string, v1alpha1.ComponentAvailability)
	// IsEnabled Indicates whether or a component is enabled for installation
	IsEnabled(effectiveCR runtime.Object) bool
	// GetMinVerrazzanoVersion returns the minimum Verrazzano version required by the component
	GetMinVerrazzanoVersion() string
	// GetIngressNames returns a list of names of the ingresses associated with the component
	GetIngressNames(context ComponentContext) []types.NamespacedName
	// GetCertificateNames returns a list of names of the TLS certificates associated with the component
	GetCertificateNames(context ComponentContext) []types.NamespacedName
	// GetJsonName returns the josn name of the verrazzano component in CRD
	GetJSONName() string
	// GetOverrides returns the list of overrides for a component
	GetOverrides(effectiveCR runtime.Object) interface{}
	// MonitorOverrides indicates whether the override sources for a component need to be monitored
	MonitorOverrides(context ComponentContext) bool
}

ComponentInfo interface defines common information and metadata about components

type ComponentInstaller

type ComponentInstaller interface {
	// IsOperatorInstallSupported Returns true if the component supports install directly via the platform operator
	// - scaffolding while we move components from the scripts to the operator
	IsOperatorInstallSupported() bool
	// IsInstalled Indicates whether or not the component is installed
	IsInstalled(context ComponentContext) (bool, error)
	// PreInstall allows components to perform any pre-processing required prior to initial install
	PreInstall(context ComponentContext) error
	// Install performs the initial install of a component
	Install(context ComponentContext) error
	// PostInstall allows components to perform any post-processing required after initial install
	PostInstall(context ComponentContext) error
}

ComponentInstaller interface defines installs operations for components that support it

type ComponentUninstaller added in v1.4.0

type ComponentUninstaller interface {
	// Exists returns true if the component exists in the cluster (may not be fully installed/available) and may be uninstalled
	Exists(context ComponentContext) (bool, error)
	// IsOperatorUninstallSupported Returns true if the component supports uninstall directly via the platform operator
	// - scaffolding while we move components from the scripts to the operator
	IsOperatorUninstallSupported() bool
	// PreUninstall allows components to perform any pre-processing required prior to upgrading
	PreUninstall(context ComponentContext) error
	// Uninstall will Uninstall the Verrazzano component specified in the CR.Version field
	Uninstall(context ComponentContext) error
	// PostUninstall allows components to perform any post-processing required after upgrading
	PostUninstall(context ComponentContext) error
}

ComponentUninstaller interface defines uninstall operations

type ComponentUpgrader

type ComponentUpgrader interface {
	// PreUpgrade allows components to perform any pre-processing required prior to upgrading
	PreUpgrade(context ComponentContext) error
	// Upgrade will upgrade the Verrazzano component specified in the CR.Version field
	Upgrade(context ComponentContext) error
	// PostUpgrade allows components to perform any post-processing required after upgrading
	PostUpgrade(context ComponentContext) error
}

ComponentUpgrader interface defines upgrade operations for components that support it

type ComponentValidator added in v1.3.0

type ComponentValidator interface {
	// ValidateInstall checks if the specified Verrazzano CR is valid for this component to be installed
	ValidateInstall(vz *v1alpha1.Verrazzano) error
	// ValidateUpdate checks if the specified new Verrazzano CR is valid for this component to be updated
	ValidateUpdate(old *v1alpha1.Verrazzano, new *v1alpha1.Verrazzano) error
	// ValidateInstallV1Beta1 checks if the specified Verrazzano CR is valid for this component to be installed
	ValidateInstallV1Beta1(vz *v1beta1.Verrazzano) error
	// ValidateUpdateV1Beta1 checks if the specified new Verrazzano CR is valid for this component to be updated
	ValidateUpdateV1Beta1(old *v1beta1.Verrazzano, new *v1beta1.Verrazzano) error
}

ComponentValidator interface defines validation operations for components that support it

type ModuleIntegration added in v1.7.0

type ModuleIntegration interface {
	// ShouldUseModule returns true if component is implemented using a Module, default false
	ShouldUseModule() bool
	// GetWatchDescriptors returns the list of WatchDescriptor for objects being watched by the component
	GetWatchDescriptors() []controllerspi.WatchDescriptor
	// GetModuleConfigAsHelmValues returns an unstructured JSON snippet representing the portion of the Verrazzano CR that corresponds to the module
	GetModuleConfigAsHelmValues(effectiveCR *v1alpha1.Verrazzano) (*apiextensionsv1.JSON, error)
}

ModuleIntegration interface defines methods needed to integreate VPO with modules

type ModuleValuesSection added in v1.7.0

type ModuleValuesSection struct {
	Spec interface{} `json:"spec,omitempty"`
}

type VerrazzanoValues added in v1.7.0

type VerrazzanoValues struct {
	Module ModuleValuesSection `json:"module,omitempty"`
}

type VerrazzanoValuesConfig added in v1.7.0

type VerrazzanoValuesConfig struct {
	Verrazzano VerrazzanoValues `json:"verrazzano"`
}

Jump to

Keyboard shortcuts

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