clusterinstance

package
v0.0.0-...-77f3d0c Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationsKey = "annotations"
	LabelsKey      = "labels"
)
View Source
const (
	WaveAnnotation        = v1alpha1.Group + "/sync-wave"
	DefaultWaveAnnotation = "0"
)
View Source
const OwnedByLabel = v1alpha1.Group + "/owned-by"

OwnedByLabel is the key for the "owned-by" label, used to identify the owner of a resource.

Variables

This section is empty.

Functions

func GenerateOwnedByLabelValue

func GenerateOwnedByLabelValue(namespace, name string) string

GenerateOwnedByLabelValue generates a consistent value for the "owned-by" label using the namespace and name of a ClusterInstance.

func GetMockAgentClusterInstallTemplate

func GetMockAgentClusterInstallTemplate() string

func GetMockBasicClusterTemplate

func GetMockBasicClusterTemplate(kind string) string

func GetMockBasicNodeTemplate

func GetMockBasicNodeTemplate(kind string) string

func GetMockBmcSecret

func GetMockBmcSecret(name, namespace string) *corev1.Secret

func GetMockClusterImageSet

func GetMockClusterImageSet(name string) *hivev1.ClusterImageSet

func GetMockClusterTemplate

func GetMockClusterTemplate(name, namespace string) *corev1.ConfigMap

func GetMockExtraManifest

func GetMockExtraManifest(name, namespace string) *corev1.ConfigMap

func GetMockImageClusterInstallTemplate

func GetMockImageClusterInstallTemplate() string

func GetMockNMStateConfigTemplate

func GetMockNMStateConfigTemplate() string

func GetMockNodeTemplate

func GetMockNodeTemplate(name, namespace string) *corev1.ConfigMap

func GetMockPullSecret

func GetMockPullSecret(name, namespace string) *corev1.Secret

func GetMockSNOClusterInstance

func GetMockSNOClusterInstance(testParams *TestParams) *v1alpha1.ClusterInstance

func GetNameFromOwnedByLabel

func GetNameFromOwnedByLabel(ownedByLabel string) string

GetNameFromOwnedByLabel extracts only the name portion from the "owned-by" label value.

func GetNamespacedNameFromOwnedByLabel

func GetNamespacedNameFromOwnedByLabel(ownedByLabel string) (types.NamespacedName, error)

GetNamespacedNameFromOwnedByLabel parses the value of the "owned-by" label to extract the namespace and name of the owning resource.

func GetOwner

func GetOwner(obj client.Object) string

GetOwner retrieves the value of the "owned-by" label from an object. If the label is not present, it returns an empty string.

func GetResourceId

func GetResourceId(name, namespace, kind string) string

func IndexOfObjectByIdentity

func IndexOfObjectByIdentity(target *RenderedObject, objects []RenderedObject) (int, error)

IndexOfObjectByIdentity searches for a RenderedObject in the given RenderedObject slice based on identity fields and returns its index. It returns -1 and a not found error if the target is not found.

func SetupTestResources

func SetupTestResources(ctx context.Context, c client.Client, testParams *TestParams)

func TeardownTestResources

func TeardownTestResources(ctx context.Context, c client.Client, testParams *TestParams)

func Validate

func Validate(ctx context.Context, c client.Client, clusterInstance *v1alpha1.ClusterInstance) error

Validate checks the given ClusterInstance, returns an error if validation fails, returns nil if it succeeds

func VerifyOwnership

func VerifyOwnership(obj client.Object, ownerRefLabel string) error

VerifyOwnership checks if an object is logically owned by a specified owner reference label.

Types

type ClusterData

type ClusterData struct {
	Spec        v1alpha1.ClusterInstanceSpec
	SpecialVars SpecialVars
}

ClusterData is a special object that provides an interface to the ClusterInstance spec fields for use in rendering templates

type NetConfigData

type NetConfigData struct {
	Interfaces []*aiv1beta1.Interface
	Config     map[string]interface{}
}

func GetMockNetConfig

func GetMockNetConfig() *NetConfigData

func (*NetConfigData) GetInterfaces

func (nc *NetConfigData) GetInterfaces() []interface{}

func (*NetConfigData) RawNetConfig

func (nc *NetConfigData) RawNetConfig() string

type RenderedObject

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

func (*RenderedObject) GetAPIVersion

func (r *RenderedObject) GetAPIVersion() string

func (*RenderedObject) GetAnnotations

func (r *RenderedObject) GetAnnotations() map[string]string

func (*RenderedObject) GetGroupVersionKind

func (r *RenderedObject) GetGroupVersionKind() schema.GroupVersionKind

