deployer

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCentralWaitTimeout        = 20 * time.Minute
	DefaultSecuredClusterWaitTimeout = 20 * time.Minute

	// AdminUsername is the default admin username for StackRox Central
	AdminUsername = "admin"
)
View Source
var (
	ErrLocalImagesUnsupported          = errors.New("cluster does not support deploying with local images")
	ErrLocalImageRetrievalNotSupported = errors.New("image pre-loader does not support retrieval of images available on the cluster")
)

Functions

func KonfluxOperatorImage added in v0.4.3

func KonfluxOperatorImage(config *Config) string

KonfluxOperatorImage returns the Konflux-built operator image reference.

func OperatorBundleImage added in v0.4.2

func OperatorBundleImage(config Config) string

func ParseFeatureFlags

func ParseFeatureFlags(flags []string) (map[string]bool, error)

ParseFeatureFlags parses a slice of feature flag strings and returns a map of flag names to boolean values. Supports formats: +ROX_FOO (enable), -ROX_FOO (disable), ROX_FOO=true, ROX_FOO=false, ROX_FOO (enable)

func ParseOperatorEnvVar added in v0.4.2

func ParseOperatorEnvVar(envExpr string) (string, string, error)

ParseOperatorEnvVar parses a single KEY=VALUE environment variable string. Values may contain '=' characters (only the first '=' is used as the separator).

func PopulateKonfluxEnvVars added in v0.4.3

func PopulateKonfluxEnvVars(config *Config)

PopulateKonfluxEnvVars populates config.Operator.EnvVars with RELATED_IMAGE_* entries for Konflux image rewriting. Explicitly-provided env vars (e.g. from --operator-env) take precedence and are not overwritten.

Types

type CentralConfig

type CentralConfig struct {
	Namespace           string                 `yaml:"namespace,omitempty"`
	ResourceProfile     types.ResourceProfile  `yaml:"resourceProfile,omitempty"`
	PauseReconciliation *bool                  `yaml:"pauseReconciliation,omitempty"`
	Exposure            *types.Exposure        `yaml:"exposure,omitempty"`
	DeployTimeout       time.Duration          `yaml:"deployTimeout,omitempty"`
	PortForwarding      *bool                  `yaml:"portForwarding,omitempty"`
	EarlyReadiness      *bool                  `yaml:"earlyReadiness,omitempty"`
	Spec                map[string]interface{} `yaml:"spec,omitempty"`
}

CentralConfig holds deployment settings for the Central component.

func DefaultCentralConfig

func DefaultCentralConfig() CentralConfig

DefaultCentralConfig returns a CentralConfig with sensible defaults.

func NewCentralConfig added in v0.4.2

func NewCentralConfig() CentralConfig

NewCentralConfig returns an emptry CentralConfig, with deep initialization of data structures.

func (*CentralConfig) ConfigureSpec

func (c *CentralConfig) ConfigureSpec(roxieConfig *RoxieConfig) error

ConfigureSpec applies feature flags and exposure settings to the Central spec.

func (*CentralConfig) CustomResource

func (c *CentralConfig) CustomResource() (map[string]interface{}, error)

CustomResource builds an unstructured Central custom resource from this config.

func (*CentralConfig) EarlyReadinessEnabled added in v0.4.1

func (c *CentralConfig) EarlyReadinessEnabled() bool

func (*CentralConfig) EarlyReadinessSet added in v0.4.2

func (c *CentralConfig) EarlyReadinessSet() bool

func (*CentralConfig) ExposureEnabled

func (c *CentralConfig) ExposureEnabled() bool

func (*CentralConfig) ExposureSet

func (c *CentralConfig) ExposureSet() bool

func (*CentralConfig) GetExposure

func (c *CentralConfig) GetExposure() types.Exposure

func (*CentralConfig) GetWaitConfig

func (c *CentralConfig) GetWaitConfig() WaitConfig

func (*CentralConfig) PauseReconciliationEnabled added in v0.4.2

func (c *CentralConfig) PauseReconciliationEnabled() bool

func (*CentralConfig) PauseReconciliationSet added in v0.4.2

func (c *CentralConfig) PauseReconciliationSet() bool

func (*CentralConfig) PortForwardingEnabled

func (c *CentralConfig) PortForwardingEnabled() bool

func (*CentralConfig) PortForwardingSet

func (c *CentralConfig) PortForwardingSet() bool

type Config

type Config struct {
	Roxie          RoxieConfig          `yaml:"roxie,omitempty"`
	Operator       OperatorConfig       `yaml:"operator,omitempty"`
	Central        CentralConfig        `yaml:"central,omitempty"`
	SecuredCluster SecuredClusterConfig `yaml:"securedCluster,omitempty"`
}

