Skip to content

deckhouse/dmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ DMT - Deckhouse Module Tool

The Swiss Knife for Deckhouse Module Development

GitHub Release

Features β€’ Installation β€’ Quick Start β€’ Documentation β€’ Contributing


πŸ“– Overview

DMT (Deckhouse Module Tool) is a comprehensive command-line tool designed to streamline the development, testing, and maintenance of Deckhouse Kubernetes Platform modules. It provides powerful linting capabilities, project bootstrapping, and validation tools to ensure your modules meet quality standards.

Why DMT?

  • βœ… Quality Assurance: Comprehensive linting with 9 specialized linters
  • πŸš€ Fast Development: Bootstrap new modules in seconds
  • πŸ”§ Configurable: Fine-tune linting rules per project
  • 🎯 CI/CD Ready: Perfect for automated pipelines

🎯 Features

πŸ” Advanced Module Linting

DMT includes 9 specialized linters to validate different aspects of your Deckhouse modules:

Linter Purpose Key Checks
Container Container configuration validation Duplicate names, env vars, security contexts, probes, resource limits
Documentation Documentation quality README presence, bilingual support, no cyrillic in English docs
Hooks Hook validation Hook syntax, ingress configurations
Images Image build instructions Dockerfile best practices, werf configuration
Module Module structure module.yaml format, OpenAPI conversions, oss.yaml, license files
NoCyrillic Character encoding Cyrillic characters in code/config files
OpenAPI OpenAPI schemas Schema validation, CRD definitions, naming conventions
RBAC Security policies Role bindings, service accounts, wildcards
Templates Kubernetes templates VPA/PDB settings, Prometheus rules, Grafana dashboards, service ports

πŸš€ Module Bootstrapping

Quickly scaffold new Deckhouse modules with best practices:

  • GitHub/GitLab CI/CD integration
  • Pre-configured project structure
  • Template customization
  • Automated setup for common patterns

βš™οΈ Flexible Configuration

  • Per-module config: Override rules for specific needs
  • Impact levels: Control severity (error/warn)
  • Exclusion rules: Skip checks for specific resources

πŸ“¦ Installation

Method 1: Install Script (Recommended)

Quick one-line installation for Linux and macOS:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/deckhouse/dmt/main/tools/install.sh)"
Alternative installation commands

Using wget:

sh -c "$(wget -qO- https://raw.githubusercontent.com/deckhouse/dmt/main/tools/install.sh)"

Install specific version:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/deckhouse/dmt/main/tools/install.sh)" "" --version v1.0.0

Install to custom directory:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/deckhouse/dmt/main/tools/install.sh)" "" --install-dir ~/bin

See installation guide for more options.

Method 2: Download Binary

Download the latest release for your platform from the releases page.

Supported Platforms:

  • Linux (amd64, arm64)
  • macOS (amd64, arm64)
  • Windows (amd64)

Method 3: Go Install

If you have Go installed (requires Go 1.24+):

go install github.com/deckhouse/dmt@latest

Note: Ensure ~/go/bin is in your PATH after installation.

Method 4: Using trdl

trdl is a tool release delivery system that provides automatic updates and channel management:

# Install from stable channel
trdl use dmt stable

# Or install from alpha channel for latest features
trdl use dmt alpha

Benefits:

  • Automatic updates
  • Channel-based releases (stable, alpha)
  • Cross-platform support
  • Version management

Note: Requires trdl to be installed first.

Verify Installation

dmt --version

πŸš€ Quick Start

Lint Your Modules

Lint a single module:

dmt lint /path/to/your-module

Lint multiple modules:

dmt lint /path/to/modules/

Lint specific directories:

dmt lint ./module-1 ./module-2 ./module-3

Example directory structure:

/path/to/modules/
β”œβ”€β”€ 001-module-one/
β”œβ”€β”€ 002-module-two/
└── 003-module-three/

Bootstrap a New Module

Create a new module with GitHub CI/CD:

dmt bootstrap my-awesome-module

Create with GitLab CI/CD:

dmt bootstrap my-module --pipeline gitlab

Specify target directory:

dmt bootstrap my-module --directory ./modules/my-module

Use custom template:

dmt bootstrap my-module --repository-url https://github.com/myorg/template/archive/main.zip

Note: Module names must be in kebab-case (e.g., my-module-name)


πŸ“š Documentation

Configuration

DMT can be configured using a .dmtlint.yaml file in your project root.

Configuration

linters-settings:
  container:
    impact: error
    exclude-rules:
      # Exclude specific resources from checks
      security-context:
        - kind: Deployment
          name: legacy-app
          container: main
      
      resources:
        - kind: DaemonSet
          name: node-exporter
  
  images:
    impact: warn
    exclude-rules:
      skip-image-file-path-prefix:
        - images/special-case/
  
  documentation:
    impact: error
  
  templates:
    impact: error
    exclude-rules:
      vpa-absent:
        - kind: Deployment
          name: one-off-job

Command Line Options

Lint Command

dmt lint [directories...] [flags]

Flags:

  • --values-file, -v: Specify custom values file
  • --linter: Run specific linter only
  • --hide-warnings: Hide warning-level issues
  • --abs-path: Show absolute paths in output
  • --show-ignored: Display ignored issues
  • --log-level: Set logging verbosity (debug, info, warn, error)

Examples:

# Run only container linter
dmt lint ./my-module --linter container

# Hide warnings
dmt lint ./my-module --hide-warnings

# Use custom values
dmt lint ./my-module --values-file custom-values.yaml

# Debug mode
dmt lint ./my-module --log-level debug

Bootstrap Command

dmt bootstrap <module-name> [flags]

Flags:

  • --pipeline, -p: CI/CD platform (github or gitlab, default: github)
  • --directory, -d: Target directory (default: current directory)
  • --repository-url, -r: Custom template repository URL

Examples:

# GitHub project
dmt bootstrap awesome-module --pipeline github

# GitLab project in specific directory
dmt bootstrap my-module -p gitlab -d ./modules/my-module

# Custom template
dmt bootstrap my-module -r https://example.com/template.zip

🀝 Contributing

We welcome contributions! Here's how you can help:

  1. Report Bugs: Open an issue describing the problem
  2. Suggest Features: Share your ideas for improvements
  3. Submit PRs: Fix bugs or add features
  4. Improve Docs: Help make documentation better

Development Guidelines

  • Follow Go best practices and idioms
  • Add tests for new features
  • Update documentation
  • Run make lint before committing
  • Use conventional commit messages

πŸ”— Links


🌟 Support

If you find DMT helpful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting bugs
  • πŸ’‘ Suggesting features
  • πŸ“– Contributing to documentation
  • πŸ”€ Submitting pull requests

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 10

Languages