Custom Applications

TOC

UnderStanding Custom Applications

A Custom Application is an application paradigm built on native Kubernetes resources (e.g., Deployment, Service, ConfigMap), strictly adhering to Kubernetes declarative API design principles. Users can define and deploy applications through standard YAML files or direct Kubernetes API calls, enabling fine-grained control over the application lifecycle. These are created from sources such as Images, code, and YAML are classified as custom application in Alauda Container Platform. Its design core lies in balancing flexibility and standardization, ideal for scenarios requiring deeply customized management.

Core Capabilities

  1. Declarative API-Driven Management
  • Aggregates distributed resources (e.g., Deployment, Service, Ingress) into a logical application unit through Application CRD, enabling atomic operations.
  1. Application-Level Abstraction & State Aggregation
  • Masks low-level resource details (e.g., Pod replica status). Developers can monitor overall application health (e.g., ready endpoint ratio, version consistency) directly via the Application resource.

  • Supports cross-component dependency declarations (e.g., database service must start before application service) to ensure resource initialization order and coordination.

  1. Full Lifecycle Governance
  • Version Control: Tracks historical configurations, enabling one-click rollback to any stable state.

  • Dependency Resolution: Automatically identifies and manages version compatibility between components (e.g., matching Service API versions with Ingress controllers).

  1. Enhanced Observability
  • Aggregates status metrics of all associated resources (e.g., Deployment available replicas, Service traffic load), providing a global view through a unified Dashboard.

Design Value

DimensionValue Proposition
Complexity ManagementEncapsulates scattered resources (e.g., Deployment, Service) into a single logical entity, reducing cognitive and operational overhead.
StandardizationUnifies application description standards via Application CRD, eliminating management entropy caused by YAML fragmentation.
Ecosystem CompatibilityEcosystem Compatibility Seamlessly integrates with native toolchains (e.g., kubectl, Kubernetes Dashboard) and supports Helm Chart extensions.
DevOps EfficiencyImplements declarative delivery through GitOps pipelines (e.g., Argo CD), accelerating CI/CD automation.

Custom Application CRD Architecture Design

The Custom Application module defines two core CRD resources, forming atomic abstraction units for application management:

DimensionValue Proposition
ApplicationDescribes metadata and component topology of logical application units, aggregating resources like Deployment/Service into a single entity.
ApplicationHistoryRecords all application lifecycle operations (create/update/rollback/delete) as versioned snapshots, tightly coupled with the Application CRD to enable end-to-end change traceability.

Application CRD Define

