What is a Model?
A Model serves as a packaging unit that bundles related infrastructure definitions together. Each model is versioned and can contain:- Components - Infrastructure resource definitions (Pods, Services, Istio VirtualServices, etc.)
- Relationships - How components interact and depend on each other
- Policies - Rules governing component behavior and constraints
- Connections - Integration definitions for external systems
- Credentials - Authentication schemas for accessing resources
Models are the foundation of Meshery’s extensibility. Without models and their registrants, Meshery cannot manage any infrastructure.
Key Characteristics
Versioned and Portable
Models are:- Versioned: Each model has semantic versioning (e.g., kubernetes v1.28.0)
- Portable: Can be exported as OCI-compatible images
- Shareable: Published to registries for reuse
- Immutable: Specific versions don’t change
Comprehensive Coverage
Models represent diverse infrastructure:- Kubernetes native resources - Pods, Deployments, Services, ConfigMaps
- Service meshes - Istio, Linkerd, Consul, Kuma
- Cloud providers - AWS, Azure, GCP resources
- Observability tools - Prometheus, Grafana, Jaeger
- Databases - PostgreSQL, MySQL, MongoDB operators
- Custom applications - Your own infrastructure definitions
Extensible Architecture
Models support:- Defining custom components
- Creating new relationships
- Adding custom policies
- Extending existing models
- Building model hierarchies
Models in the Architecture
Models are stored in Meshery’s Registry: Registry responsibilities:- Store and index models
- Manage model versions
- Enable model discovery
- Track model relationships
- Provide model APIs
Model Structure
Models are defined with metadata and packaged contents:Model Metadata
Key metadata fields: Identity:name- Unique model identifierversion- Semantic versiondisplayName- Human-readable name
category- Model categorization (e.g., “Orchestration & Management”)subCategory- Finer-grained classification
primaryColor- Brand color for UIsecondaryColor- Accent colorsvgColor- Colored iconsvgWhite- White icon for dark backgrounds
source- Origin URL (GitHub, docs, etc.)metadata- Additional context
Component Definitions
Components within a model define infrastructure capabilities:Relationship Definitions
Relationships describe component interactions: Relationship types:- Hierarchical - Parent-child relationships (Deployment → Pod)
- Edge - Network connections (Service → Pod)
- Sibling - Peer relationships (Pod ↔ Pod)
- Binding - Configuration bindings (ConfigMap → Deployment)
Model Registration
Models are registered in Meshery through registrants:What is a Registrant?
A registrant is a component that registers models with Meshery Server: Registrant types:- Meshery Server - Built-in models
- Meshery Adapters - Service mesh models (Istio, Linkerd, etc.)
- MeshSync - Discovered CRDs and operators
- Manual imports - User-uploaded models
- OCI registries - Pulled model images
- Registrant starts and connects to Meshery Server
- Registrant provides model definitions
- Server validates model schema
- Components registered in capability registry
- Relationships indexed for evaluation
- Models become available for use
Model Discovery
MeshSync automatically discovers models:- Custom Resource Definitions (CRDs)
- Operator-managed resources
- Service mesh components
- Observability integrations
Model Lifecycle
Importing Models
Via Meshery UI:- Navigate to Registry → Models
- Click “Import Model”
- Upload model file or provide URL
- Review and confirm import
Exporting Models
As OCI Image:Versioning Models
Models follow semantic versioning:- Same name + version = duplicate (rejected)
- Different versions can coexist
- Designs specify which version to use
- Default to latest version if not specified
Built-in Models
Meshery includes models for popular infrastructure:Kubernetes Core
Model:kubernetesComponents: Pod, Service, Deployment, StatefulSet, DaemonSet, Job, CronJob, ConfigMap, Secret, Ingress, NetworkPolicy, PersistentVolume, PersistentVolumeClaim, ServiceAccount, Role, RoleBinding, and more.
Service Meshes
Istio Model:- VirtualService, DestinationRule, Gateway, ServiceEntry
- EnvoyFilter, Sidecar, WorkloadEntry, WorkloadGroup
- AuthorizationPolicy, PeerAuthentication, RequestAuthentication
- ServiceProfile, TrafficSplit
- HTTPRoute, TCPRoute
- ServiceDefaults, ServiceResolver, ServiceRouter, ServiceSplitter
- ProxyDefaults, IngressGateway, TerminatingGateway
Observability
Prometheus Model:- ServiceMonitor, PodMonitor, PrometheusRule
- Prometheus, Alertmanager, ThanosRuler
- Dashboard, Datasource, Folder
- GrafanaNotificationPolicy, GrafanaNotificationChannel
Cloud Providers
AWS Models:- EC2, EKS, RDS, S3, Lambda, DynamoDB
- VPC, IAM, CloudFront, Route53
Creating Custom Models
Model Definition Template
Component Schema
Define component schemas using JSON Schema:Relationship Definition
Define how components relate:Model Portability
OCI Image Format
Models export as OCI-compatible images: Image structure:- Standard container registry storage
- Version control through tags
- Access control via registry permissions
- Bandwidth-efficient layer caching
Intellectual Property Protection
Model packaging protects custom work: Encapsulation:- Package proprietary components
- Hide implementation details
- Control distribution
- Enforce licensing
- Private registries for internal use
- Public registries for community sharing
- Selective component exposure
- Watermarking and attribution
Model Registry
The registry is Meshery’s model database: Registry capabilities:- Store all registered models
- Index components for fast lookup
- Track relationship definitions
- Manage model versions
- Provide search and discovery
- Enable model querying
Design Principles
Meshery Models adhere to key design principles:1. Comprehensive
Represent wide range of cloud native resources:- Core infrastructure (Kubernetes, VMs)
- Service meshes and networking
- Observability and monitoring
- Security and policy
- Databases and storage
- Custom applications
2. Extensible
Support customization and extension:- Add new components to existing models
- Define custom relationships
- Create entirely new models
- Override default behaviors
3. User-Centric
Designed for ease of use:- Intuitive component naming
- Clear relationship semantics
- Visual representations
- Documentation and examples
4. Machine-Readable
Enable automation:- Structured schemas (JSON, YAML)
- Programmatic access via APIs
- Integration with CI/CD
- Infrastructure as Code support
Best Practices
Model Design
- Single responsibility: One model per logical infrastructure domain
- Semantic naming: Use clear, descriptive names
- Version compatibility: Follow semantic versioning strictly
- Documentation: Include descriptions and examples
- Testing: Validate models before publishing
Component Definitions
- Complete schemas: Define all component properties
- Validation rules: Use JSON Schema constraints
- Defaults: Provide sensible default values
- Examples: Include usage examples
- Metadata: Add display names, descriptions, icons
Relationship Mapping
- Explicit relationships: Define all component interactions
- Correct semantics: Use appropriate relationship types
- Bidirectional: Consider both directions of relationships
- Policy enforcement: Use policies to validate relationships
Model Distribution
- Versioning: Bump versions appropriately
- Changelog: Document changes between versions
- Deprecation: Mark deprecated components clearly
- Migration guides: Help users upgrade
Models having the same name and version are considered duplicates and will be rejected during registration.
Related Concepts
- Components - Building blocks within models
- Relationships - Component interaction definitions
- Designs - Using model components in deployments
- Registry - Model storage and discovery
- Policies - Governance and constraints