A configMap is an API object that is used to store non-confidential data in key-value pairs. If you want to mount a custom file to Artifactory, either an init shell script or a custom configuration file (such as logback.xml
), you can use this option.
Create Custom configMaps for Artifactory
Create a configmaps.yaml
file as per the example below, then use it with your Helm installation/upgrade. This will, in turn, do the following:
Create a volume pointing to the configMap with the name
artifactory-configmaps
.Mount this configMap onto
/tmp/my-config-map
usingcustomVolumeMounts
.Set the shell script we mounted as the
lifecycle.postStart.exec.command
.Copy the
logback.xml
file to$ARTIFACTORY_HOME/etc/artifactory
directory.artifactory: configMaps: | logback.xml: | <configuration debug="false"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> <layout class="org.artifactory.logging.layout.BackTracePatternLayout"> <pattern>%date [%-5level] \(%-20c{3}:%L\) %message%n</pattern> </layout> </encoder> </appender> <logger name="/artifactory"> <level value="INFO"/> <appender-ref ref="CONSOLE"/> </logger> <logger name="org.eclipse.jetty"> <level value="WARN"/> <appender-ref ref="CONSOLE"/> </logger> </configuration> my-custom-post-start-hook.sh: | echo "This is my custom post start hook" customVolumeMounts: | - name: artifactory-configmaps mountPath: /tmp/my-config-map lifecycle: | postStart: | exec: | commandpostStartCommand: "post_hook_temp=/tmp/post-hook-temp; mkdir ${post_hook_temp}; cp -fv /tmp/my-config-map/my-custom-post-start-hook.sh ${post_hook_temp}; chmod +x ${post_hook_temp}/my-custom-post-start-hook.sh;bash ${post_hook_temp}/my-custom-post-start-hook.sh > ${post_hook_temp}/my-custom-post-start-hook.log 2>&1" copyOnEveryStartup: - source: /tmp/my-config-map/logback.xml target: etc/artifactory
Artifactory
helm upgrade --install artifactory -f configmaps.yaml --namespace artifactory jfrog/artifactory
Artifactory HA
helm upgrade --install artifactory-ha jfrog/artifactory-ha --namespace artifactory-ha -f values.yaml
Create a Custom nginx.conf Using Nginx
Create the
nginx.conf
file:kubectl create configmap nginx-config --from-file=nginx.conf
Pass the configMap to the Helm installation:
Artifactory
helm upgrade --install artifactory --set nginx.customConfigMap=nginx-config --namespace artifactory jfrog/artifactory
Artifactory HA
helm upgrade --install artifactory-ha jfrog/artifactory-ha --namespace artifactory-ha -f values.yaml