If you are a cloud-native developer and have no clue about what is the Open Application Model (OAM), why you would want to use it, and how, you have come to the right place. In this beginner’s guide, we will introduce you to OAM and guide your first steps. Then it will be your time to decide if you, like us in Napptive, want to make your life easier from now on by using it.
What is OAM
Open Application Model (OAM) is an open-source specification for creating cloud-native applications. It offers a uniform and simple method for describing and deploying cloud-native apps and all of their components on any orchestration service, specially Kubernetes-based platforms – no matter the cloud provider if it is an on-prem cluster or even edge devices.
Kubernetes is usually fed with configuration files that describe pods, services, containers, etc. Instead of focusing on these low-level details, OAM proposes a high-level, functionality-centered configuration. It introduces a new layer on top of Kubernetes that defines a set of entities to facilitate an application’s definition, its components, how it will be deployed, etc.
Our CTO, Daniel Higuero, makes an excellent introduction to OAM and KubeVela on Kunal Kushwaha’s YouTube channel that you may want to check out.
The ultimate goal is to make it simpler for developers to create, test, and deploy cloud-native applications. The idea behind creating OAM was to free developers from dealing with low-level details that are more about the cluster architecture than the business logic. This is achieved by creating a standard for specifying an application’s functionality and configuration, including the components and their dependencies. Developers can now define and manage their apps declaratively without worrying about the underlying infrastructure.
OAM helps to simplify the development of cloud-native apps by offering a standard method for definition and management, freeing developers to concentrate on creating excellent applications.
Benefits of using OAM
By offering a common specification and set of tools, OAM streamlines the creation and deployment of cloud-native applications:
- Facilitates independent application component development and testing without requiring deep knowledge of the underlying architecture
- Reduces the complexity of managing applications at scale by enabling developers to describe and manage applications declaratively
- Makes it simpler to automate scaling and distribution by offering a consistent and repeatable method for deploying and managing apps
- Makes it simpler to create applications in the programming language and framework of your choosing by supporting a variety of them
- Makes it simpler to launch applications on any Kubernetes-based platform because it is runtime-agnostic.
Using OAM to create cloud-native applications
Now that we have introduced you to OAM, let’s dive into how it works.
The OAM specification defines a cloud-native application as “a collection of interrelated, but discrete components (services, tasks, workers) that, when coupled with configuration and instantiated in a suitable runtime infrastructure, together accomplish a unified functional purpose.”
Based on this definition, the model includes five new entities that complement Kubernetes native objects:
- Components: they describe a runnable unit, together with a description.
- Traits: they are overlays that augment or modify a component with additional operations-specific features (for example, how the scaling is done).
- Policies: Offer a method to apply application-level configuration options that affect all components.
- Workflows: Enable developers to define how the application should be deployed making use of individual workflow steps that enable multiple types of actions from deploying components to communicating with other services.
- Application: it assembles a set of component instances, their traits, and the application scopes in which they are placed, combined with configuration parameters and metadata.
If you want a little more detail about these entities and how they look in a YAML file, the following snippet describes an application that will deploy nginx exposing the service through an ingress by means of the gateway trait.
apiVersion: core.oam.dev/v1beta1 kind: Application metadata: name: nginx-app spec: components: - name: nginx type: webservice properties: image: nginx:1.20.0 ports: - port: 80 expose: true traits: - type: gateway properties: http: "/": 80
And remember, that you are able to define your own components, traits, and workflow steps to better adapt the usage of OAM to your own use case. Each definition describes the set of properties that are accepted which enables you to define parameters that contain your specific business logic, standards, etc.
These are a few examples of prominent projects leveraging OAM:
- The flagship platform for running OAM applications in Kubernetes is KubeVela, which recently joined the CNCF Incubator. It is highly extensible and customizable to fit your organization’s needs.
- Alibaba Cloud Container Service for Kubernetes (ACK) is a managed Kubernetes service that provides built-in support for OAM applications. Lei Zhang, from Alibaba, explains how they use it in this KubeCon 2020 talk.
- Crossplane is an open-source project that simplifies working with infrastructure elements and can be easily integrated with your OAM applications.
- Meshery enables the easy adoption, operation, and management of any service mesh for OAM-based application delivery workflow.
- 4Paradigm uses OAM to build its cloud-native AI platform for machine learning.
- And here at Napptive, we offer a managed cloud-native application platform centered on Kubernetes and OAM.
How to use OAM in your projects
Do you want to include this model to boost the development of cloud-native applications in your organization? Here are step-by-step instructions for implementing OAM in a project:
- Identify your application components. Each component will typically be associated with a container image that will be deployed as part of the application, but depending on your use case, components can be other elements such as ones related to configuration, infrastructure elements, or others. In KubeVela you will be provided with a set of predefined components that represent both long-lived running processes such as webservice or worker, and short-lived tasks and scheduled crontasks.
- Define the application by adding all the required components and use traits to augment or modify their behavior as needed. Traits will enable you to set up storage, expose services, set environment variables, and much more.
- Define the application components as independent, composable units that can be combined to form an application. Each component has a well-defined interface and can be deployed and managed independently.
- Deploy the OAM application on the Kubernetes cluster using the OAM runtime. This will create the necessary resources on the cluster, including pods, services, and other Kubernetes objects.
- Monitor and scale the application: Once the application is deployed, you can use the OAM runtime to monitor and scale the application based on the defined configuration.
- Iterate and improve: Iterate on the application and its components, updating the OAM specification and redeploying the application as needed.
By following these steps, you can implement OAM in your project and create cloud-native applications that are easy to deploy, manage, and scale.
Companies that have successfully used the model
These are some companies that have successfully adopted OAM to simplify the development and deployment of cloud-native applications and to improve the scalability and reliability of their services:
- Alibaba Cloud: As we have just mentioned, Alibaba has a managed Kubernetes service that provides built-in support for OAM applications named ACK.
- JD.com: This is probably China’s largest retailer and it has successfully adopted Kubernetes – together with OAM – to serve its millions of users while reducing hardware costs.
- Bytedance: A gaming company that uses OAM and KubeVela in its game platform.
- China Merchants Bank: Using KubeVela to build a hybrid cloud application platform to unify the whole process from build, ship, and run.