nate-mar opened a new issue #10973:
URL: https://github.com/apache/druid/issues/10973


   Druid Docker config property override does not work when using custom 
Kubernetes config maps 
   
   ### Affected Version
   0.18.1
   
   ### Description
   There are two related issues:
   
   1) the documentation states the following: `the script which launches Druid 
in the container will also attempt to use any environment variable starting 
with the druid_ prefix as a command-line configuration.` (
   https://druid.apache.org/docs/latest/tutorials/docker.html#configuration) 
However, the druid.sh script doesn't actually use the environment variable as a 
command-line configuration. Instead, it updates the actual property files 
(common and service-specific) directly. 
(https://github.com/apache/druid/blob/master/distribution/docker/druid.sh#L69-L80
 and 
https://github.com/apache/druid/blob/master/distribution/docker/druid.sh#L104-L110)
 The documentation should be updated to reflect this.
   
   2) The main issue is that while the script does update the configuration 
files when a druid_ prefixed environment variable is passed in, the script also 
takes in a few reserved environment variables, namely DRUID_CONFIG_COMMON. 
DRUID_CONFIG_<druid_service>. These allow for kubernetes config maps to be used 
in place of the default druid configurations properties files. The script 
replaces the default property files with the config map ones, but it does this 
after the environment variable overrides are made, rendering said environment 
variable overrides unusable.
   
https://github.com/apache/druid/blob/master/distribution/docker/druid.sh#L119-L132
   
   Presumably, many who use config maps don't need an env variable override. 
Yet, there are valid cases when both a configmap and an environment variable 
override may be needed. One case is when setting a property that maps to a 
password/secret, such as druid.azure.key. Using an environment override would 
allow the property to not be hardcoded in the file.
   
   Steps to reproduce the problem
   1. Setup a kubernetes manifest specifying config maps for druid properties. 
For example, for historical:
   
         containers:
         - name: druid
           image: "druid"
           args: [ "historical" ]
           env:
           - name: DRUID_CONFIG_COMMON
             value: "/tmp/my-conf/_common.runtime.properties"
           - name: DRUID_CONFIG_historical
             value: "/tmp/my-conf/runtime.properties"
          ports:
           - containerPort: 8083
             name: 
           volumeMounts:
             - name: data
               mountPath: /var/druid/
             - name: service-config-volume
               mountPath: /tmp/my-conf
             - name: common-config-volume
               mountPath: /tmp/my-conf
         volumes:
           - name: service-config-volume
             configMap:
               name: historical
           - name: common-config-volume
             configMap:
               name: common
   
   2. Set the following environment variables to point to the custom config map 
files:
   name: DRUID_CONFIG_COMMON
   name: DRUID_CONFIG_historical
   
   3. Per the documentation, specify a druid property to override via an 
environment variable. (e.g. druid.azure.account)
   
   4. Deploy the manifest, which launches the druid container
   
   Actual Behavior:
    Logs show that `(e.g. druid.azure.account) was updated by the entrypoint 
script druid.sh, (e.g. Setting druid.azure.account=myaccount in 
/tmp/conf/druid/cluster/data/historical/runtime.properties`  but the property 
doesn't appear in the start up logs when printing out all of the set 
properties. Also, the properties files updated by the startup script and the 
default properties files both do not contain the overridden property.
   
   Expected Behavior: 
   The overridden property appears both in the properties files as well as in 
the list of properties in the application logs after the druid process starts, 
thereby successfully overriding the desired druid configuration
   
   Having the druid.sh startup script update replace the property files with 
the config map files before the environment variable overrides would seem to 
address this issue.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to