version

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(ctx context.Context, c client.Reader) (*semver.Version, error)

Detect performs priority-based version detection from multiple sources Priority order: DataScienceCluster > DSCInitialization > OLM Returns parsed semver.TargetVersion or error if version cannot be determined from any source.

func DetectFromDSCInitialization

func DetectFromDSCInitialization(ctx context.Context, c client.Reader) (string, bool, error)

DetectFromDSCInitialization attempts to detect version from DSCInitialization resource Returns version string and true if found, empty string and false otherwise.

func DetectFromDataScienceCluster

func DetectFromDataScienceCluster(ctx context.Context, c client.Reader) (string, bool, error)

DetectFromDataScienceCluster attempts to detect version from DataScienceCluster resource Returns version string and true if found, empty string and false otherwise.

func DetectFromOLM

func DetectFromOLM(ctx context.Context, c client.Reader) (string, bool, error)

DetectFromOLM attempts to detect version from OLM ClusterServiceVersion Returns version string and true if found, empty string and false otherwise.

func DetectOpenShiftVersion added in v0.0.11

func DetectOpenShiftVersion(
	ctx context.Context,
	k8sClient client.Reader,
) (*semver.Version, error)

DetectOpenShiftVersion queries the OpenShift ClusterVersion resource to determine the cluster version.

func IsUpgradeFrom2xTo3x added in v0.0.9

func IsUpgradeFrom2xTo3x(from *semver.Version, to *semver.Version) bool

IsUpgradeFrom2xTo3x checks if the versions represent an upgrade from 2.x to 3.x specifically. Future major versions (4.x+) may have different compatibility requirements. Returns false if either version is nil.

func IsVersionAtLeast added in v0.0.9

func IsVersionAtLeast(
	version *semver.Version,
	major uint64,
	minor uint64,
) bool

IsVersionAtLeast checks if the given version is at least the specified major.minor version. Patch version is ignored in the comparison. Returns false if version is nil.

func VersionToBranch

func VersionToBranch(version string) (string, error)

VersionToBranch maps a version string to the corresponding Git branch TargetVersion format: X.Y.Z Branch mapping:

  • 2.x.x → stable-2.x
  • 3.x.x → main
  • Unknown → ""

Types

type ClusterVersion

type ClusterVersion struct {
	// Version is the semver version string (e.g., "2.17.0")
	Version string

	// Source indicates where the version was detected from
	Source VersionSource

	// Confidence indicates the reliability of the detection
	Confidence VersionConfidence

	// Branch is the corresponding Git branch for this version (e.g., "stable-2.17")
	Branch string
}

ClusterVersion represents detected OpenShift AI cluster version.

func (*ClusterVersion) String

func (v *ClusterVersion) String() string

String returns a human-readable representation of the cluster version.

type VersionConfidence

type VersionConfidence string

VersionConfidence indicates the reliability of the version detection.

const (
	ConfidenceHigh   VersionConfidence = "High"   // From DataScienceCluster or DSCInitialization
	ConfidenceMedium VersionConfidence = "Medium" // From OLM ClusterServiceVersion
	ConfidenceLow    VersionConfidence = "Low"    // Fallback or uncertain
)

func (VersionConfidence) String

func (c VersionConfidence) String() string

String returns the string representation of the confidence level.

type VersionSource

type VersionSource string

VersionSource indicates where the version information was obtained.

const (
	SourceDataScienceCluster VersionSource = "DataScienceCluster"
	SourceDSCInitialization  VersionSource = "DSCInitialization"
	SourceOLM                VersionSource = "OLM"
	SourceManual             VersionSource = "Manual" // User-specified target version
	SourceUnknown            VersionSource = "Unknown"
)

func (VersionSource) String

func (s VersionSource) String() string

String returns the string representation of the version source.

Jump to

Keyboard shortcuts

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