Skip to content

Commit

Permalink
Merge pull request #34 from ndustrialio/feat/envvar-map
Browse files Browse the repository at this point in the history
feat(deployment): add `extraEnvVarsMap`
  • Loading branch information
kalinon authored Jan 4, 2022
2 parents ff6f005 + d1e5451 commit 340281f
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 35 deletions.
4 changes: 2 additions & 2 deletions ndustrial/deployment/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ maintainers:
- email: devops@ndustrial.io
name: DevOps
# Please make sure that version and appVersion are always the same.
version: 0.1.21
appVersion: 0.1.21
version: 0.1.22
appVersion: 0.1.22
3 changes: 2 additions & 1 deletion ndustrial/deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
| `ingress.pathType` | Ingress path type | `ImplementationSpecific` |
| `ingress.apiVersion` | Force Ingress API version (automatically detected if not set) | `nil` |
| `ingress.hostname` | Default host for the ingress record | `chart-example.local` |
| `ingress.path` | Default path for the ingress record | `ImplementationSpecific` |
| `ingress.path` | Default path for the ingress record | `/` |
| `ingress.annotations` | Additional custom annotations for the ingress record | `{}` |
| `ingress.tls` | Enable TLS configuration for the host defined at `ingress.hostname` parameter | `false` |
| `ingress.certManager` | Add the corresponding annotations for cert-manager integration | `false` |
Expand Down Expand Up @@ -142,6 +142,7 @@
| `lifecycleHooks` | Add lifecycle hooks to the Deployment deployment | `{}` |
| `shareProcessNamespace` | Share a single process namespace between all of the containers in a pod. When this is set containers will be able to view and signal processes from other containers in the same pod, and the first process in each container will not be assigned PID 1. HostPID and ShareProcessNamespace cannot both be set. Optional: Default to false. | `false` |
| `extraEnvVars` | Add extra environment variables to the Deployment container | `[]` |
| `extraEnvVarsMap` | Add extra environment variables to the Deployment container | `{}` |
| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` |
| `extraEnvVarsCMs` | Optionally specify extra list of additional existing ConfigMaps containing extra env vars | `[]` |
| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `nil` |
Expand Down
4 changes: 4 additions & 0 deletions ndustrial/deployment/_var_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@
group: Pod
default: []
type:
- variable: extraEnvVarsMap
group: Pod
default: {}
type:
- variable: extraEnvVarsCM
group: Pod
default:
Expand Down
6 changes: 6 additions & 0 deletions ndustrial/deployment/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ spec:
{{- if .Values.extraEnvVars }}
{{- include "nio-common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.extraEnvVarsMap }}
{{- range $key, $val := .Values.extraEnvVarsMap }}
- name: {{ $key }}
value: {{ include "nio-common.tplvalues.render" (dict "value" $key "context" $) | quote }}
{{- end }}
{{- end }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
Expand Down
7 changes: 7 additions & 0 deletions ndustrial/deployment/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,13 @@ shareProcessNamespace: false
##
extraEnvVars: []

## @param extraEnvVarsMap Add extra environment variables to the Deployment container
## E.g:
## extraEnvVarsMap:
## FOO: "bar"
##
extraEnvVarsMap: {}

## @param extraEnvVarsCM Name of existing ConfigMap containing extra env vars
##
extraEnvVarsCM:
Expand Down
4 changes: 2 additions & 2 deletions ndustrial/statefulset/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ maintainers:
- email: devops@ndustrial.io
name: DevOps
# Please make sure that version and appVersion are always the same.
version: 0.1.20
appVersion: 0.1.20
version: 0.1.21
appVersion: 0.1.21
16 changes: 8 additions & 8 deletions ndustrial/statefulset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@

### persistentVolume parameters

| Name | Description | Value |
| ------------------------------- | ------------------------------------ | ------------- |
| `persistentVolume.enabled` | Enable persistentVolume | `true` |
| `persistentVolume.accessModes` | Storage size of the persistentVolume | `[]` |
| `persistentVolume.storageClass` | StorageClass of the persistentVolume | `""` |
| `persistentVolume.size` | Storage size of the persistentVolume | `400M` |
| `persistentVolume.mountPath` | Mount path of the persistentVolume | `/tmp/volume` |
| Name | Description | Value |
| ------------------------------- | ------------------------------------ | ------------------- |
| `persistentVolume.enabled` | Enable persistentVolume | `true` |
| `persistentVolume.accessModes` | Storage size of the persistentVolume | `["ReadWriteOnce"]` |
| `persistentVolume.storageClass` | StorageClass of the persistentVolume | `""` |
| `persistentVolume.size` | Storage size of the persistentVolume | `400M` |
| `persistentVolume.mountPath` | Mount path of the persistentVolume | `/tmp/volume` |


### Service parameters
Expand Down Expand Up @@ -101,7 +101,7 @@
| `ingress.pathType` | Ingress path type | `ImplementationSpecific` |
| `ingress.apiVersion` | Force Ingress API version (automatically detected if not set) | `nil` |
| `ingress.hostname` | Default host for the ingress record | `chart-example.local` |
| `ingress.path` | Default path for the ingress record | `ImplementationSpecific` |
| `ingress.path` | Default path for the ingress record | `/` |
| `ingress.annotations` | Additional custom annotations for the ingress record | `{}` |
| `ingress.tls` | Enable TLS configuration for the host defined at `ingress.hostname` parameter | `false` |
| `ingress.certManager` | Add the corresponding annotations for cert-manager integration | `false` |
Expand Down
31 changes: 9 additions & 22 deletions scripts/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,25 @@
set -e

WORKDIR=$(pwd)
CI_DIR=${WORKDIR}/.ci
README_GEN_BIN=$(which readme-generator)
README_GEN_BIN=$(which readme-generator || true)

to_workdir() {
cd ${WORKDIR}
cd "${WORKDIR}"
}

to_chart_dir() {
local chart=$1
cd ${WORKDIR}/ndustrial/${chart}
cd "${WORKDIR}"/ndustrial/"${chart}"
}

install_md_gen() {
if [ -d ${CI_DIR} ]; then
mkdir -p ${CI_DIR}
fi

if [ -d ${CI_DIR}/readme-generator-for-helm ]; then
cd ${CI_DIR}
git clone https://github.com/bitnami-labs/readme-generator-for-helm
cd ${CI_DIR}/readme-generator-for-helm
npm install
cd ${CI_DIR}
npm install -g readme-generator-for-helm
fi

to_workdir
npm install -g git+https://github.com/bitnami-labs/readme-generator-for-helm
}

gen_readme() {
local chart=$1
echo "Generating README.md for ${chart}"
to_chart_dir ${chart}
to_chart_dir "${chart}"
${README_GEN_BIN} -r ./README.md -v values.yaml
to_workdir
}
Expand All @@ -43,13 +29,14 @@ gen_questions() {
local chart=$1

echo "Generating questions for ${chart}"
docker run --rm -v $(pwd):/app crystallang/crystal:1.0.0 \
crystal /app/scripts/question_gen.cr -f /app/ndustrial/${chart}/values.yaml
docker run --rm -v "$(pwd)":/app crystallang/crystal:1.0.0 \
crystal /app/scripts/question_gen.cr -f /app/ndustrial/"${chart}"/values.yaml
}

if [ -z ${README_GEN_BIN} ]; then
if [ -z "${README_GEN_BIN}" ]; then
echo "missing readme-generator"
install_md_gen
README_GEN_BIN=$(which readme-generator)
fi

echo "Generating README.md"
Expand Down

0 comments on commit 340281f

Please sign in to comment.