utils

package
v0.0.0-...-caabeff Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

This package is for low-level utility functions used by both controllers and CloudClient interface implementations.

This package is for low-level utility functions used by both controllers and CloudClient interface implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFromRawExtension

func ConvertFromRawExtension[T any](extension *runtime.RawExtension) (*T, error)

func ConvertToRawBytes

func ConvertToRawBytes(t interface{}) ([]byte, error)

func DeleteCPMS

func DeleteCPMS(ctx context.Context, kclient client.Client, cpms *machinev1.ControlPlaneMachineSet) error

DeleteCPMS will remove the CPMS of the cluster - in OSD this will trigger the CPMS to be recreated in an inactive state.

func GetClusterBaseDomain

func GetClusterBaseDomain(kclient client.Client) (string, error)

GetClusterBaseDomain returns the installed clsuter's base domain name

func GetClusterName

func GetClusterName(kclient client.Client) (string, error)

GetClusterName returns the installed cluster's name (max 27 characters)

func GetClusterVersionObject

func GetClusterVersionObject(kclient client.Client) (*configv1.ClusterVersion, error)

GetClusterVersionObject returns the canonical ClusterVersion object To check current version: `output.Status.History[0].Version`

`history contains a list of the most recent versions applied to the cluster. This value may be empty during cluster startup, and then will be updated when a new update is being applied. The newest update is first in the list and it is ordered by recency`

Note: This can be queried inside the controllers, caching doesn't apply if the scope is global rather than namespaced.

func GetControlPlaneMachineSet

func GetControlPlaneMachineSet(kclient client.Client) (*machinev1.ControlPlaneMachineSet, error)

GetControlPlaneMachineSet returns an OSD cluster's CPMS.

func GetInfrastructureObject

func GetInfrastructureObject(kclient client.Client) (*configv1.Infrastructure, error)

GetInfrastructureObject returns the canonical Infrastructure object

func GetMasterMachines

func GetMasterMachines(kclient client.Client) (*machineapi.MachineList, error)

GetMasterMachines returns a MachineList object whose .Items can be iterated over to perform actions on/with information from each master machine object.

func GetPlatformType

func GetPlatformType(kclient client.Client) (*configv1.PlatformType, error)

GetPlatformType returns the cloud platform type for the cluster

func IsVersionHigherThan

func IsVersionHigherThan(input string) bool

IsVersionHigherThan checks whether the given version is higher than the cluster version input is required to be a version such as: 4.10 or 4.10.1 Returns false(no action) if there's an exception.

func SetCPMSActive

func SetCPMSActive(ctx context.Context, kclient client.Client, cpms *machinev1.ControlPlaneMachineSet) error

SetCPMSActive will set a CPMS back to active. This is required after calling DeleteCPMS, as it will recreate the CPMS in an inactive state.

func SetClusterVersion

func SetClusterVersion(kclient client.Client) error

SetClusterVersion sets the cluster version globally(to ENV as CLUSTER_VERSION)

Types

This section is empty.

Jump to

Keyboard shortcuts

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