navigation

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: UPL-1.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIVersionAndKindToContainedGVK

func APIVersionAndKindToContainedGVK(apiVersion string, kind string) *schema.GroupVersionKind

APIVersionAndKindToContainedGVK returns the GroupVersionKind of the contained resource for the given wrapper resource API version and kind.

func ComponentFromWorkloadLabels

func ComponentFromWorkloadLabels(ctx context.Context, cli client.Reader, namespace string, labels map[string]string) (*oamv1.ApplicationConfigurationComponent, error)

ComponentFromWorkloadLabels returns the OAM component from the application configuration that references the workload. The workload lookup is done using the OAM labels from the workload metadata.

func ConvertRawExtensionToUnstructured

func ConvertRawExtensionToUnstructured(rawExtension *runtime.RawExtension) (*unstructured.Unstructured, error)

ConvertRawExtensionToUnstructured converts a runtime.RawExtension to unstructured.Unstructured. The CRDs for our wrapping types embed a runtime.RawExtension for the actual workload spec (e.g. WebLogic Domain, Coherence)

func FetchContainedWorkload

func FetchContainedWorkload(ctx context.Context, cli client.Reader, workload *unstructured.Unstructured) (*unstructured.Unstructured, error)

FetchContainedWorkload takes a Verrazzano workload and fetches the contained workload as unstructured.

func FetchTrait

func FetchTrait(ctx context.Context, cli client.Reader, log logr.Logger, name types.NamespacedName) (*vzapi.MetricsTrait, error)

FetchTrait attempts to get a trait given a namespaced name. Will return nil for the trait and no error if the trait does not exist.

func FetchUnstructuredByReference

func FetchUnstructuredByReference(ctx context.Context, cli client.Reader, log logr.Logger, reference vzapi.QualifiedResourceRelation) (*unstructured.Unstructured, error)

FetchUnstructuredByReference fetches an unstructured using the namespace and name from a qualified resource relation.

func FetchUnstructuredChildResourcesByAPIVersionKinds

func FetchUnstructuredChildResourcesByAPIVersionKinds(ctx context.Context, cli client.Reader, log logr.Logger, namespace string, parentUID types.UID, childResKinds []v1alpha2.ChildResourceKind) ([]*unstructured.Unstructured, error)

FetchUnstructuredChildResourcesByAPIVersionKinds find all of the child resource of specific kinds having a specific parent (workload) UID. The child kinds are APIVersion and Kind (e.g. apps/v1.Deployment or v1.Service). The objects of these resource kinds are listed and the ones having the correct parent UID are collected and accumulated and returned. This is used to collect a subset children of a particular parent object. There is a case where the parent (workload) UID is equal to the child kind referenced, native Kubernetes types such as Deployment ctx - The calling context namespace - The namespace to search for children objects parentUID - The parent UID a child must have to be included in the result. childResKinds - The set of resource kinds a child's resource kind must in to be included in the result.

func FetchWorkloadChildren

func FetchWorkloadChildren(ctx context.Context, cli client.Reader, log logr.Logger, workload *unstructured.Unstructured) ([]*unstructured.Unstructured, error)

FetchWorkloadChildren finds the children resource of a workload resource. Both the workload and the returned array of children are unstructured maps of primitives. Finding children is done by first looking to the workflow definition of the provided workload. The workload definition contains a set of child resource types supported by the workload. The namespace of the workload is then searched for child resources of the supported types.

func FetchWorkloadDefinition

func FetchWorkloadDefinition(ctx context.Context, cli client.Reader, log logr.Logger, workload *unstructured.Unstructured) (*v1alpha2.WorkloadDefinition, error)

FetchWorkloadDefinition fetches the workload definition of the provided workload. The definition is found by converting the workload APIVersion and Kind to a CRD resource name. for example core.oam.dev/v1alpha2.ContainerizedWorkload would be converted to containerizedworkloads.core.oam.dev. Workload definitions are always found in the default namespace.

func FetchWorkloadFromTrait

func FetchWorkloadFromTrait(ctx context.Context, cli client.Reader, log logr.Logger, trait oam.Trait) (*unstructured.Unstructured, error)

