v2v-helper Environment Variable Injection via ConfigMap
Injecting environment variables into the v2v-helper pod is a feature that allows users to inject environment variables into the v2v-helper pod using a Kubernetes ConfigMap.
How It Works
-
Cloud-init populates environment variables
Users must provide environment variables in the
/etc/pf9/env
file during provisioning, typically using a cloud-init script. -
ConfigMap creation from /etc/pf9/env
A helper script or manual command reads
/etc/pf9/env
and creates a Kubernetes ConfigMap namedpf9-env
. This is done while the vjailbreak VM is being provisioned.Terminal window kubectl create configmap pf9-env --from-env-file=/etc/pf9/env -n migration-system
Example
If you want proxy variables to be injected into the v2v-helper pod, you can add the following to the /etc/pf9/env
file via the cloud-init script:
http_proxy=http://<proxy-server>:<proxy-port>https_proxy=http://<proxy-server>:<proxy-port>no_proxy=localhost,127.0.0.1
You can either populate the /etc/pf9/env
file via cloud-init or manually.
If done manually please follow the steps mentioned in Injecting Environment Variables Post-Provisioning:
Now this will be picked up by the v2v-helper pod and the proxy variables will be available in the pod and it would be respected by the v2v-helper pod.
Injecting Environment Variables Post-Provisioning
If you would like to inject environment variables after the vjailbreak VM has been provisioned, follow these steps:
-
Delete the existing ConfigMap
Terminal window kubectl delete configmap pf9-env -n migration-system -
Populate the
/etc/pf9/env
file with whatever env variables neededTerminal window echo "http_proxy=http://<proxy-server>:<proxy-port>" >> /etc/pf9/envecho "https_proxy=http://<proxy-server>:<proxy-port>" >> /etc/pf9/envecho "no_proxy=localhost,127.0.0.1" >> /etc/pf9/env -
Create a new ConfigMap
Terminal window kubectl create configmap pf9-env --from-env-file=/etc/pf9/env -n migration-system -
Trigger a new migration for the envs to be reflected in the pod
Trigger via UI or via api.