Skip to content

Commit

Permalink
chore(hook): add ability to set hook annotaitons
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjohnburton committed Aug 14, 2023
1 parent ac1df15 commit a590495
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test.*.yaml
test.*.*
.idea
2 changes: 1 addition & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ maintainers:

type: application

version: 0.1.1
version: 0.1.2

appVersion: "0.8.7"
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ metadata:
"helm.sh/hook": post-install
"helm.sh/hook-weight": "-5"
"helm.sh/hook-delete-policy": hook-succeeded, hook-failed
{{- with .Values.hook.extraAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
template:
metadata:
Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions charts/node/tests/hook_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
suite: hook tests
templates:
- hook-create-keys.yaml
- hook-rbac.yaml
tests:
- it: should template the create-keys hook if generateKeysOnStart is true
set:
common.keys.generateKeysOnStart: true
asserts:
- hasDocuments:
count: 1
template: hook-create-keys.yaml
- hasDocuments:
count: 3
template: hook-rbac.yaml
- isKind:
of: Job
template: hook-create-keys.yaml
- isKind:
of: ServiceAccount
template: hook-rbac.yaml
documentIndex: 0
- isKind:
of: Role
template: hook-rbac.yaml
documentIndex: 1
- isKind:
of: RoleBinding
template: hook-rbac.yaml
documentIndex: 2
- it: should create annotations on the job if set
set:
common.keys.generateKeysOnStart: true
hook.extraAnnotations:
foo: bar
asserts:
- hasDocuments:
count: 1
template: hook-create-keys.yaml
- equal:
path: metadata.annotations.foo
value: bar
documentIndex: 0
template: hook-create-keys.yaml
5 changes: 5 additions & 0 deletions charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,10 @@ cli:
# -- chainflip-cli image pull policy
pullPolicy: Always

# -- hook configuration
hook:
# -- add extra annotations to the create-keys hook
extraAnnotations: {}

# -- create extra kubernetes manifests
extraManifests: []

0 comments on commit a590495

Please sign in to comment.