Skip to content

DeMAF Transformations

This documentation describes in detail the transformations carried out by the DeMAF for each supported deployment technology. Technology-specific deployment models of these deployment technologies are transformed into a unified, technology-agnostic deployment model based on the Essential Deployment Metamodel (EDMM).

We currently support the transformation of the following deployment technologies, explained in detail in separate files:

Deployment Technology Transformation Documentation Dev Version
Ansible Ansible Ansible-DEV
Bash Bash Bash-DEV
Docker Docker -
Helm Helm Helm-DEV
Kubernetes Kubernetes Kubernetes-DEV
Terraform Terraform Terraform-DEV
AWS Cloud Development Kit (CDK) AWS CDK AWSCDK-DEV

For some deployment technologies, we provide a dev-version that reflects the current implementation state including where features are unfinished or need improvement.

Each file describes the technology-specific metamodel of the deployment technology, the mappings and transformation rules from this technology-specific metamodel to the EDMM, and which and how embedded deployment models are detected. In addition, it gives details on how this transformation is carried out. The transformation of most deployment technologies is carried out in 4 general steps:

  • Step 1: Deployment Model Parser
  • Step 2: Main M2M Transformation
  • Step 3: Model Merger
  • Step 4: Post M2M Transformation

EDMM

Here, we describe how the DeMAF implements the Essential Deployment Metamodel (EDMM). The DeMAF uses a general type system for Component and Relation types that we document in DeMAF Type Definitions.

Essential Deployment Metamodel
Hold "Alt" / "Option" to enable pan & zoom

Embedded Deployment Models

Often, a mix of deployment technologies are used to deploy software systems. To this end, deployment technologies provide means to embed the deployment models of other deployment technologies, leading to what we call heterogenuously nested deployment models. Moreover, we refer to the overall deployment model of the software system that contains all embedded deployment mdoels as the system deployment model. We distinguish between two different methods by which one deployment model can embed another deployment model:

Reference Embedding: The embedding deployment model references an external location where the embedded deployment model is defined (for example, a file).

Containment Embedding: The embedded deployment model is specified directly in the embedding deployment model.

A deployment technology can provide means to embed deployment models using either one or both of these methods. The following table shows the methods provided by the deployment technologies to embed deployment models and which of them are currently detected by the DeMAF.

embeds → Ansible AWS CDK Bash Docker Helm Kubernetes Terraform
Ansible R R, C R R R, C R
AWS CDK R, C R R C
Bash R R R R R R R
Docker C R
Helm R C
Kubernetes R
Terraform R R, C R R C R

R = reference embedding, C = containment embedding, bold = detected by the DeMAF

The following subsections explain each embedding in more detail, including technical means and constructs the embedding deployment technology provides to achieve it and how the DeMAF detects this embedding, if applicable.

Ansible

Documentation: Ansible Documentation

Ansible mostly embeds deployment models through dedicated modules provided in official or community collections.

Ansible → Ansible

Reference embedding: A playbook can include playbooks, task files, and roles that are defined in separate files and are executed as part of the playbook.

Ansible → Bash

Reference embedding: A task executes a shell script that is stored in a separate file.

Containment embedding: A task contains shell commands that are executed on the managed host.

  • ansible.builtin.shell executes a command through a shell (/bin/sh by default, configurable with executable), including pipes, redirects, and multi-line scripts.
  • ansible.builtin.command executes a command without a shell, i.e., without shell features such as pipes or environment variable expansion.

Ansible → Docker

Reference embedding: A task runs containers from or builds Docker images, which are defined by a Dockerfile in a separate file or are published in a registry.

Detection: For roles and hosts of plays with docker_container tasks, the DeMAF requests the analysis of the referenced image by the Docker plugin.

Ansible → Helm

Reference embedding: A task installs a Helm chart that is stored in a chart repository or in a local directory.

  • kubernetes.core.helm installs a release of the chart given by chart_ref (a chart in an added repository, a local path, or a URL), optionally with chart_repo_url and chart_version. Values can be contained in the task (release_values, set_values) or referenced (values_files).
  • kubernetes.core.helm_repository adds a chart repository.

Ansible → Kubernetes

Reference embedding: A task applies Kubernetes manifests that are stored in separate files.

Containment embedding: A task contains Kubernetes objects directly in the playbook.

  • kubernetes.core.k8s with resource_definition (alias definition) applies the Kubernetes objects specified inline in YAML.

Ansible → Terraform

Reference embedding: A task applies a Terraform configuration that is stored in a separate directory.

  • community.general.terraform runs terraform apply (or destroy) for the configuration in project_path, with input variables given by variables or variables_files.

AWS CDK

Documentation: AWS CDK Developer Guide, AWS CDK API Reference

The AWS CDK plugin analyzes the synthesized cloud assembly (cdk.out) instead of the CDK source code. Thus, an embedding becomes visible only if the CDK constructs leave a trace in the synthesized CloudFormation templates or asset manifests. This is the case for all embeddings described below.

