Skip to content

[bitnami/nginx] chart overwrites preexisting server_blocks #6693

Description

@davgia

Which chart:
nginx:9.2.0

Describe the bug
The chart always mounts /opt/bitnami/nginx/conf/server_blocks path. This mean that any preexisting *.conf file are ignored.

To Reproduce
Steps to reproduce the behavior:

  1. create a custom bitnami nginx docker image
  2. customize the image by placing additional *.conf files in /opt/bitnami/nginx/conf/server_blocks (or in any subdirectory)
  3. deploy the chart using the custom docker image
  4. the pod may fail (e.g. the missing server_block declared a variable using map; the variable is not found during initialization) or behave unexpectedly (e.g. the missing server block exposed something else on a different port; nginx does not reply to the port)

Expected behavior
The chart should not mount the path /opt/bitnami/nginx/conf/server_blocks by default. It should do that only if it requires to write additional files to it (i.e. if one of those values are declared: .Values.serverBlock, .Values.ldapDaemon.enabled. .Values.existingServerBlockConfigmap).

volumeMounts:
- name: nginx-server-block-paths
mountPath: /opt/bitnami/nginx/conf/server_blocks
{{- if or .Values.serverBlock .Values.existingServerBlockConfigmap }}
- name: nginx-server-block
mountPath: /opt/bitnami/nginx/conf/server_blocks/common
{{- end }}
{{- if .Values.ldapDaemon.enabled }}
- name: nginx-server-block-ldap
mountPath: /opt/bitnami/nginx/conf/server_blocks/ldap
{{- end }}

Another solution would be to allow the user to disable the mount with an additional value.

NOTE: this bug can currently be circumvented by declaring the same server block using the .Values.serverBlock value.

Version of Helm and Kubernetes:

  • Output of helm version:
version.BuildInfo{Version:"v3.5.3", GitCommit:"041ce5a2c17a58be0fcd5f5e16fb3e7e95fea622", GitTreeState:"dirty", GoVersion:"go1.15.8"}
  • Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.5", GitCommit:"6b1d87acf3c8253c123756b9e61dac642678305f", GitTreeState:"clean", BuildDate:"2021-03-18T01:10:43Z", GoVersion:"go1.15.8", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d325d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:15:20Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions