Skip to content

Commit 58ff545

Browse files
committed
v0.3.0
1 parent b61537a commit 58ff545

File tree

15 files changed

+275
-56
lines changed

15 files changed

+275
-56
lines changed

.vscode/launch.json

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"args": [
55
"-n",
66
"sealed-secrets",
7-
"--resource-paths",
7+
"--resources",
88
"sealed-secrets/templates/",
99
"--kustomization-directory",
1010
"."
@@ -20,9 +20,9 @@
2020
"args": [
2121
"-n",
2222
"sealed-secrets",
23-
"--resource-paths",
23+
"--resources",
2424
"sealed-secrets/templates/",
25-
"--patches-strategic-merge-paths",
25+
"--patchesStrategicMerge",
2626
"patches/",
2727
"--kustomization-directory",
2828
".",
@@ -38,9 +38,28 @@
3838
"args": [
3939
"-n",
4040
"sealed-secrets",
41-
"--resource-paths",
41+
"--resources",
4242
"sealed-secrets/templates/",
43-
"--common-labels",
43+
"--commonAnnotations",
44+
"linkerd.io/inject=enabled",
45+
"annotation/iam=true",
46+
"--kustomization-directory",
47+
"."
48+
],
49+
"console": "integratedTerminal",
50+
"cwd": "${workspaceFolder}/examples/commonAnnotations",
51+
"name": "Example - commonAnnotations",
52+
"program": "${workspaceFolder}/src/helmizer.py",
53+
"request": "launch",
54+
"type": "python"
55+
},
56+
{
57+
"args": [
58+
"-n",
59+
"sealed-secrets",
60+
"--resources",
61+
"sealed-secrets/templates/",
62+
"--commonLabels",
4463
"app.kubernetes.io/helmizer=true",
4564
"app.kubernetes.io/yes=false",
4665
"--kustomization-directory",
@@ -52,6 +71,47 @@
5271
"program": "${workspaceFolder}/src/helmizer.py",
5372
"request": "launch",
5473
"type": "python"
74+
},
75+
{
76+
"args": [
77+
"-n",
78+
"cert-manager",
79+
"--resources",
80+
"https://github.com/jetstack/cert-manager/releases/download/v1.1.0/cert-manager.yaml",
81+
"cert-manager/templates/",
82+
"--kustomization-file-name",
83+
"kustomization.yml",
84+
"--kustomization-directory",
85+
"."
86+
],
87+
"console": "integratedTerminal",
88+
"cwd": "${workspaceFolder}/examples/resources",
89+
"name": "Example - resources (URL)",
90+
"program": "${workspaceFolder}/src/helmizer.py",
91+
"request": "launch",
92+
"type": "python"
93+
},
94+
{
95+
"args": [
96+
"--help"
97+
],
98+
"console": "integratedTerminal",
99+
"cwd": "${workspaceFolder}",
100+
"name": "Example - help",
101+
"program": "${workspaceFolder}/src/helmizer.py",
102+
"request": "launch",
103+
"type": "python"
104+
},
105+
{
106+
"args": [
107+
"--version"
108+
],
109+
"console": "integratedTerminal",
110+
"cwd": "${workspaceFolder}",
111+
"name": "Example - version",
112+
"program": "${workspaceFolder}/src/helmizer.py",
113+
"request": "launch",
114+
"type": "python"
55115
}
56116
],
57117
"version": "0.2.0"

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.linting.enabled": true
3+
}

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,28 @@ I began transitioning my helm charts to local templates via [helm template](http
2828
## Usage
2929

3030
```bash
31-
usage: helmizer [-h] [--common-labels [COMMON_LABELS ...]] [--debug] [--dry-run] [--kustomization-file-name KUSTOMIZATION_FILE_NAME] [--namespace NAMESPACE]
32-
[--patches-strategic-merge-paths [PATCHES_STRATEGIC_MERGE_PATHS ...]] [--resource-paths [RESOURCE_PATHS ...]]
31+
usage: helmizer [-h] [--commonAnnotations [COMMON_ANNOTATIONS ...]] [--commonLabels [COMMON_LABELS ...]] [--debug] [--dry-run] [--kustomization-file-name KUSTOMIZATION_FILE_NAME]
32+
[--namespace NAMESPACE] [--patchesStrategicMerge [PATCHES_STRATEGIC_MERGE ...]] [--resources [RESOURCES ...]]
3333
[--resource-absolute-paths [RESOURCE_ABSOLUTE_PATHS ...]] --kustomization-directory KUSTOMIZATION_DIRECTORY [--version]
3434

3535
Helmizer
3636

3737
optional arguments:
3838
-h, --help show this help message and exit
3939

40-
--common-labels [COMMON_LABELS ...]
41-
Common Labels where `=` is the assignment operator e.g key=value (default: None)
40+
--commonAnnotations [COMMON_ANNOTATIONS ...]
41+
Common Annotations where '=' is the assignment operator e.g linkerd.io/inject=enabled (default: None)
42+
--commonLabels [COMMON_LABELS ...]
43+
Common Labels where '=' is the assignment operator e.g labelname=labelvalue (default: None)
4244
--debug Enable debug logging (default: False)
4345
--dry-run Do not write to a file system. (default: True)
4446
--kustomization-file-name KUSTOMIZATION_FILE_NAME
45-
options: `kustomization.yaml`, kustomization.yml, `Kustomization` (default: kustomization.yaml)
47+
options: 'kustomization.yaml', 'kustomization.yml', 'Kustomization' (default: kustomization.yaml)
4648
--namespace NAMESPACE, -n NAMESPACE
4749
Specify namespace in kustomization (default: None)
48-
--patches-strategic-merge-paths [PATCHES_STRATEGIC_MERGE_PATHS ...]
49-
Path(s) to patch directories or files patchStrategicMerge (default: None)
50-
--resource-paths [RESOURCE_PATHS ...]
50+
--patchesStrategicMerge [PATCHES_STRATEGIC_MERGE ...]
51+
Path(s) to patch directories or files patchesStrategicMerge (default: None)
52+
--resources [RESOURCES ...]
5153
Path(s) to resource directories or files (default: None)
5254
--resource-absolute-paths [RESOURCE_ABSOLUTE_PATHS ...]
5355
TODO (default: None)
@@ -58,8 +60,9 @@ optional arguments:
5860
5961
### Examples
6062
63+
- [commonAnnotations](examples/commonAnnotations/)
6164
- [commonLabels](examples/commonLabels/)
62-
- [patchStrategicMerge](examples/patchStrategicMerge/)
65+
- [patchStrategicMerge](examples/patchesStrategicMerge/)
6366
- [resources](examples/resources/)
6467
6568
_With vscode you can utilize the included [launch.json](.vscode/launch.json) to test these more quickly, or reference for your configuration._
@@ -146,7 +149,7 @@ docker run --name helmizer \
146149
--rm \
147150
-v "$PWD"/examples:/tmp/helmizer \
148151
-w /tmp/helmizer \
149-
docker.pkg.github.com/chicken231/helmizer/helmizer:v0.2.0 /usr/src/app/helmizer.py \
152+
docker.pkg.github.com/chicken231/helmizer/helmizer:latest /usr/src/app/helmizer.py \
150153
-n sealed-secrets \
151154
--resource-paths ./resources/sealed-secrets/templates/ \
152155
--kustomization-directory ./resources/ > ./examples/resources/kustomization.yaml
@@ -156,15 +159,15 @@ docker run --name helmizer \
156159

157160
### Supported
158161

162+
- [commonAnnotations](https://kubectl.docs.kubernetes.io/references/kustomize/commonannotations/)
163+
- [commonLabels](https://kubectl.docs.kubernetes.io/references/kustomize/commonlabels/)
159164
- [namespace](https://kubectl.docs.kubernetes.io/references/kustomize/namespace/)
160-
- [resources](https://kubectl.docs.kubernetes.io/references/kustomize/resource/)
161165
- [patchStrategicMerge](https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/)
162-
- [commonLabels](https://kubectl.docs.kubernetes.io/references/kustomize/commonlabels/)
166+
- [resources](https://kubectl.docs.kubernetes.io/references/kustomize/resource/)
163167

164168
### Unsupported (Currently)
165169

166170
- [bases](https://kubectl.docs.kubernetes.io/references/kustomize/bases/)
167-
- [commonAnnotations](https://kubectl.docs.kubernetes.io/references/kustomize/commonannotations/)
168171
- [components](https://kubectl.docs.kubernetes.io/references/kustomize/components/)
169172
- [configMapGenerator](https://kubectl.docs.kubernetes.io/references/kustomize/configmapgenerator/)
170173
- [crds](https://kubectl.docs.kubernetes.io/references/kustomize/crds/)

docker-build-push.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#!/bin/bash
2-
set -ex
2+
set -e
33
TAG="${1}"
4-
docker build -t docker.pkg.github.com/chicken231/helmizer/helmizer:${TAG} -t docker.pkg.github.com/chicken231/helmizer/helmizer:latest .
5-
docker push docker.pkg.github.com/chicken231/helmizer/helmizer:${TAG}
4+
docker build \
5+
-t docker.pkg.github.com/chicken231/helmizer/helmizer:${TAG} \
6+
-t docker.pkg.github.com/chicken231/helmizer/helmizer:latest .
7+
8+
echo "Push to container registry?"
9+
select yn in "Yes" "No"; do
10+
case $yn in
11+
Yes ) docker push docker.pkg.github.com/chicken231/helmizer/helmizer:${TAG};;
12+
No ) echo "No further action being taken"; exit;;
13+
esac
14+
done

examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
**/sealed-secrets/
2+
**/cert-manager/

examples/commonAnnotations/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# commonAnnotations
2+
3+
- [commonAnnotations](#commonannotations)
4+
- [Generating the Helm Template](#generating-the-helm-template)
5+
- [Generate Kustomization](#generate-kustomization)
6+
- [Raw Python](#raw-python)
7+
- [Docker](#docker)
8+
- [Validate](#validate)
9+
10+
---
11+
12+
## Generating the Helm Template
13+
14+
```bash
15+
helm -n sealed-secrets template \
16+
sealed-secrets \
17+
--output-dir . \
18+
--include-crds \
19+
--skip-tests \
20+
--version 1.12.2 \
21+
stable/sealed-secrets
22+
```
23+
24+
## Generate Kustomization
25+
26+
_These assumes you're in the root directory of this repository_
27+
28+
### Raw Python
29+
30+
```bash
31+
python3 ./src/helmizer.py \
32+
-n sealed-secrets \
33+
--resources ./examples/commonAnnotations/sealed-secrets/templates/ \
34+
--commonAnnotations ./examples/commonAnnotations/sealed-secrets/templates/ \
35+
--kustomization-directory ./examples/commonAnnotations/
36+
```
37+
38+
### Docker
39+
40+
```bash
41+
docker run --name helmizer \
42+
--rm \
43+
-v "$PWD":/tmp/helmizer -w /tmp/helmizer \
44+
docker.pkg.github.com/chicken231/helmizer/helmizer:latest /usr/src/app/helmizer.py \
45+
-n sealed-secrets \
46+
--resources ./examples/commonAnnotations/sealed-secrets/templates/ \
47+
--commonAnnotations "app.kubernetes.io/annotation=yeah" "linkerd.io/inject=enabled" \
48+
--kustomization-directory ./examples/commonAnnotations/ > ./examples/commonAnnotations/kustomization.yaml
49+
```
50+
51+
## Validate
52+
53+
```bash
54+
kubectl kustomize .
55+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
commonAnnotations:
3+
app.kubernetes.io/annotation: yeah
4+
linkerd.io/inject: enabled
5+
kind: Kustomization
6+
namespace: sealed-secrets
7+
resources:
8+
- sealed-secrets/templates/deployment.yaml
9+
- sealed-secrets/templates/role-binding.yaml
10+
- sealed-secrets/templates/service.yaml
11+
- sealed-secrets/templates/cluster-role-binding.yaml
12+
- sealed-secrets/templates/cluster-role.yaml
13+
- sealed-secrets/templates/service-account.yaml
14+
- sealed-secrets/templates/sealedsecret-crd.yaml
15+
- sealed-secrets/templates/role.yaml
16+

examples/commonLabels/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Simple Resources
1+
# commonLabels
22

3-
- [Simple Resources](#simple-resources)
3+
- [commonLabels](#commonlabels)
44
- [Generating the Helm Template](#generating-the-helm-template)
55
- [Generate Kustomization](#generate-kustomization)
66
- [Raw Python](#raw-python)
@@ -30,7 +30,8 @@ _These assumes you're in the root directory of this repository_
3030
```bash
3131
python3 ./src/helmizer.py \
3232
-n sealed-secrets \
33-
--resource-paths ./examples/commonLabels/sealed-secrets/templates/ \
33+
--resources ./examples/commonLabels/sealed-secrets/templates/ \
34+
--commonLabels "app.kubernetes.io/helmizer=true" "app.kubernetes.io/yes=false" \
3435
--kustomization-directory ./examples/commonLabels/
3536
```
3637

@@ -40,10 +41,10 @@ python3 ./src/helmizer.py \
4041
docker run --name helmizer \
4142
--rm \
4243
-v "$PWD":/tmp/helmizer -w /tmp/helmizer \
43-
docker.pkg.github.com/chicken231/helmizer/helmizer:v0.2.0 /usr/src/app/helmizer.py \
44+
docker.pkg.github.com/chicken231/helmizer/helmizer:latest /usr/src/app/helmizer.py \
4445
-n sealed-secrets \
45-
--resource-paths ./examples/commonLabels/sealed-secrets/templates/ \
46-
--common-labels "app.kubernetes.io/helmizer=true" "app.kubernetes.io/yes=false" \
46+
--resources ./examples/commonLabels/sealed-secrets/templates/ \
47+
--commonLabels "app.kubernetes.io/helmizer=true" "app.kubernetes.io/yes=false" \
4748
--kustomization-directory ./examples/commonLabels/ > ./examples/commonLabels/kustomization.yaml
4849
```
4950

examples/patchStrategicMerge/README.md renamed to examples/patchesStrategicMerge/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Simple Resources
1+
# patchesStrategicMerge
22

33
## Generating the Helm Template
44

@@ -32,7 +32,7 @@ python3 ./src/helmizer.py \
3232
docker run --name helmizer \
3333
--rm \
3434
-v "$PWD":/tmp/helmizer -w /tmp/helmizer \
35-
docker.pkg.github.com/chicken231/helmizer/helmizer:v0.2.0 /usr/src/app/helmizer.py \
35+
docker.pkg.github.com/chicken231/helmizer/helmizer:latest /usr/src/app/helmizer.py \
3636
-n sealed-secrets \
3737
--resource-paths ./examples/patchStrategicMerge/sealed-secrets/templates/ \
3838
--patches-strategic-merge-paths ./examples/patchStrategicMerge/extra/ \

0 commit comments

Comments
 (0)