Skip to content

Commit b6b3b6c

Browse files
add 'extraDeploy' value to Helm Chart to allow deploying additional r… (#1640)
* add 'extraDeploy' value to Helm Chart to allow deploying additional resources
1 parent 25a6c3c commit b6b3b6c

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed

.helm/starter/README.md

+61-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,63 @@ These sub-headers aim to be a more intuitive entrypoint into customizing your de
3232
### External Postgres
3333
The `AWX.postgres` section simplifies the creation of the external postgres secret. If enabled, the configs provided will automatically be placed in a `postgres-config` secret and linked to the `AWX` resource. For proper secret management, the `AWX.postgres.password` value, and any other sensitive values, can be passed in at the command line rather than specified in code. Use the `--set` argument with `helm install`. Supplying the password this way is not recommended for production use, but may be helpful for initial PoC.
3434

35+
### Additional Kubernetes Resources
36+
The `AWX.extraDeploy` section allows the creation of additional Kubernetes resources. This simplifies setups requiring additional objects that are used by AWX, e.g. using `ExternalSecrets` to create Kubernetes secrets.
37+
38+
Resources are passed as an array, either as YAML or strings (literal "|"). The resources are passed through `tpl`, so templating is possible. Example:
39+
40+
```yaml
41+
AWX:
42+
# enable use of awx-deploy template
43+
...
44+
45+
# configurations for external postgres instance
46+
postgres:
47+
enabled: false
48+
...
49+
50+
extraDeploy:
51+
- |
52+
apiVersion: external-secrets.io/v1beta1
53+
kind: ExternalSecret
54+
metadata:
55+
name: {{ .Release.Name }}-postgres-secret-string-example
56+
namespace: {{ .Release.Namespace }}
57+
labels:
58+
app: {{ .Release.Name }}
59+
spec:
60+
secretStoreRef:
61+
name: vault
62+
kind: ClusterSecretStore
63+
refreshInterval: "1h"
64+
target:
65+
name: postgres-configuration-secret-string-example
66+
creationPolicy: "Owner"
67+
deletionPolicy: "Delete"
68+
dataFrom:
69+
- extract:
70+
key: awx/postgres-configuration-secret
71+
72+
- apiVersion: external-secrets.io/v1beta1
73+
kind: ExternalSecret
74+
metadata:
75+
name: "{{ .Release.Name }}-postgres-secret-yaml-example"
76+
namespace: "{{ .Release.Namespace }}"
77+
labels:
78+
app: "{{ .Release.Name }}"
79+
spec:
80+
secretStoreRef:
81+
name: vault
82+
kind: ClusterSecretStore
83+
refreshInterval: "1h"
84+
target:
85+
name: postgres-configuration-secret-yaml-example
86+
creationPolicy: "Owner"
87+
deletionPolicy: "Delete"
88+
dataFrom:
89+
- extract:
90+
key: awx/postgres-configuration-secret
91+
```
3592
3693
## Values Summary
3794
@@ -43,6 +100,10 @@ The `AWX.postgres` section simplifies the creation of the external postgres secr
43100
| `AWX.spec` | specs to directly configure the AWX resource | `{}` |
44101
| `AWX.postgres` | configurations for the external postgres secret | - |
45102

103+
### extraDeploy
104+
| Value | Description | Default |
105+
|---|---|---|
106+
| `extraDeploy` | array of additional resources to be deployed (supports YAML or literal "\|") | - |
46107

47108
# Contributing
48109

@@ -63,5 +124,3 @@ The chart is currently hosted on the gh-pages branch of the repo. During the rel
63124
Instead of CR, we use `helm repo index` to generate an index from all locally pulled chart versions. Since we build from scratch every time, the timestamps of all entries will be updated. This could be improved by using yq or something similar to detect which tags are already in the index.yaml file, and only merge in tags that are not present.
64125

65126
Not using CR could be addressed in the future by keeping the chart built as a part of releases, as long as CR compares the chart to previous release packages rather than previous commits. If the latter is the case, then we would not have the necessary history for comparison.
66-
67-
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- range .Values.extraDeploy }}
2+
---
3+
{{- if typeIs "string" . }}
4+
{{- tpl . $ }}
5+
{{- else }}
6+
{{- tpl (. | toYaml | nindent 0) $ }}
7+
{{- end }}
8+
{{- end }}

0 commit comments

Comments
 (0)