# Functions
Abs for int.
AddAnnotations will merge annotations with existing ones.
AddLabels will merge labels with existing labels.
AsController converts the supplied object reference to a controller reference.
AsOwner converts the supplied object reference to an owner reference.
BeEquivalentToError matches the error to take care of nil.
CheckAppRevision check if appRevision list is right.
ComputeHash returns a hash value calculated from pod template and a collisionCount to avoid hash collision.
ConvertDefinitionRevName can help convert definition type defined in Application to DefinitionRevision Name e.g., [email protected] will be convert to worker-v1.3.1.
ConvertWorkloadGVK2Definition help convert a GVK to DefinitionReference.
DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.
EndReconcileWithNegativeCondition is used to handle reconcile failure for a conditioned resource.
EndReconcileWithPositiveCondition is used to handle reconcile success for a conditioned resource.
ExtractComponentName will extract the componentName from a revisionName.
ExtractRevisionNum extract revision number.
GenerateVersion Generate version numbers by time.
GenTraitName generate trait name.
GetCapabilityDefinition can get different versions of ComponentDefinition/TraitDefinition.
GetDefinition get definition from two level namespace.
GetDefinitionFromNamespace get definition from namespace.
GetDefinitionName return the Definition name of any resources the format of the definition of a resource is <kind plurals>.<group> Now the definition name of a resource could also be defined as `definition.oam.dev/name` in `metadata.annotations` typeLabel specified which Definition it is, if specified, will directly get definition from label.
GetDefinitionNamespaceWithCtx will get namespace from context, it will try get `AppDefinitionNamespace` key, if not found, will use default system level namespace defined in `systemvar.SystemDefinitionNamespace`.
GetGVKFromDefinition help get Group Version Kind from DefinitionReference.
GetObjectGivenGVKAndName fetches the kubernetes object given its gvk and name.
GetObjectsGivenGVKAndLabels fetches the kubernetes object given its gvk and labels by list API.
GetXDefinitionNamespaceWithCtx will get namespace from context, it will try get `XDefinitionNamespace` key, if not found, will use default system level namespace defined in `vela-system`.
IsConditionChanged will check if conditions in workload are changed compare to newCondition.
JSONMarshal returns the JSON encoding.
Max for int.
MergeMapOverrideWithDst merges two could be nil maps.
Min for int.
MustJSONMarshal json-marshals an object into bytes.
NewApplicationResourceNamespaceAccessor create namespace accessor for resource in application.
Object2Map turn the Object to a map.
Object2RawExtension converts an object to a rawExtension.
Object2Unstructured converts an object to an unstructured struct.
PassLabelAndAnnotation passes through labels and annotation objectMeta from the parent to the child object when annotation or labels has conflicts, the parentObj will override the childObj.
PatchCondition will patch status with condition and return, it generally used by cases which don't want to reconcile after patch.
RawExtension2Application converts runtime.RawExtension to Application.
RawExtension2Map will convert rawExtension to map.
RawExtension2Unstructured converts a rawExtension to an unstructured struct.
RemoveAnnotations removes keys that contains in the removekeys slice from the annotation.
RemoveLabels removes keys that contains in the removekeys slice from the label.
SetNamespaceInCtx set app namespace in context, Sometimes webhook handler may receive a request that appNs is empty string, and will cause error when search definition So if namespace is empty, it will use `default` namespace by default.
SetXDefinitionNamespaceInCtx set x-definition namespace in context, Sometimes x-definition is installed to customized namespace So it is empty, it will use `vela-system` namespace by default.
UnMarshalStringToComponentDefinition parse a string to a componentDefinition object.
UnMarshalStringToPolicyDefinition parse a string to a policyDefinition object.
UnMarshalStringToTraitDefinition parse a string to a traitDefinition object.
# Constants
AppDefinitionNamespace is context key to define app namespace.
ComponentDef describe a workload of Defined by ComponentDefinition.
Dummy used for dummy definition.
DummyTraitMessage is a message for trait which don't have definition found.
ErrBadRevision represents an error when the revision name is not standardized.
ErrCreateConvertedWorklaodDefinition is the error while apply a WorkloadDefinition.
ErrCreateDefinitionRevision is the error while create or update DefinitionRevision.
ErrGenerateDefinitionRevision is the error while generate DefinitionRevision.
ErrGenerateOpenAPIV2JSONSchemaForCapability is the error while generating OpenAPI v3 schema.
ErrReconcileErrInCondition indicates one or more error occurs and are recorded in status conditions.
ErrRefreshPackageDiscover is the error while refresh PackageDiscover.
ErrStoreCapabilityInConfigMap is the error while storing capability in ConfigMap.
ErrUpdateCapabilityInConfigMap is the error while creating or updating a capability.
ErrUpdateComponentDefinition is the error while update ComponentDefinition.
ErrUpdatePolicyDefinition is the error while update PolicyDefinition.
ErrUpdateStatus is the error while applying status.
ErrUpdateStepDefinition is the error while update WorkflowStepDefinition.
ErrUpdateTraitDefinition is the error while update TraitDefinition.
ErrUpdateWorkflowStepDefinition is the error while update WorkflowStepDefinition.
HELMDef describe a workload refer to HELM.
KubeDef describe a workload refer to raw K8s resource.
ReferWorkload describe an existing workload.
TerraformDef describes a workload refer to Terraform.
TraitPrefixKey is prefix of trait name.
XDefinitionNamespace is context key to define the namespace, which x-definition(Component/Trait) is installed to.
# Structs
AlreadyExistMatcher matches the error to be already exist.
ErrorMatcher matches errors.
NotFoundMatcher matches the error to be not found.
# Interfaces
A ConditionedObject is an Object type with condition field.
NamespaceAccessor namespace accessor for resource.
# Type aliases
WorkloadType describe the workload type of ComponentDefinition.