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/
./
¶
.deploykf_generator
metadata about the generator:- (JSON format, includes the
generator_schema
version to ensure compatibility with the CLI)
- (JSON format, includes the
default_values.yaml
default values for the generatorhelpers/
helpers that are used in thetemplates/
templates/
templates that are used to generate the output
./templates/
¶
.gomplateignore_template
template of a.gomplateignore
fileapp-of-apps.yaml
an Argo CD app-of-apps (points to./argocd/kustomization.yaml
)argocd/
templates for Argo CD applications and namespacesmanifests/
templates for Helm & Kustomize apps
./templates/argocd/
¶
kustomization.yaml
a Kustomize file pointing toapplications/
andnamespaces/
applications/
templates for Argo CD Applicationsnamespaces/
templates for Kubernetes Namespaces
./templates/argocd/applications/
¶
kustomization.yaml
a Kustomize file pointing to the Argo CD applicationsdeploykf-core/
Argo CD applications fordeploykf-core
deploykf-dependencies/
Argo CD applications fordeploykf-dependencies
deploykf-opt/
Argo CD applications fordeploykf-opt
deploykf-tools/
Argo CD applications fordeploykf-tools
kubeflow-dependencies/
Argo CD applications forkubeflow-dependencies
kubeflow-tools/
Argo CD applications forkubeflow-tools
./templates/argocd/namespaces/
¶
kustomization.yaml
a Kustomize file pointing to the Kubernetes Namespacesdeploykf-core/
Kubernetes Namespaces fordeploykf-core
deploykf-dependencies/
Kubernetes Namespaces fordeploykf-dependencies
deploykf-opt/
Kubernetes Namespaces fordeploykf-opt
deploykf-tools/
Kubernetes Namespaces fordeploykf-tools
kubeflow-dependencies/
Kubernetes Namespaces forkubeflow-dependencies
kubeflow-tools/
Kubernetes Namespaces forkubeflow-tools
./templates/manifests/
¶
kustomization.yaml
a Kustomize file pointing to the Helm & Kustomize appsdeploykf-core/
templated Helm & Kustomize apps fordeploykf-core
deploykf-dependencies/
templated Helm & Kustomize apps fordeploykf-dependencies
deploykf-opt/
templated Helm & Kustomize apps fordeploykf-opt
deploykf-tools/
templated Helm & Kustomize apps fordeploykf-tools
kubeflow-dependencies/
templated Helm & Kustomize apps forkubeflow-dependencies
kubeflow-tools/
templated Helm & Kustomize apps forkubeflow-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:
- Locate the deployKF Generator to use, depending on which arguments were provided:
--source-version
: download a generator ZIP from the GitHub releases ofdeploykf/deploykf
--source-path
: use a local generator ZIP or folder with unzipped generator files
- Unzip or copy the generator into a temporary folder:
- The folder is automatically deleted after the command is run, or if the command fails
- Read the
.deploykf_generator
marker file from the root of the generator:- The
.deploykf_generator
file contains JSON data with information like thegenerator_schema
version - If the CLI does not support the encountered
generator_schema
version, the CLI will exit with an error
- The
- 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
- The CLI will only remove the contents of a non-empty target if there is a
- Render the manifests into
--output-dir
in two phases, using the provided--values
files:- 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
- Note, these files behave like
- 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)
- Note, the resulting output folder will be structured identically to the
- PHASE 1: render the
The output folder will contain a .deploykf_output
marker file with the following information in JSON format:
generated_at
: the time the generator was runsource_version
: the source version that was used (if--source-version
was provided)source_path
: the path of the source artifact that was usedsource_hash
: the SHA256 hash of the source artifact that was usedcli_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.
Created: 2023-04-25