Config is the top-level deployment configuration, combining settings for roxie itself, the operator, Central, and SecuredCluster.

func DefaultConfig added in v0.4.2

func DefaultConfig() Config

DefaultConfig returns a Config populated with default values.

func NewConfig

func NewConfig() Config

NewConfig returns a Config populated with default values.

func (*Config) DeepCopy

func (c *Config) DeepCopy() (*Config, error)

DeepCopy creates a deep-copy of the provided config using a YAML marshaling/unmarshaling roundtrip. Due the `omitempty`, this causes empty values (e.g. empty maps) from being discarded (replace with nil in the resulting copy).

type Deployer

type Deployer struct {
	// contains filtered or unexported fields
}

Deployer is the base deployer for ACS

func New

func New(log *logger.Logger) (*Deployer, error)

New creates a new Deployer instance. It verifies that the current environment contains necessary tools. It creates a temporary directory for the deployer to use during deployment, and it is the caller's responsibility to clean it up using the Cleanup() method when not used anymore.

func (*Deployer) Cleanup

func (d *Deployer) Cleanup()

Cleanup cleans up any temporary resources created by the deployer, such as temporary files.

func (*Deployer) Deploy

func (d *Deployer) Deploy(ctx context.Context, components component.Component) error

Deploy deploys the specified components to the cluster.

func (*Deployer) GetCentralDeploymentInfo

func (d *Deployer) GetCentralDeploymentInfo() types.CentralDeploymentInfo

func (*Deployer) GetContainerRuntimeSocket added in v0.4.2

func (d *Deployer) GetContainerRuntimeSocket() string

func (*Deployer) GetKubeContext added in v0.4.2

func (d *Deployer) GetKubeContext() string

func (*Deployer) GetPreLoaderForCluster added in v0.4.2

func (d *Deployer) GetPreLoaderForCluster() (ImagePreLoader, error)

GetPreLoaderForCluster returns an ImagePreLoader suited for the detected cluster type, or ErrLocalImagesUnsupported if the cluster does not support it.

func (*Deployer) PrintCentralDeploymentSummary

func (d *Deployer) PrintCentralDeploymentSummary()

func (*Deployer) PrintSecuredClusterDeploymentSummary

func (d *Deployer) PrintSecuredClusterDeploymentSummary()

