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_generatormetadata about the generator:- (JSON format, includes the
generator_schemaversion to ensure compatibility with the CLI)
- (JSON format, includes the
default_values.yamldefault values for the generatorhelpers/helpers that are used in thetemplates/templates/templates that are used to generate the output
./templates/¶
.gomplateignore_templatetemplate of a.gomplateignorefileapp-of-apps.yamlan 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.yamla Kustomize file pointing toapplications/andnamespaces/applications/templates for Argo CD Applicationsnamespaces/templates for Kubernetes Namespaces
./templates/argocd/applications/¶
kustomization.yamla Kustomize file pointing to the Argo CD applicationsdeploykf-core/Argo CD applications fordeploykf-coredeploykf-dependencies/Argo CD applications fordeploykf-dependenciesdeploykf-opt/Argo CD applications fordeploykf-optdeploykf-tools/Argo CD applications fordeploykf-toolskubeflow-dependencies/Argo CD applications forkubeflow-dependencieskubeflow-tools/Argo CD applications forkubeflow-tools
./templates/argocd/namespaces/¶
kustomization.yamla Kustomize file pointing to the Kubernetes Namespacesdeploykf-core/Kubernetes Namespaces fordeploykf-coredeploykf-dependencies/Kubernetes Namespaces fordeploykf-dependenciesdeploykf-opt/Kubernetes Namespaces fordeploykf-optdeploykf-tools/Kubernetes Namespaces fordeploykf-toolskubeflow-dependencies/Kubernetes Namespaces forkubeflow-dependencieskubeflow-tools/Kubernetes Namespaces forkubeflow-tools
./templates/manifests/¶
kustomization.yamla Kustomize file pointing to the Helm & Kustomize appsdeploykf-core/templated Helm & Kustomize apps fordeploykf-coredeploykf-dependencies/templated Helm & Kustomize apps fordeploykf-dependenciesdeploykf-opt/templated Helm & Kustomize apps fordeploykf-optdeploykf-tools/templated Helm & Kustomize apps fordeploykf-toolskubeflow-dependencies/templated Helm & Kustomize apps forkubeflow-dependencieskubeflow-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_generatormarker file from the root of the generator:- The
.deploykf_generatorfile contains JSON data with information like thegenerator_schemaversion - If the CLI does not support the encountered
generator_schemaversion, the CLI will exit with an error
- The
- Clean the folder currently at the
--output-dirtarget:- The CLI will only remove the contents of a non-empty target if there is a
.deploykf_outputmarker 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-dirin two phases, using the provided--valuesfiles:- PHASE 1: render the
.gomplateignore_templatefiles into.gomplateignorefiles (still in the temporary folder)- Note, these files behave like
.gitignorefiles, 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
templatesfolder into the--output-dir- Note, the resulting output folder will be structured identically to the
templatesfolder (subject to the.gomplateignorefiles)
- 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-versionwas 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