Documentation
¶
Overview ¶
Package preflight provides utilities for performing preflight checks during upgrade operations.
Index ¶
- Constants
- func ValidateVersionJump(currentVersion, targetVersion string) (bool, string, error)
- type CheckResult
- type CheckSeverity
- type CustomConfigValidationCheck
- type HelmConnectivityCheck
- type KubernetesConnectivityCheck
- type KubernetesResourceCheck
- type PreflightCheck
- type RadiusInstallationCheck
- type Registry
- type ResourceQuota
- type VersionCompatibilityCheck
Constants ¶
const ( // DefaultChartPath is the default path to the Radius Helm chart. DefaultChartPath = "../../../deploy/Chart" // SetParamFormat is the expected format for --set parameters SetParamFormat = "key=value" // SetFileParamFormat is the expected format for --set-file parameters SetFileParamFormat = "key=filepath" )
const (
RADIUS_EDGE_CHART_VERSION = "0.42.42-dev"
)
const (
// RadiusSystemNamespace is the namespace where Radius components are installed
RadiusSystemNamespace = "radius-system"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateVersionJump ¶
ValidateVersionJump checks if a version jump is safe for upgrade. This is a utility function that can be used when resolving "latest" versions. It returns true if the jump is safe (incremental), false if it requires special handling.
Types ¶
type CheckResult ¶
type CheckResult struct {
Check PreflightCheck
Success bool
Message string
Error error
Severity CheckSeverity
}
CheckResult represents the result of running a preflight check.
type CheckSeverity ¶
type CheckSeverity string
CheckSeverity represents the severity level of a preflight check.
const ( // SeverityError indicates a check failure that must prevent the upgrade. SeverityError CheckSeverity = "Error" // SeverityWarning indicates a check failure that should be noted but may not prevent the upgrade. SeverityWarning CheckSeverity = "Warning" // SeverityInfo indicates an informational check that provides useful context. SeverityInfo CheckSeverity = "Info" )
type CustomConfigValidationCheck ¶ added in v0.49.0
type CustomConfigValidationCheck struct {
// contains filtered or unexported fields
}
CustomConfigValidationCheck validates that custom configuration parameters are accessible and properly formatted against the actual Helm chart.
This check loads the Radius chart and validates --set parameters using Helm's own validation logic to ensure they match the chart's expected structure.
func NewCustomConfigValidationCheck ¶ added in v0.49.0
func NewCustomConfigValidationCheck(setParams, setFileParams []string, chartPath string, helmClient helm.HelmClient) *CustomConfigValidationCheck
NewCustomConfigValidationCheck creates a new custom configuration validation check. If chartPath is empty, it defaults to the standard Radius chart location. If helmClient is nil, a new client will be created. The check will fall back to basic syntax validation if the chart is not found.
func (*CustomConfigValidationCheck) Name ¶ added in v0.49.0
func (c *CustomConfigValidationCheck) Name() string
Name returns the name of this check.
func (*CustomConfigValidationCheck) Run ¶ added in v0.49.0
Run executes the custom configuration validation check.
func (*CustomConfigValidationCheck) Severity ¶ added in v0.49.0
func (c *CustomConfigValidationCheck) Severity() CheckSeverity
Severity returns the severity level of this check.
type HelmConnectivityCheck ¶ added in v0.49.0
type HelmConnectivityCheck struct {
// contains filtered or unexported fields
}
HelmConnectivityCheck validates that Helm can connect to the cluster and access the Radius release for upgrade operations.
func NewHelmConnectivityCheck ¶ added in v0.49.0
func NewHelmConnectivityCheck(helmInterface helm.Interface, kubeContext string) *HelmConnectivityCheck
NewHelmConnectivityCheck creates a new Helm connectivity check.
func (*HelmConnectivityCheck) Name ¶ added in v0.49.0
func (h *HelmConnectivityCheck) Name() string
Name returns the name of this check.
func (*HelmConnectivityCheck) Severity ¶ added in v0.49.0
func (h *HelmConnectivityCheck) Severity() CheckSeverity
Severity returns the severity level of this check.
type KubernetesConnectivityCheck ¶
type KubernetesConnectivityCheck struct {
// contains filtered or unexported fields
}
KubernetesConnectivityCheck validates cluster connectivity and basic permissions.
func NewKubernetesConnectivityCheck ¶
func NewKubernetesConnectivityCheck(kubeContext string) *KubernetesConnectivityCheck
NewKubernetesConnectivityCheck creates a new check that will create its own client.
func NewKubernetesConnectivityCheckWithClientset ¶
func NewKubernetesConnectivityCheckWithClientset(kubeContext string, clientset kubernetes.Interface) *KubernetesConnectivityCheck
NewKubernetesConnectivityCheckWithClientset creates a new check with an existing client.
func (*KubernetesConnectivityCheck) Name ¶
func (k *KubernetesConnectivityCheck) Name() string
Name returns the name of this check.
func (*KubernetesConnectivityCheck) Severity ¶
func (k *KubernetesConnectivityCheck) Severity() CheckSeverity
Severity returns the severity level of this check.
type KubernetesResourceCheck ¶
type KubernetesResourceCheck struct {
// contains filtered or unexported fields
}
KubernetesResourceCheck validates cluster resource availability for upgrades.
func NewKubernetesResourceCheck ¶
func NewKubernetesResourceCheck(kubeContext string) *KubernetesResourceCheck
NewKubernetesResourceCheck creates a new check that will create its own client.
func NewKubernetesResourceCheckWithClientset ¶
func NewKubernetesResourceCheckWithClientset(kubeContext string, clientset kubernetes.Interface) *KubernetesResourceCheck
NewKubernetesResourceCheckWithClientset creates a new check with an existing client.
func (*KubernetesResourceCheck) Name ¶
func (k *KubernetesResourceCheck) Name() string
Name returns the name of this check.
func (*KubernetesResourceCheck) Severity ¶
func (k *KubernetesResourceCheck) Severity() CheckSeverity
Severity returns the severity level of this check.
type PreflightCheck ¶
type PreflightCheck interface {
// Run executes the preflight check and returns success status,
// a descriptive message, and any error encountered.
Run(ctx context.Context) (bool, string, error)
// Name returns the human-readable name of this check.
Name() string
// Severity returns the severity level of this check.
Severity() CheckSeverity
}
PreflightCheck defines the interface for all preflight checks that must be performed before an upgrade operation.
type RadiusInstallationCheck ¶
type RadiusInstallationCheck struct {
// contains filtered or unexported fields
}
RadiusInstallationCheck validates that Radius is currently installed in the cluster and in a healthy state for upgrading.
func NewRadiusInstallationCheck ¶
func NewRadiusInstallationCheck(helmInterface helm.Interface, kubeContext string) *RadiusInstallationCheck
NewRadiusInstallationCheck creates a new Radius installation check.
func (*RadiusInstallationCheck) Name ¶
func (r *RadiusInstallationCheck) Name() string
Name returns the name of this check.
func (*RadiusInstallationCheck) Severity ¶
func (r *RadiusInstallationCheck) Severity() CheckSeverity
Severity returns the severity level of this check.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages and executes a collection of preflight checks.
func NewRegistry ¶
NewRegistry creates a new preflight check registry.
func (*Registry) AddCheck ¶
func (r *Registry) AddCheck(check PreflightCheck)
AddCheck adds a preflight check to the registry.
type ResourceQuota ¶
ResourceQuota represents CPU and memory resource quantities.
type VersionCompatibilityCheck ¶
type VersionCompatibilityCheck struct {
// contains filtered or unexported fields
}
VersionCompatibilityCheck validates that the target version is a valid upgrade from the current version. It prevents downgrades and enforces incremental upgrade policies.
func NewVersionCompatibilityCheck ¶
func NewVersionCompatibilityCheck(currentVersion, targetVersion string) *VersionCompatibilityCheck
NewVersionCompatibilityCheck creates a new version compatibility check. Both currentVersion and targetVersion must be specific semantic versions (e.g., "v0.43.0"). If targetVersion is "latest", it must be resolved to a specific version before creating this check.
func (*VersionCompatibilityCheck) Name ¶
func (v *VersionCompatibilityCheck) Name() string
Name returns the name of this check.
func (*VersionCompatibilityCheck) Severity ¶
func (v *VersionCompatibilityCheck) Severity() CheckSeverity
Severity returns the severity level of this check.