I have a K8s config map that defines an ENVIRONMENT parameter.
That value is mounted as an environment variable on the deployment yaml using an excerpt in src/fabric8/deployment.yml:
spec:
template:
spec:
containers:
- env:
- name: "ENVIRONMENT"
valueFrom:
configMapKeyRef:
name: global-configmap
key: ENVIRONMENT
I would like to use that ENVIRONMENT env variable to configure the spring.active.profiles
property.
Is it supported in some way by fabric8 maven plugin? If not, can you suggest some workaround?
Another way that also worked was explicitly defining it in the JAVA_OPTIONS parameters:
spec:
template:
spec:
containers:
- env:
- name: JAVA_OPTIONS
value: "-Dspring.profiles.active=${ENVIRONMENT}"
- name: ENVIRONMENT
valueFrom:
configMapKeyRef:
name: global-configmap
key: ENVIRONMENT