Can't add custom sonar.properties for ldap integration
Is this a request for help?: Yes
Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG Report
Version of Helm and Kubernetes: Helm Version: Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"} Server: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
Kubernetes Version: Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.5", GitCommit:"32ac1c9073b132b8ba18aa830f46b77dcceb0723", GitTreeState:"clean", BuildDate:"2018-06-21T11:46:00Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:25:46Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Which chart: stable/sonarqube
What happened: I am trying to enable ldap. But when I provide a custom sonar.properties file by adding a multiline YAML in the sonarProperties, it throws the below error in the logs:
chown: changing ownership of '/opt/sonarqube/conf/..data': Read-only file system
chown: changing ownership of '/opt/sonarqube/conf/..2019_02_20_07_43_57.217223797/sonar.properties': Read-only file system
chown: changing ownership of '/opt/sonarqube/conf/..2019_02_20_07_43_57.217223797': Read-only file system
chown: changing ownership of '/opt/sonarqube/conf/sonar.properties': Read-only file system
chown: changing ownership of '/opt/sonarqube/conf': Read-only file system
What you expected to happen: I expect it to create a custom sonar.properties with ldap details in it and start the server with ldap enabled.
How to reproduce it (as minimally and precisely as possible): You can try to add ldap configuration or any other configuration using multiline YAML by sonarProperties and check if it works.
Anything else we need to know: I am running sonarqube 7.1 developer edition.
Can you provide a link to your dockerfile for sonarqube developer 7.1 edition? You can assign a security context to your container to run it without root in a Kubernetes pod:
You can add this in your values.yaml file in the securitycontext section.
securityContext:
runAsUser: 999
fsGroup: 999
When you uncomment the below lines in values. yaml, the helm charts create a sonar.properties configmap and mounts to /opt/sonarqube/conf/sonar.properties. https://github.com/helm/charts/blob/master/stable/sonarqube/templates/config.yaml
sonarProperties: |
sonar.security.realm=LDAP
ldap.bindDn=cn=user,OU=yourOU,dc=yourdc
ldap.bindPassword=<bindpassword>
For sonarqube 7.1 developer edition, I am not using a separate docker image. So I don't have a Dockerfile of my own. I am using the commerical available sonarqube 7.1 and then I install the license on it.
The file sonar.properties is present under /tmp/conf but it is not mounted to /opt/sonarqube/conf
I had to give 4 indentations and that resolved my issue.
sonarProperties: |
sonar.security.realm=LDAP
ldap.bindDn=cn=user,OU=yourOU,dc=yourdc
ldap.bindPassword=<bindpassword>