-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add init container for setting up base config (#2649)
Problem: We are starting to introduce configuration options that exist in the main context. However, that configuration won't be written until the control plane writes it to nginx, meaning it doesn't exist on nginx startup. Therefore nginx uses its default configuration for a brief time, which is incorrect. We want to be able to provide this configuration on startup. Solution: Using an init container, we can mount a ConfigMap containing the dynamic base config, and copy it to the proper location in the filesystem before nginx starts. We can't mount the ConfigMap directly to the proper location because it would be read-only, preventing our control plane from writing to it. This allows us to bootstrap the user config into nginx on startup, while also allowing our control plane to overwrite it if the user ever changes the config after the fact. Removed logic that cleared out nginx files on startup because it would erase this bootstrap config, and it wasn't really needed since we delete nginx files when we write config anyway. Also fixed an issue where the log level was not honored when no Gateway resources existed.
- Loading branch information
Showing
18 changed files
with
534 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
charts/nginx-gateway-fabric/templates/include-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: nginx-includes | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "nginx-gateway.labels" . | nindent 4 }} | ||
data: | ||
main.conf: | | ||
{{- if and .Values.nginx.config .Values.nginx.config.logging .Values.nginx.config.logging.errorLevel }} | ||
error_log stderr {{ .Values.nginx.config.logging.errorLevel }}; | ||
{{ else }} | ||
error_log stderr info; | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.