Skip to content

Commit

Permalink
add 'extraDeploy' value to Helm Chart to allow deploying additional r… (
Browse files Browse the repository at this point in the history
#1640)

* add 'extraDeploy' value to Helm Chart to allow deploying additional resources
  • Loading branch information
justsomescripts authored Dec 13, 2023
1 parent 25a6c3c commit b6b3b6c
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
63 changes: 61 additions & 2 deletions .helm/starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,63 @@ These sub-headers aim to be a more intuitive entrypoint into customizing your de
### External Postgres
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.

### Additional Kubernetes Resources
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.

This comment has been minimized.

Copy link
@heinzelmannm

heinzelmannm Aug 1, 2024

@justsomescripts: The 'extraDeploy' section must be on root level instead nested in 'AWX'

This comment has been minimized.

Copy link
@justsomescripts

justsomescripts Aug 2, 2024

Author Contributor

You're right, thanks. I overlooked this. Fixed in #1932


Resources are passed as an array, either as YAML or strings (literal "|"). The resources are passed through `tpl`, so templating is possible. Example:

```yaml
AWX:
# enable use of awx-deploy template
...

# configurations for external postgres instance
postgres:
enabled: false
...

extraDeploy:
- |
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: {{ .Release.Name }}-postgres-secret-string-example
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Release.Name }}
spec:
secretStoreRef:
name: vault
kind: ClusterSecretStore
refreshInterval: "1h"
target:
name: postgres-configuration-secret-string-example
creationPolicy: "Owner"
deletionPolicy: "Delete"
dataFrom:
- extract:
key: awx/postgres-configuration-secret
- apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "{{ .Release.Name }}-postgres-secret-yaml-example"
namespace: "{{ .Release.Namespace }}"
labels:
app: "{{ .Release.Name }}"
spec:
secretStoreRef:
name: vault
kind: ClusterSecretStore
refreshInterval: "1h"
target:
name: postgres-configuration-secret-yaml-example
creationPolicy: "Owner"
deletionPolicy: "Delete"
dataFrom:
- extract:
key: awx/postgres-configuration-secret
```
## Values Summary
Expand All @@ -43,6 +100,10 @@ The `AWX.postgres` section simplifies the creation of the external postgres secr
| `AWX.spec` | specs to directly configure the AWX resource | `{}` |
| `AWX.postgres` | configurations for the external postgres secret | - |

### extraDeploy
| Value | Description | Default |
|---|---|---|
| `extraDeploy` | array of additional resources to be deployed (supports YAML or literal "\|") | - |

# Contributing

Expand All @@ -63,5 +124,3 @@ The chart is currently hosted on the gh-pages branch of the repo. During the rel
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.

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.


8 changes: 8 additions & 0 deletions .helm/starter/templates/extra-list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- range .Values.extraDeploy }}
---
{{- if typeIs "string" . }}
{{- tpl . $ }}
{{- else }}
{{- tpl (. | toYaml | nindent 0) $ }}
{{- end }}
{{- end }}

0 comments on commit b6b3b6c

Please sign in to comment.