kubernetes jee: Map resources property file

12/28/2018

I've this quartz.properties file into src/main/resources folder project:

org.quartz.jobStore.class = net.joelinn.quartz.jobstore.RedisJobStore
org.quartz.jobStore.host = redisbo

As you can see, I need to change org.quartz.jobStore.host according to current environment.

I mean, according to the environment my project has to be deployed, this value has to change as well.

All my environment are on kubernetes/openshift.

I don't quite figure out how to create a configmap in order to map this property of my src/main/resources/quartz.properties.

Any ideas?

-- Jordi
jakarta-ee
kubernetes
quartz-scheduler

2 Answers

12/28/2018

I would consider creating an External Service, so you keep your redisbo as it is in your code and use kubernetes to map to external dns. We use this technique a lot.

This guide is super helpful

https://akomljen.com/kubernetes-tips-part-1/

-- Bal Chua
Source: StackOverflow

12/28/2018

I think you can configure as following steps.

  • Create configmap using quartz.properties file as follows.

    # kubectl create configmap quartz-config --from-file=quartz.properties
  • set the volume as configmap created as follows.

    apiVersion: v1 kind: Pod metadata: name: test spec: containers: - name: test-container image: k8s.gcr.io/busybox command: [ "/bin/sh", "-c", "ls /src/main/resources" ] volumeMounts: - name: config-volume mountPath: /src/main/resources volumes: - name: config-volume configMap: name: quartz-config restartPolicy: Never

-- Daein Park
Source: StackOverflow