Issue
In one of my deployment files, I want to set an environment variable. The variable is KUBE_VERSION
and values must be fetched from a ConfigMap.
kube_1_21: 1.21.10_1550
This is part of ConfigMap where I want to set 1.21.10_1550
to KUBE_VERSION
, but if the cluster is of IKS 1.20, then the key will be:
kube_1_20: 1.20.21_3456
kube_
is always static. How can I set environment variable using a regex expression?
Something of this sort:
- name: KUBE_VERSION
valueFrom:
configMapKeyRef:
name: cluster-info
key: "kube_1*"
Solution
As far as I know it is unfortunately not possible to use the regular expression as you would like. Additionally, you have information about the regular expression that validates the entered data:
regex used for validation is '[-._a-zA-Z0-9]+')
It follows that you have to enter key
as an alphanumeric string and additionally you can use the characters -
, _
and .
So it is not possible to use regex in this place.
To workaround you can write your custom script i.e. in Bash and replace the proper line with sed command.
Answered By - Mikołaj Głodziak Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.