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

The purpose of this change is to allow core parser and client to work with other resource codecs that know how to work with custom types.