Skip to content

Commit

Permalink
v0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DaemonDude23 committed Apr 11, 2022
1 parent e790530 commit d30b82d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ repos:
- id: requirements-txt-fixer
- id: check-ast
repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v4.1.0
rev: v4.2.0
- hooks:
- id: black
language_version: python3.9
args:
- --line-length
- "140"
repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.3.0
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
Expand Down
12 changes: 0 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,6 @@
"program": "${workspaceFolder}/src/helmizer.py",
"request": "launch",
"type": "python"
},
{
"args": [
"--debug",
"/home/drew/Nextcloud/TECH/git/private/lab-k8s/flux/kustomize/helm/cert-manager/helmizer.yaml"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"name": "TEMP",
"program": "${workspaceFolder}/src/helmizer.py",
"request": "launch",
"type": "python"
}
],
"version": "0.2.0"
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"*test.py"
],
"python.testing.pytestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.unittestEnabled": false,
"python.testing.promptToConfigure": false,
"python.pythonPath": "/home/drew/Nextcloud/TECH/git/private/helmizer/venv/bin/python"
"python.defaultInterpreterPath": "./helmizer/venv/bin/python"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

- [Changelog](#changelog)
- [v0.11.0](#v0110)
- [v0.10.0](#v0100)
- [v0.9.1](#v091)
- [v0.9.0](#v090)
Expand All @@ -15,6 +16,18 @@

---

## [v0.11.0](https://github.com/DaemonDude23/helmizer/releases/tag/v0.11.0)

April 11 2022

**Enhancements**

- Added support for `buildMetadata and `patches`.

**Housekeeping**

- Cleaned up vscode configs.

## [v0.10.0](https://github.com/DaemonDude23/helmizer/releases/tag/v0.10.0)

January 21 2022
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@

## About

**TLDR**

Generates a `kustomization.yaml file`, optionally providing the ability to run commands (e.g. `helm template`) on your OS prior to generating a kustomization, and will compose the kustomization fields that deal with file paths (e.g. `resources`) with glob-like features, as well as pass-through all other kustomization configuration properties. No need to explicitly enumerate every file to be kustomized individually.

It takes a config file as input, telling **Helmizer** if you want to run any commands. Then if you give it one or more directories for `resources`, for example, it will recursively lookup all of those files and render them into your kustomization.yaml. Want to skip including one file like `templates/secret.yaml`? Just add the relative path to `helmizer.ignore` to `helmizer.yaml`.

---

[Thou shall not _glob_](https://github.com/kubernetes-sigs/kustomize/issues/3205), said the **kustomize** developers (thus far).

**Helmizer** takes various inputs from a YAML config file (`helmizer.yaml` by default) and constructs a [kustomization file](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/) from those inputs. It can run a sequence of commands before rendering the kustomization file.

Instead of manually entering the paths to [`resources`](https://kubectl.docs.kubernetes.io/references/kustomize/resource/) in a kustomization file, this tool will walk any number of directories containing resources and populate the kustomization with these resources. Or only pull in individual files, it's your choice.

I began transitioning my `helm` charts to local templates via [`helm template`](https://helm.sh/docs/helm/helm_template/), which were then applied to the cluster separately via [Kustomize](https://kustomize.io/). I didn't enjoy having to manually manage the relative paths to files in the **kustomization**. I wanted a repeatable process to generate **Kubernetes** manifests from a helm chart, _and_ tack on any patches or related resources later with a single command. Thus, **helmizer**. **But [Helm](https://helm.sh/) is in no way required to make this tool useful** - have it walk your raw manifests as well.

**TLDR**

Provides the ability to run commands (e.g. `helm template`) on your OS prior to generating a kustomization, and will compose the kustomization fields that deal with file paths (e.g. `resources`) with glob-like features, as well as pass-through all other kustomization configurations. No need to explicitly enumerate every file individually.
I began transitioning my `helm` charts to local manifests via [`helm template`](https://helm.sh/docs/helm/helm_template/), which were then applied to the cluster separately via [Kustomize](https://kustomize.io/). I didn't enjoy having to manually manage the relative paths to files in the **kustomization**. I wanted a repeatable process to generate **Kubernetes** manifests from a helm chart, _and_ tack on any patches or related resources later with a single command. Thus, **helmizer**. **But [Helm](https://helm.sh/) is in no way required to make this tool useful** - have it walk your raw manifests as well. This is just a wrapper that allows combining steps, and glob-like behavior, to managing `kustomization.yaml` files.

## Usage

Expand Down Expand Up @@ -157,7 +161,7 @@ kustomize: # this is essentially an overlay for your eventual kustomization.yam
For local installation/use of the raw script, I use a local virtual environment to isolate dependencies:

```bash
git clone https://github.com/DaemonDude23/helmizer.git -b v0.10.0
git clone https://github.com/DaemonDude23/helmizer.git -b v0.11.0
cd helmizer
```

Expand Down Expand Up @@ -274,7 +278,7 @@ In this example (*Nix OS), we're redirecting program output to the (e.g. `kustom
docker run --name helmizer \
--rm \
-v "$PWD"/examples:/tmp/helmizer -w /tmp/helmizer \
docker.pkg.github.com/DaemonDude23/helmizer/helmizer:v0.10.0 /usr/src/app/helmizer.py \
docker.pkg.github.com/DaemonDude23/helmizer/helmizer:v0.11.0 /usr/src/app/helmizer.py \
./resources/ > ./examples/resources/kustomization.yaml
```

Expand Down
10 changes: 2 additions & 8 deletions src/helmizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, helmizer_config, arguments):
pass

# get lists
for key in ["configMapGenerator", "images", "patchesJson6902", "replicas", "replacements", "vars"]:
for key in ["buildMetadata", "configMapGenerator", "images", "patches", "patchesJson6902", "replicas", "replacements", "vars"]:
try:
list_key = self.get_list(key)
if list_key:
Expand Down Expand Up @@ -216,10 +216,8 @@ def get_dict(self, key):
logging.debug(f"{key}: {dict_raw_yaml}")
except NotFoundError:
logging.debug(f"key not found: {key}")
pass
except KeyError:
logging.debug(f"key not found: {key}")
pass
except TypeError:
pass
return dict_raw_yaml
Expand All @@ -232,10 +230,8 @@ def get_str(self, key):
logging.debug(f"{key}: {str_raw_yaml}")
except NotFoundError:
logging.debug(f"key not found: {key}")
pass
except KeyError:
logging.debug(f"key not found: {key}")
pass
except TypeError:
pass
return str_raw_yaml
Expand All @@ -248,10 +244,8 @@ def get_list(self, key):
logging.debug(f"{key}: {list_raw_yaml}")
except NotFoundError:
logging.debug(f"key not found: {key}")
pass
except KeyError:
logging.debug(f"key not found: {key}")
pass
except TypeError:
pass
return list_raw_yaml
Expand Down Expand Up @@ -335,7 +329,7 @@ def init_arg_parser():
help="quiet output from subprocesses",
default=False,
)
args.add_argument("--version", "-v", action="version", version="v0.10.0")
args.add_argument("--version", "-v", action="version", version="v0.11.0")
args.add_argument(
"helmizer_config",
action="store",
Expand Down

0 comments on commit d30b82d

Please sign in to comment.