func (*RenderedObject) GetKind

func (r *RenderedObject) GetKind() string

func (*RenderedObject) GetLabels

func (r *RenderedObject) GetLabels() map[string]string

func (*RenderedObject) GetName

func (r *RenderedObject) GetName() string

func (*RenderedObject) GetNamespace

func (r *RenderedObject) GetNamespace() string

func (*RenderedObject) GetObject

func (r *RenderedObject) GetObject() unstructured.Unstructured

func (*RenderedObject) GetResourceId

func (r *RenderedObject) GetResourceId() string

func (*RenderedObject) GetSyncWave

func (r *RenderedObject) GetSyncWave() (int, error)

func (*RenderedObject) ManifestReference

func (r *RenderedObject) ManifestReference() *v1alpha1.ManifestReference

func (*RenderedObject) MatchesIdentity

func (r *RenderedObject) MatchesIdentity(other *RenderedObject) bool

MatchesIdentity checks if two RenderedObjects are equal based on identifying fields. These fields are APIGroup, Kind, Name, and Namespace.

func (*RenderedObject) SetObject

func (r *RenderedObject) SetObject(manifest map[string]interface{}) error

type RenderedObjectCollection

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

func (*RenderedObjectCollection) AddObject

func (r *RenderedObjectCollection) AddObject(object RenderedObject) error

func (*RenderedObjectCollection) AddObjects

func (r *RenderedObjectCollection) AddObjects(objects []RenderedObject) error

func (*RenderedObjectCollection) GetPruneObjects

func (r *RenderedObjectCollection) GetPruneObjects() []RenderedObject

func (*RenderedObjectCollection) GetRenderObjects

func (r *RenderedObjectCollection) GetRenderObjects() []RenderedObject

func (*RenderedObjectCollection) GetSuppressObjects

func (r *RenderedObjectCollection) GetSuppressObjects() []RenderedObject

type SpecialVars

type SpecialVars struct {
	CurrentNode                      v1alpha1.NodeSpec
	InstallConfigOverrides           string
	ControlPlaneAgents, WorkerAgents int
}

type SyncWaveMap

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

func (*SyncWaveMap) Add

func (s *SyncWaveMap) Add(obj RenderedObject) error

func (*SyncWaveMap) AddObjects

func (s *SyncWaveMap) AddObjects(objects []RenderedObject) error

func (*SyncWaveMap) GetAscendingSyncWaves

func (s *SyncWaveMap) GetAscendingSyncWaves() []int

func (*SyncWaveMap) GetDescendingSyncWaves

func (s *SyncWaveMap) GetDescendingSyncWaves() []int

func (*SyncWaveMap) GetObjectsForSyncWave

func (s *SyncWaveMap) GetObjectsForSyncWave(syncWave int) []RenderedObject

type TemplateEngine

type TemplateEngine struct{}

func NewTemplateEngine

func NewTemplateEngine() *TemplateEngine

func (*TemplateEngine) ProcessTemplates

func (te *TemplateEngine) ProcessTemplates(
	ctx context.Context,
	c client.Client,
	log *zap.Logger,
	clusterInstance v1alpha1.ClusterInstance,
) (RenderedObjectCollection, error)

type TestParams

type TestParams struct {
	ClusterName         string
	ClusterNamespace    string
	PullSecret          string
	BmcCredentialsName  string
	ClusterImageSetName string
	ExtraManifestName   string
	ClusterTemplateRef  string
	NodeTemplateRef     string
}

func (*TestParams) GenerateBMCSecret

func (tp *TestParams) GenerateBMCSecret() *corev1.Secret

func (*TestParams) GenerateClusterImageSet

func (tp *TestParams) GenerateClusterImageSet() *hivev1.ClusterImageSet

func (*TestParams) GenerateClusterTemplate

func (tp *TestParams) GenerateClusterTemplate() *corev1.ConfigMap

func (*TestParams) GenerateExtraManifest

func (tp *TestParams) GenerateExtraManifest() *corev1.ConfigMap

func (*TestParams) GenerateNodeTemplate

func (tp *TestParams) GenerateNodeTemplate() *corev1.ConfigMap

func (*TestParams) GeneratePullSecret

func (tp *TestParams) GeneratePullSecret() *corev1.Secret

func (*TestParams) GenerateSNOClusterInstance

func (tp *TestParams) GenerateSNOClusterInstance() *v1alpha1.ClusterInstance

func (*TestParams) GetResources

func (tp *TestParams) GetResources() map[string]string

Jump to

Keyboard shortcuts

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