TODO(#91): plenty of code in common with the central variant that should probably be extracted

func (*Deployer) SetConfig

func (d *Deployer) SetConfig(config Config)

func (*Deployer) SetEnvrcFile

func (d *Deployer) SetEnvrcFile(path string)

func (*Deployer) SetVerbose

func (d *Deployer) SetVerbose(verbose bool)

func (*Deployer) Teardown

func (d *Deployer) Teardown(ctx context.Context, components component.Component) error

func (*Deployer) TryTransferLocalImages added in v0.4.2

func (d *Deployer) TryTransferLocalImages(ctx context.Context, preLoader ImagePreLoader) error

TryTransferLocalImages sends locally available ACS images to the cluster via the given pre-loader, skipping images already present in the cluster.

func (*Deployer) WaitForCentral

func (d *Deployer) WaitForCentral(timeout time.Duration) bool

WaitForCentral waits for Central to be ready and responding on its endpoint Returns true if Central is ready, false if timeout occurs

type HAProxyConfig added in v0.4.4

type HAProxyConfig struct {
	Disabled *bool `yaml:"disabled"`
	BindPort int   `yaml:"bindPort"`
}

func (*HAProxyConfig) Enabled added in v0.4.4

func (c *HAProxyConfig) Enabled() bool

type ImagePreLoader added in v0.4.2

type ImagePreLoader interface {
	SendImage(ctx context.Context, imageTag string) error
	GetImages(ctx context.Context) ([]string, error)
	Name() string
}

ImagePreLoader transfers container images into a local cluster's image store.

func NewCustomImagePreloader added in v0.4.2

func NewCustomImagePreloader(_ context.Context, log *logger.Logger, command string) ImagePreLoader

type OperatorConfig

type OperatorConfig struct {
	SkipDeployment *bool             `yaml:"skipDeployment,omitempty"`
	DeployViaOlm   *bool             `yaml:"deployViaOlm,omitempty"`
	Version        string            `yaml:"version,omitempty"`
	EnvVars        map[string]string `yaml:"envVars,omitempty"`
}

OperatorConfig controls how the ACS operator is deployed.

func (*OperatorConfig) Configure

func (c *OperatorConfig) Configure(roxieConfig *RoxieConfig) error

Configure derives the operator version from the roxie configuration.

func (*OperatorConfig) DeployViaOlmEnabled added in v0.4.2

func (c *OperatorConfig) DeployViaOlmEnabled() bool

func (*OperatorConfig) DeployViaOlmSet added in v0.4.2

func (c *OperatorConfig) DeployViaOlmSet() bool

func (*OperatorConfig) SkipDeploymentEnabled added in v0.4.2

func (c *OperatorConfig) SkipDeploymentEnabled() bool

func (*OperatorConfig) SkipDeploymentSet added in v0.4.2

func (c *OperatorConfig) SkipDeploymentSet() bool

type OperatorDeploymentMode

type OperatorDeploymentMode bool

OperatorDeploymentMode represents how the operator is deployed

const (
	OperatorModeNonOLM OperatorDeploymentMode = false
	OperatorModeOLM    OperatorDeploymentMode = true
)

type ResourceToDelete

type ResourceToDelete struct {
	Kind      string
	Name      string
	OwnerName string
}

type RoxieConfig

type RoxieConfig struct {
	Version       string            `yaml:"version,omitempty"`
	KonfluxImages *bool             `yaml:"konfluxImages,omitempty"`
	FeatureFlags  map[string]bool   `yaml:"featureFlags,omitempty"`
	ClusterType   types.ClusterType `yaml:"clusterType,omitempty"`
	HAProxy       HAProxyConfig     `yaml:"haProxy,omitempty"`
}

RoxieConfig holds roxie-level settings such as version and feature flags.

func DefaultRoxieConfig added in v0.4.4

func DefaultRoxieConfig() RoxieConfig

func NewRoxieConfig

func NewRoxieConfig() RoxieConfig

NewRoxieConfig returns a RoxieConfig with initialized defaults.

func (*RoxieConfig) KonfluxImagesEnabled added in v0.4.2

func (c *RoxieConfig) KonfluxImagesEnabled() bool

func (*RoxieConfig) KonfluxImagesSet added in v0.4.2

func (c *RoxieConfig) KonfluxImagesSet() bool

type SecuredClusterConfig

type SecuredClusterConfig struct {
	Namespace           string                 `yaml:"namespace,omitempty"`
	ResourceProfile     types.ResourceProfile  `yaml:"resourceProfile,omitempty"`
	PauseReconciliation *bool                  `yaml:"pauseReconciliation,omitempty"`
	DeployTimeout       time.Duration          `yaml:"deployTimeout,omitempty"`
	EarlyReadiness      *bool                  `yaml:"earlyReadiness,omitempty"`
	Spec                map[string]interface{} `yaml:"spec,omitempty"`
}

SecuredClusterConfig holds deployment settings for the SecuredCluster component.

func DefaultSecuredClusterConfig

func DefaultSecuredClusterConfig() SecuredClusterConfig

DefaultSecuredClusterConfig returns a SecuredClusterConfig with sensible defaults.

func NewSecuredClusterConfig added in v0.4.2

func NewSecuredClusterConfig() SecuredClusterConfig

NewSecuredClusterConfig returns an emptry SecuredClusterConfig, with deep initialization of data structures.

func (*SecuredClusterConfig) ConfigureSpec

func (s *SecuredClusterConfig) ConfigureSpec(roxieConfig *RoxieConfig, centralConfig *CentralConfig) error

ConfigureSpec applies feature flags and the central endpoint to the SecuredCluster spec.

func (*SecuredClusterConfig) CustomResource

func (s *SecuredClusterConfig) CustomResource() (map[string]interface{}, error)

CustomResource builds an unstructured SecuredCluster custom resource from this config.

func (*SecuredClusterConfig) EarlyReadinessEnabled added in v0.4.1

func (s *SecuredClusterConfig) EarlyReadinessEnabled() bool

func (*SecuredClusterConfig) EarlyReadinessSet added in v0.4.2

func (s *SecuredClusterConfig) EarlyReadinessSet() bool

func (*SecuredClusterConfig) GetWaitConfig

func (s *SecuredClusterConfig) GetWaitConfig() WaitConfig

func (*SecuredClusterConfig) PauseReconciliationEnabled added in v0.4.2

func (s *SecuredClusterConfig) PauseReconciliationEnabled() bool

func (*SecuredClusterConfig) PauseReconciliationSet added in v0.4.2

func (s *SecuredClusterConfig) PauseReconciliationSet() bool

type WaitConfig

type WaitConfig struct {
	Namespace      string
	EarlyReadiness bool
	WaitFor        string
	Timeout        time.Duration
}

WaitConfig describes how to wait for a component to become ready.

Jump to

Keyboard shortcuts

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