KubeVela Application Delivery Platform
repository·master·Indexed 11 days ago
https://github.com/kubevela/kubevelaAn application delivery platform based on the Open Application Model (OAM) for deploying and managing applications across hybrid and multi-cloud environments. It features a core controller, a CLI (vela), and support for CUE-based ComponentDefinitions, TraitDefinitions, and WorkflowStepDefinitions. The platform supports multi-cluster capabilities, custom resource management, and a structured enhancement process via KubeVela Enhancement Proposals (KEPs). Compatible with Kubernetes versions >= v1.19 and < v1.22.
What's inside KubeVela
- The CUE Generator is a tool used to automatically generate CUE schemas and documentation from Go structs. It maps Go types to CUE types and respects specific struct tags to control the output schema.
Overview of Vela Templates
masterVela templates are built-in CUE templates used by Vela Core and the Vela Registry. These templates are organized into two main directories:
definitions/registry: Templates used for the Registry.definitions/internal: Templates used for Vela Core internals.
Overview of KubeVela application delivery
masterKubeVela is a modern application delivery platform designed to simplify deploying and operating applications across hybrid and multi-cloud environments. It follows a "render, orchestrate, deploy" workflow and is built upon the Open Application Model (OAM).
Key capabilities include:
- Deployment as Code: Declare deployment plans as workflows that can be integrated with CI/CD or GitOps systems. Workflows can be extended using CUE.
- Multi-cloud/Hybrid Support: Native support for progressive rollouts (canary, blue-green), continuous verification, and placement strategies across different clusters and clouds.
- Built-in Governance: Out-of-the-box support for multi-tenancy, LDAP integration, fine-grained RBAC, and automated observability dashboards.
- Extensibility: A lightweight architecture that uses reusable modules (addons) to orchestrate infrastructure capabilities.
Features of the KubeVela Go SDK
masterThe KubeVela Go SDK provides two main functional areas for interacting with KubeVela applications:
Application Manipulation
- Add Components, Traits, Workflow Steps, and Policies.
- Set Workflow Mode.
- Convert to and from Kubernetes Application Objects.
- Convert applications to YAML or JSON formats.
- Retrieve Components, Traits, Workflow Steps, and Policies from an existing application.
- Recursively validate required application parameters.
Application Client
- Perform CRUD operations on Applications: Create, Delete, Patch, and Update.
- List and Get Applications.
Author KubeVela X-Definitions using the defkit Go SDK
masterThe Definition Kit (
defkit) is a Go SDK that allows platform engineers to author KubeVela X-Definitions (ComponentDefinition, TraitDefinition, PolicyDefinition, and WorkflowStepDefinition) using native Go code instead of CUE.Key benefits include:
- Full IDE support: Autocomplete, type checking, and inline documentation.
- Testability: Use standard Go testing frameworks (
go test) to unit test definitions. - Compile-time safety: Catch invalid field names and type mismatches before deployment.
- Standard Distribution: Share definitions as versioned Go modules via
go get. - Transparent Compilation: The SDK compiles Go to CUE automatically; the KubeVela controller remains compatible without needing to execute Go code at runtime.
package myplatform import ( "github.com/oam-dev/kubevela/pkg/definition/defkit" ) func init() { defkit.Register(WebserviceComponent()) }Understand the Cluster Infrastructure Abstraction implementation plan
masterThe Cluster Infrastructure Abstraction is a multi-phase architectural design for KubeVela to manage cluster lifecycles, including provisioning, adoption, and connection. The implementation is divided into several key functional areas:
- Core CRDs & Controllers: Management of
Cluster,ClusterPlane,ClusterBlueprint, andClusterProviderDefinition. - Cluster Lifecycle: Workflows for provisioning (via Crossplane/Terraform), adopting existing clusters, and connecting to remote clusters via kubeconfig.
- Definition System: Introduction of a
definition.oam.dev/scopeannotation to distinguish betweenapplicationandclusterscoped definitions. - Rollout Engine: Managing cluster updates via
ClusterRolloutStrategyusing waves, maintenance windows, and approval gates. - Health & Observability: Hierarchical health aggregation (Cluster → Plane → Component → Resource) using providers like Prometheus or Datadog.
- Drift Detection: Comparing cluster state against blueprints and providing remediation via
vela cluster remediate.
- Core CRDs & Controllers: Management of
Overview of the defkit Go SDK
masterThe
defkit(Definition Kit) is a Go SDK designed for authoring KubeVela X-Definitions. It allows platform engineers to write definitions (Components, Traits, Policies, and Workflow Steps) using Go's type safety and standard tooling instead of raw CUE.Key Characteristics:
- Compile-time execution: Go code runs on the CLI during
vela def applyorvela addon enableto generate static CUE. It does not execute at application deployment time. - Coexistence: CUE definitions remain fully supported;
defkitis an alternative path. - Security: Leverages standard Go security tools (gosec, staticcheck) and Go module checksums for dependency integrity.
- Compile-time execution: Go code runs on the CLI during
What is a ClusterPlane and how is it used
masterA
ClusterPlanerepresents a composable infrastructure layer, typically owned by a specific team (e.g., networking, security, observability).Important Distinction: A
ClusterPlaneis a template, not a self-reconciling resource. Creating aClusterPlaneCRD does not automatically create infrastructure resources. It serves as a definition that can be used within a blueprint to drive the reconciliation of specific infrastructure components.Implement API Line Versioning for stable contracts
masterTo prevent breaking changes when updating definitions (like a database schema), KubeVela uses API Line Versioning.
Instead of referencing a bare type name or a fragile
DefinitionRevision, users reference a stable API line. This line acts as a contract: the platform engineer promises that the parameter schema for that line will remain compatible.Usage Pattern:
- Bare name (Old):
type: database(Breaks if the schema changes). - Revision pinning (Fragile):
type: database@v1.2.3(Hard to manage in GitOps). - API Line (Recommended):
type: postgres/v1/database(Thev1indicates a stable parameter contract. The underlying addon can be updated freely as long as it respects thev1schema).
# The type reference carries the stability contract. components: - name: my-db type: postgres/v1/database # "I bind to the v1 parameter contract."- Bare name (Old):
Configure container-ports for multiple containers
masterTo manage ports for multiple containers within a single Pod using the
container-portstrait, use thecontainersproperty. Each item in thecontainerslist must include acontainerNameto identify which container the ports apply to.traits: - type: container-ports properties: containers: - containerName: container-a ports: - containerPort: 80 protocol: TCP hostPort: 8080 - containerName: container-b ports: - containerPort: 9000 protocol: TCP hostPort: 9001How nested component definitions work in KubeVela
masterKubeVela supports a hierarchical composition model where one
ComponentDefinitioncan delegate to another using thedef.#RenderComponentfunction. This allows developers to create layers of abstraction:- Base Components (Level 1): Low-level definitions that map directly to Kubernetes resources (e.g., a
webservicedefining aDeployment). - Abstraction Layers (Level 2): Intermediate definitions that wrap base components to simplify configuration (e.g., a
myorg-servicethat maps asizeparameter likes,m, orlto specific CPU/Memory/Replica values). - Minimal Interfaces (Level 3): High-level, user-facing definitions that expose only the most essential parameters (e.g., a
myorg-simple-servicethat only asks for animage).
When a user deploys a high-level component, KubeVela recursively calls
def.#RenderComponentdown the chain, compiling and evaluating CUE templates at each step until final Kubernetes manifests are generated.graph TD subgraph "Level 3: Simple Interface" A[myorg-simple-service<br/>Parameters: image] end subgraph "Level 2: Size-Based" B[myorg-service<br/>Parameters: image, size] end subgraph "Level 1: Full Featured" C[webservice<br/>Parameters: image, replicas,<br/>resources, env, ports, etc.] end A -->|def.#RenderComponent| B B -->|def.#RenderComponent| C C --> D[Kubernetes Deployment]- Base Components (Level 1): Low-level definitions that map directly to Kubernetes resources (e.g., a
Understand the Deprecation Lifecycle for Addon Modules
masterWhen an addon module is updated, API lines (versions) follow a specific deprecation lifecycle managed via
AddonModuleStatus:- Active: The line is available and used by applications.
- Deprecated: A line enters this state if
enabledevaluates tofalse(via_version.cue) or if the line is removed from the current addon version.- Behavior: Deprecated lines remain on the cluster indefinitely and are not automatically removed. However, the admission webhook blocks new Applications from referencing them.
- Reversibility: If the deprecation was caused by a context-based disable (
disabled-by-context), it is reversible if the context becomes enabled again. If the line was physically removed from the source (line-removed), it is a one-way transition.
- Removal: Removal of a line is an explicit action (e.g., upgrading the addon or KubeVela controller).