Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
[common] Fix env vars even more
Browse files Browse the repository at this point in the history
  • Loading branch information
bjw-s committed Aug 2, 2022
1 parent 78ee353 commit 9710bde
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/stable/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: common
description: Function library for k8s-at-home charts
type: library
version: 4.5.1
version: 4.5.2
kubeVersion: ">=1.16.0-0"
keywords:
- k8s-at-home
Expand Down
10 changes: 8 additions & 2 deletions charts/stable/common/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# common

![Version: 4.5.1](https://img.shields.io/badge/Version-4.5.1-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
![Version: 4.5.2](https://img.shields.io/badge/Version-4.5.2-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)

Function library for k8s-at-home charts

Expand Down Expand Up @@ -237,6 +237,12 @@ All notable changes to this library Helm chart will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [4.5.2]

#### Fixed

- Fixed environment variable processing logic for main container when initContainers or additionalContainers were set.

### [4.5.1]

#### Fixed
Expand Down Expand Up @@ -563,4 +569,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Join our [Discord](https://discord.gg/sTMX7Vh) community

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
Autogenerated from chart metadata using [helm-docs v0.1.1](https://github.com/k8s-at-home/helm-docs/releases/v0.1.1)
6 changes: 6 additions & 0 deletions charts/stable/common/README_CHANGELOG.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ All notable changes to this library Helm chart will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [4.5.2]

#### Fixed

- Fixed environment variable processing logic for main container when initContainers or additionalContainers were set.

### [4.5.1]

#### Fixed
Expand Down
2 changes: 2 additions & 0 deletions charts/stable/common/templates/lib/controller/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ initContainers:
{{- if $container.env -}}
{{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}}
{{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}}
{{- $_ := unset $.ObjectValues "env" -}}
{{- $_ := set $container "env" $newEnv.env }}
{{- end }}
{{- $initContainers = append $initContainers $container }}
Expand All @@ -71,6 +72,7 @@ containers:
{{- $_ := set $ "ObjectValues" (dict "env" $container.env) -}}
{{- $newEnv := fromYaml (include "common.controller.env_vars" $) -}}
{{- $_ := set $container "env" $newEnv.env }}
{{- $_ := unset $.ObjectValues "env" -}}
{{- end }}
{{- $additionalContainers = append $additionalContainers $container }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ tests:

- it: with custom env vars dict should pass
set:
env:
main_env: value
additionalContainers:
additional1:
env:
Expand All @@ -57,6 +59,12 @@ tests:
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[0].env[0]
value:
name: main_env
value: "value"
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].env[0]
Expand Down

0 comments on commit 9710bde

Please sign in to comment.