diff --git a/examples/third-party-resources/main.go b/examples/third-party-resources/main.go index d59ed92c6..6222dd68f 100644 --- a/examples/third-party-resources/main.go +++ b/examples/third-party-resources/main.go @@ -7,10 +7,11 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/errors" - "k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/apis/extensions/v1beta1" + metav1 "k8s.io/client-go/pkg/apis/meta/v1" "k8s.io/client-go/pkg/runtime" + "k8s.io/client-go/pkg/runtime/schema" "k8s.io/client-go/pkg/runtime/serializer" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" @@ -39,7 +40,7 @@ func main() { } // initialize third party resource if it does not exist - tpr, err := clientset.Extensions().ThirdPartyResources().Get("example.k8s.io") + tpr, err := clientset.Extensions().ThirdPartyResources().Get("example.k8s.io", metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { tpr := &v1beta1.ThirdPartyResource{ @@ -130,7 +131,7 @@ func buildConfig(kubeconfig string) (*rest.Config, error) { } func configureClient(config *rest.Config) { - groupversion := unversioned.GroupVersion{ + groupversion := schema.GroupVersion{ Group: "k8s.io", Version: "v1", } diff --git a/examples/third-party-resources/types.go b/examples/third-party-resources/types.go index 6ff43ccc4..f4e75b677 100644 --- a/examples/third-party-resources/types.go +++ b/examples/third-party-resources/types.go @@ -5,7 +5,8 @@ import ( "k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api/meta" - "k8s.io/client-go/pkg/api/unversioned" + metav1 "k8s.io/client-go/pkg/apis/meta/v1" + "k8s.io/client-go/pkg/runtime/schema" ) type ExampleSpec struct { @@ -14,21 +15,21 @@ type ExampleSpec struct { } type Example struct { - unversioned.TypeMeta `json:",inline"` - Metadata api.ObjectMeta `json:"metadata"` + metav1.TypeMeta `json:",inline"` + Metadata api.ObjectMeta `json:"metadata"` Spec ExampleSpec `json:"spec"` } type ExampleList struct { - unversioned.TypeMeta `json:",inline"` - Metadata unversioned.ListMeta `json:"metadata"` + metav1.TypeMeta `json:",inline"` + Metadata metav1.ListMeta `json:"metadata"` Items []Example `json:"items"` } // Required to satisfy Object interface -func (e *Example) GetObjectKind() unversioned.ObjectKind { +func (e *Example) GetObjectKind() schema.ObjectKind { return &e.TypeMeta } @@ -38,12 +39,12 @@ func (e *Example) GetObjectMeta() meta.Object { } // Required to satisfy Object interface -func (el *ExampleList) GetObjectKind() unversioned.ObjectKind { +func (el *ExampleList) GetObjectKind() schema.ObjectKind { return &el.TypeMeta } // Required to satisfy ListMetaAccessor interface -func (el *ExampleList) GetListMeta() unversioned.List { +func (el *ExampleList) GetListMeta() metav1.List { return &el.Metadata }