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 'additionalEnvVars' to the chart #303

Merged
merged 4 commits into from
May 30, 2024

Conversation

Stevenpc3
Copy link
Contributor

@Stevenpc3 Stevenpc3 commented May 29, 2024

Add ability to set additional ENV vars via additionalEnv value.

Array containing extra environment variables which can be templated. You can add this to an additional override file or example putting this in override.yaml

additionalEnv:
  - name: "{{ .Release.Namespace }}"
    value: "{{ .Release.Namespace }}"
  - name: MY_VAR
    value: mySpecialKey
  - name: 1234
    value: 5678
  - name: lottery
    value: 12345
  - name: bool
    value: false
  - name: empty
    value: ""

Then deploy with helm upgrade -i cnpg -n namespace-a charts/cnpg/ -f override.yaml

will generate (partial template below)

image

With these logs

image

Copy link
Collaborator

@itay-grudev itay-grudev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cloudnative-pg.extraEnv doesn't looks like right to me. Does it work with multiple values at all?

charts/cloudnative-pg/Chart.yaml Outdated Show resolved Hide resolved
charts/cloudnative-pg/values.yaml Outdated Show resolved Hide resolved
charts/cloudnative-pg/values.yaml Outdated Show resolved Hide resolved
@Stevenpc3
Copy link
Contributor Author

Stevenpc3 commented May 29, 2024

The cloudnative-pg.extraEnv doesn't looks like right to me. Does it work with multiple values at all?

Yes it does work with multiple values. If you further review my description you can see where I use two values and then pass them in and then highlight the results in the configmap which shows both values passed in.

Signed-off-by: Steven <[email protected]>
@itay-grudev
Copy link
Collaborator

The cloudnative-pg.extraEnv doesn't looks like right to me. Does it work with multiple values at all?

Yes it does work with multiple values. If you further review my description you can see where I use two values and then pass them in and then highlight the results in the configmap which shows both values passed in.

I think the check whether the value is string only makes sense when you wrap your macro in a range - i.e.:

{{- range $e := .Values.additionalEnv }}
{{- include "cloudnative-pg.extraEnv" (dict "value" $e "context" $ ) | nindent 8 }}
{{- end }}

Otherwise .value will always be an array

@itay-grudev
Copy link
Collaborator

And then why don't you always do tpl. If there is no {{ sequence there wouldn't be anything to replace.

@Stevenpc3
Copy link
Contributor Author

The cloudnative-pg.extraEnv doesn't looks like right to me. Does it work with multiple values at all?

Yes it does work with multiple values. If you further review my description you can see where I use two values and then pass them in and then highlight the results in the configmap which shows both values passed in.

I think the check whether the value is string only makes sense when you wrap your macro in a range - i.e.:

{{- range $e := .Values.additionalEnv }}
{{- include "cloudnative-pg.extraEnv" (dict "value" $e "context" $ ) | nindent 8 }}
{{- end }}

Otherwise .value will always be an array

Ranging over means I need to add my own "-" before name for list conversion. Here is teh results of the template above and the override.yaml below. You can see how range changed the items from a list to individial line outputs.

image

@Stevenpc3
Copy link
Contributor Author

And then why don't you always do tpl. If there is no {{ sequence there wouldn't be anything to replace.

Yeah this is good. I made this change and it works well with how I testsed below.

image

Stevenpc3 added 2 commits May 29, 2024 17:51
Signed-off-by: Steven <[email protected]>
@Stevenpc3
Copy link
Contributor Author

I simplified it and used the test cases of [] and the list above. It appears good and not sure I can simplify any further.

Copy link
Collaborator

@phisco phisco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks @Stevenpc3 and @itay-grudev!