The Application CRD uses the spec.componentKinds field to declare Kubernetes resource types (e.g., Deployment, Service), enabling cross-resource lifecycle management.

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: applications.app.k8s.io
spec:
  group: app.k8s.io
  names:
    kind: Application
    listKind: ApplicationList
    plural: applications
    singular: application
  scope: Namespaced
  subresources:
    status: {}
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
          type: string
        metadata:
          description: 'Metadata is a object value representing the metadata of the kubernetes resource.
            More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata'
          type: object
        spec:
          properties:
            assemblyPhase:
              description: |
                The installer can set this field to indicate that the application's components
                are still being deployed ("Pending") or all are deployed already ("Succeeded"). When the
                application cannot be successfully assembled, the installer can set this field to "Failed".'
              type: string
            componentKinds:
              description: |
                This array of GroupKinds is used to indicate the types of resources that the
                application is composed of. As an example an Application that has a service and a deployment
                would set this field to [{"group":"core","kind": "Service"},{"group":"apps","kind":"Deployment"}]
              items:
                description: 'The item of the GroupKinds, with a structure like \"{"group":"core","kind": "Service"}\"'
                type: object
              type: array
            descriptor:
              properties:
                description:
                  description: 'A short, human readable textual description of the Application.'
                  type: string
                icons:
                  description: 'A list of icons for an application. Icon information includes the source, size, and mime type.'
                  items:
                    properties:
                      size:
                        description: 'The size of the icon.'
                        type: string
                      src:
                        description: 'The source of the icon.'
                        type: string
                      type:
                        description: 'The mime type of the icon.'
                        type: string
                    required:
                    - src
                    type: object
                  type: array
                keywords:
                  description: 'A list of keywords that identify the application.'
                  items:
                    type: string
                  type: array
                links:
                  description: 'Links are a list of descriptive URLs intended to be used to surface additional documentation, dashboards, etc.'
                  items:
                    properties:
                      description:
                        description: 'The description of the link.'
                        type: string
                      url:
                        description: 'The url of the link.'
                        type: string
                    type: object
                  type: array
                maintainers:
                  description: 'A list of the maintainers of the Application. Each maintainer has a 
                    name, email, and URL. This field is meant for the distributors of the Application
                    to indicate their identity and contact information.'
                  items:
                    properties:
                      email:
                        description: 'The email of the maintainer.'
                        type: string
                      name:
                        description: 'The name of the maintainer.'
                        type: string
                      url:
                        description: 'The url to contact the maintainer.'
                        type: string
                    type: object
                  type: array
                notes:
                  description: 'Notes contain human readable snippets intended as a quick start
                    for the users of the Application. They may be plain text or CommonMark markdown.'
                  type: string
                owners:
                  items:
                    properties:
                      email:
                        description: 'The email of the owner.'
                        type: string
                      name:
                        description: 'The name of the owner.'
                        type: string
                      url:
                        description: 'The url to contact the owner.'
                        type: string
                    type: object
                  type: array
                type:
                  description: 'The type of the application (e.g. WordPress, MySQL, Cassandra).
                    You can have many applications of different names in the same namespace.
                    They type field is used to indicate that they are all the same type of application.'
                  type: string
                version:
                  description: 'A version indicator for the application (e.g. 5.7 for MySQL version 5.7).'
                  type: string
              type: object
            info:
              description: 'Info contains human readable key-value pairs for the Application.'
              items:
                properties:
                  name:
                    description: 'The name of the information.'
                    type: string
                  type:
                    description: 'The type of the information.'
                    type: string
                  value:
                    description: 'The value of the information.'
                    type: string
                  valueFrom:
                    description: 'The value reference from other resource.'
                    properties:
                      configMapKeyRef:
                        description: 'The config map key reference.'
                        properties:
                          key:
                            type: string
                        type: object
                      ingressRef:
                        description: 'The ingress reference.'
                        properties:
                          host:
                            description: 'The host of the ingress reference.'
                            type: string
                          path:
                            description: 'The path of the ingress reference.'
                            type: string
                        type: object
                      secretKeyRef:
                        description: 'The secret key reference.'
                        properties:
                          key:
                            type: string
                        type: object
                      serviceRef:
                        description: 'The service reference.'
                        properties:
                          path:
                            description: 'The path of the service reference.'
                            type: string
                          port:
                            description: 'The port of the service reference.'
                            format: int32
                            type: integer
                        type: object
                      type:
                        type: string
                    type: object
                type: object
              type: array
            selector:
              description: 'The selector is used to match resources that belong to the Application.
                All of the applications resources should have labels such that they match this selector.
                Users should use the app.kubernetes.io/name label on all components of the Application
                and set the selector to match this label. For instance,
                {"matchLabels": [{"app.kubernetes.io/name": "my-cool-app"}]} should be used as the selector
                for an Application named "my-cool-app", and each component should contain a label that matches.'
              type: object
          type: object
        status:
          description: 'The status summarizes the current state of the object.'
          properties:
            observedGeneration:
              description: 'The observedGeneration is the generation most recently observed by the component
                responsible for acting upon changes to the desired state of the resource.'
              format: int64
              type: integer
          type: object
  version: v1beta1
  versions:
  - name: v1beta1
    served: true
    storage: true

ApplicationHistory Define

The ApplicationHistory CRD captures all lifecycle operations (e.g., creation, update, rollback) as version-controlled snapshots and is tightly integrated with the Application CRD to deliver end-to-end audit trails.

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: applicationhistories.app.k8s.io
spec:
  group: app.k8s.io
  names:
    kind: ApplicationHistory
    listKind: ApplicationHistoryList
    plural: applicationhistories
    singular: applicationhistory
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
          type: string
        metadata:
          description: 'Metadata is a object value representing the metadata of the kubernetes resource.
            More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata'
          type: object
        spec:
          properties:
            changeCause:
              description: 'The change cause of the application to generate the ApplicationHistory.'
              type: string
            creationTimestamp:
              description: 'The creation timestamp of the application history.'
              format: date-time
              type: string
            resourceDiffs:
              description: 'The resource differences between the current and last version of application. It contains 3 types of diff: `create`,
                `delete` and `update`. The item of the diff compose of the kind and name of the diff resource object.'
              properties:
                create:
                  items:
                    properties:
                      kind:
                        description: 'The kind of the created resource.'
                        type: string
                      name:
                        description: 'The name of the created resource.'
                        type: string
                    type: object
                  type: array
                delete:
                  items:
                    properties:
                      kind:
                        description: 'The kind of the deleted resource.'
                        type: string
                      name:
                        description: 'The name of the deleted resource.'
                        type: string
                    type: object
                  type: array
                update:
                  items:
                    properties:
                      kind:
                        description: 'The kind of the updated resource.'
                        type: string
                      name:
                        description: 'The name of the updated resource.'
                        type: string
                    type: object
                  type: array
              type: object
            revision:
              description: |
                The revision number of the application history. It's an integer that will be incremented on
                every change of the application.'
              type: integer
            user:
              description: 'The user name who triggered the change of the application.'
              type: string
            yaml:
              description: |
                The YAML string of the snapshot of the application and it's components.
              type: string
          type: object
        status:
          description: 'The status summarizes the current state of the object.'
          properties:
            observedGeneration:
              description: 'The observedGeneration is the generation most recently observed by the component
                responsible for acting upon changes to the desired state of the resource.'
              format: int64
              type: integer
          type: object
      type: object
  version: v1beta1
  versions:
  - name: v1beta1
    served: true
    storage: true