> For the complete documentation index, see [llms.txt](https://docs.cennso.com/cennso/cdm/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/cennso/cdm/latest/architecture.md).

# Architecture

This document describes the architecture of Cennso Data Mesh (CDM).

Cennso Data Mesh is built on three technical components that manage the communication, configuration, and orchestration within the mesh. These components function in a hierarchy: the CDM Manager and CDM Node serve as low-level foundational elements, while the CDM Provider operates at a higher level to represent and create the mesh entity.

```likec4 dynamicViewVariant=diagram viewId=signaling_deployment
specification {
  element actor {
    notation "Person, User"
    style {
      color secondary
      opacity 35%
      shape person
    }
  }
  element cluster {
    notation "K8S cluster"
    style {
      opacity 35%
      border none
    }
  }
  element provider {
    style {
      color secondary
      opacity 35%
      border none
    }
  }
    element component {
    style {
      color secondary
      opacity 35%
      border none
    }
  }
}

model {
  user = actor 'User' {
    description 'Person who integrates system'
  }
  mc = cluster 'Management Cluster' {

    api1 = component 'Kubernetes API' {
      description 'Kubernetes API for managing resources'
    }
    cdm_provider = provider 'CDM Provider' {
      description 'Component providing CDM services'
    }
    manager = component 'CDM Manager' {
      description 'Component managing CDM operations'
    }
    k8s_provider = provider 'Kubernetes Provider' {
      description 'Component providing Kubernetes services'
    }
    helm_provider = provider 'Helm Provider' {
      description 'Component providing Helm services'
    }
  }
  
  cc = cluster 'Core Cluster' {

    api2 = component 'Kubernetes API' {
      description 'Kubernetes API for managing resources'
    }
    cdm = component 'CDM Instance' {
      description 'Instance of CDM Signaling'
    }
  }
}

views {

  dynamic view signaling_deployment {
    title 'CDM Signaling deployment'

    user
      -> api1 'Creates Mesh.cdm.cennso.com'

    api1
     <- cdm_provider 'Reads Mesh.cdm.cennso.com'
    
    cdm_provider
      -> manager 'Requests credential generation'

    manager
      -> manager 'Generates credentials'
    
    api1
      <- manager 'Stores the generated credentials'

    api1
      <- cdm_provider 'Reads the generated credentials'

    cdm_provider
      -> api1 'Creates Objects.kubernetes.crossplane.io'
    
    k8s_provider
      -> api1 'Reads Objects.kubernetes.crossplane.io'

    k8s_provider
      -> api2 'Creates Secrets in the Core CLuster'
    
    cdm_provider
      -> api1 'Creates Releases.helm-crossplane.io'
    
    helm_provider
      -> api1 'Reads Releases.helm-crossplane.io'
    
    helm_provider
      -> api2 'Deploys CDM Signaling Node to the Core Cluster'
    
    api2
      -> cdm 'Manages the lifecycle of the CDM Signaling Mesh instance'

    include
      user,
      mc,
        api1,
        cdm_provider,
        manager,
        k8s_provider,
        helm_provider,
      cc,
        api2,
        cdm

    style cc {
      color secondary
      opacity 20%
    }
    style mc {
      color secondary
      opacity 20%
    }
  }
}
```

## CDM Node

CDM Node acts as an "opinionated wrapper" for NATS servers, focusing on the technical execution of communication within the mesh. It serves as the primary communication element where permissions are applied. Its core responsibilities include:

- Security and verification: It implements a two-level security model (TLS) for communication and a three-level verification system (operators, accounts, and users) to control what each node can access or see.
- Clustering and availability: It can be run in single mode or High Availability (HA) mode. HA currently uses three nodes but may expand to five or seven in the future.
- Operational stability: Because it caches secrets and credentials (JWTs, certificates, and so on) in memory, the node continues to function even if its underlying secrets are deleted, remaining operational until the pod is restarted.

## CDM Manager

CDM Manager is the central authority for configuration, identity, and permissions. Its key duties are:

- Identity administration: This is a crucial service used to safely create new users and accounts, and link them together. It manages the complex imports and exports that ensure the management cluster has the necessary permissions to communicate with Cennso Portal.
- Secret management: It handles a job that automatically creates the necessary secrets (operators, accounts, users) required to launch a basic CDM Node, specifically for the OAM use case.
- Mesh composition: It defines how operators, accounts, and users are composed to allow a mesh to run across core clusters.
- Discovery and signing: It manages a Discovery mode to broadcast network information and serves as the central point for signing and granting permissions; no permissions are distributed across other components.

## CDM Provider

CDM Provider is a Kubernetes controller and orchestrator that handles the lifecycle of the mesh. Its responsibilities include:

- Automated installation: When a mesh is defined through a Custom Resource Definition (CRD), the provider automates the entire setup. It communicates with CDM Manager to retrieve secrets, copies them using Crossplane objects, and triggers the necessary Helm chart installations.
- Orchestration: It manages the sequential process of mesh creation, which is time-sensitive and requires waiting for specific elements to be ready before proceeding to the next step.
- Resource control: It allows users to control the mesh creation process using a limited set of parameters, such as cluster names and resource (CPU and memory) limits.
- Status and troubleshooting: It provides visibility into the installation process, allowing administrators to identify and troubleshoot failures, such as missing credentials or configuration errors.