AWS CDK → Bash

Reference embedding: An EC2 instance executes a shell script that is stored in a separate file when it boots.

Containment embedding: An EC2 instance executes shell commands that are contained in the CDK app when it boots.

AWS CDK → Docker

Reference embedding: A container or a Lambda function runs a Docker image that is published in a registry or built from a Dockerfile in a separate directory.

AWS CDK → Helm

Reference embedding: A Helm chart that is stored in a chart repository or in a local directory is installed on an EKS cluster.

  • cluster.addHelmChart(...) and eks.HelmChart (options) install a release of the chart given by chart, repository, and version, or of a local chart uploaded as an S3 asset (chartAsset). Values can be contained in the CDK app (values). They are synthesized into a custom resource of type Custom::AWSCDK-EKS-HelmChart.

AWS CDK → Kubernetes

Containment embedding: Kubernetes objects applied on an EKS cluster that are specified in the CDK app.

These are containment embeddings because the Kubernetes objects are meant to be defined directly in the CDK app, not in an external file. Even if the objects are read from an external manifest file in the CDK app, they are contained in the synthesized custom resource.

Bash

Documentation: GNU Bash Reference Manual

Bash scripts embed deployment models of other deployment technologies by calling their command line interfaces with the location of the deployment model.

Bash → Ansible

Reference embedding:

Bash → AWS CDK

Reference embedding:

  • cdk deploy synthesizes and deploys the CDK app in the current directory (or given by --app).
  • cdk synth synthesizes the cloud assembly without deploying it.

Bash → Bash

Reference embedding:

Bash → Docker

Reference embedding:

Bash → Helm

Reference embedding:

Detection: The DeMAF detects helm install commands and passes the complete command line, including values given by --set or -f, on to the Helm plugin together with all previous helm repo commands of the script. The Helm plugin executes the helm repo commands and renders the chart by executing the command with install replaced by template, so that the values are considered. Values files given by -f with a relative path are resolved against the working directory of the Helm plugin instead of the directory of the script. helm upgrade --install commands are not detected.

Bash → Kubernetes

Reference embedding:

Detection: The DeMAF detects kubectl commands and requests the analysis of the manifests at the path given by -f.

Bash → Terraform

Reference embedding:

Detection: The DeMAF detects terraform commands and requests the analysis of the configuration in the given directory.

Docker

Documentation: Docker Documentation, Dockerfile reference

Docker → Bash

Containment embedding: A Dockerfile contains shell commands that are executed when the image is built.

Docker → Docker

Reference embedding: An image is built on top of other images that are defined by separate Dockerfiles and published in a registry.

This embedding can only be detected from the Dockerfile, not from the built image: an image does not record which images it was built upon. Although its layers and its history (docker history) include those of its base images, they do not contain their names. Only optional metadata, such as provenance attestations or the OCI annotations org.opencontainers.image.base.name and org.opencontainers.image.base.digest, can reference the base images.

Helm

Documentation: Helm Documentation

Helm → Helm

Reference embedding: A chart depends on other charts (subcharts), which are installed together with it.

  • dependencies in Chart.yaml reference charts by name, version, and repository, optionally with condition, tags, and alias. helm dependency update downloads them into the charts/ directory of the chart.
  • Charts can also contain their subcharts directly in the charts/ directory (see Subcharts and Global Values).

Detection: Subcharts are not analyzed as separate embedded deployment models. However, helm template renders the manifests of the subcharts together with the manifests of the chart, so they are part of the Kubernetes deployment model analyzed by the Kubernetes plugin (see Helm → Kubernetes). This requires the subcharts to be present in the charts/ directory, which is the case for packaged charts from a chart repository; the Helm plugin does not download missing dependencies.

Helm → Kubernetes

Containment embedding: A chart contains Kubernetes manifests, which are rendered and applied when the chart is installed.

  • The files in templates/ are Kubernetes manifests with Go template directives that are rendered with the values of the chart.
  • The files in crds/ are plain manifests of custom resource definitions.

Detection: The DeMAF renders the chart with helm template, including the given values and the subcharts, and requests the analysis of the resulting Kubernetes deployment model by the Kubernetes plugin.

Kubernetes

Documentation: Kubernetes Documentation

Kubernetes → Docker

Reference embedding: Containers run Docker images that are published in a registry.

Detection: For Deployments, StatefulSets, and ReplicaSets, the DeMAF requests the analysis of the referenced images by the Docker plugin.

Terraform

Documentation: Terraform Documentation, Terraform Registry

Terraform → Ansible

Reference embedding: A Terraform configuration executes a playbook that is stored in a separate file.

Terraform → Bash

Reference embedding: A Terraform configuration executes shell scripts that are stored in separate files.

  • The remote-exec provisioner with script or scripts copies scripts to the created resource and executes them there.

