Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'extraDeploy' value to Helm Chart to allow deploying additional r… #1640

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

justsomescripts
Copy link
Contributor

SUMMARY

This PR allows deploying additional resources in the cluster when using the Helm Chart. Resources are defined as an array (either directly in YAML or using literal "|"). That makes it easier to deploy additional objects that are used by AWX, e.g. using ExternalSecrets to create secrets required by AWX, which currently requires manual deployments or using an own Helm Chart.

ISSUE TYPE
  • New or Enhanced Feature
ADDITIONAL INFORMATION

The resources are passed trough tpl, so Helm templating is possible. This feature is also common in other Charts as well, e.g. Bitnami Helm Charts

Example usage

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

@rooftopcellist
Copy link
Member

cc @miles-w-3 for awareness and review

@miles-w-3
Copy link
Contributor

miles-w-3 commented Nov 22, 2023

It's a nice way to avoid needing to downstream/wrap the chart in order to deploy additional resources, cool. Tpl is super powerful because It basically allows the chart to deploy anything. Not too many charts do this but I don't see a problem with it.

Once thing you may want to consider for the yaml case is piping to nindent 0 and chomping the new line at the start, I've found that can be helpful for ensuring whitespace works

@justsomescripts
Copy link
Contributor Author

Once thing you may want to consider for the yaml case is piping to nindent 0 and chomping the new line at the start, I've found that can be helpful for ensuring whitespace works

Could you provide an example to help clarify? I've tried various definitions using different spacing, but I haven't been able to create an incorrect or problematic YAML.

@TheRealHaoLiu
Copy link
Member

@justsomescripts can you put the example that you have in the issue into the doc?

if @miles-w-3 agree with the approach (please indicate via an approval) than we will go ahead and merge this PR

@justsomescripts
Copy link
Contributor Author

@justsomescripts can you put the example that you have in the issue into the doc?

@TheRealHaoLiu sure, I updated the PR.

@miles-w-3
Copy link
Contributor

Sorry for the delay @justsomescripts, I added an example in a comment. It will also help you clean up the indentation without having to tab inside your {{

@rooftopcellist rooftopcellist enabled auto-merge (squash) December 13, 2023 19:17
@rooftopcellist rooftopcellist merged commit b6b3b6c into ansible:devel Dec 13, 2023
6 checks passed
@justsomescripts justsomescripts deleted the devel branch January 12, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants