Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAppDeploymentUsingAppRevision(ctx context.Context, c client.Reader, appNs string, appName string) ([]string, error)
- func CheckDisabledCapabilities(disableCaps string) error
- func CompareWithRevision(ctx context.Context, c client.Client, logger logging.Logger, ...) (bool, error)
- func ComputeSpecHash(spec interface{}) (string, error)
- func ConstructRevisionName(componentName string, revision int64) string
- func ConvertOpenAPISchema2SwaggerObject(data []byte) (*openapi3.Schema, error)
- func DiscoveryFromPodSpec(w *unstructured.Unstructured, fieldPath string) ([]intstr.IntOrString, error)
- func DiscoveryFromPodTemplate(w *unstructured.Unstructured, fields ...string) ([]intstr.IntOrString, map[string]string, error)
- func ExtractComponentName(revisionName string) string
- func ExtractRevision(revisionName string) (int, error)
- func GenerateOpenAPISchemaFromDefinition(definitionName, cueTemplate string) ([]byte, error)
- func GetAppNextRevision(app *v1beta1.Application) (string, int64)
- func GetPodSpecPath(workloadDef *v1alpha2.WorkloadDefinition) (string, bool)
- func RefreshPackageDiscover(dm discoverymapper.DiscoveryMapper, pd *definition.PackageDiscover, ...) error
- func SelectOAMAppLabelsWithoutRevision(labels map[string]string) map[string]string
- func StoreInSet(disableCaps string) mapset.Set
- type CapabilityBaseDefinition
- type CapabilityComponentDefinition
- func (def *CapabilityComponentDefinition) GetCapabilityObject(ctx context.Context, k8sClient client.Client, namespace, name string) (*types.Capability, error)
- func (def *CapabilityComponentDefinition) GetKubeSchematicOpenAPISchema(params []commontypes.KubeParameter) ([]byte, error)
- func (def *CapabilityComponentDefinition) GetOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, ...) ([]byte, error)
- func (def *CapabilityComponentDefinition) StoreOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, ...) error
- type CapabilityDefinitionInterface
- type CapabilityTraitDefinition
- func (def *CapabilityTraitDefinition) GetCapabilityObject(ctx context.Context, k8sClient client.Client, namespace, name string) (*types.Capability, error)
- func (def *CapabilityTraitDefinition) GetOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, ...) ([]byte, error)
- func (def *CapabilityTraitDefinition) StoreOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, ...) error
Constants ¶
const ErrNoSectionParameterInCue = "capability %s doesn't contain section `parameter`"
ErrNoSectionParameterInCue means there is not parameter section in Cue template of a workload
const LabelPodSpecable = "workload.oam.dev/podspecable"
LabelPodSpecable defines whether a workload has podSpec or not.
Variables ¶
var DefaultBackoff = wait.Backoff{ Duration: 1 * time.Second, Factor: 2, Steps: 5, Jitter: 0.1, }
DefaultBackoff is the backoff we use in controller
Functions ¶
func CheckAppDeploymentUsingAppRevision ¶ added in v1.0.3
func CheckAppDeploymentUsingAppRevision(ctx context.Context, c client.Reader, appNs string, appName string) ([]string, error)
CheckAppDeploymentUsingAppRevision get all appDeployments using appRevisions related the app
func CheckDisabledCapabilities ¶ added in v0.2.0
CheckDisabledCapabilities checks whether the disabled capability controllers are valid
func CompareWithRevision ¶ added in v1.0.0
func CompareWithRevision(ctx context.Context, c client.Client, logger logging.Logger, componentName, nameSpace, latestRevision string, curCompSpec *v1alpha2.ComponentSpec) (bool, error)
CompareWithRevision compares a component's spec with the component's latest revision content
func ComputeSpecHash ¶ added in v1.0.0
ComputeSpecHash computes the hash value of a k8s resource spec
func ConstructRevisionName ¶ added in v1.0.0
ConstructRevisionName will generate a revisionName given the componentName and revision will be <componentName>-v<RevisionNumber>, for example: comp-v1
func ConvertOpenAPISchema2SwaggerObject ¶ added in v1.0.0
ConvertOpenAPISchema2SwaggerObject converts OpenAPI v2 JSON schema to Swagger Object
func DiscoveryFromPodSpec ¶
func DiscoveryFromPodSpec(w *unstructured.Unstructured, fieldPath string) ([]intstr.IntOrString, error)
DiscoveryFromPodSpec will discover pods from podSpec
func DiscoveryFromPodTemplate ¶
func DiscoveryFromPodTemplate(w *unstructured.Unstructured, fields ...string) ([]intstr.IntOrString, map[string]string, error)
DiscoveryFromPodTemplate not only discovery port, will also use labels in podTemplate
func ExtractComponentName ¶ added in v1.0.0
ExtractComponentName will extract the componentName from a revisionName
func ExtractRevision ¶ added in v1.0.0
ExtractRevision will extract the revision from a revisionName
func GenerateOpenAPISchemaFromDefinition ¶ added in v1.0.0
GenerateOpenAPISchemaFromDefinition returns the parameter of a definition
func GetAppNextRevision ¶ added in v1.0.0
func GetAppNextRevision(app *v1beta1.Application) (string, int64)
GetAppNextRevision will generate the next revision name and revision number for application
func GetPodSpecPath ¶
func GetPodSpecPath(workloadDef *v1alpha2.WorkloadDefinition) (string, bool)
GetPodSpecPath get podSpec field and label
func RefreshPackageDiscover ¶ added in v1.0.2
func RefreshPackageDiscover(dm discoverymapper.DiscoveryMapper, pd *definition.PackageDiscover, workloadGVK commontypes.WorkloadGVK, workloadref commontypes.DefinitionReference, def oamtypes.CapType) error
RefreshPackageDiscover help refresh package discover
func SelectOAMAppLabelsWithoutRevision ¶
SelectOAMAppLabelsWithoutRevision will filter and return OAM app labels only, if no labels, return the original one.
func StoreInSet ¶ added in v0.2.0
StoreInSet stores items in Set
Types ¶
type CapabilityBaseDefinition ¶ added in v1.0.0
type CapabilityBaseDefinition struct { }
CapabilityBaseDefinition is the base struct for CapabilityWorkloadDefinition and CapabilityTraitDefinition
func (*CapabilityBaseDefinition) CreateOrUpdateConfigMap ¶ added in v1.0.0
func (def *CapabilityBaseDefinition) CreateOrUpdateConfigMap(ctx context.Context, k8sClient client.Client, namespace, definitionName string, jsonSchema []byte, ownerReferences []metav1.OwnerReference) (string, error)
CreateOrUpdateConfigMap creates ConfigMap to store OpenAPI v3 schema or or updates data in ConfigMap
type CapabilityComponentDefinition ¶ added in v1.0.0
type CapabilityComponentDefinition struct { Name string `json:"name"` ComponentDefinition v1beta1.ComponentDefinition `json:"componentDefinition"` WorkloadType util.WorkloadType `json:"workloadType"` WorkloadDefName string `json:"workloadDefName"` Helm *commontypes.Helm `json:"helm"` Kube *commontypes.Kube `json:"kube"` CapabilityBaseDefinition }
CapabilityComponentDefinition is the struct for ComponentDefinition
func (*CapabilityComponentDefinition) GetCapabilityObject ¶ added in v1.0.0
func (def *CapabilityComponentDefinition) GetCapabilityObject(ctx context.Context, k8sClient client.Client, namespace, name string) (*types.Capability, error)
GetCapabilityObject gets types.Capability object by WorkloadDefinition name
func (*CapabilityComponentDefinition) GetKubeSchematicOpenAPISchema ¶ added in v1.0.0
func (def *CapabilityComponentDefinition) GetKubeSchematicOpenAPISchema(params []commontypes.KubeParameter) ([]byte, error)
GetKubeSchematicOpenAPISchema gets OpenAPI v3 schema based on kube schematic parameters
func (*CapabilityComponentDefinition) GetOpenAPISchema ¶ added in v1.0.0
func (def *CapabilityComponentDefinition) GetOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, namespace, name string) ([]byte, error)
GetOpenAPISchema gets OpenAPI v3 schema by WorkloadDefinition name
func (*CapabilityComponentDefinition) StoreOpenAPISchema ¶ added in v1.0.0
func (def *CapabilityComponentDefinition) StoreOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, namespace, name, revName string) error
StoreOpenAPISchema stores OpenAPI v3 schema in ConfigMap from WorkloadDefinition
type CapabilityDefinitionInterface ¶ added in v1.0.0
type CapabilityDefinitionInterface interface { GetCapabilityObject(ctx context.Context, k8sClient client.Client, namespace, name string) (*types.Capability, error) GetOpenAPISchema(ctx context.Context, k8sClient client.Client, namespace, name string) ([]byte, error) }
CapabilityDefinitionInterface is the interface for Capability (WorkloadDefinition and TraitDefinition)
type CapabilityTraitDefinition ¶ added in v1.0.0
type CapabilityTraitDefinition struct { Name string `json:"name"` TraitDefinition v1beta1.TraitDefinition `json:"traitDefinition"` CapabilityBaseDefinition }
CapabilityTraitDefinition is the Capability struct for TraitDefinition
func (*CapabilityTraitDefinition) GetCapabilityObject ¶ added in v1.0.0
func (def *CapabilityTraitDefinition) GetCapabilityObject(ctx context.Context, k8sClient client.Client, namespace, name string) (*types.Capability, error)
GetCapabilityObject gets types.Capability object by TraitDefinition name
func (*CapabilityTraitDefinition) GetOpenAPISchema ¶ added in v1.0.0
func (def *CapabilityTraitDefinition) GetOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, namespace, name string) ([]byte, error)
GetOpenAPISchema gets OpenAPI v3 schema by TraitDefinition name
func (*CapabilityTraitDefinition) StoreOpenAPISchema ¶ added in v1.0.0
func (def *CapabilityTraitDefinition) StoreOpenAPISchema(ctx context.Context, k8sClient client.Client, pd *definition.PackageDiscover, namespace, name string) error
StoreOpenAPISchema stores OpenAPI v3 schema from TraitDefinition in ConfigMap