Containment embedding: A Terraform configuration contains shell commands.

  • The local-exec provisioner executes command on the machine running Terraform, with /bin/sh -c by default (configurable with interpreter).
  • The remote-exec provisioner with inline executes commands on the created resource.

Provisioners can be attached to any resource, or to a terraform_data (formerly null_resource) resource if they are not related to a specific resource.

Terraform → Docker

Reference embedding: A Terraform configuration runs containers from or builds Docker images, which are defined by a Dockerfile in a separate file or are published in a registry.

Detection: For docker_container resources, the DeMAF requests the analysis of the referenced image by the Docker plugin.

Terraform → Helm

Reference embedding: A Terraform configuration installs a Helm chart that is stored in a chart repository or in a local directory.

  • The helm_release resource of the hashicorp/helm provider installs a release of the chart given by chart, repository, and version, or of a local chart given by its path in chart. The chart can also be given as a local path, as a URL of a packaged chart, or from an OCI registry (repository = "oci://..."). Values can be contained in the configuration (set, set_list, set_sensitive, values) or referenced (values = [file("values.yaml")]).

Detection: For each helm_release resource, the DeMAF creates the following Helm commands and requests their analysis by the Helm plugin:

  • If the repository is a URL: helm repo add <chart> <repository>
  • helm install <name> <repository or chart>/<chart>, extended by --set <name>=<value> for each set entry and by --version <version>

Only values given by set are considered; values given by values, set_list, or set_sensitive are not. Resources without name or chart, or with a set entry without name or value, are skipped.

Note

The --version option is appended to the helm install command without a separating space.

Terraform → Kubernetes

Containment embedding: A Terraform configuration contains Kubernetes objects, specified in HCL.

  • The resources of the hashicorp/kubernetes provider represent Kubernetes objects, e.g., kubernetes_deployment_v1, kubernetes_stateful_set_v1, kubernetes_service_v1, or kubernetes_persistent_volume_claim_v1.
  • The kubernetes_manifest resource contains any Kubernetes object as an HCL object in manifest.

Even if the objects are read from a manifest file, e.g., with yamldecode(file(...)), they are contained in the configuration as HCL objects.

Detection: The DeMAF extracts a Kubernetes deployment model from the following resources, stores it in the models service, and requests its analysis by the Kubernetes plugin. Before, references to variables and other resources in the arguments of the resources are resolved.

Resource type Kubernetes object
kubernetes_deployment, kubernetes_deployment_v1, kubernetes_stateful_set, kubernetes_stateful_set_v1 Deployment
kubernetes_service Service
kubernetes_persistence_volume_claim, kubernetes_persistence_volume_claim_v1 Persistent Volume Claim

Note

The resource types for persistent volume claims are misspelled: the Terraform Kubernetes provider names them kubernetes_persistent_volume_claim(_v1), so persistent volume claims are currently not extracted. kubernetes_service_v1 is not extracted either.

Terraform → Terraform

Reference embedding: A Terraform configuration calls modules, which are Terraform configurations stored in a separate directory or published in a registry.

  • The module block references the module by source (a local path, a Terraform registry address, a Git repository, an HTTP URL, or an S3 bucket), optionally with version, and passes input variables.

Diagram Overview

The following diagram shows an overview of the methods provided by the deployment technologies to embed deployment models (reference embeddings are denoted as aggregations, and containment embeddings are denoted as compositions). Deployment technologies that can embed deployment models of the same technology by reference (e.g., Terraform modules or Docker base images) are marked with the stereotype <<selfEmbedding>>:

classDiagram
    class Ansible
    class Bash
    class Docker
    class Helm
    class Kubernetes
    class Terraform
    class AWSCDK["AWS CDK"]
    <<selfEmbedding>> Ansible
    <<selfEmbedding>> Bash
    <<selfEmbedding>> Docker
    <<selfEmbedding>> Helm
    <<selfEmbedding>> Terraform
    Ansible o-- Bash
    Ansible *-- Bash
    Ansible o-- Docker
    Ansible o-- Helm
    Ansible o-- Kubernetes
    Ansible *-- Kubernetes
    Ansible o-- Terraform
    AWSCDK o-- Bash
    AWSCDK *-- Bash
    AWSCDK o-- Docker
    AWSCDK o-- Helm
    AWSCDK *-- Kubernetes
    Bash o-- Ansible
    Bash o-- AWSCDK
    Bash o-- Docker
    Bash o-- Helm
    Bash o-- Kubernetes
    Bash o-- Terraform
    Docker *-- Bash
    Helm *-- Kubernetes
    Kubernetes o-- Docker
    Terraform o-- Ansible
    Terraform o-- Bash
    Terraform *-- Bash
    Terraform o-- Docker
    Terraform o-- Helm
    Terraform *-- Kubernetes
Hold "Alt" / "Option" to enable pan & zoom