@itay-grudev itay-grudev merged commit e364ff6 into cloudnative-pg:main May 30, 2024
4 checks passed
szinn referenced this pull request in szinn/k8s-homelab May 30, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cloudnative-pg](https://cloudnative-pg.io)
([source](https://togithub.com/cloudnative-pg/charts)) | patch |
`0.21.2` -> `0.21.3` |

---

### Release Notes

<details>
<summary>cloudnative-pg/charts (cloudnative-pg)</summary>

###
[`v0.21.3`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.3)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3)

CloudNativePG Operator Helm Chart

#### What's Changed

- Add 'additionalEnvVars' to the chart by
[@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

#### New Contributors

- [@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) made their first
contribution in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3

</details>

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODIuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM4Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9oZWxtIiwidHlwZS9wYXRjaCJdfQ==-->

Co-authored-by: repo-jeeves[bot] <106431701+repo-jeeves[bot]@users.noreply.github.com>
szinn referenced this pull request in szinn/k8s-homelab May 30, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cloudnative-pg](https://cloudnative-pg.io)
([source](https://togithub.com/cloudnative-pg/charts)) | patch |
`0.21.2` -> `0.21.3` |

---

### Release Notes

<details>
<summary>cloudnative-pg/charts (cloudnative-pg)</summary>

###
[`v0.21.3`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.3)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3)

CloudNativePG Operator Helm Chart

#### What's Changed

- Add 'additionalEnvVars' to the chart by
[@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

#### New Contributors

- [@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) made their first
contribution in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3

</details>

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODIuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM4Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9oZWxtIiwidHlwZS9wYXRjaCJdfQ==-->

Co-authored-by: repo-jeeves[bot] <106431701+repo-jeeves[bot]@users.noreply.github.com>
@Stevenpc3 Stevenpc3 deleted the issue/299 branch May 30, 2024 13:05
@Stevenpc3
Copy link
Contributor Author

there was a typo left in this PR. I have made a fix here #305

PrivatePuffin referenced this pull request in truecharts/public May 30, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|  | lockFileMaintenance | All locks refreshed |
| csi-driver-smb | minor | `v1.14.0` -> `v1.15.0` |
| [cloudnative-pg](https://cloudnative-pg.io)
([source](https://togithub.com/cloudnative-pg/charts)) | minor |
`0.20.2` -> `0.21.3` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

🔧 This Pull Request updates lock files to use the latest dependency
versions.

---

### Release Notes

<details>
<summary>cloudnative-pg/charts (cloudnative-pg)</summary>

###
[`v0.21.3`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.3)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3)

CloudNativePG Operator Helm Chart

#### What's Changed

- Add 'additionalEnvVars' to the chart by
[@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

#### New Contributors

- [@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) made their first
contribution in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3

###
[`v0.21.2`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.2)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.1...cloudnative-pg-v0.21.2)

CloudNativePG Operator Helm Chart

#### What's Changed

- Release cloudnative-pg-v0.21.2 by
[@&#8203;leonardoce](https://togithub.com/leonardoce) in
[https://github.com/cloudnative-pg/charts/pull/274](https://togithub.com/cloudnative-pg/charts/pull/274)

#### New Contributors

- [@&#8203;leonardoce](https://togithub.com/leonardoce) made their first
contribution in
[https://github.com/cloudnative-pg/charts/pull/274](https://togithub.com/cloudnative-pg/charts/pull/274)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.1...cloudnative-pg-v0.21.2

###
[`v0.21.1`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.1)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.0...cloudnative-pg-v0.21.1)

CloudNativePG Operator Helm Chart

#### What's Changed

- fix: Bump chart dependency grafana-dashboards to version 0.0.2 by
[@&#8203;dexter136](https://togithub.com/dexter136) in
[https://github.com/cloudnative-pg/charts/pull/270](https://togithub.com/cloudnative-pg/charts/pull/270)

#### New Contributors

- [@&#8203;dexter136](https://togithub.com/dexter136) made their first
contribution in
[https://github.com/cloudnative-pg/charts/pull/270](https://togithub.com/cloudnative-pg/charts/pull/270)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.0...cloudnative-pg-v0.21.1

###
[`v0.21.0`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.0)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.20.2...cloudnative-pg-v0.21.0)

CloudNativePG Operator Helm Chart

#### What's Changed

- chore(deps): update actions/checkout action to v4.1.3 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/cloudnative-pg/charts/pull/260](https://togithub.com/cloudnative-pg/charts/pull/260)
- chore(deps): update helm/kind-action action to v1.10.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/cloudnative-pg/charts/pull/261](https://togithub.com/cloudnative-pg/charts/pull/261)
- Release cloudnative-pg-v0.21.0 by
[@&#8203;github-actions](https://togithub.com/github-actions) in
[https://github.com/cloudnative-pg/charts/pull/266](https://togithub.com/cloudnative-pg/charts/pull/266)

#### New Contributors

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.20.2...cloudnative-pg-v0.21.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on monday" in timezone
Europe/Amsterdam, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNDIuMSIsInVwZGF0ZWRJblZlciI6IjM3LjM4Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbInVwZGF0ZS9oZWxtL3N5c3RlbSJdfQ==-->
@itay-grudev itay-grudev added the chart( operator ) Related to the operator (cloudnative-pg) chart label May 30, 2024
nrdufour pushed a commit to nrdufour/home-ops that referenced this pull request Jun 2, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cloudnative-pg](https://cloudnative-pg.io) ([source](https://github.com/cloudnative-pg/charts)) | patch | `0.21.2` -> `0.21.3` |

---

### Release Notes

<details>
<summary>cloudnative-pg/charts (cloudnative-pg)</summary>

### [`v0.21.3`](https://github.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.3)

[Compare Source](cloudnative-pg/charts@cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3)

CloudNativePG Operator Helm Chart

#### What's Changed

-   Add 'additionalEnvVars' to the chart by [@&#8203;Stevenpc3](https://github.com/Stevenpc3) in cloudnative-pg/charts#303

#### New Contributors

-   [@&#8203;Stevenpc3](https://github.com/Stevenpc3) made their first contribution in cloudnative-pg/charts#303

**Full Changelog**: cloudnative-pg/charts@cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjM4MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.internal/nrdufour/home-ops/pulls/468
Co-authored-by: Renovate <[email protected]>
Co-committed-by: Renovate <[email protected]>
sp3nx0r referenced this pull request in sp3nx0r/homelab Jun 22, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cloudnative-pg](https://cloudnative-pg.io)
([source](https://togithub.com/cloudnative-pg/charts)) | patch |
`0.21.2` -> `0.21.5` |

---

### Release Notes

<details>
<summary>cloudnative-pg/charts (cloudnative-pg)</summary>

###
[`v0.21.5`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.5)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.4...cloudnative-pg-v0.21.5)

CloudNativePG Operator Helm Chart

#### What's Changed

- chore(deps): update actions/checkout action to v4.1.7 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/cloudnative-pg/charts/pull/318](https://togithub.com/cloudnative-pg/charts/pull/318)
- Release cloudnative-pg-v0.21.5 by
[@&#8203;github-actions](https://togithub.com/github-actions) in
[https://github.com/cloudnative-pg/charts/pull/315](https://togithub.com/cloudnative-pg/charts/pull/315)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.4...cloudnative-pg-v0.21.5

###
[`v0.21.4`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.4)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.3...cloudnative-pg-v0.21.4)

CloudNativePG Operator Helm Chart

#### What's Changed

- fix additionalEnv typo in deployment.yaml by
[@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) in
[https://github.com/cloudnative-pg/charts/pull/305](https://togithub.com/cloudnative-pg/charts/pull/305)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.3...cloudnative-pg-v0.21.4

###
[`v0.21.3`](https://togithub.com/cloudnative-pg/charts/releases/tag/cloudnative-pg-v0.21.3)

[Compare
Source](https://togithub.com/cloudnative-pg/charts/compare/cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3)

CloudNativePG Operator Helm Chart

#### What's Changed

- Add 'additionalEnvVars' to the chart by
[@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

#### New Contributors

- [@&#8203;Stevenpc3](https://togithub.com/Stevenpc3) made their first
contribution in
[https://github.com/cloudnative-pg/charts/pull/303](https://togithub.com/cloudnative-pg/charts/pull/303)

**Full Changelog**:
cloudnative-pg/charts@cloudnative-pg-v0.21.2...cloudnative-pg-v0.21.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on saturday" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/sp3nx0r/homelab).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9oZWxtIiwidHlwZS9wYXRjaCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chart( operator ) Related to the operator (cloudnative-pg) chart
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants