Documentation ¶
Index ¶
- Constants
- func GenerateOwnedByLabelValue(namespace, name string) string
- func GetMockAgentClusterInstallTemplate() string
- func GetMockBasicClusterTemplate(kind string) string
- func GetMockBasicNodeTemplate(kind string) string
- func GetMockBmcSecret(name, namespace string) *corev1.Secret
- func GetMockClusterImageSet(name string) *hivev1.ClusterImageSet
- func GetMockClusterTemplate(name, namespace string) *corev1.ConfigMap
- func GetMockExtraManifest(name, namespace string) *corev1.ConfigMap
- func GetMockImageClusterInstallTemplate() string
- func GetMockNMStateConfigTemplate() string
- func GetMockNodeTemplate(name, namespace string) *corev1.ConfigMap
- func GetMockPullSecret(name, namespace string) *corev1.Secret
- func GetMockSNOClusterInstance(testParams *TestParams) *v1alpha1.ClusterInstance
- func GetNameFromOwnedByLabel(ownedByLabel string) string
- func GetNamespacedNameFromOwnedByLabel(ownedByLabel string) (types.NamespacedName, error)
- func GetOwner(obj client.Object) string
- func GetResourceId(name, namespace, kind string) string
- func IndexOfObjectByIdentity(target *RenderedObject, objects []RenderedObject) (int, error)
- func SetupTestResources(ctx context.Context, c client.Client, testParams *TestParams)
- func TeardownTestResources(ctx context.Context, c client.Client, testParams *TestParams)
- func Validate(ctx context.Context, c client.Client, ...) error
- func VerifyOwnership(obj client.Object, ownerRefLabel string) error
- type ClusterData
- type NetConfigData
- type RenderedObject
- func (r *RenderedObject) GetAPIVersion() string
- func (r *RenderedObject) GetAnnotations() map[string]string
- func (r *RenderedObject) GetGroupVersionKind() schema.GroupVersionKind
- func (r *RenderedObject) GetKind() string
- func (r *RenderedObject) GetLabels() map[string]string
- func (r *RenderedObject) GetName() string
- func (r *RenderedObject) GetNamespace() string
- func (r *RenderedObject) GetObject() unstructured.Unstructured
- func (r *RenderedObject) GetResourceId() string
- func (r *RenderedObject) GetSyncWave() (int, error)
- func (r *RenderedObject) ManifestReference() *v1alpha1.ManifestReference
- func (r *RenderedObject) MatchesIdentity(other *RenderedObject) bool
- func (r *RenderedObject) SetObject(manifest map[string]interface{}) error
- type RenderedObjectCollection
- func (r *RenderedObjectCollection) AddObject(object RenderedObject) error
- func (r *RenderedObjectCollection) AddObjects(objects []RenderedObject) error
- func (r *RenderedObjectCollection) GetPruneObjects() []RenderedObject
- func (r *RenderedObjectCollection) GetRenderObjects() []RenderedObject
- func (r *RenderedObjectCollection) GetSuppressObjects() []RenderedObject
- type SpecialVars
- type SyncWaveMap
- type TemplateEngine
- type TestParams
- func (tp *TestParams) GenerateBMCSecret() *corev1.Secret
- func (tp *TestParams) GenerateClusterImageSet() *hivev1.ClusterImageSet
- func (tp *TestParams) GenerateClusterTemplate() *corev1.ConfigMap
- func (tp *TestParams) GenerateExtraManifest() *corev1.ConfigMap
- func (tp *TestParams) GenerateNodeTemplate() *corev1.ConfigMap
- func (tp *TestParams) GeneratePullSecret() *corev1.Secret
- func (tp *TestParams) GenerateSNOClusterInstance() *v1alpha1.ClusterInstance
- func (tp *TestParams) GetResources() map[string]string
Constants ¶
const ( AnnotationsKey = "annotations" LabelsKey = "labels" )
const ( WaveAnnotation = v1alpha1.Group + "/sync-wave" DefaultWaveAnnotation = "0" )
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 ¶
GenerateOwnedByLabelValue generates a consistent value for the "owned-by" label using the namespace and name of a ClusterInstance.
func GetMockAgentClusterInstallTemplate ¶
func GetMockAgentClusterInstallTemplate() string
func GetMockBmcSecret ¶
func GetMockClusterImageSet ¶
func GetMockClusterImageSet(name string) *hivev1.ClusterImageSet
func GetMockClusterTemplate ¶
func GetMockExtraManifest ¶
func GetMockImageClusterInstallTemplate ¶
func GetMockImageClusterInstallTemplate() string
func GetMockNMStateConfigTemplate ¶
func GetMockNMStateConfigTemplate() string
func GetMockNodeTemplate ¶
func GetMockPullSecret ¶
func GetMockSNOClusterInstance ¶
func GetMockSNOClusterInstance(testParams *TestParams) *v1alpha1.ClusterInstance
func GetNameFromOwnedByLabel ¶
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 ¶
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 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)
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 ¶
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 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