I am looking for an example where I can use dynamic value in matchExpressions under preferredDuringSchedulingIgnoredDuringExecution in podAffinity.
Below is an example of what I want to do:
podAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- $(user_name)
topologyKey: topology.kubernetes.io/zone
weight: 100
$(user_name) is a dynamic value that changes on different user that logs in to the system and I either want to pick this dynamic value from an environment value or provide it to the pod at the time of scheduling.
Please provide pointers on how to solve this. thanks