mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-30 04:26:44 +00:00
client-go: deprecate TPR example and add CRD example
Kubernetes-commit: e2b50ac9b817dfb49c146b9423d1ee9a5da97cb2
This commit is contained in:
parent
5f9a335584
commit
99b01357a0
7
examples/custom-resources/README.md
Normal file
7
examples/custom-resources/README.md
Normal file
@ -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.
|
@ -8,12 +8,6 @@ load(
|
|||||||
"go_library",
|
"go_library",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
|
||||||
name = "third-party-resources",
|
|
||||||
library = ":go_default_library",
|
|
||||||
tags = ["automanaged"],
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = ["main.go"],
|
srcs = ["main.go"],
|
||||||
@ -21,12 +15,18 @@ go_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1: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-deprecated/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-deprecated/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/controller:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/kubernetes: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/api/v1:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/tools/clientcmd: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"],
|
||||||
|
)
|
@ -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:
|
This particular example demonstrates how to perform basic operations such as:
|
||||||
|
|
@ -20,7 +20,7 @@ go_library(
|
|||||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_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/runtime/serializer:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/util/wait: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/kubernetes:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/pkg/api/v1: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",
|
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
|
@ -21,7 +21,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
"k8s.io/client-go/rest"
|
"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) {
|
func NewClient(cfg *rest.Config) (*rest.RESTClient, *runtime.Scheme, error) {
|
@ -22,7 +22,7 @@ import (
|
|||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"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"
|
"k8s.io/client-go/kubernetes"
|
||||||
apiv1 "k8s.io/client-go/pkg/api/v1"
|
apiv1 "k8s.io/client-go/pkg/api/v1"
|
||||||
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
|
@ -14,7 +14,7 @@ go_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
|
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
|
||||||
"//vendor/k8s.io/apimachinery/pkg/runtime: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/pkg/api/v1:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||||
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
|
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
|
@ -26,7 +26,7 @@ import (
|
|||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/cache"
|
"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
|
// Watcher is an example of watching on resource create/update/delete events
|
@ -32,9 +32,9 @@ import (
|
|||||||
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
|
// 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"
|
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
|
||||||
|
|
||||||
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"
|
||||||
exampleclient "k8s.io/client-go/examples/third-party-resources/client"
|
exampleclient "k8s.io/client-go/examples/third-party-resources-deprecated/client"
|
||||||
examplecontroller "k8s.io/client-go/examples/third-party-resources/controller"
|
examplecontroller "k8s.io/client-go/examples/third-party-resources-deprecated/controller"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
Loading…
Reference in New Issue
Block a user