import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/apis/extensions/v1beta3" "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" "k8s.io/kubernetes/pkg/conversion" ) func convertPod(pod *v1beta3.Pod) (*api.Pod, error) { pod_v1beta1 := &v1beta1.Pod{} err := conversion.ConvertVia(pod, pod_v1beta1, nil) if err != nil { return nil, err } pod_v1 := &api.Pod{} err = conversion.ConvertVia(pod_v1beta1, pod_v1, nil) if err != nil { return nil, err } return pod_v1, nil }
import ( "k8s.io/kubernetes/pkg/apis/apps/v1beta2" "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" "k8s.io/kubernetes/pkg/conversion" ) func convertReplicationController(rc *api.ReplicationController) (*v1beta2.Deployment, error) { rc_v1beta1 := &v1beta1.ReplicaSet{} err := conversion.ConvertVia(rc, rc_v1beta1, nil) if err != nil { return nil, err } deployment_v1beta2 := &v1beta2.Deployment{} err = conversion.ConvertVia(rc_v1beta1, deployment_v1beta2, nil) if err != nil { return nil, err } return deployment_v1beta2, nil }This function takes a v1 ReplicationController object, converts it to a v1beta1 ReplicaSet object, and then converts that ReplicaSet object to a v1beta2 Deployment object using the ConvertVia function from the conversion package library.