FetchWorkloadFromTrait fetches a workload resource using data from a trait resource. The trait's workload reference is populated by the OAM runtime when the trait resource is created. This provides a way for the trait's controller to locate the workload resource that was generated from the common applicationconfiguration resource.

func GetAPIVersionKindOfUnstructured

func GetAPIVersionKindOfUnstructured(u *unstructured.Unstructured) (string, error)

GetAPIVersionKindOfUnstructured gets the Kubernetes apiVersion.kind of the unstructured resource.

func GetAPIVersionOfUnstructured

func GetAPIVersionOfUnstructured(u *unstructured.Unstructured) (string, error)

GetAPIVersionOfUnstructured gets the Kubernetes apiVersion of the unstructured resource.

func GetContainedWorkloadVersionKindName

func GetContainedWorkloadVersionKindName(workload *unstructured.Unstructured) (string, string, string, error)

GetContainedWorkloadVersionKindName returns the API version, kind, and name of the contained workload inside a Verrazzano*Workload.

func GetDefinitionOfResource

func GetDefinitionOfResource(resourceAPIVersion string, resourceKind string) types.NamespacedName

GetDefinitionOfResource converts APIVersion and Kind of CR to a CRD namespaced name. For example CR APIVersion.Kind core.oam.dev/v1alpha2.ContainerizedWorkload would be converted to containerizedworkloads.core.oam.dev in the default (i.e. "") namespace. resourceAPIVersion - The CR APIVersion resourceKind - The CR Kind

func GetKindOfUnstructured

func GetKindOfUnstructured(u *unstructured.Unstructured) (string, error)

GetKindOfUnstructured get the Kubernetes kind for an unstructured resource.

func GetNamespacedNameFromObjectMeta

func GetNamespacedNameFromObjectMeta(objectMeta metav1.ObjectMeta) types.NamespacedName

GetNamespacedNameFromObjectMeta creates a namespaced name from the values in an object meta.

func GetNamespacedNameFromUnstructured

func GetNamespacedNameFromUnstructured(u *unstructured.Unstructured) types.NamespacedName

GetNamespacedNameFromUnstructured creates a namespaced name from the values in a unstructured.

func IsOwnedByVerrazzanoWorkloadKind

func IsOwnedByVerrazzanoWorkloadKind(workload *unstructured.Unstructured) bool

IsOwnedByVerrazzanoWorkloadKind returns true if the workloads owner is a Verrazzano workload kind

func IsVerrazzanoWorkloadKind

func IsVerrazzanoWorkloadKind(workload *unstructured.Unstructured) bool

IsVerrazzanoWorkloadKind returns true if the workload is a Verrazzano workload kind (e.g. VerrazzanoWebLogicWorkload), false otherwise.

func MetricsTraitFromWorkloadLabels

func MetricsTraitFromWorkloadLabels(ctx context.Context, cli client.Reader, log logr.Logger, namespace string, workloadMeta v1.ObjectMeta) (*vzapi.MetricsTrait, error)

MetricsTraitFromWorkloadLabels returns the MetricsTrait object associated with the workload or nil if there is no associated metrics trait for the workload. If there is an associated metrics trait and the lookup of the trait fails, an error is returned and the reconcile should be retried.

func ParseGroupAndVersionFromAPIVersion

func ParseGroupAndVersionFromAPIVersion(apiVersion string) (string, string)

ParseGroupAndVersionFromAPIVersion splits APIVersion into API and version parts. An APIVersion takes the form api/version (e.g. networking.k8s.io/v1) If the input does not contain a / the group is defaulted to the empty string. apiVersion - The combined api and version to split

func ParseNamespacedNameFromQualifiedName

func ParseNamespacedNameFromQualifiedName(qualifiedName string) (*types.NamespacedName, error)

ParseNamespacedNameFromQualifiedName parses a string representation of a namespace qualified name.

func WorkloadToContainedGVK

func WorkloadToContainedGVK(workload *unstructured.Unstructured) *schema.GroupVersionKind

WorkloadToContainedGVK returns the GroupVersionKind of the contained resource for the type wrapped by the provided Verrazzano workload.

Types

This section is empty.

Jump to

Keyboard shortcuts

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