import ( "github.com/google/go-cmp/cmp" "github.com/googlecloudplatform/kubernetes/pkg/conversion" "k8s.io/api/apps/v1beta2" "k8s.io/api/apps/v1" ) func main() { var old v1beta2.Deployment var new v1.Deployment // Populate old Deployment resource // ... conv := conversion.NewConverter(&v1beta2.Deployment{}, &v1.Deployment{}) if err := conv.Convert(&old, &new, nil); err != nil { // Handle error } if diff := cmp.Diff(old, new); diff != "" { // Handle differences between old and new resources } }
import ( "github.com/googlecloudplatform/kubernetes/pkg/conversion" "k8s.io/api/core/v1" "k8s.io/api/core/v1beta1" ) func main() { var old v1.Service var new v1beta1.Service // Populate old Service resource // ... conv := conversion.NewConverter(&v1.Service{}, &v1beta1.Service{}) if err := conv.Convert(&old, &new, nil); err != nil { // Handle error } }The package library being used in these examples is the `github.com.googlecloudplatform.kubernetes.pkg.conversion` library.