Skip to content

Commit

Permalink
feat: Add envFrom for secrets
Browse files Browse the repository at this point in the history
We can provide sensetive data as environment
variables through the Kubernetes Secrets

Signed-off-by: Sergiy Kulanov <[email protected]>
  • Loading branch information
SergK authored and JAORMX committed Oct 8, 2024
1 parent 6fd3b4b commit 0d91099
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ please refer to [the official krakend documentation](https://www.krakend.io/docs
| krakend.config | string, optional | `""` | If set, this key will contain the full configuration of the krakend service |
| krakend.configFileSource | string, optional | `""` | an external file relative path, will contain the full configuration of the krakend service. useful if config file is generated with flexible config https://www.krakend.io/docs/configuration/flexible-config/ |
| krakend.env | array | `[]` | The environment variables to use for the krakend container. The default is just the ones needed to enable flexible configuration. |
| krakend.envFromSecret | string | `""` | The name of the secret containing the environment variables to use for the krakend container. |
| krakend.extraConfig | object | `{"router":{"@comment":"The health endpoint checks do not show in the logs","logger_skip_paths":["/__health"]}}` | The service-level "extra_config" settings. This will directly be translated to JSON and is added only if you're not fully overriding the configuration via the `config` setting. For more information, see https://www.krakend.io/docs/enterprise/configuration/ |
| krakend.partials | Object | `{"endpoints.tmpl":"[\n {\n \"endpoint\": \"/test\",\n \"method\": \"GET\",\n \"backend\": [\n {\n \"method\": \"GET\",\n \"host\": [],\n \"url_pattern\": \"/__debug/roots\",\n \"encoding\": \"json\",\n \"deny\": [\n \"message\"\n ]\n }\n ],\n \"extra_config\": {\n \"proxy\": {\n \"static\": {\n \"data\": {\n \"collection\": [\n {\n \"directories\": [\n \"Graceland\"\n ]\n }\n ],\n \"version\": \"deficient\"\n },\n \"strategy\": \"always\"\n }\n }\n },\n \"output_encoding\": \"json\"\n }\n]","input_headers.tmpl":"\"input_headers\": [\n \"Content-Type\",\n \"ClientId\"\n]","rate_limit_backend.tmpl":"\"qos/ratelimit/proxy\": {\n \"max_rate\": 0.5,\n \"capacity\": 1\n}"}` | The default configuration has a partials files that will be used to load several aspects of the configuration. If you want to include expra partials, add or remove them here. |
| krakend.partialsDirSource | string, optional | `""` | an external file relative path, will contain the partial configuration files of the krakend service. |
Expand Down
5 changes: 5 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ spec:
{{- with .Values.krakend.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.krakend.envFromSecret }}
envFrom:
- secretRef:
name: {{ .Values.krakend.envFromSecret }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
Expand Down
3 changes: 3 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
"env": {
"type": "array"
},
"envFromSecret": {
"type": "string"
},
"extraConfig": {
"type": "object"
},
Expand Down
2 changes: 2 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ krakend:
# -- (array) The environment variables to use for the krakend container.
# The default is just the ones needed to enable flexible configuration.
env: []
# -- (string) The name of the secret containing the environment variables to use for the krakend container.
envFromSecret: ""
# -- (string, optional) If set, this key will contain the full configuration of the krakend service
config: ""
# -- (string, optional) an external file relative path, will contain the full
Expand Down

0 comments on commit 0d91099

Please sign in to comment.