Skip to content

Architecture of deployKF

Learn about the architecture of deployKF and its components.


Overview

deployKF has three user-facing components:

Component
(Click for Details)
Description
deployKF Generator A versioned .zip package with the templates and helpers needed to generate the manifests
deployKF CLI A command line program to generate a the Kubernetes manifests, from configs provided in one or more values files
deployKF ArgoCD Plugin A plugin for ArgoCD which allows you to use deployKF without rendering manifests into a git repo

deployKF Generator

The deployKF Generator is a versioned ZIP package which contains all the templates and helpers needed to generate the output folders.

The generator is developed in the deployKF/deployKF GitHub repo.

Generator Templates

The generator templates are rendered using a version of gomplate that is embedded in the deployKF CLI.

Note, the template delimiters are set to {{< and >}} as to avoid conflicts with Helm and other Go-like templates.

Generator ZIP Structure

Tree View

.
├── .deploykf_generator
├── default_values.yaml
├── helpers/
└── templates/
    ├── .gomplateignore_template
    ├── app-of-apps.yaml
    ├── argocd/
    │   ├── kustomization.yaml
    │   ├── applications/
    │   │   ├── kustomization.yaml
    │   │   ├── namespaces.yaml
    │   │   ├── deploykf-core/
    │   │   ├── deploykf-dependencies/
    │   │   ├── deploykf-opt/
    │   │   ├── deploykf-tools/
    │   │   ├── kubeflow-dependencies/
    │   │   └── kubeflow-tools/
    │   └── namespaces/
    │       ├── kustomization.yaml
    │       ├── deploykf-core/
    │       ├── deploykf-dependencies/
    │       ├── deploykf-opt/
    │       ├── deploykf-tools/
    │       ├── kubeflow-dependencies/
    │       └── kubeflow-tools/
    └── manifests/
        ├── deploykf-core/
        ├── deploykf-dependencies/
        ├── deploykf-opt/
        ├── deploykf-tools/
        ├── kubeflow-dependencies/
        └── kubeflow-tools/

./

./templates/

  • .gomplateignore_template template of a .gomplateignore file
  • app-of-apps.yaml an Argo CD app-of-apps (points to ./argocd/kustomization.yaml)
  • argocd/ templates for Argo CD applications and namespaces
  • manifests/ templates for Helm & Kustomize apps

./templates/argocd/

  • kustomization.yaml a Kustomize file pointing to applications/ and namespaces/
  • applications/ templates for Argo CD Applications
  • namespaces/ templates for Kubernetes Namespaces

./templates/argocd/applications/

./templates/argocd/namespaces/

./templates/manifests/

  • kustomization.yaml a Kustomize file pointing to the Helm & Kustomize apps
  • deploykf-core/ templated Helm & Kustomize apps for deploykf-core
  • deploykf-dependencies/ templated Helm & Kustomize apps for deploykf-dependencies
  • deploykf-opt/ templated Helm & Kustomize apps for deploykf-opt
  • deploykf-tools/ templated Helm & Kustomize apps for deploykf-tools
  • kubeflow-dependencies/ templated Helm & Kustomize apps for kubeflow-dependencies
  • kubeflow-tools/ templated Helm & Kustomize apps for kubeflow-tools

deployKF CLI

The deployKF CLI is a command line program written in Go.

The CLI is developed in the deployKF/cli GitHub repo.

deploykf generate

Code

The code which defines the deploykf generate command is found in cmd/deploykf/generate.go.

Implementation

The deploykf generate command is implemented as follows:

  1. Locate the deployKF Generator to use, depending on which arguments were provided:
  2. Unzip or copy the generator into a temporary folder:
    • The folder is automatically deleted after the command is run, or if the command fails
  3. Read the .deploykf_generator marker file from the root of the generator:
    • The .deploykf_generator file contains JSON data with information like the generator_schema version
    • If the CLI does not support the encountered generator_schema version, the CLI will exit with an error
  4. Clean the folder currently at the --output-dir target:
    • The CLI will only remove the contents of a non-empty target if there is a .deploykf_output marker file at its root
  5. Render the manifests into --output-dir in two phases, using the provided --values files:
    1. PHASE 1: render the .gomplateignore_template files into .gomplateignore files (still in the temporary folder)
      • Note, these files behave like .gitignore files, and are used to exclude files from the output in the second phase
    2. PHASE 2: render the templates from the templates folder into the --output-dir
      • Note, the resulting output folder will be structured identically to the templates folder (subject to the .gomplateignore files)

The output folder will contain a .deploykf_output marker file with the following information in JSON format:

  • generated_at: the time the generator was run
  • source_version: the source version that was used (if --source-version was provided)
  • source_path: the path of the source artifact that was used
  • source_hash: the SHA256 hash of the source artifact that was used
  • cli_version: the version of the deployKF CLI that was used

deployKF ArgoCD Plugin

The deployKF ArgoCD Plugin is a plugin for ArgoCD which allows you to use deployKF without rendering manifests into a git repo (or using the CLI directly).

The plugin is developed in the deployKF/deployKF GitHub repo.


Last update: 2024-05-10
Created: 2024-05-10