From 99b01357a034994b9b4de60de69edd5392ca2798 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 6 Jun 2017 16:58:33 +0200 Subject: [PATCH] client-go: deprecate TPR example and add CRD example Kubernetes-commit: e2b50ac9b817dfb49c146b9423d1ee9a5da97cb2 --- examples/custom-resources/README.md | 7 +++++++ .../BUILD | 18 +++++++++--------- .../README.md | 4 +++- .../apis/tpr/v1/BUILD | 0 .../apis/tpr/v1/register.go | 0 .../apis/tpr/v1/types.go | 0 .../apis/tpr/v1/types_test.go | 0 .../client/BUILD | 2 +- .../client/client.go | 2 +- .../client/tpr.go | 2 +- .../controller/BUILD | 2 +- .../controller/controller.go | 2 +- .../main.go | 6 +++--- 13 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 examples/custom-resources/README.md rename examples/{third-party-resources => third-party-resources-deprecated}/BUILD (84%) rename examples/{third-party-resources => third-party-resources-deprecated}/README.md (89%) rename examples/{third-party-resources => third-party-resources-deprecated}/apis/tpr/v1/BUILD (100%) rename examples/{third-party-resources => third-party-resources-deprecated}/apis/tpr/v1/register.go (100%) rename examples/{third-party-resources => third-party-resources-deprecated}/apis/tpr/v1/types.go (100%) rename examples/{third-party-resources => third-party-resources-deprecated}/apis/tpr/v1/types_test.go (100%) rename examples/{third-party-resources => third-party-resources-deprecated}/client/BUILD (95%) rename examples/{third-party-resources => third-party-resources-deprecated}/client/client.go (94%) rename examples/{third-party-resources => third-party-resources-deprecated}/client/tpr.go (96%) rename examples/{third-party-resources => third-party-resources-deprecated}/controller/BUILD (93%) rename examples/{third-party-resources => third-party-resources-deprecated}/controller/controller.go (97%) rename examples/{third-party-resources => third-party-resources-deprecated}/main.go (94%) diff --git a/examples/custom-resources/README.md b/examples/custom-resources/README.md new file mode 100644 index 00000000..2ade0ddd --- /dev/null +++ b/examples/custom-resources/README.md @@ -0,0 +1,7 @@ +# Custom Resource Example + +**Note:** CustomResourceDefinition is the successor of the deprecated ThirdPartyResource. + +For a client-go example using CustomResourceDefinitions, go to + + http://github.com/kubernetes/apiextensions-apiserver/examples/client-go. diff --git a/examples/third-party-resources/BUILD b/examples/third-party-resources-deprecated/BUILD similarity index 84% rename from examples/third-party-resources/BUILD rename to examples/third-party-resources-deprecated/BUILD index bd800471..e031404e 100644 --- a/examples/third-party-resources/BUILD +++ b/examples/third-party-resources-deprecated/BUILD @@ -8,12 +8,6 @@ load( "go_library", ) -go_binary( - name = "third-party-resources", - library = ":go_default_library", - tags = ["automanaged"], -) - go_library( name = "go_default_library", srcs = ["main.go"], @@ -21,12 +15,18 @@ go_library( deps = [ "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", - "//vendor/k8s.io/client-go/examples/third-party-resources/apis/tpr/v1:go_default_library", - "//vendor/k8s.io/client-go/examples/third-party-resources/client:go_default_library", - "//vendor/k8s.io/client-go/examples/third-party-resources/controller:go_default_library", + "//vendor/k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1:go_default_library", + "//vendor/k8s.io/client-go/examples/third-party-resources-deprecated/client:go_default_library", + "//vendor/k8s.io/client-go/examples/third-party-resources-deprecated/controller:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/client-go/pkg/api/v1:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library", ], ) + +go_binary( + name = "third-party-resources-deprecated", + library = ":go_default_library", + tags = ["automanaged"], +) diff --git a/examples/third-party-resources/README.md b/examples/third-party-resources-deprecated/README.md similarity index 89% rename from examples/third-party-resources/README.md rename to examples/third-party-resources-deprecated/README.md index 4a225b6b..a461e63d 100644 --- a/examples/third-party-resources/README.md +++ b/examples/third-party-resources-deprecated/README.md @@ -1,4 +1,6 @@ -# Third Party Resources Example +# Third Party Resources Example – Deprecated + +**Note:** ThirdPartyResources are deprecated since 1.7. The successor is CustomResourceDefinition in the apiextensions.k8s.io API group. This particular example demonstrates how to perform basic operations such as: diff --git a/examples/third-party-resources/apis/tpr/v1/BUILD b/examples/third-party-resources-deprecated/apis/tpr/v1/BUILD similarity index 100% rename from examples/third-party-resources/apis/tpr/v1/BUILD rename to examples/third-party-resources-deprecated/apis/tpr/v1/BUILD diff --git a/examples/third-party-resources/apis/tpr/v1/register.go b/examples/third-party-resources-deprecated/apis/tpr/v1/register.go similarity index 100% rename from examples/third-party-resources/apis/tpr/v1/register.go rename to examples/third-party-resources-deprecated/apis/tpr/v1/register.go diff --git a/examples/third-party-resources/apis/tpr/v1/types.go b/examples/third-party-resources-deprecated/apis/tpr/v1/types.go similarity index 100% rename from examples/third-party-resources/apis/tpr/v1/types.go rename to examples/third-party-resources-deprecated/apis/tpr/v1/types.go diff --git a/examples/third-party-resources/apis/tpr/v1/types_test.go b/examples/third-party-resources-deprecated/apis/tpr/v1/types_test.go similarity index 100% rename from examples/third-party-resources/apis/tpr/v1/types_test.go rename to examples/third-party-resources-deprecated/apis/tpr/v1/types_test.go diff --git a/examples/third-party-resources/client/BUILD b/examples/third-party-resources-deprecated/client/BUILD similarity index 95% rename from examples/third-party-resources/client/BUILD rename to examples/third-party-resources-deprecated/client/BUILD index 016a1aac..81d93954 100644 --- a/examples/third-party-resources/client/BUILD +++ b/examples/third-party-resources-deprecated/client/BUILD @@ -20,7 +20,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", - "//vendor/k8s.io/client-go/examples/third-party-resources/apis/tpr/v1:go_default_library", + "//vendor/k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/client-go/pkg/api/v1:go_default_library", "//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library", diff --git a/examples/third-party-resources/client/client.go b/examples/third-party-resources-deprecated/client/client.go similarity index 94% rename from examples/third-party-resources/client/client.go rename to examples/third-party-resources-deprecated/client/client.go index 82128abd..9c777d1a 100644 --- a/examples/third-party-resources/client/client.go +++ b/examples/third-party-resources-deprecated/client/client.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/client-go/rest" - tprv1 "k8s.io/client-go/examples/third-party-resources/apis/tpr/v1" + tprv1 "k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1" ) func NewClient(cfg *rest.Config) (*rest.RESTClient, *runtime.Scheme, error) { diff --git a/examples/third-party-resources/client/tpr.go b/examples/third-party-resources-deprecated/client/tpr.go similarity index 96% rename from examples/third-party-resources/client/tpr.go rename to examples/third-party-resources-deprecated/client/tpr.go index 6a1c0564..9f69e1f3 100644 --- a/examples/third-party-resources/client/tpr.go +++ b/examples/third-party-resources-deprecated/client/tpr.go @@ -22,7 +22,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" - tprv1 "k8s.io/client-go/examples/third-party-resources/apis/tpr/v1" + tprv1 "k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1" "k8s.io/client-go/kubernetes" apiv1 "k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/apis/extensions/v1beta1" diff --git a/examples/third-party-resources/controller/BUILD b/examples/third-party-resources-deprecated/controller/BUILD similarity index 93% rename from examples/third-party-resources/controller/BUILD rename to examples/third-party-resources-deprecated/controller/BUILD index e34f7e2f..40a14ee3 100644 --- a/examples/third-party-resources/controller/BUILD +++ b/examples/third-party-resources-deprecated/controller/BUILD @@ -14,7 +14,7 @@ go_library( deps = [ "//vendor/k8s.io/apimachinery/pkg/fields:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", - "//vendor/k8s.io/client-go/examples/third-party-resources/apis/tpr/v1:go_default_library", + "//vendor/k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1:go_default_library", "//vendor/k8s.io/client-go/pkg/api/v1:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/k8s.io/client-go/tools/cache:go_default_library", diff --git a/examples/third-party-resources/controller/controller.go b/examples/third-party-resources-deprecated/controller/controller.go similarity index 97% rename from examples/third-party-resources/controller/controller.go rename to examples/third-party-resources-deprecated/controller/controller.go index 19955d3f..15355296 100644 --- a/examples/third-party-resources/controller/controller.go +++ b/examples/third-party-resources-deprecated/controller/controller.go @@ -26,7 +26,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - tprv1 "k8s.io/client-go/examples/third-party-resources/apis/tpr/v1" + tprv1 "k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1" ) // Watcher is an example of watching on resource create/update/delete events diff --git a/examples/third-party-resources/main.go b/examples/third-party-resources-deprecated/main.go similarity index 94% rename from examples/third-party-resources/main.go rename to examples/third-party-resources-deprecated/main.go index e7ad48b3..87770683 100644 --- a/examples/third-party-resources/main.go +++ b/examples/third-party-resources-deprecated/main.go @@ -32,9 +32,9 @@ import ( // Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters). // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" - tprv1 "k8s.io/client-go/examples/third-party-resources/apis/tpr/v1" - exampleclient "k8s.io/client-go/examples/third-party-resources/client" - examplecontroller "k8s.io/client-go/examples/third-party-resources/controller" + tprv1 "k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1" + exampleclient "k8s.io/client-go/examples/third-party-resources-deprecated/client" + examplecontroller "k8s.io/client-go/examples/third-party-resources-deprecated/controller" ) func main() {