Use codec to encode/decode api objects in client and kubecfg parser