One basic kuttl test is :
apiVersion: v1
kind: Pod
metadata:
name: my-pod
status:
phase: Successful
But the pod name gets some random Id at the end. For example, if I am creating a pod: hello
, it gets generated as hello-gdha123-67as
. In this case, I am not aware of the pod name since it gets Generated randomly. I want to pass the variable in place or name in the above test. Any suggestions? I know the command to get only the pod name. If I put it in some YAML, how can we pass it to the test?
example: Start a nginx pod, but overload the spec with a partial set of values parsed from JSON.
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
ref: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands