Compare commits

...

305 Commits

Author SHA1 Message Date
Kubernetes Publisher
d92e8497f7 sync: resync vendor folder 2017-07-28 13:53:02 +00:00
Kubernetes Publisher
91e3f9312a sync(k8s.io/kubernetes) 84dfa6a4e3c655bb3cf63756d1674dff1976fe06 2017-07-28 13:52:41 +00:00
Wojciech Tyczynski
1f9a49df2c Kubernetes version v1.7.3-beta.0 file updates
Kubernetes-commit: 84dfa6a4e3c655bb3cf63756d1674dff1976fe06
2017-07-28 13:52:41 +00:00
Wojciech Tyczynski
ec392585e9 Kubernetes version v1.7.2 file updates
Kubernetes-commit: 922a86cfcd65915a9b2f69f3f193b8907d741d9c
2017-07-28 13:52:41 +00:00
Brendan Burns
d9588c19ff Cherry pick of #47140 on release-1.7
Kubernetes-commit: d7985a982d742444c0ce151b9c388ea370ae6b97
2017-07-28 13:52:41 +00:00
Maxim Ivanov
d1fa9c161c Fix subPath existence check to not follow symlink
Volume mounting logic introduced in #43775 and #45623 checks
for subPath existence before attempting to create a directory,
should subPath not be present.

This breaks if subPath is a dangling symlink, os.Stat returns
"do not exist" status, yet `os.MkdirAll` can't create directory
as symlink is present at the given path.

This patch makes existence check to use os.Lstat which works for
normal files/directories as well as doesn't not attempt to follow
symlink, therefore it's "do not exist" status is more reliable when
making a decision whether to create directory or not.

subPath symlinks can be dangling in situations where kubelet is
running in a container itself with access to docker socket, such
as CoreOS's kubelet-wrapper script

Kubernetes-commit: d552dff164dfc7b91d21bd7d7881838babab2a63
2017-07-28 13:52:41 +00:00
Kubernetes Publisher
0caf586a65 sync: reset Godeps.json 2017-07-28 13:52:40 +00:00
Kubernetes Publisher
16b0436fa2 sync(k8s.io/kubernetes) aa6ec59679c9041a772912788a550adca0d0996c 2017-07-16 04:05:19 +00:00
Chao Xu
9508caae84 Kubernetes version v1.7.2-beta.0 file updates
Kubernetes-commit: aa6ec59679c9041a772912788a550adca0d0996c
2017-07-16 04:05:19 +00:00
Chao Xu
25bffd9c45 Kubernetes version v1.7.1 file updates
Kubernetes-commit: 1dc5c66f5dd61da08412a74221ecc79208c2165b
2017-07-16 04:05:19 +00:00
Kubernetes Publisher
df46f7f13b sync(k8s.io/kubernetes) ebb8d6e0fadfc95f3d64ccecc36c8ed2ac9224ef 2017-07-07 20:27:35 +00:00
Chao Xu
684c9f06e8 Kubernetes version v1.7.1-beta.0 file updates
Kubernetes-commit: ebb8d6e0fadfc95f3d64ccecc36c8ed2ac9224ef
2017-07-07 20:27:35 +00:00
Chao Xu
e356aa2e77 Kubernetes version v1.7.0 file updates
Kubernetes-commit: d3ada0119e776222f11ec7945e6d860061339aad
2017-07-07 20:27:35 +00:00
Nikhita Raghunath
d8822e0597 Update CR example in client-go
Remove custom-resources directory from client-go

Add TPR example back

Mention CRD is successor to TPR

Kubernetes-commit: b0504c6bff0ea5f923f935a4844e1eeab0ae5405
2017-07-07 20:27:35 +00:00
Chao Xu
e83269bc2b Kubernetes version v1.7.0-rc.1 file updates
Kubernetes-commit: 6b9ded1649cfb512d4e88570c738aca9f8265639
2017-07-07 20:27:35 +00:00
Seth Jennings
382c391988 include object fieldpath in event key
Kubernetes-commit: dee9955b8c120cdbc8b235ec9278fe8c9fceba2f
2017-07-07 20:27:34 +00:00
Nikhita Raghunath
eddc268ce3 Fix typo in cross-repo link
Kubernetes-commit: ddfd2e0b1498249e0ee5fa710110f9ee4062c36a
2017-07-07 20:27:34 +00:00
Chao Xu
63a56d7439 Kubernetes version v1.7.0-beta.2 file updates
Kubernetes-commit: ceab7f7a6753c20d3be75463b17402fdcea856ba
2017-07-07 20:27:34 +00:00
Kubernetes Publisher
cc44961f93 sync(k8s.io/kubernetes) 797dc10a0ccd89bec0b29c41613025035ed23a0f 2017-06-22 18:11:06 +00:00
Ricky Pai
1cd03f0805 generated code
Kubernetes-commit: 797dc10a0ccd89bec0b29c41613025035ed23a0f
2017-06-22 18:11:06 +00:00
Kubernetes Publisher
51bf18f5e6 sync: resync vendor folder 2017-06-22 03:54:09 +00:00
Kubernetes Publisher
46003734b1 sync(k8s.io/kubernetes) 03014f486c86dbe8a7fbe275fe14250854aab219 2017-06-22 03:53:48 +00:00
Josh Horwitz
56e6e0e8fd Revert "Merge pull request #43946 from jhorwit2/jah/host-path-psp"
This reverts commit b5eadb5d6b9ce34a673caeafe4fa0971c4b91139, reversing
changes made to 1889d654f5c76fcc6ce14c6d3702c06a6498695d.

Kubernetes-commit: b6e08ec39dde2a6f3c24648aa8867c6aee9853cb
2017-06-22 03:53:48 +00:00
mbohlool
4030b37262 update generated files
Kubernetes-commit: 70c4fe7f4ff7f7acf5de9fee7551da1b2e5aa22c
2017-06-22 03:53:47 +00:00
mbohlool
1c32168167 Remove all references to types.UnixUserID and types.UnixGroupID
Kubernetes-commit: c91a12d205c0391d3c2649aadf40091222906281
2017-06-22 03:53:47 +00:00
Matt Tyler
cc9ad31a2a Clear auth config when gcp credentials fail
Specific use case is when utilizing multiple
gcp accounts, the user may provide credentials
for the wrong account.

This change ensures the incorrect credentials
are not cached in auth config, and logs an
appropriate message.

Kubernetes-commit: b92016769e30c541479e81d40dd3584e2f5aa822
2017-06-22 03:53:47 +00:00
Kubernetes Publisher
b131aa47b5 sync(k8s.io/kubernetes) 35016b153e70281c058eed96f5ecac0608c35575 2017-06-20 17:28:45 +00:00
Marc Sluiter
83b93de35a run update-bazel.sh
Kubernetes-commit: 92ac232790afefad522016f76b48dbb697a8e0f7
2017-06-20 17:28:45 +00:00
Marc Sluiter
6620bd1af9 Added namespace and better pod name in client go example
Kubernetes-commit: a71bb87ec714276264282197c99bbd3f86fd7b55
2017-06-20 17:28:45 +00:00
Marc Sluiter
ecd7406c9f Updated error handling example based on PR feedback
Kubernetes-commit: 601ab10dbd08debca4b8a835f8dea00a26666060
2017-06-20 17:28:45 +00:00
Marc Sluiter
2c59aca317 Added example for status errors in go client
Kubernetes-commit: 8ca1732023621063d1c91205cdf0efa4b03b5a30
2017-06-20 17:28:45 +00:00
Kubernetes Publisher
b3357e1e10 sync: resync vendor folder 2017-06-19 23:58:13 +00:00
Kubernetes Publisher
dbc1e28158 sync(k8s.io/kubernetes) 606825eea47f41c72a3da1d4d2a769a340e1b69d 2017-06-19 23:57:41 +00:00
Clayton Coleman
d54b530cba generated: protobuf with stable map ordering
Kubernetes-commit: 606825eea47f41c72a3da1d4d2a769a340e1b69d
2017-06-19 23:57:40 +00:00
Kubernetes Publisher
c1b6a1c0a4 sync(k8s.io/kubernetes) 532cb25d21b3af988f92f586f57fcb3a538bb293 2017-06-17 22:03:58 +00:00
Dr. Stefan Schimanski
7e76c26781 Fix cross-repo link
Kubernetes-commit: 2aa87e4fee7f78b2e567111835c9e14505cf3892
2017-06-17 22:03:57 +00:00
Kubernetes Publisher
5c999e1aec sync: resync vendor folder 2017-06-16 22:04:22 +00:00
Kubernetes Publisher
70922d408f sync(k8s.io/kubernetes) d7b631a52d4e18e698bfe805d63f8141769d4f2d 2017-06-16 22:03:56 +00:00
Janet Kuo
5adaf62880 Rename DaemonSet and StatefulSet hash label
Make them share the same hash label "controller-revision-hash", for
consistency

Kubernetes-commit: 25a67fc5cdac9c3b41bd0c7fdfb0a2c24a925894
2017-06-16 22:03:56 +00:00
Ahmet Alp Balkan
6df6f2148a clientgo/examples: add ToC for examples
Also add authenticate- prefix to auth samples.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

Kubernetes-commit: 62d1251874cb259d38d727300ac4b2646c4122c8
2017-06-16 22:03:56 +00:00
zhengjiajin
2163038fbf Fix api description
Kubernetes-commit: f7ce20d2e4b4c24cfa7440e135abf78e538673bb
2017-06-16 22:03:56 +00:00
Kubernetes Publisher
36b51953e6 sync: resync vendor folder 2017-06-14 20:37:32 +00:00
Kubernetes Publisher
d184230daa sync(k8s.io/kubernetes) 7560142e27ba9c0c535695356a14ac169acd7476 2017-06-14 20:37:07 +00:00
Kenneth Owens
c2459566d6 Generated code
Kubernetes-commit: 37a54d521afa6b65f86426826068a1499b22a4c9
2017-06-14 20:37:07 +00:00
Cosmin Cojocar
e12b58626c Add client auth plugin for Azure Active Directory
This plugin acquires a fresh access token for apiserver from Azure Active
Directory using the device code flow. The access token is saved in the
configuration in order to be reused for upcomming accesses to appiserver.
In additon the access token is automatically refreshed when expired.

Kubernetes-commit: 682d5ec01f37c65117b2496865cc9bf0cd9e0902
2017-06-14 20:37:07 +00:00
Kubernetes Publisher
fabe644bb3 sync: reset Godeps.json 2017-06-14 20:37:06 +00:00
Chao Xu
1741b65fcb Merge pull request #210 from caesarxuchao/fix-travis
bump go version to 1.8.1 for travis
2017-06-13 16:02:11 -07:00
Chao Xu
794d95e91e bump go version to 1.8.1 for travis 2017-06-13 15:56:37 -07:00
Kubernetes Publisher
83b4b27326 sync: resync vendor folder 2017-06-13 20:39:14 +00:00
Kubernetes Publisher
5990d225d9 sync(k8s.io/kubernetes) a648e10910328500729548513a81c733aaef24a2 2017-06-13 20:38:48 +00:00
Guangya Liu
d44b3079ca Update client-go.
Kubernetes-commit: 4250c5d3f43bfcf6197c7361dac483a677c22d3d
2017-06-13 20:38:48 +00:00
Dr. Stefan Schimanski
92eadecb13 client-go: GetOptions for dynamic client
Kubernetes-commit: 30668b24fbd92e7ab532471f9518ba7b7ef66dcf
2017-06-13 20:38:48 +00:00
Simon Croome
5c16341058 Add StorageOS volume plugin
Kubernetes-commit: 5e2503e71fa51ae08fbbc90cc94e7d293709528e
2017-06-13 20:38:48 +00:00
Jeff Grafton
bbe6158ef3 Convert go_binary linkstamp to x_defs
Kubernetes-commit: 64bd79fad78d39788bd1073b836cd5fe89cc29e3
2017-06-13 20:38:48 +00:00
Klaus Ma
4f99d16391 generated client-go.
Kubernetes-commit: 6ad529be3ee75eb16f0e1c6b4d518bfe5edaeeaa
2017-06-13 20:38:48 +00:00
Dr. Stefan Schimanski
99b01357a0 client-go: deprecate TPR example and add CRD example
Kubernetes-commit: e2b50ac9b817dfb49c146b9423d1ee9a5da97cb2
2017-06-13 20:38:48 +00:00
Kenneth Owens
5f9a335584 Auto generated code for StatefulSet update
Kubernetes-commit: 1a784ef86ff94994e984753d885ffeff6e1772ac
2017-06-13 20:38:47 +00:00
Christoph Blecker
a8d18952cb Update docs/ URLs to point to proper locations
Kubernetes-commit: 1bdc7a29aee051ccef4bb21dcd9d43ee47b2a5d8
2017-06-13 20:38:47 +00:00
Jing Xu
1f501c6ac0 Add EmptyDir Volume and local storage for container overlay Isolation
This PR adds two features:
1. add support for isolating the emptyDir volume use. If user
sets a size limit for emptyDir volume, kubelet's eviction manager
monitors its usage
and evict the pod if the usage exceeds the limit.
2. add support for isolating the local storage for container overlay. If
the container's overly usage exceeds the limit defined in container
spec, eviction manager will evict the pod.

Kubernetes-commit: 0b13aee0c0f9bd06eb323ea249db29547b66bc46
2017-06-13 20:38:47 +00:00
Jeff Peeler
25e58688a7 Allow pods to opt out of PodPreset mutation
An annotation in the pod spec of the form:
podpreset.admission.kubernetes.io/exclude: "true"
Will cause the admission controller to skip manipulating the pod spec,
no matter the labelling.

The annotation for a podpreset acting on a pod has also been slightly
modified to contain a podpreset prefix:
podpreset.admission.kubernetes.io/podpreset-{name} = resource version

Fixes #44161

Kubernetes-commit: 08a59530e196ab9b30d306fb0fac5979b07298a1
2017-06-13 20:38:47 +00:00
Solly Ross
52247e9130 Update generated autoscaling files
This commit updates the generated autoscaling files to be up-to-date
with the HPA status condition changes.

Kubernetes-commit: c8fdeb022fbd11c3ac5333a772192a0d4f8213bb
2017-06-13 20:38:47 +00:00
Janet Kuo
b1f01ecf00 Autogen: run hack/update-all.sh
Kubernetes-commit: 4e6f70ff67ec435289984c9a162f0e75eb0180b8
2017-06-13 20:38:47 +00:00
Clayton Coleman
157df17111 generated: client-go staging
Kubernetes-commit: b993f7d303aa72961d6b0a32a42e7fcc5cb26190
2017-06-13 20:38:47 +00:00
Haoran Wang
1db1ab7b11 gcp auth provider not to override the Auth header if it's already exits
Kubernetes-commit: 9760dd9943f99c0ab850ac350b818406eead30cd
2017-06-13 20:38:47 +00:00
Tim Hockin
bf9b15475a 'Global' -> 'Cluster' for traffic policy
Kubernetes-commit: fc34a9d6ba4679298abc2d371b86eb32354f0c7b
2017-06-13 20:38:47 +00:00
Chao Xu
62a5cd0975 generated
Kubernetes-commit: e9d9b05234b46d2419112adb2009a9802998027c
2017-06-13 20:38:47 +00:00
Daniel Smith
38cb1a951d Implement dynamic admission webhooks
Also fix a bug in rest client

Kubernetes-commit: d6e1140b5d3c5c9d8696b7ccda0a5f92f36033df
2017-06-13 20:38:46 +00:00
Quintin Lee
d9ea62815a Add annotation for image policy webhook fail open.
Kubernetes-commit: a38c2b4ce183da25262791c791215697e7aeaaa0
2017-06-13 20:38:46 +00:00
Jing Xu
a23ebdbf48 generated files
Kubernetes-commit: 695f7be697b4137875e2fc93c39b06ab2784fa2f
2017-06-13 20:38:46 +00:00
Chao Xu
27aa69fcc8 generated
Kubernetes-commit: ec787db460c21af5d5d5989f90f8f6fc1640f73f
2017-06-13 20:38:46 +00:00
deads2k
aad51bc86d move labels to components which own the APIs
Kubernetes-commit: 954eb3ceb98032b50362da19a675bc9dacc110e2
2017-06-13 20:38:46 +00:00
Tomas Nozicka
b113bd5b26 Fix standardFinalizers - add missing metav1.FinalizerDeleteDependents
Kubernetes-commit: 9ed01e44a14e52ec8460b0282930b44964940972
2017-06-13 20:38:46 +00:00
Ahmet Alp Balkan
11c69ac127 clientgo/examples/out-of-cluster: add instructions
Adding instructions for out-of-cluster example and making it work without
specifying the -kubeconfig argument if the home directory can be inferred.

This is part of the body of work improving the client library samples.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

Kubernetes-commit: e59f05fe0ee6980c4bdaae76f5a77ef884bd2da1
2017-06-13 20:38:46 +00:00
Ahmet Alp Balkan
8787fb55e2 client-go: Add CRUD Deployment sample
This sample adds sample code for create/list/replace/delete operations for
Deployment resource for client-go library. This patch also contains
documentation explaining what the example application does and how it can be
executed.

This patch is part of the body of work improving the client library samples.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

Kubernetes-commit: d75710f9f4d2e74979f6da07de31b02fae0392b0
2017-06-13 20:38:46 +00:00
Clayton Coleman
8db6be287c Refactor printers to support rendering as a Table
Return tables from the server.

Kubernetes-commit: 7ce63eb608cdf95df429d6138ccf8dbf8b47a740
2017-06-13 20:38:46 +00:00
Josh Horwitz
375eed416f staging client
Kubernetes-commit: 24271c4c86ede012b6ecc42243ed01a82dcefdf4
2017-06-13 20:38:46 +00:00
Dr. Stefan Schimanski
c39a8b699d apimachinery: move unversioned registration to metav1
Kubernetes-commit: e3b92a11f1e9b898265d50eba92727b8209e0bb2
2017-06-13 20:38:45 +00:00
Dan Winship
5ae2719295 Regenerate files
Kubernetes-commit: 0923f860f1b9a05e9fbeeadc7345e0b0e6105040
2017-06-13 20:38:45 +00:00
Solly Ross
44b2cb7282 Regenerate protobuf and client-go
This commit regenerates the protobuf as per the recent generation
changes (removing erroneous imports, adding k8s.io/metrics), and
syncs the changes to client-go (which also ensures that client-go
protobuf IDL has the correct package names).

Kubernetes-commit: 8d03536d00b354aa299bf7359e482009146bf0da
2017-06-13 20:38:45 +00:00
deads2k
d3d2ebe2d3 prevent illegal verb/name combinations in default policy rules
Kubernetes-commit: 5539a6721dd3ea52261b51f859e5504c6b6affce
2017-06-13 20:38:45 +00:00
zhengjiajin
e65054aaa9 fix api description in swagger
Kubernetes-commit: 60c3152c56448aa72ed68a2a0da72a0e73d0dd08
2017-06-13 20:38:45 +00:00
Chao Xu
5ccf401176 generated
Kubernetes-commit: 89e506c46a3a8007e943aac1e743608f6bbc148c
2017-06-13 20:38:45 +00:00
xilabao
cad616fd7b add policy_compact to rbac validation
Kubernetes-commit: 9fe2ef54ba81144b4e0863212ddc0367e2498325
2017-06-13 20:38:45 +00:00
Kenneth Owens
10e9ca1449 Implements ControllerRevision API Object without codec and code
generation

Kubernetes-commit: ba128e6e417a8a2af062de0a81b4171e3a54a6fc
2017-06-13 20:38:45 +00:00
Michail Kargakis
b1f4aacc70 Generated changes for collision count
Signed-off-by: Michail Kargakis <mkargaki@redhat.com>

Kubernetes-commit: 9190a47c3769c329ed8b29844a667a1c959307df
2017-06-13 20:38:45 +00:00
Tim Hockin
7bef0aa41b Inject clock through flowcontrol
Kubernetes-commit: 3153ca2815c5a596adec770392248573c7e448b7
2017-06-13 20:38:45 +00:00
Tim Hockin
0c8efe21e2 Update godeps for juju ratelimit
This picked up an unrelated but missing change.

Kubernetes-commit: 3178433b9fb9a75ffe8b53c4c61fa8b71a409c65
2017-06-13 20:38:44 +00:00
Ken Simon
6bfadd9f8f Include event messages in aggregated events
This changes the event aggregation behavior so that, when multiple events are
deduplicated, the aggregated event includes the message of the latest related
event.

This fixes an issue where the original event expires due to TTL, and the
aggregate event doesn't contain any useful message.

Kubernetes-commit: 6ada269d8f199b02dd5852f1545746a14f58f4eb
2017-06-13 20:38:44 +00:00
zhengjiajin
2e44fe3560 /pkg/client/listers: fix some typo
Kubernetes-commit: dc48a5abc9233d7f3b18518d97d4842bdee694f7
2017-06-13 20:38:44 +00:00
Andy Goldstein
48409ad603 Fix in-cluster kubectl --namespace override
Before this change, if the config was empty, ConfirmUsable() would
return an "invalid configuration" error instead of examining and
honoring the value of the --namespace flag. This change looks at the
overrides first, and returns the overridden value if it exists before
attempting to check if the config is usable. This is most applicable to
in-cluster clients, where they don't have a kubeconfig but they do have
a token and can use KUBERNETES_SERVICE_HOST/_PORT.

Kubernetes-commit: 23e32b100fb9745b70203c30716697bd03926313
2017-06-13 20:38:44 +00:00
Anirudh
18c8914690 PDB MaxUnavailable: Generated
Kubernetes-commit: 48d76edc744ea2f8857717b51e6a564a4d49544b
2017-06-13 20:38:44 +00:00
System Administrator
ed614f066a Kubernetes core API changes for vSphere
Kubernetes-commit: 83520a7470e05362552a32fb97c4878fa05ce7de
2017-06-13 20:38:44 +00:00
Michelle Au
dc0c592386 Fix storage node affinity helpers
Kubernetes-commit: 5fcb82dde93429e443c77c8936e4412b9a936744
2017-06-13 20:38:44 +00:00
Eric Tune
0d7af62b83 Move PDB controller and type ownership to SIG-Apps
Created OWNERS_ALIASES called sig-apps-reviewers from the union of reviewers in:
 pkg/controller/{cronjob,deployment,daemon,job,replicaset,statefulset}/OWNERS
except removed inactive user bprashanth

Created OWNERS_ALIASES called sig-apps-api-reviewers as the intersection
of sig-apps-reviewers and the approvers from pkg/api/OWNERS.

Used those OWNERS_ALIASES as the reviewers/approvers for the disruption controller,
and API.

Kubernetes-commit: b17e3c14ebbdb66eacbf0bc4ae8d737df8e06869
2017-06-13 20:38:44 +00:00
Eric Chiang
1309db5ec6 oidc client plugin: reduce round trips and switch to golang.org/x/oauth2
This PR attempts to simplify the OpenID Connect client plugin to
reduce round trips. The steps taken by the client are now:

* If ID Token isn't expired:
   * Do nothing.
* If ID Token is expired:
   * Query /.well-known discovery URL to find token_endpoint.
   * Use an OAuth2 client and refresh token to request new ID token.

This avoids the previous pattern of always initializing a client,
which would hit the /.well-known endpoint several times.

The client no longer does token validation since the server already
does this. As a result, this code no longer imports
github.com/coreos/go-oidc, instead just using golang.org/x/oauth2
for refreshing.

Kubernetes-commit: 6915f857574505a2cd2072c32d9d6da66ce6f55a
2017-06-13 20:38:44 +00:00
Steven E. Harris
a5e25d7218 Remove redundant third-party type registration
Since NewSchemeBuilder registers the supplied Scheme transformation
functions synchronously, there's no need for a subsequent call
to (*SchemeBuilder).Register against the same instance.

Kubernetes-commit: 3a8e44bda80f74d674bf2df0b87cb4562a3587a0
2017-06-13 20:38:44 +00:00
Steven E. Harris
87c960d69b Copyedit third-party resource registration example
Kubernetes-commit: fe3ca9a6eba9b39a305b8cdffc2fbc7a66b812da
2017-06-13 20:38:44 +00:00
Jeffrey Regan
8debebccfb **What this PR does / why we need it**:
Remove kubectl's dependence on pkg/api/helper, as part of
broader effort to isolate kubectl from the rest of k8s.
In this case, the code becomes private to kubectl; nobody else uses it.

**Which issue this PR fixes**

Part of a series of PRs to address kubernetes/community#598

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```

Kubernetes-commit: 5a9b06b717805ad47da1edda6018fea107ac4ce9
2017-06-13 20:38:43 +00:00
Michelle Au
309d9ec71a Generated code for local persistent volumes
Kubernetes-commit: 936269a2eb60be837685a632b78a11941cb9d434
2017-06-13 20:38:43 +00:00
Clayton Coleman
e06018a166 Support burst in stateful set scale up and down
The alpha field podManagementPolicy defines how pods are created,
deleted, and replaced. The new `Parallel` policy will replace pods
as fast as possible, not waiting for the pod to be `Ready` or providing
an order. This allows for advanced clustered software to take advantage
of rapid changes in scale.

Kubernetes-commit: 2861ae5eb986a059c69e812513c272566c346710
2017-06-13 20:38:43 +00:00
Klaus Ma
e15298083c generated client-go.
Kubernetes-commit: fd0190fd685d648ab2c4ddc5802d14ad8813d07f
2017-06-13 20:38:43 +00:00
Ahmet Alp Balkan
8efad6dbf0 clientgo/examples/in-cluster: add instructions to run the example
This patch adds instructions for how to run the in-cluster client-go example.
To make this example executable, providing a Dockerfile and build steps so
that it can directly be run on minikube.

This is part of the body of work improving the client library samples.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

Kubernetes-commit: 8604ed6d9906ebfb33206b55467db41c87e9f148
2017-06-13 20:38:43 +00:00
xilabao
6e8ae30f39 update gopass to fix format error
Kubernetes-commit: 892980dd748bd99b0493b117ff4bf27eefb0ba63
2017-06-13 20:38:43 +00:00
fate-grand-order
d12329fb4d correct misspell "identify" in client_config.go
Kubernetes-commit: 8f2891c10267b5fb8e8bc1f8d6cb6d84145c9577
2017-06-13 20:38:43 +00:00
Kubernetes Publisher
07c4fcb4df sync: reset Godeps.json 2017-06-13 20:38:42 +00:00
Chao Xu
6b1566ccaa Merge pull request #195 from ahmetb/update-readme
Add travis build status & godoc badges to README
2017-05-22 10:54:13 -07:00
Kubernetes Publisher
450baa5d60 sync: resync vendor folder 2017-05-21 17:20:49 +00:00
Kubernetes Publisher
34de549141 sync(k8s.io/kubernetes) ad720cc651916aedd1d3aca665eff901c3445a88 2017-05-21 17:20:30 +00:00
Clayton Coleman
074f58b23a generated: bazel
Kubernetes-commit: ad720cc651916aedd1d3aca665eff901c3445a88
2017-05-21 17:20:29 +00:00
Clayton Coleman
25835dfc1e Mutation cache should support retrieving items from ByIndex()
Allows tokens controller to observe updates

Kubernetes-commit: 5ac3214c427614ec5c4a53ddc05d952474402412
2017-05-21 17:20:29 +00:00
Clayton Coleman
d84ceacdd1 Add a filtering resource handler for informers
Allows an informer consumer to easily filter a set of changes out,
possibly to maintain a smaller cache or to only operate on a known set
of objects.

Kubernetes-commit: 5439cfd24571a1727aacf741d3ab8bd33f974cab
2017-05-21 17:20:29 +00:00
Clayton Coleman
09165439d7 Refactor move of client-go/util/clock to apimachinery
Kubernetes-commit: 3e095d12b4f152a45b593927804e2e7b8816239a
2017-05-21 17:20:29 +00:00
Clayton Coleman
dd465010d3 Move client-go/util/clock to apimachinery/pkg/util/clock
For reuse

Kubernetes-commit: 8013212db54e95050c622675c6706cce5de42b45
2017-05-21 17:20:29 +00:00
Kubernetes Publisher
c6a3373021 sync: reset Godeps.json 2017-05-21 17:20:29 +00:00
Kubernetes Publisher
1f73522a95 sync(k8s.io/kubernetes) 113cf85612afafccd50eda03a6e9fa181bd4346a 2017-05-20 17:20:32 +00:00
Brendan Burns
b59661b22c more stuff.
Kubernetes-commit: 97f6c52ffde705bcdf127d890d3976740d70bbe6
2017-05-20 17:20:32 +00:00
Kubernetes Publisher
2255f22758 sync(k8s.io/kubernetes) dd9e0ecd06e7f11cb61c1549b00a6e6185b85e47 2017-05-19 17:20:32 +00:00
Tim St. Clair
4e6534081b Misc proto changes
Kubernetes-commit: dd9e0ecd06e7f11cb61c1549b00a6e6185b85e47
2017-05-19 17:20:32 +00:00
Kubernetes Publisher
45154911ef sync: resync vendor folder 2017-05-18 17:20:47 +00:00
Kubernetes Publisher
1788286020 sync(k8s.io/kubernetes) bdd4d34c7d514ec2eaae67fa462491711e02c8b9 2017-05-18 17:20:28 +00:00
Clayton Coleman
16495c6a8f generated: api changes
Kubernetes-commit: bdd4d34c7d514ec2eaae67fa462491711e02c8b9
2017-05-18 17:20:28 +00:00
Chao Xu
59a623b7ba restrict visibility of client-go/pkg/api
Kubernetes-commit: 88aed19e6361af6b2bcaaf1bb8ac35954e7079ae
2017-05-18 17:20:28 +00:00
Zihong Zheng
6a84e825d9 Autogenerated files
Kubernetes-commit: 931892af8a76ee768108798a8bcaecaac0c4d9f2
2017-05-18 17:20:28 +00:00
Christoph Blecker
b904f78ea0 Update generated files
Kubernetes-commit: 4361a9146e34d74fce9c0193b11b920ffbd0eda8
2017-05-18 17:20:27 +00:00
Zihong Zheng
3a86c93348 Autogenerated files
Kubernetes-commit: 5992425588dc9b370245d66fea2e46ff66982b2d
2017-05-18 17:20:27 +00:00
Ahmet Alp Balkan
24b46cb91b Add travis build status & godoc badges to README
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-05-17 11:26:19 -07:00
Kubernetes Publisher
8aceb98010 sync: resync vendor folder 2017-05-17 17:20:47 +00:00
Kubernetes Publisher
5eab562d64 sync(k8s.io/kubernetes) edd2d973a3c777afd691d6abe7b1e6420ad43cba 2017-05-17 17:20:30 +00:00
deads2k
cf4d5c32f3 stop setting bad defaults that are indistinguishable from real values for clients
Kubernetes-commit: edd2d973a3c777afd691d6abe7b1e6420ad43cba
2017-05-17 17:20:30 +00:00
deads2k
cf4cea8c3f remove unnessary confusion of dead values
Kubernetes-commit: 75bd27a59504919694b7a38e61613f84813f8d93
2017-05-17 17:20:30 +00:00
deads2k
3290c558e2 start using customresourcedefinition.status
Kubernetes-commit: cb604f756a7147fab8b5b4cccd3fd6869ef9bb2c
2017-05-17 17:20:30 +00:00
deads2k
0aaf615b8c add mutation cache filter
Kubernetes-commit: f88c7725b4f9446c652d160bdcfab7c6201bddea
2017-05-17 17:20:30 +00:00
mbohlool
a53d10f5ad Update generated files
Kubernetes-commit: 103c1bfc1ea77c87bc187f76c5ea7d4ff31d329e
2017-05-17 17:20:30 +00:00
Ahmet Alp Balkan
2ea6418cfa Autogenerated files
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

Kubernetes-commit: c4fd4789589e9fadfc0d0c69c530a788a9a84ce5
2017-05-17 17:20:30 +00:00
Kubernetes Publisher
c5bdf38534 sync: reset Godeps.json 2017-05-17 17:20:29 +00:00
Kubernetes Publisher
299a25eb5a sync: resync vendor folder 2017-05-16 17:20:46 +00:00
Kubernetes Publisher
7ed1861317 sync(k8s.io/kubernetes) 294c6362bd2aa12d77777fba1b77312d6385624b 2017-05-16 17:20:28 +00:00
Dmitry Shulyak
9e7cf8d7ca Use streaming constants from pkg/api/v1 instead of pkg/api
Kubernetes-commit: a713604b24bfb4530b690e061e863e71e0bc1087
2017-05-16 17:20:28 +00:00
Dmitry Shulyak
28760732a9 Add remotecommand to client-go/pkg/api visibility rules
Kubernetes-commit: 64d98c2d92ca18e966a7b7cdabfec4f2c594fb6f
2017-05-16 17:20:28 +00:00
Dmitry Shulyak
dffa083760 Add exec module to client-go/util only with required code
client-go/pkt/util was removed in favor of client-go util, which consists
only from CodeExitError and ExitError interface

Kubernetes-commit: 8574bc564f4c54aa964d6c0c7ccec3202d9e2f1b
2017-05-16 17:20:28 +00:00
Dmitry Shulyak
20e59c60f8 Move client/unversioned/remotecommand to client-go
Module remotecommand originally part of kubernetes/pkg/client/unversioned was moved
to client-go/tools, and will be used as authoritative in kubectl, e2e and other places.

Module remotecommand relies on util/exec module which will be copied to client-go/pkg/util

Kubernetes-commit: 2612e0c78ad18ac87bbd200d547100cf99f36089
2017-05-16 17:20:28 +00:00
Cao Shufeng
29b5bff0fa add --as-group option to cli
The usecase of this change:
When a super user grant some RBAC permissions to a group, he can use
--as-group to test whether the group get the permissions.
Note that now we support as-groups, as-user-extra in kubeconfig file
after this change.

Kubernetes-commit: e541defd49d01024d17dddf8e966eba2c46a6db0
2017-05-16 17:20:28 +00:00
Jordan Liggitt
fdfa162aed Require nodeName for mirror pods, make mirror pod annotation immutable
Kubernetes-commit: cd3a1187a1736985ea32111a61646ab691849a4d
2017-05-16 17:20:27 +00:00
Kubernetes Publisher
8a36291845 sync: reset Godeps.json 2017-05-16 17:20:27 +00:00
Kubernetes Publisher
a546461dcc sync(k8s.io/kubernetes) 9590b94f7ce47862316bf5acaae7f1af3075db9a 2017-05-15 17:20:25 +00:00
Andy Lindeman
f851632ada Uses container/heap
Kubernetes-commit: dad64459a9b8c56d5bca681e37c3d0f44921d472
2017-05-15 17:20:25 +00:00
Andy Lindeman
fe9ac9f9c0 Adds benchmark test
Kubernetes-commit: 21ca6c498aec2879fd7b9796f55743e5f14d5a80
2017-05-15 17:20:25 +00:00
Kubernetes Publisher
1bf81ae841 sync(k8s.io/kubernetes) abaffb243e39067197344e650989bc9f89b2f62d 2017-05-13 17:20:26 +00:00
Zihong Zheng
f3b79c3323 Autogenerated files
Kubernetes-commit: 12b6c2b8792f375460c94f59c9bffe39895df37f
2017-05-13 17:20:25 +00:00
Chao Xu
3c049628f8 run visibility-control.sh to setup visibility for all internal versions of client-go api groups, and their install packages
Kubernetes-commit: b91f787d8368ae5499a2f25009f5acf17918ebf5
2017-05-13 17:20:25 +00:00
Chao Xu
7ee9bbd10c update visibility manually
Kubernetes-commit: b1b5ead8b400d123f0027408c054370c55c01230
2017-05-13 17:20:25 +00:00
Nail Islamov
f1648c6391 Replacing “Pod Injection Policy” with “Pod Preset” in the code documentation
Kubernetes-commit: 66f45195afd0b867d9c2befa5d43824723569758
2017-05-13 17:20:25 +00:00
Kubernetes Publisher
1b8c2a3e22 sync: resync vendor folder 2017-05-12 17:22:18 +00:00
Kubernetes Publisher
29ea990f7c sync(k8s.io/kubernetes) 0c5a7b434ca85b15cdabce1ff6bc928d15065c6e 2017-05-12 17:21:59 +00:00
Dr. Stefan Schimanski
6434e2e4bb NotRegisteredErr for known kinds not registered in target GV
The dynamic client uses NotRegisteredErr to fall back to core v1 if ListOptions is not known
in the given GV. This commit fixes the case that ListOptions is known in some group, but not
in the given one.

Kubernetes-commit: 2ece9e4dec483c9712d09dc7c1fd5be1fe68ea62
2017-05-12 17:21:59 +00:00
Guangya Liu
5a21aa58a2 Added indexer description for the API of NewIndexerInformer.
Kubernetes-commit: e42f7c7480c304144b3c90089232c5fc59229cce
2017-05-12 17:21:59 +00:00
Dr. Stefan Schimanski
bdefb3c11a Update generated files
Kubernetes-commit: b498019f2f7aebe1c0e5c0d7a825069e25650fc6
2017-05-12 17:21:59 +00:00
Dr. Stefan Schimanski
a46cb79cf4 client-go tpr example: round trip external tpr types
Kubernetes-commit: fb2298de18eee7cb3d677143d3dd2cfde440aa6a
2017-05-12 17:21:59 +00:00
Chao Xu
e833e172a0 generated
Kubernetes-commit: a5fd6b91e7986b1de2589077e3cfdafcdb6de013
2017-05-12 17:21:59 +00:00
Chao Xu
d112596ad6 make client-go/pkg/api invisible to k8s.io/metrics; except for the fake
client, which will be fixed soon

Kubernetes-commit: dec78eb9aef9d09dd9ef090a580a28ecf90dac21
2017-05-12 17:21:59 +00:00
Klaus Ma
02b7d62fd4 generated client-go.
Kubernetes-commit: 3278de723add74849089e9563be20005bb018af5
2017-05-12 17:21:59 +00:00
Dr. Stefan Schimanski
1120d7fc8d Add myself to client-go OWNERS
Kubernetes-commit: b7146bca19820bc320e8286f7edfd90a3ab0f9b7
2017-05-12 17:21:59 +00:00
Nail Islamov
8d49905c48 ThirdPartyResource client-go example: added TPR controller example, code cleanup and integration test
Kubernetes-commit: a6c97715ed7e24581dd9a02a256d57e56b70ac44
2017-05-12 17:21:59 +00:00
Haoran Wang
bb2e182124 oidc auth plugin not to override the Auth header if it's already exits
Kubernetes-commit: f54a08093d6d65be64fa9281622997126af966f8
2017-05-12 17:21:59 +00:00
mbohlool
650f6b4f1d Update go-restful dependency
Kubernetes-commit: ea042c6ca0fc7eb8017012ca56d6879b8cf10637
2017-05-12 17:21:59 +00:00
Jamie Hannaford
958f3df6a4 Use dedicated Unix User and Group ID types
Kubernetes-commit: 9440a68744ea97a45ceeef6d75466405ac101ea1
2017-05-12 17:21:59 +00:00
NickrenREN
dad27d745a remove deprecated NodeLegacyHostIP
Kubernetes-commit: 7d00e5cfb66d4501879125f4d3c732f9bb726d0c
2017-05-12 17:21:58 +00:00
Klaus Ma
ca719949f1 Set defaults for initContainer beta.
Kubernetes-commit: 7b7a759915c515c37455dafa2e98b4d95e6ce6b7
2017-05-12 17:21:58 +00:00
Kubernetes Publisher
1f311d1b79 sync: reset Godeps.json 2017-05-12 17:21:58 +00:00
Kubernetes Publisher
22eca115bd sync(k8s.io/kubernetes) 99540c6435075bad7522f60f0bcdc6e63c0a4f2d 2017-05-05 20:28:27 +00:00
Solly Ross
e71930600e OWNERS: add directxman12 to pkg/apis/autoscaling
Added directxman12 (current SIG lead of SIG-autoscaling) as a reviewer
for pkg/apis/autoscaling.

Kubernetes-commit: b6256e1f3f6f6dbf6f600bc3b958508f09d9e383
2017-05-05 20:28:27 +00:00
Kubernetes Publisher
d2e281defd sync: resync vendor folder 2017-05-04 20:28:52 +00:00
Kubernetes Publisher
69da22a50f sync(k8s.io/kubernetes) d22a9c25997c3b94078c76af72fd4c7071e6c882 2017-05-04 20:28:29 +00:00
Chao Xu
6db1a83402 generated clientset changes
propagate to client-go
update-bazel.sh

Kubernetes-commit: 5f5a70f65f7dbcfc9215caee27cfd9a4be23f348
2017-05-04 20:28:29 +00:00
Chao Xu
85c50f4ccb remove registry from testing/fixture.go; update client-gen to not use
registry in the generated clients

Kubernetes-commit: bbb94e42c108840c540c5667f8da97c33b81d84a
2017-05-04 20:28:29 +00:00
Chao Xu
ede4e68eb7 Remove redundent GetObjectKind() defined on top-level types
TypeMeta is embedded in all these types and TypeMeta has GetObjectKind()
method to implement the runtime.Object interface.

Kubernetes-commit: 47b410f58b4f00c010a2238d4faff44d16582315
2017-05-04 20:28:29 +00:00
Chao Xu
89e9cea531 control visibility client-go/pkg/api
Kubernetes-commit: c9844686781176b5d175728cbd6cc6327d62198e
2017-05-04 20:28:28 +00:00
Andy Goldstein
0389c75147 Fix typo in lister-gen, regenerate
NamespaeLister -> NamespaceLister

Kubernetes-commit: 11e4f149d906ad0c87d0a4062078cd4e24c813f6
2017-05-04 20:28:28 +00:00
Eric Chiang
8e696697e7 staging: run ./hack/update-staging-client-go.sh
Kubernetes-commit: 9fc727cf44ed4d00d8f51270d244cb140d3c1b3c
2017-05-04 20:28:28 +00:00
Kubernetes Publisher
64e947de2f sync: reset Godeps.json 2017-05-04 20:28:28 +00:00
Kubernetes Publisher
f0ab6b85bd sync: resync vendor folder 2017-05-03 20:28:57 +00:00
Kubernetes Publisher
ad97d39b91 sync(k8s.io/kubernetes) 80f26fa8a89ef5863cb19c71a620bb389d025166 2017-05-03 20:28:32 +00:00
Dr. Stefan Schimanski
b3c3c3d1fe apimachinery: rename meta.{ -> UnsafeGuess}KindToResource
Kubernetes-commit: b0b711119b48854e0b73805e42be2bcc4b2bd604
2017-05-03 20:28:32 +00:00
Chao Xu
7b1f9a193b remove references to client-go/pkg/api
Kubernetes-commit: d978f22e04519f6eecfde839110c398dc28d4e8e
2017-05-03 20:28:31 +00:00
Kubernetes Publisher
f1cb94b672 sync(k8s.io/kubernetes) 4a487cbb11c2cc10483fe9f19271a0b3dd910c2f 2017-05-02 20:28:24 +00:00
Henrique Truta
bc6311c19c Fixes broken link in PodSpec
The PodSpec reference to NodeSelector misses
 the .md extension in the file.

Kubernetes-commit: 4a487cbb11c2cc10483fe9f19271a0b3dd910c2f
2017-05-02 20:28:23 +00:00
Kubernetes Publisher
7ba6be5949 sync: resync vendor folder 2017-05-01 20:28:46 +00:00
Kubernetes Publisher
db4645fe45 sync: resync vendor folder 2017-04-29 20:28:42 +00:00
Kubernetes Publisher
ee36746f42 sync(k8s.io/kubernetes) a76ada8d5ac5f4cea2d7fabce23d7af9c62e3eb9 2017-04-29 20:28:22 +00:00
Ricky Pai
750abd4711 generated files
Kubernetes-commit: a76ada8d5ac5f4cea2d7fabce23d7af9c62e3eb9
2017-04-29 20:28:22 +00:00
deads2k
e7b07ed0c1 generated
Kubernetes-commit: afc5ae1539b0b27a8b569c4bd737db21bf1229ee
2017-04-29 20:28:22 +00:00
Kubernetes Publisher
9ccb531510 sync: reset Godeps.json 2017-04-29 20:28:22 +00:00
Kubernetes Publisher
54b86aca52 sync: resync vendor folder 2017-04-28 20:28:48 +00:00
Kubernetes Publisher
d4d5232db6 sync(k8s.io/kubernetes) 2b178ad608bd443efeaf3e9ea7c700e72ab68de1 2017-04-28 20:28:26 +00:00
Fabiano Franz
1a014f4539 Basic support for kubectl plugins
Kubernetes-commit: 2b178ad608bd443efeaf3e9ea7c700e72ab68de1
2017-04-28 20:28:26 +00:00
Chao Xu
153fd0bab2 make it possible to move SchemeBuilder with zz_generated.deepcopy.go
Kubernetes-commit: d0b94538b9744d0c06df6ddec2604be168568f9d
2017-04-28 20:28:26 +00:00
Chao Xu
384737846d bazel
Kubernetes-commit: 958903509c29fdfe216c0bbf0abce1ce0abd59a6
2017-04-28 20:28:26 +00:00
Chao Xu
cf012f20d0 easy changes
Kubernetes-commit: 3fa7b7824abbf3daec1189b118b91b5bb726958f
2017-04-28 20:28:25 +00:00
Kubernetes Publisher
670b68600e sync: resync vendor folder 2017-04-27 20:28:58 +00:00
Kubernetes Publisher
313ec0555a sync(k8s.io/kubernetes) c446132a97d5a1d035b031b4f8e322aea3a7cfac 2017-04-27 20:28:33 +00:00
Chao Xu
c6d944a2de bazel
Kubernetes-commit: ee61ffb4b15afc5e2a63eea687e95accb46fd44f
2017-04-27 20:28:33 +00:00
Chao Xu
3fa06e848c update list-gen to not import internal package in external listers
Kubernetes-commit: 0bac9b6aaabfe3dcf50fdcbdddfc8b4eb5aa805e
2017-04-27 20:28:33 +00:00
Andy Goldstein
6bc1999690 Add redirect support to SpdyRoundTripper
Add support for following redirects to the SpdyRoundTripper. This is
necessary for clients using it directly (e.g. the apiserver talking
directly to the kubelet) because the CRI streaming server issues a
redirect for streaming requests.

Also extract common logic for following redirects.

Kubernetes-commit: 715d5d9c91c669cf33c0bf9a9c9d352c6c4228a6
2017-04-27 20:28:33 +00:00
Phillip Wittrock
6cd603a009 kubectl OpenAPI bazel updates
Kubernetes-commit: 21e239fb82e7e81dfed9bfddc4e95ff8201c52fa
2017-04-27 20:28:33 +00:00
Phillip Wittrock
97a8b3b040 kubectl OpenAPI support
Kubernetes-commit: 212c2a3a7217ff7e0a7c895582c7a25d03ac7f8c
2017-04-27 20:28:33 +00:00
Phillip Wittrock
c192350f2c kubectl OpenAPI godeps updates
Kubernetes-commit: 70704196be463508d0a43dfd04a002364f28346a
2017-04-27 20:28:32 +00:00
Kubernetes Publisher
dee664a95b sync: reset Godeps.json 2017-04-27 20:28:32 +00:00
Kubernetes Publisher
71cbfce9d8 sync: resync vendor folder 2017-04-26 20:28:44 +00:00
Kubernetes Publisher
818c53c780 sync(k8s.io/kubernetes) 50af2e84ab699ef54dfadca9dda84f9dce552d10 2017-04-26 20:28:24 +00:00
Lucas Käldström
51e9e663fd Update the staging directory
Kubernetes-commit: 50af2e84ab699ef54dfadca9dda84f9dce552d10
2017-04-26 20:28:23 +00:00
Kubernetes Publisher
837527a2a0 sync: resync vendor folder 2017-04-25 20:28:46 +00:00
Kubernetes Publisher
70c13e394d sync(k8s.io/kubernetes) f4eed2477d649e8a516e77d6f8b8fa304475355d 2017-04-25 20:28:25 +00:00
Jan Safranek
d3789e9779 Regenerate everything
Kubernetes-commit: cde2746821954c8eba5ef4d2ab55691619cae4df
2017-04-25 20:28:25 +00:00
Jordan Liggitt
21a475eefb Stop treating in-cluster-config namespace as an override
Kubernetes-commit: 1305559abbcd1e5558980062221ed3e65a8f0387
2017-04-25 20:28:25 +00:00
NickrenREN
714e60e890 Define const annotation variable once
Move annotation to package imported by both pkg/volume and pkg/volume/validation

Kubernetes-commit: e443277d58e3ff1f0701ab97a1f4932389c27847
2017-04-25 20:28:24 +00:00
Kubernetes Publisher
e2c503b420 sync: resync vendor folder 2017-04-24 20:28:45 +00:00
Kubernetes Publisher
1aa489224e sync(k8s.io/kubernetes) fa750c02be9dca2caa1e3f0d755edf88e4677406 2017-04-22 20:28:23 +00:00
Jordan Liggitt
7972aac9f3 Explicit namespace from kubeconfig should override in-cluster config
Kubernetes-commit: 63b5650885acf6c2f4e68c8140ade2964bc2c6cb
2017-04-22 20:28:23 +00:00
Kubernetes Publisher
a4c9f96ebf sync: resync vendor folder 2017-04-21 20:28:40 +00:00
Kubernetes Publisher
a8293e2363 sync(k8s.io/kubernetes) c4bc7c1166dd494194c64a2a5edc3ed51dcf6003 2017-04-21 20:28:22 +00:00
Roman Mohr
3e24501bb6 client-go workqueue example
Demonstrates how to compose a controller out of cache.Controller,
cache.Indexer and a workqueue.

Kubernetes-commit: b39b3ba01675828c13bc0dea67d5114b4c225644
2017-04-21 20:28:22 +00:00
Yves Peter
1baf68dddb client-go PortForwarder: don't log an error if net.Listen fails
Kubernetes-commit: 99711a96a4e5fbd2bc26cbc070c96852c5939570
2017-04-21 20:28:21 +00:00
Kubernetes Publisher
f64a115c80 sync(k8s.io/kubernetes) 7b43f922aa059abfbbd9be1840499080cb7d6f54 2017-04-20 20:28:19 +00:00
Jordan Liggitt
e57428f505 Switch to pointer to policy rule, visit and short circuit during authorization
Kubernetes-commit: 67360883bc801b0f1334b146e8dce6f282e50e7e
2017-04-20 20:28:19 +00:00
Anthony Yeh
4c84996bc2 Job: Update Lister documentation for ControllerRef.
The Job Listers still use selectors, because this is the
behavior expected by callers. This clarifies the meaning of the
returned list. Some callers may need to switch to using
GetControllerOf() instead, but that is a separate, case-by-case issue.

Kubernetes-commit: ad026026e0252469bab05f9adba4bb1b20a8f6a9
2017-04-20 20:28:19 +00:00
Kubernetes Publisher
69f0a81e21 sync: resync vendor folder 2017-04-18 20:28:40 +00:00
Kubernetes Publisher
65b634c822 sync(k8s.io/kubernetes) a1684fea80d0470db1e30bc3e051e87a0b956c71 2017-04-18 20:28:21 +00:00
Chao Xu
354468e551 move pkg/api/v1/ref.go and pkg/api/v1/resource.go to subpackages. move some functions in resource.go to pkg/api/v1/node and pkg/api/v1/pod
Kubernetes-commit: 4f9591b1de11bff617c920f89144004669b0f461
2017-04-18 20:28:21 +00:00
Christoph Blecker
ad53524c7c Fix gofmt errors
Kubernetes-commit: 6681835b0c00122a408bd4addd47b02840b6208c
2017-04-18 20:28:21 +00:00
Antoine Pelisse
b128bee2cc OWNERS: Create sig-node alias
Create an alias group for sig-node
WaitForCacheSync method comment "contoller" is error word

Kubernetes-commit: 77cbdddb5907a81cb6bbd9b9234e2acfd4394004
2017-04-18 20:28:21 +00:00
Kubernetes Publisher
5188c3e3d4 sync(k8s.io/kubernetes) ca8f1bcf3d67bae574146a2adf9989b4a43046e3 2017-04-17 20:28:21 +00:00
Tim Hockin
2876fbe4ad --amend
Kubernetes-commit: fa93290b7276e1b3585de9ec70f26a935bce8746
2017-04-17 20:28:21 +00:00
xu fei
3113f909d8 change event count type
event count type had better to be uint.

Kubernetes-commit: 461761e5b0b4beb3f49cc5973b50e9a6de3875dd
2017-04-17 20:28:21 +00:00
Kubernetes Publisher
f215249656 sync: resync vendor folder 2017-04-16 20:28:34 +00:00
Kubernetes Publisher
4f4d9e78f5 sync: resync vendor folder 2017-04-15 20:28:35 +00:00
Kubernetes Publisher
dd45794e15 sync(k8s.io/kubernetes) f05ce1e8f171529773c9ca05c85e01f317d84ea4 2017-04-15 20:28:18 +00:00
Jeffrey Regan
633aab4bea Use OS-specific libs when computing client User-Agent.
**What this PR does / why we need it**:

The User-Agent reported by clients (e.g. kubectl) in request
headers should include the name of the client executable
but not the full path to that executable.

This PR changes how this name is determined by using the
operating-system specific package "path/filepath" (meant for
working with file system paths) instead of the "path" package
(meant for URL paths).

This fixes a problem on the Windows OS in the case where, if the
user has not set their PATH to point to the location of their
client executable, the User-Agent unnecessarily includes the
full path.

Fixes: #44419

Kubernetes-commit: 04f993250bc7a1aef0f2874d440ddb4bec1012c5
2017-04-15 20:28:18 +00:00
Chao Xu
bb2e2ad83c move pkg/api/v1/helpers.go to subpackage
Kubernetes-commit: d4850b6c2b3b367345ef944a12a778d860fdd0db
2017-04-15 20:28:18 +00:00
Mike Danese
4b15a8b136 add testdata for tests in //vendor/k8s.io/...
Kubernetes-commit: 981dd8dc6615f397a9b85c5b965998dc8a0b1338
2017-04-15 20:28:18 +00:00
Mike Danese
9a45999fa0 autogenerated
Kubernetes-commit: a05c3c0efdc5822049e34b1a5a1ee259c5fb1906
2017-04-15 20:28:18 +00:00
Kubernetes Publisher
a1a3cacf90 sync: resync vendor folder 2017-04-14 20:28:39 +00:00
Kubernetes Publisher
3cbc5ba655 sync(k8s.io/kubernetes) 47ccb092f499bbf02abfdea218b777c1715c69e5 2017-04-14 20:28:21 +00:00
Chao Xu
76c209704f move resource_helpers.go to a subpackage
Kubernetes-commit: 9837a98564b06ee1f8662b83960051463e8e3c36
2017-04-14 20:28:21 +00:00
Chao Xu
5b1ad11ba7 move ref.go to its own subpackage
Kubernetes-commit: d9920c53a575a7c017a9cd120220ef2ad761a962
2017-04-14 20:28:21 +00:00
Maciej Szulik
449f25e669 Staging changes for docs in batch types.go
Kubernetes-commit: a307c47dfd417889967413d5e50515e499b3b772
2017-04-14 20:28:20 +00:00
Jordan Liggitt
8a68cfcf75 Remove vestiges of defaulting from conversion path, switch to top-level default registration only
Kubernetes-commit: ad116026d9fefe70bbc37f30b9d299ca3af6e43c
2017-04-14 20:28:20 +00:00
StudyNick
268171e690 'workqueue' modify 'work queue'
Kubernetes-commit: dc460c3e15651d7e3527337c7997ab7f956ad6b1
2017-04-14 20:28:20 +00:00
Kubernetes Publisher
bc86c35183 sync(k8s.io/kubernetes) 868eb745abc4b12d53286cb2f6a279a9f375d5d3 2017-04-13 20:28:17 +00:00
Maciej Szulik
fcf5e39983 Staging client changes for defaults updates
Kubernetes-commit: ce013adfbba0df510e082e645daad971a069c9e5
2017-04-13 20:28:17 +00:00
Daniel Smith
d2a94be401 Merge pull request #179 from caesarxuchao/move-dep
Move dep to the last recommended vendoring tool
2017-04-13 12:25:15 -07:00
Chao Xu
57fb61ca9c move down dep to the last recommended vendoring tool 2017-04-13 11:25:49 -07:00
Kubernetes Publisher
5b0e11b577 sync: resync vendor folder 2017-04-12 20:28:38 +00:00
Kubernetes Publisher
faba476f26 sync(k8s.io/kubernetes) d70b55ead532f970876708cf4b96f84976a6e343 2017-04-12 20:28:20 +00:00
Chao Xu
b4836ee03e move helpers.go to helper
Kubernetes-commit: 08aa712a6c3bf429017e14cdec3dcfb4d983af82
2017-04-12 20:28:20 +00:00
Sahdev P. Zala
184fe30384 Conversion generated code changes for golint fix
The exported or public functions requires a doc comment to pass golint.
This commit has changes of conversion generated code. The actual doc
changes are added into a separate commit for a clean review.

Kubernetes-commit: 08639023d027e0b69e3b3e5535b04148e084b1bd
2017-04-12 20:28:20 +00:00
Timothy St. Clair
bcb754b775 Update staging files
Kubernetes-commit: fc04bba10e18eef666de3f7348513af49b27019c
2017-04-12 20:28:20 +00:00
Timothy St. Clair
656cf48fd6 Level sets dependency graph to consume etcd 3.1.5
Kubernetes-commit: 93c051e28fc43ed35cb9074f6de5a8c4de799eb2
2017-04-12 20:28:20 +00:00
NickrenREN
0865289f28 Remove alphaProvisioner in PVController and AlphaStorageClassAnnotation
Kubernetes-commit: fa7bd44966f02a87bd964dd63cba8e741aaaacc8
2017-04-12 20:28:20 +00:00
Dr. Stefan Schimanski
5cca8d5380 hack/verify-staging-imports.sh: check that plugins are not imported by default
Kubernetes-commit: 792d1f3dc0bd45ab63c59cfee298bfc4b898a914
2017-04-12 20:28:20 +00:00
Kubernetes Publisher
d7af91d796 sync: reset Godeps.json 2017-04-12 20:28:19 +00:00
Kubernetes Publisher
4a3ab2f5be sync: resync vendor folder 2017-04-11 20:28:38 +00:00
Kubernetes Publisher
e4963c97a8 sync(k8s.io/kubernetes) f1b9c17cef2f18268b3521dede120634c3f7252a 2017-04-11 20:28:18 +00:00
deads2k
5d5193044b make unstructured items correspond to other items for storage
Kubernetes-commit: 706823aaa8b34ac197230ff7952c095fc0a7a614
2017-04-11 20:28:18 +00:00
deads2k
bd7878428d remove objectmetafor
Kubernetes-commit: 04460c8750b9a47672aa708251de0e703cfb7266
2017-04-11 20:28:18 +00:00
Dan Winship
035f98d6c6 Regenerate files
Kubernetes-commit: 11471e965d1aa7f32f576186270b6d89001946ae
2017-04-11 20:28:18 +00:00
Andy Goldstein
634770b327 validateClusterInfo: use clientcmdapi.NewCluster()
Change validateClusterInfo to use clientcmdapi.NewCluster() instead of
clientcmdapi.Cluster{} when comparing against the passed in clusterInfo.
clusterInfo most likely will be a combination of
clientcmdapi.NewCluster() merged with potential overrides. This is
necessary because otherwise, the DeepEqual between what is supposed to
be an empty Cluster and clusterInfo will fail, resulting in an error
that doesn't allow fall-through to checking for in-cluster
configuration.

Kubernetes-commit: 266ba9ffdeeeeba8022ce94ae4e725d996c29363
2017-04-11 20:28:18 +00:00
Jacob Simpson
f503ec43c7 Change the PEM block type to use the constant
Kubernetes-commit: 515987db3f039f5f19c3f6292af072b937aacdd7
2017-04-11 20:28:18 +00:00
Kubernetes Publisher
1953732e1e sync: resync vendor folder 2017-04-10 20:28:32 +00:00
Kubernetes Publisher
0ec10d4351 sync: resync vendor folder 2017-04-08 20:28:36 +00:00
Kubernetes Publisher
875418b286 sync(k8s.io/kubernetes) d043e20febe4652a1a4281f327e2b6499bde7e8d 2017-04-08 20:28:19 +00:00
Chao Xu
b71dbc873e separate constants to their own file
Kubernetes-commit: 2e44bb1c3b4584b21f515511ac1389e38eb4aa8a
2017-04-08 20:28:19 +00:00
ymqytw
f065b8d2f7 autogen
Kubernetes-commit: 5f60dcd90bac8e08323e4a0bc50c23d3fcc81f58
2017-04-08 20:28:18 +00:00
ymqytw
f256b244db add patch comment tags in open api
Kubernetes-commit: 1804e5e54800182539edde31dc7bf579e9a55f03
2017-04-08 20:28:18 +00:00
Huamin Chen
8459297e5e generated files
Signed-off-by: Huamin Chen <hchen@redhat.com>

Kubernetes-commit: 777eb32e91ed1bf47a2d23e755734a1d85bbad68
2017-04-08 20:28:18 +00:00
Harry Zhang
74bee732dd Update generate staging client-go
Kubernetes-commit: 74a99e1e1dd1ae0b6daa6ddc8d67f1ddd9992c12
2017-04-08 20:28:18 +00:00
deads2k
dcd132623d remove ListMetaFor
Kubernetes-commit: 7df37c484dac3438530f2b8cb03cf63f85f2fc29
2017-04-08 20:28:18 +00:00
Kubernetes Publisher
623dbc3dc4 sync: resync vendor folder 2017-04-06 20:28:32 +00:00
Kubernetes Publisher
d89514765b sync(k8s.io/kubernetes) e3e44b77ff6a6574c956253cc384c44378d89737 2017-04-06 20:28:15 +00:00
Klaus Ma
1f9cd88972 generated client-go.
Kubernetes-commit: 98a52fd6b5fd50f45554c4c8f86350d62826fc26
2017-04-06 20:28:15 +00:00
fate-grand-order
7f5f33cf4b fix misspell "underlying" in request.go
Kubernetes-commit: 122ea2551202e5edb3e840a97518170e060c484f
2017-04-06 20:28:15 +00:00
Kubernetes Publisher
dabf37f5df sync(k8s.io/kubernetes) dc4b8e3496791ca6e9f847007666baeb113da036 2017-04-05 20:28:15 +00:00
Chris Hupman
e4d1dd445d Fixed inaccurate comments for Secret and ConfigMap
Fixes #42203

ran documentation update scripts in hack folder

Signed-off-by: Chris Hupman <chupman@us.ibm.com>

Kubernetes-commit: dc4b8e3496791ca6e9f847007666baeb113da036
2017-04-05 20:28:15 +00:00
Kubernetes Publisher
4e221f82e2 sync(k8s.io/kubernetes) e28cb42706c32795b15a4159a275a53e020d4ac6 2017-04-04 20:28:14 +00:00
andrewsykim
6919445563 Regenerate code for api change
Kubernetes-commit: f05d584a4aa5a2071755c7bc97b2c3048f1557cb
2017-04-04 20:28:14 +00:00
Daniel Smith
e65642b619 Merge pull request #172 from caesarxuchao/3.0-changelog
update CHANGELOG for v3.0.0-beta.0
2017-04-03 15:53:08 -07:00
Chao Xu
bcb98146bb update CHANGELOG entry for v3.0.0-beta.0 2017-04-03 15:49:49 -07:00
Chao Xu
e8ae1e5c8e Merge pull request #171 from caesarxuchao/update-dep-readme
minor update to installation guide using dep
2017-04-03 14:32:39 -07:00
Chao Xu
388446dfe7 minor update to INSTALL guide using dep 2017-04-03 14:26:19 -07:00
Kubernetes Publisher
8c2f08eadb sync(k8s.io/kubernetes) 81545c2922b5e933eff52c19502510b906499d4f 2017-04-03 20:28:13 +00:00
Morgan Bauer
16f41facbc Update godoc to match
Kubernetes-commit: 3e5f904c89619bd158b241a31255541967fc99b4
2017-04-03 20:28:13 +00:00
Daniel Smith
1b8a363f59 Merge pull request #169 from caesarxuchao/3.0-tag
Add client-go 3.0 beta to compatibility matrix
2017-04-03 12:35:07 -07:00
Chao Xu
20aa040788 add client-go 3.0 beta to compatibility entry 2017-04-03 10:48:45 -07:00
Daniel Smith
63e44d4493 Merge pull request #157 from caesarxuchao/go-get
We support `go get` now, update INSTALL.md
2017-03-31 16:55:44 -07:00
Kubernetes Publisher
4c84db01ca sync: resync vendor folder 2017-03-31 20:29:47 +00:00
Kubernetes Publisher
8462402abd sync(k8s.io/kubernetes) bb656f97f1fa6d043dc3465285ba8bf4959cd595 2017-03-31 20:29:30 +00:00
yupengzte
f15453e5cd Fix typo
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>

Kubernetes-commit: bb656f97f1fa6d043dc3465285ba8bf4959cd595
2017-03-31 20:29:30 +00:00
deads2k
999c0d5c20 move category expansion out of restmapper
Kubernetes-commit: 8895f314b478714a561dc1fc79d7411d31f91dc6
2017-03-31 20:29:30 +00:00
deads2k
9be38b2aa2 wire in aggregation
Kubernetes-commit: 8e26fa25da6d3b1deb333fe2484f794795d1c6b9
2017-03-31 20:29:30 +00:00
Avesh Agarwal
45bc41463a Auto generated stuff.
Kubernetes-commit: 0f65df66e68d9fbd4c1cb4a84ef30c751c0588fa
2017-03-31 20:29:30 +00:00
Jordan Liggitt
09ffb13d76 Update client-go
Kubernetes-commit: 7ceeee8665a80dca701bada1d85b4edbc8d8a281
2017-03-31 20:29:30 +00:00
Chao Xu
98caa049f9 remove timed_queue, its functionality is supported by a regular queue now
Kubernetes-commit: 29432ce05476e3452b3afe0563d45bdc66ef8c27
2017-03-31 20:29:30 +00:00
Chao Xu
6be328a96b fix fake_event_expansion.go
Kubernetes-commit: 68effc7b2d2428a1cca6322d8d87e17b4ff6f1b0
2017-03-31 20:29:30 +00:00
Lou Yihua
45e7f68a04 Update generated & client-go
Kubernetes-commit: 64f2b0c0fc183291553ff96cddd9d42e6d8e43eb
2017-03-31 20:29:29 +00:00
Kris
200ba6b1ab Remove krousey from some OWNERS files
Kubernetes-commit: ee4227f4bfe8c33426f1ac267a945094bfbc83cf
2017-03-31 20:29:29 +00:00
Chao Xu
399b27ce31 we support go get now, update INSTALL.md 2017-03-21 16:09:02 -07:00
895 changed files with 76610 additions and 31725 deletions

View File

@@ -3,6 +3,6 @@ language: go
go_import_path: k8s.io/client-go
go:
- 1.7.4
- 1.8.1
script: go build ./...

View File

@@ -3,8 +3,22 @@ TODO: This document was neglected and is currently not complete. Working on
fixing this.
# HEAD (changes that will go into the next release)
* Added dependency on k8s.io/apimachinery
* Added generated listers and informers
# v3.0.0-beta.0
* Added dependency on k8s.io/apimachinery. The impacts include changing import path of API objects like `ListOptions` from `k8s.io/client-go/pkg/api/v1` to `k8s.io/apimachinery/pkg/apis/meta/v1`.
* Added generated listers (listers/) and informers (informers/)
* Kubernetes API changes:
* Added client support for:
* authentication/v1
* authorization/v1
* autoscaling/v2alpha1
* rbac/v1beta1
* settings/v1alpha1
* storage/v1
* Changed client support for:
* certificates from v1alpha1 to v1beta1
* policy from v1alpha1 to v1beta1
* CHANGED: pass typed options to dynamic client (https://github.com/kubernetes/kubernetes/pull/41887)
# v2.0.0
@@ -18,7 +32,7 @@ fixing this.
in separate branches.
* Clientset supported multiple versions per API group
* Added ThirdPartyResources example
* API changes
* Kubernetes API changes
* Apps API group graduated to v1beta1
* Policy API group graduated to v1beta1
* Added support for batch/v2alpha1/cronjob

257
Godeps/Godeps.json generated
View File

@@ -1,6 +1,6 @@
{
"ImportPath": "k8s.io/client-go",
"GoVersion": "go1.7",
"GoVersion": "go1.8",
"GodepVersion": "v79",
"Packages": [
"./..."
@@ -16,6 +16,26 @@
"Comment": "v0.1.0-115-g3b1ae45",
"Rev": "3b1ae45394a234c385be014e9a488f2bb6eef821"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest",
"Comment": "v8.0.0",
"Rev": "58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest/adal",
"Comment": "v8.0.0",
"Rev": "58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest/azure",
"Comment": "v8.0.0",
"Rev": "58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d"
},
{
"ImportPath": "github.com/Azure/go-autorest/autorest/date",
"Comment": "v8.0.0",
"Rev": "58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d"
},
{
"ImportPath": "github.com/PuerkitoBio/purell",
"Comment": "v1.0.0",
@@ -64,6 +84,11 @@
"ImportPath": "github.com/davecgh/go-spew/spew",
"Rev": "5215b55f46b2b919f50a1df0eaa5886afe4e3b3d"
},
{
"ImportPath": "github.com/dgrijalva/jwt-go",
"Comment": "v3.0.0-4-g01aeca5",
"Rev": "01aeca54ebda6e0fbfafd0a524d234159c05ec20"
},
{
"ImportPath": "github.com/docker/distribution/digest",
"Comment": "v2.4.0-rc.1-38-gcd27f17",
@@ -74,25 +99,37 @@
"Comment": "v2.4.0-rc.1-38-gcd27f17",
"Rev": "cd27f179f2c10c5d300e6d09025b538c475b0d51"
},
{
"ImportPath": "github.com/docker/spdystream",
"Rev": "449fdfce4d962303d702fec724ef0ad181c92528"
},
{
"ImportPath": "github.com/docker/spdystream/spdy",
"Rev": "449fdfce4d962303d702fec724ef0ad181c92528"
},
{
"ImportPath": "github.com/emicklei/go-restful",
"Comment": "v1.2-96-g09691a3",
"Rev": "09691a3b6378b740595c1002f40c34dd5f218a22"
"Comment": "2.2.0-4-gff4f55a",
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
},
{
"ImportPath": "github.com/emicklei/go-restful-swagger12",
"Comment": "1.0.1",
"Rev": "dcef7f55730566d41eae5db10e7d6981829720f6"
},
{
"ImportPath": "github.com/emicklei/go-restful/log",
"Comment": "v1.2-96-g09691a3",
"Rev": "09691a3b6378b740595c1002f40c34dd5f218a22"
},
{
"ImportPath": "github.com/emicklei/go-restful/swagger",
"Comment": "v1.2-96-g09691a3",
"Rev": "09691a3b6378b740595c1002f40c34dd5f218a22"
"Comment": "2.2.0-4-gff4f55a",
"Rev": "ff4f55a206334ef123e4f79bbf348980da81ca46"
},
{
"ImportPath": "github.com/ghodss/yaml",
"Rev": "73d445a93680fa1a78ae23a5839bad48f32ba1ee"
},
{
"ImportPath": "github.com/go-openapi/analysis",
"Rev": "b44dc874b601d9e4e2f6e19140e794ba24bead3b"
},
{
"ImportPath": "github.com/go-openapi/jsonpointer",
"Rev": "46af16f9f7b149af66e5d1bd010e3574dc06de98"
@@ -101,6 +138,10 @@
"ImportPath": "github.com/go-openapi/jsonreference",
"Rev": "13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272"
},
{
"ImportPath": "github.com/go-openapi/loads",
"Rev": "18441dfa706d924a39a030ee2c3b1d8d81917b38"
},
{
"ImportPath": "github.com/go-openapi/spec",
"Rev": "6aced65f8501fe1217321abf0749d354824ba2ff"
@@ -111,13 +152,13 @@
},
{
"ImportPath": "github.com/gogo/protobuf/proto",
"Comment": "v0.2-33-ge18d7aa",
"Rev": "e18d7aa8f8c624c915db340349aad4c49b10d173"
"Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/gogo/protobuf/sortkeys",
"Comment": "v0.2-33-ge18d7aa",
"Rev": "e18d7aa8f8c624c915db340349aad4c49b10d173"
"Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
},
{
"ImportPath": "github.com/golang/glog",
@@ -129,15 +170,23 @@
},
{
"ImportPath": "github.com/golang/protobuf/proto",
"Rev": "8616e8ee5e20a1704615e6c8d7afcdac06087a67"
"Rev": "4bd1920723d7b7c925de087aa32e2187708897f7"
},
{
"ImportPath": "github.com/google/gofuzz",
"Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c"
},
{
"ImportPath": "github.com/hashicorp/golang-lru",
"Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"
},
{
"ImportPath": "github.com/hashicorp/golang-lru/simplelru",
"Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"
},
{
"ImportPath": "github.com/howeyc/gopass",
"Rev": "3ca23474a7c7203e0a0a070fd33508f6efdb9b3d"
"Rev": "bf9dde6d0d2c004a008c27aaee91170c786f6db8"
},
{
"ImportPath": "github.com/imdario/mergo",
@@ -150,7 +199,7 @@
},
{
"ImportPath": "github.com/juju/ratelimit",
"Rev": "77ed1c8a01217656d2080ad51981f6e99adaa177"
"Rev": "5b9ff866471762aa2ab2dced63c9fb6f53921342"
},
{
"ImportPath": "github.com/mailru/easyjson/buffer",
@@ -187,47 +236,47 @@
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "e90d6d0afc4c315a0d87a568ae68577cc15149a0"
"Rev": "f2499483f923065a842d38eb4c7f1927e6fc6e6d"
},
{
"ImportPath": "golang.org/x/net/context/ctxhttp",
"Rev": "e90d6d0afc4c315a0d87a568ae68577cc15149a0"
"Rev": "f2499483f923065a842d38eb4c7f1927e6fc6e6d"
},
{
"ImportPath": "golang.org/x/net/http2",
"Rev": "e90d6d0afc4c315a0d87a568ae68577cc15149a0"
"Rev": "f2499483f923065a842d38eb4c7f1927e6fc6e6d"
},
{
"ImportPath": "golang.org/x/net/http2/hpack",
"Rev": "e90d6d0afc4c315a0d87a568ae68577cc15149a0"
"Rev": "f2499483f923065a842d38eb4c7f1927e6fc6e6d"
},
{
"ImportPath": "golang.org/x/net/idna",
"Rev": "e90d6d0afc4c315a0d87a568ae68577cc15149a0"
"Rev": "f2499483f923065a842d38eb4c7f1927e6fc6e6d"
},
{
"ImportPath": "golang.org/x/net/lex/httplex",
"Rev": "e90d6d0afc4c315a0d87a568ae68577cc15149a0"
"Rev": "f2499483f923065a842d38eb4c7f1927e6fc6e6d"
},
{
"ImportPath": "golang.org/x/oauth2",
"Rev": "3c3a985cb79f52a3190fbc056984415ca6763d01"
"Rev": "a6bd8cefa1811bd24b86f8902872e4e8225f74c4"
},
{
"ImportPath": "golang.org/x/oauth2/google",
"Rev": "3c3a985cb79f52a3190fbc056984415ca6763d01"
"Rev": "a6bd8cefa1811bd24b86f8902872e4e8225f74c4"
},
{
"ImportPath": "golang.org/x/oauth2/internal",
"Rev": "3c3a985cb79f52a3190fbc056984415ca6763d01"
"Rev": "a6bd8cefa1811bd24b86f8902872e4e8225f74c4"
},
{
"ImportPath": "golang.org/x/oauth2/jws",
"Rev": "3c3a985cb79f52a3190fbc056984415ca6763d01"
"Rev": "a6bd8cefa1811bd24b86f8902872e4e8225f74c4"
},
{
"ImportPath": "golang.org/x/oauth2/jwt",
"Rev": "3c3a985cb79f52a3190fbc056984415ca6763d01"
"Rev": "a6bd8cefa1811bd24b86f8902872e4e8225f74c4"
},
{
"ImportPath": "golang.org/x/sys/unix",
@@ -273,38 +322,6 @@
"ImportPath": "golang.org/x/text/width",
"Rev": "2910a502d2bf9e43193af9d68ca516529614eed3"
},
{
"ImportPath": "google.golang.org/appengine",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal/app_identity",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal/base",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal/datastore",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal/log",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal/modules",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "google.golang.org/appengine/internal/remote_api",
"Rev": "4f7eeb5305a4ba1966344836ba4af9996b7b4e05"
},
{
"ImportPath": "gopkg.in/inf.v0",
"Comment": "v0.9.0",
@@ -316,179 +333,211 @@
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/unstructured",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/openapi",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/rand",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "c1c4a7fe832857c75cc1d79c8e40d71d5da15fc6"
"Rev": "1fd2e63a9a370677308a42f24fd40c86438afddf"
}
]
}

View File

@@ -2,10 +2,33 @@
## For the casual user
Currently, there is no super easy way to use client-go. Hopefully this will
change soon. Simply running `go get k8s.io/client-go/...` will leave you with a
library that can't practically be used. It is important to synchronize your
dependencies with the ones that are required by the library.
If you want to write a simple script, don't care about a reproducible client
library install, don't mind getting head (which may be less stable than a
particular release), then simply:
```sh
$ go get k8s.io/client-go/...
```
This will install `k8s.io/client-go` in your `$GOPATH`. `k8s.io/client-go`
includes most of its own dependencies in its `k8s.io/client-go/vendor` path,
except for `k8s.io/apimachinery` and `glog`. `go get` will recursively download
these excluded repos to your `$GOPATH`, if they don't already exist. If
`k8s.io/apimachinery` preexisted in `$GOPATH`, you also need to:
```sh
$ go get -u k8s.io/apimachinery/...
```
because the head of client-go is only guaranteed to work with the head of
apimachinery.
We excluded `k8s.io/apimachinery` and `glog` from `k8s.io/client-go/vendor` to
prevent `go get` users from hitting issues like
[#19](https://github.com/kubernetes/client-go/issues/19) and
[#83](https://github.com/kubernetes/client-go/issues/83). If your project share
other dependencies with client-go, and you hit issues similar to #19 or #83,
then you'll need to look down at the next section.
Note: the official go policy is that libraries should not vendor their
dependencies. This is unworkable for us, since our dependencies change and HEAD
@@ -26,42 +49,6 @@ Reasons why you might need to use a dependency management system:
There are three tools you could in theory use for this. Instructions
for each follows.
### Dep
[dep](https://github.com/golang/dep) is an up-and-coming dependency management tool,
which has the goal of being accepted as part of the standard go toolchain. Its
status is currently alpha. However, it comes the closest to working easily out
of the box.
```sh
$ go get github.com/golang/dep
$ go install github.com/golang/dep/cmd/dep
# Make sure you have a go file in your directory which imports k8s.io/client-go
# first--I suggest copying one of the examples.
$ dep init
$ dep ensure k8s.io/client-go@^2.0.0
```
Then you can try one of the
[examples](https://github.com/kubernetes/client-go/tree/v2.0.0/examples/) from
the 2.0.0 release.
This will set up a `vendor` directory in your current directory, add `k8s.io/client-go`
to it, and flatten all of `k8s.io/client-go`'s dependencies into that vendor directory,
so that your code and `client-go` will both get the same copy of each
dependency.
After installing like this, you could either use dep for your other
dependencies, or copy everything in the `vendor` directory into your
`$GOPATH/src` directory and proceed as if you had done a fancy `go get` that
flattened dependencies sanely.
One thing to note about dep is that it will omit dependencies that aren't
actually used, and some dependencies of `client-go` are used only if you import
one of the plugins (for example, the auth plugins). So you may need to run `dep
ensure` again if you start importing a plugin that you weren't using before.
### Godep
[godep](https://github.com/tools/godep) is an older dependency management tool, which is
@@ -155,3 +142,39 @@ After modifying, run `glide up -v` again to re-populate your /vendor directory.
Optionally, Glide users can also use [`glide-vc`](https://github.com/sgotti/glide-vc)
after running `glide up -v` to remove unused files from /vendor.
### Dep
[dep](https://github.com/golang/dep) is an up-and-coming dependency management tool,
which has the goal of being accepted as part of the standard go toolchain. Its
status is currently alpha. However, it comes the closest to working easily out
of the box.
```sh
$ go get github.com/golang/dep
$ go install github.com/golang/dep/cmd/dep
# Make sure you have a go file in your directory which imports a package of
# k8s.io/client-go first--I suggest copying one of the examples.
$ dep init
$ dep ensure k8s.io/client-go@^2.0.0
```
Then you can try one of the
[examples](https://github.com/kubernetes/client-go/tree/v2.0.0/examples/) from
the 2.0.0 release.
This will set up a `vendor` directory in your current directory, add `k8s.io/client-go`
to it, and flatten all of `k8s.io/client-go`'s dependencies into that vendor directory,
so that your code and `client-go` will both get the same copy of each
dependency.
After installing like this, you could either use dep for your other
dependencies, or copy everything in the `vendor` directory into your
`$GOPATH/src` directory and proceed as if you had done a fancy `go get` that
flattened dependencies sanely.
One thing to note about dep is that it will omit dependencies that aren't
actually used, and some dependencies of `client-go` are used only if you import
one of the plugins (for example, the auth plugins). So you may need to run `dep
ensure` again if you start importing a plugin that you weren't using before.

1
OWNERS
View File

@@ -4,6 +4,7 @@ approvers:
- krousey
- lavalamp
- smarterclayton
- sttts
reviewers:
- thockin
- lavalamp

View File

@@ -6,6 +6,9 @@ We currently recommend using the v2.0.0 tag. See [INSTALL.md](/INSTALL.md) for
detailed installation instructions. `go get k8s.io/client-go/...` works, but
will give you head and doesn't handle the dependencies well.
[![Build Status](https://travis-ci.org/kubernetes/client-go.svg?branch=master)](https://travis-ci.org/kubernetes/client-go)
[![GoDoc](https://godoc.org/k8s.io/client-go?status.svg)](https://godoc.org/k8s.io/client-go)
## Table of Contents
- [What's included](#whats-included)
@@ -77,20 +80,21 @@ We will backport bugfixes--but not new features--into older versions of
#### Compatibility matrix
| | Kubernetes 1.3 | Kubernetes 1.4 | Kubernetes 1.5 | Kubernetes 1.6 (not released yet) |
|----------------|----------------|----------------|----------------|----------------|
| client-go 1.4 | + | ✓ | - | - |
| client-go 1.5 | + | + | - | - |
| client-go 2.0 | + | + | ✓ | - |
| client-go HEAD | + | + | + | ✓ |
| | Kubernetes 1.3 | Kubernetes 1.4 | Kubernetes 1.5 | Kubernetes 1.6 |
|---------------------|----------------|----------------|----------------|----------------|
| client-go 1.4 | + | ✓ | - | - |
| client-go 1.5 | + | + | - | - |
| client-go 2.0 | + | + | ✓ | - |
| client-go 3.0 beta | + | + | + | ✓ |
| client-go HEAD | + | + | + | + |
Key:
* Exactly the same features / API objects in both client-go and the Kubernetes
* `✓` Exactly the same features / API objects in both client-go and the Kubernetes
version.
* + client-go has features or api objects that may not be present in the
* `+` client-go has features or api objects that may not be present in the
Kubernetes cluster, but everything they have in common will work.
* - The Kubernetes cluster has features the client-go library can't use
* `-` The Kubernetes cluster has features the client-go library can't use
(additional API objects, etc).
See the [CHANGELOG](./CHANGELOG.md) for a detailed description of changes
@@ -101,13 +105,14 @@ between client-go versions.
| client-go 1.4 | Kubernetes main repo, 1.4 branch | = - |
| client-go 1.5 | Kubernetes main repo, 1.5 branch | = - |
| client-go 2.0 | Kubernetes main repo, 1.5 branch | ✓ |
| client-go 3.0 | Kubernetes main repo, 1.6 branch | ✓ |
| client-go HEAD | Kubernetes main repo, master branch | ✓ |
Key:
* Changes in main Kubernetes repo are actively published to client-go by a bot
* = Maintenance is manual, only severe security bugs will be patched.
* - Deprecated; please upgrade.
* `✓` Changes in main Kubernetes repo are actively published to client-go by a bot
* `=` Maintenance is manual, only severe security bugs will be patched.
* `-` Deprecated; please upgrade.
#### Deprecation policy

63
discovery/BUILD Normal file
View File

@@ -0,0 +1,63 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_library(
name = "go_default_library",
srcs = [
"discovery_client.go",
"helper.go",
"restmapper.go",
"unstructured.go",
],
tags = ["automanaged"],
deps = [
"//vendor/github.com/emicklei/go-restful-swagger12:go_default_library",
"//vendor/github.com/go-openapi/loads:go_default_library",
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/version:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
go_test(
name = "go_default_xtest",
srcs = [
"discovery_client_test.go",
"helper_blackbox_test.go",
"restmapper_test.go",
],
tags = ["automanaged"],
deps = [
"//vendor/github.com/emicklei/go-restful-swagger12:go_default_library",
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/github.com/stretchr/testify/assert: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/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/version:go_default_library",
"//vendor/k8s.io/client-go/discovery:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/scheme: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/fake:go_default_library",
],
)

View File

@@ -23,15 +23,17 @@ import (
"sort"
"strings"
"github.com/emicklei/go-restful/swagger"
"github.com/emicklei/go-restful-swagger12"
"github.com/go-openapi/loads"
"github.com/go-openapi/spec"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/pkg/api/v1"
restclient "k8s.io/client-go/rest"
)
@@ -47,6 +49,7 @@ type DiscoveryInterface interface {
ServerResourcesInterface
ServerVersionInterface
SwaggerSchemaInterface
OpenAPISchemaInterface
}
// CachedDiscoveryInterface is a DiscoveryInterface with cache invalidation and freshness.
@@ -91,6 +94,12 @@ type SwaggerSchemaInterface interface {
SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error)
}
// OpenAPISchemaInterface has a method to retrieve the open API schema.
type OpenAPISchemaInterface interface {
// OpenAPISchema retrieves and parses the swagger API schema the server supports.
OpenAPISchema() (*spec.Swagger, error)
}
// DiscoveryClient implements the functions that discover server-supported API groups,
// versions and resources.
type DiscoveryClient struct {
@@ -332,6 +341,7 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
}
// SwaggerSchema retrieves and parses the swagger API schema the server supports.
// TODO: Replace usages with Open API. Tracked in https://github.com/kubernetes/kubernetes/issues/44589
func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) {
if version.Empty() {
return nil, fmt.Errorf("groupVersion cannot be empty")
@@ -365,6 +375,21 @@ func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.A
return &schema, nil
}
// OpenAPISchema fetches the open api schema using a rest client and parses the json.
// Warning: this is very expensive (~1.2s)
func (d *DiscoveryClient) OpenAPISchema() (*spec.Swagger, error) {
data, err := d.restClient.Get().AbsPath("/swagger.json").Do().Raw()
if err != nil {
return nil, err
}
msg := json.RawMessage(data)
doc, err := loads.Analyzed(msg, "")
if err != nil {
return nil, err
}
return doc.Spec(), err
}
// withRetries retries the given recovery function in case the groups supported by the server change after ServerGroup() returns.
func withRetries(maxRetries int, f func(failEarly bool) ([]*metav1.APIResourceList, error)) ([]*metav1.APIResourceList, error) {
var result []*metav1.APIResourceList
@@ -385,7 +410,7 @@ func withRetries(maxRetries int, f func(failEarly bool) ([]*metav1.APIResourceLi
func setDiscoveryDefaults(config *restclient.Config) error {
config.APIPath = ""
config.GroupVersion = nil
codec := runtime.NoopEncoder{Decoder: api.Codecs.UniversalDecoder()}
codec := runtime.NoopEncoder{Decoder: scheme.Codecs.UniversalDecoder()}
config.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: codec})
if len(config.UserAgent) == 0 {
config.UserAgent = restclient.DefaultKubernetesUserAgent()

View File

@@ -18,13 +18,15 @@ package discovery_test
import (
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"reflect"
"testing"
"github.com/emicklei/go-restful/swagger"
"github.com/emicklei/go-restful-swagger12"
"github.com/go-openapi/spec"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
@@ -325,6 +327,81 @@ func TestGetSwaggerSchemaFail(t *testing.T) {
}
}
var returnedOpenAPI = spec.Swagger{
SwaggerProps: spec.SwaggerProps{
Definitions: spec.Definitions{
"fake.type.1": spec.Schema{
SchemaProps: spec.SchemaProps{
Properties: map[string]spec.Schema{
"count": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
},
},
},
},
},
"fake.type.2": spec.Schema{
SchemaProps: spec.SchemaProps{
Properties: map[string]spec.Schema{
"count": {
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
},
},
},
},
},
},
},
},
},
},
}
func openapiSchemaFakeServer() (*httptest.Server, error) {
var sErr error
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/swagger.json" {
sErr = fmt.Errorf("Unexpected url %v", req.URL)
}
if req.Method != "GET" {
sErr = fmt.Errorf("Unexpected method %v", req.Method)
}
output, err := json.Marshal(returnedOpenAPI)
if err != nil {
sErr = err
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(output)
}))
return server, sErr
}
func TestGetOpenAPISchema(t *testing.T) {
server, err := openapiSchemaFakeServer()
if err != nil {
t.Errorf("unexpected error starting fake server: %v", err)
}
defer server.Close()
client := NewDiscoveryClientForConfigOrDie(&restclient.Config{Host: server.URL})
got, err := client.OpenAPISchema()
if err != nil {
t.Fatalf("unexpected error getting openapi: %v", err)
}
if e, a := returnedOpenAPI, *got; !reflect.DeepEqual(e, a) {
t.Errorf("expected %v, got %v", e, a)
}
}
func TestServerPreferredResources(t *testing.T) {
stable := metav1.APIResourceList{
GroupVersion: "v1",
@@ -617,8 +694,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) {
w.Write(output)
},
expected: map[schema.GroupVersionResource]struct{}{
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}: {},
schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}: {},
{Group: "", Version: "v1", Resource: "pods"}: {},
{Group: "", Version: "v1", Resource: "services"}: {},
},
},
{
@@ -660,8 +737,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) {
w.Write(output)
},
expected: map[schema.GroupVersionResource]struct{}{
schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}: {},
schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
{Group: "batch", Version: "v1", Resource: "jobs"}: {},
{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
},
},
{
@@ -703,8 +780,8 @@ func TestServerPreferredNamespacedResources(t *testing.T) {
w.Write(output)
},
expected: map[schema.GroupVersionResource]struct{}{
schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "jobs"}: {},
schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
{Group: "batch", Version: "v2alpha1", Resource: "jobs"}: {},
{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}: {},
},
},
}

25
discovery/fake/BUILD Normal file
View File

@@ -0,0 +1,25 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["discovery.go"],
tags = ["automanaged"],
deps = [
"//vendor/github.com/emicklei/go-restful-swagger12:go_default_library",
"//vendor/github.com/go-openapi/spec:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/version:go_default_library",
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/version:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/testing:go_default_library",
],
)

View File

@@ -19,8 +19,9 @@ package fake
import (
"fmt"
"github.com/emicklei/go-restful/swagger"
"github.com/emicklei/go-restful-swagger12"
"github.com/go-openapi/spec"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
@@ -92,6 +93,8 @@ func (c *FakeDiscovery) SwaggerSchema(version schema.GroupVersion) (*swagger.Api
return &swagger.ApiDeclaration{}, nil
}
func (c *FakeDiscovery) OpenAPISchema() (*spec.Swagger, error) { return &spec.Swagger{}, nil }
func (c *FakeDiscovery) RESTClient() restclient.Interface {
return nil
}

View File

@@ -41,25 +41,13 @@ func MatchesServerVersion(clientVersion apimachineryversion.Info, client Discove
return nil
}
// NegotiateVersion queries the server's supported api versions to find
// a version that both client and server support.
// - If no version is provided, try registered client versions in order of
// preference.
// - If version is provided and the server does not support it,
// return an error.
// TODO negotiation should be reserved for cases where we need a version for a given group. In those cases, it should return an ordered list of
// server preferences. From that list, a separate function can match from an ordered list of client versions.
// This is not what the function has ever done before, but it makes more logical sense.
func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion, clientRegisteredGVs []schema.GroupVersion) (*schema.GroupVersion, error) {
clientVersions := sets.String{}
for _, gv := range clientRegisteredGVs {
clientVersions.Insert(gv.String())
}
// ServerSupportsVersion returns an error if the server doesn't have the required version
func ServerSupportsVersion(client DiscoveryInterface, requiredGV schema.GroupVersion) error {
groups, err := client.ServerGroups()
if err != nil {
// This is almost always a connection error, and higher level code should treat this as a generic error,
// not a negotiation specific error.
return nil, err
return err
}
versions := metav1.ExtractGroupVersions(groups)
serverVersions := sets.String{}
@@ -67,46 +55,17 @@ func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion
serverVersions.Insert(v)
}
// If version explicitly requested verify that both client and server support it.
// If server does not support warn, but try to negotiate a lower version.
if requiredGV != nil {
if !clientVersions.Has(requiredGV.String()) {
return nil, fmt.Errorf("client does not support API version %q; client supported API versions: %v", requiredGV, clientVersions)
}
// If the server supports no versions, then we should just use the preferredGV
// This can happen because discovery fails due to 403 Forbidden errors
if len(serverVersions) == 0 {
return requiredGV, nil
}
if serverVersions.Has(requiredGV.String()) {
return requiredGV, nil
}
// If we are using an explicit config version the server does not support, fail.
return nil, fmt.Errorf("server does not support API version %q", requiredGV)
if serverVersions.Has(requiredGV.String()) {
return nil
}
for _, clientGV := range clientRegisteredGVs {
if serverVersions.Has(clientGV.String()) {
// Version was not explicitly requested in command config (--api-version).
// Ok to fall back to a supported version with a warning.
// TODO: caesarxuchao: enable the warning message when we have
// proper fix. Please refer to issue #14895.
// if len(version) != 0 {
// glog.Warningf("Server does not support API version '%s'. Falling back to '%s'.", version, clientVersion)
// }
t := clientGV
return &t, nil
}
// If the server supports no versions, then we should pretend it has the version because of old servers.
// This can happen because discovery fails due to 403 Forbidden errors
if len(serverVersions) == 0 {
return nil
}
// if we have no server versions and we have no required version, choose the first clientRegisteredVersion
if len(serverVersions) == 0 && len(clientRegisteredGVs) > 0 {
return &clientRegisteredGVs[0], nil
}
// fall back to an empty GroupVersion. Most client commands no longer respect a GroupVersion anyway
return &schema.GroupVersion{}, nil
return fmt.Errorf("server does not support API version %q", requiredGV)
}
// GroupVersionResources converts APIResourceLists to the GroupVersionResources.

View File

@@ -32,11 +32,10 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/discovery"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/pkg/api/v1"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/rest/fake"
_ "k8s.io/client-go/pkg/api/install"
)
func objBody(object interface{}) io.ReadCloser {
@@ -47,87 +46,45 @@ func objBody(object interface{}) io.ReadCloser {
return ioutil.NopCloser(bytes.NewReader([]byte(output)))
}
func TestNegotiateVersion(t *testing.T) {
func TestServerSupportsVersion(t *testing.T) {
tests := []struct {
name string
requiredVersion *schema.GroupVersion
expectedVersion *schema.GroupVersion
requiredVersion schema.GroupVersion
serverVersions []string
clientVersions []schema.GroupVersion
expectErr func(err error) bool
sendErr error
statusCode int
}{
{
name: "server supports client default",
serverVersions: []string{"version1", api.Registry.GroupOrDie(api.GroupName).GroupVersion.String()},
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusOK,
},
{
name: "server falls back to client supported",
serverVersions: []string{"version1"},
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusOK,
},
{
name: "explicit version supported",
requiredVersion: &schema.GroupVersion{Version: "v1"},
serverVersions: []string{"/version1", api.Registry.GroupOrDie(api.GroupName).GroupVersion.String()},
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &schema.GroupVersion{Version: "v1"},
requiredVersion: schema.GroupVersion{Version: "v1"},
serverVersions: []string{"/version1", v1.SchemeGroupVersion.String()},
statusCode: http.StatusOK,
},
{
name: "explicit version not supported on server",
requiredVersion: &schema.GroupVersion{Version: "v1"},
requiredVersion: schema.GroupVersion{Version: "v1"},
serverVersions: []string{"version1"},
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
expectErr: func(err error) bool { return strings.Contains(err.Error(), `server does not support API version "v1"`) },
statusCode: http.StatusOK,
},
{
name: "explicit version not supported on client",
requiredVersion: &schema.GroupVersion{Version: "v1"},
serverVersions: []string{"v1"},
clientVersions: []schema.GroupVersion{{Version: "version1"}},
expectErr: func(err error) bool { return strings.Contains(err.Error(), `client does not support API version "v1"`) },
statusCode: http.StatusOK,
},
{
name: "connection refused error",
serverVersions: []string{"version1"},
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
sendErr: errors.New("connection refused"),
expectErr: func(err error) bool { return strings.Contains(err.Error(), "connection refused") },
statusCode: http.StatusOK,
},
{
name: "discovery fails due to 403 Forbidden errors and thus serverVersions is empty, use default GroupVersion",
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusForbidden,
},
{
name: "discovery fails due to 404 Not Found errors and thus serverVersions is empty, use requested GroupVersion",
requiredVersion: &schema.GroupVersion{Version: "version1"},
clientVersions: []schema.GroupVersion{{Version: "version1"}, api.Registry.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &schema.GroupVersion{Version: "version1"},
requiredVersion: schema.GroupVersion{Version: "version1"},
statusCode: http.StatusNotFound,
},
{
name: "discovery fails due to 403 Forbidden errors and thus serverVersions is empty, fallback to empty GroupVersion",
expectedVersion: &schema.GroupVersion{},
statusCode: http.StatusForbidden,
},
}
for _, test := range tests {
fakeClient := &fake.RESTClient{
APIRegistry: api.Registry,
NegotiatedSerializer: api.Codecs,
NegotiatedSerializer: scheme.Codecs,
Resp: &http.Response{
StatusCode: test.statusCode,
Body: objBody(&uapi.APIVersions{Versions: test.serverVersions}),
@@ -143,7 +100,7 @@ func TestNegotiateVersion(t *testing.T) {
}
c := discovery.NewDiscoveryClientForConfigOrDie(&restclient.Config{})
c.RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
response, err := discovery.NegotiateVersion(c, test.requiredVersion, test.clientVersions)
err := discovery.ServerSupportsVersion(c, test.requiredVersion)
if err == nil && test.expectErr != nil {
t.Errorf("expected error, got nil for [%s].", test.name)
}
@@ -153,9 +110,6 @@ func TestNegotiateVersion(t *testing.T) {
}
continue
}
if *response != *test.expectedVersion {
t.Errorf("%s: expected version %s, got %s.", test.name, test.expectedVersion, response)
}
}
}

View File

@@ -20,7 +20,6 @@ import (
"fmt"
"sync"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -127,10 +126,9 @@ func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
for _, version := range group.Versions {
resources, err := cl.ServerResourcesForGroupVersion(version.GroupVersion)
if err != nil {
if errors.IsNotFound(err) {
continue // ignore as this can race with deletion of 3rd party APIs
}
return nil, err
// continue as best we can
// TODO track the errors and update callers to handle partial errors.
continue
}
groupResources.VersionedResources[version.Version] = resources.APIResources
}
@@ -279,20 +277,6 @@ func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind, versions
return
}
// AliasesForResource returns whether a resource has an alias or not.
func (d *DeferredDiscoveryRESTMapper) AliasesForResource(resource string) (as []string, ok bool) {
del, err := d.getDelegate()
if err != nil {
return nil, false
}
as, ok = del.AliasesForResource(resource)
if len(as) == 0 && !d.cl.Fresh() {
d.Reset()
as, ok = d.AliasesForResource(resource)
}
return
}
// ResourceSingularizer converts a resource name from plural to
// singular (e.g., from pods to pod).
func (d *DeferredDiscoveryRESTMapper) ResourceSingularizer(resource string) (singular string, err error) {

View File

@@ -25,11 +25,11 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
. "k8s.io/client-go/discovery"
"k8s.io/client-go/pkg/api"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/rest/fake"
"github.com/emicklei/go-restful/swagger"
"github.com/emicklei/go-restful-swagger12"
"github.com/go-openapi/spec"
"github.com/stretchr/testify/assert"
)
@@ -208,7 +208,7 @@ func TestDeferredDiscoveryRESTMapper_CacheMiss(t *testing.T) {
assert := assert.New(t)
cdc := fakeCachedDiscoveryInterface{fresh: false}
m := NewDeferredDiscoveryRESTMapper(&cdc, api.Registry.InterfacesFor)
m := NewDeferredDiscoveryRESTMapper(&cdc, nil)
assert.False(cdc.fresh, "should NOT be fresh after instantiation")
assert.Zero(cdc.invalidateCalls, "should not have called Invalidate()")
@@ -347,3 +347,7 @@ func (c *fakeCachedDiscoveryInterface) ServerVersion() (*version.Info, error) {
func (c *fakeCachedDiscoveryInterface) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) {
return &swagger.ApiDeclaration{}, nil
}
func (c *fakeCachedDiscoveryInterface) OpenAPISchema() (*spec.Swagger, error) {
return &spec.Swagger{}, nil
}

55
dynamic/BUILD Normal file
View File

@@ -0,0 +1,55 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = [
"client_test.go",
"dynamic_util_test.go",
],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/rest/watch:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = [
"client.go",
"client_pool.go",
"dynamic_util.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/conversion/queryparams:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/scheme: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/util/flowcontrol:go_default_library",
],
)

View File

@@ -34,7 +34,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/pkg/api/v1"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/util/flowcontrol"
@@ -126,11 +126,16 @@ func (rc *ResourceClient) List(opts metav1.ListOptions) (runtime.Object, error)
}
// Get gets the resource with the specified name.
func (rc *ResourceClient) Get(name string) (*unstructured.Unstructured, error) {
func (rc *ResourceClient) Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error) {
parameterEncoder := rc.parameterCodec
if parameterEncoder == nil {
parameterEncoder = defaultParameterEncoder
}
result := new(unstructured.Unstructured)
err := rc.cl.Get().
NamespaceIfScoped(rc.ns, rc.resource.Namespaced).
Resource(rc.resource.Name).
VersionedParams(&opts, parameterEncoder).
Name(name).
Do().
Into(result)
@@ -245,9 +250,9 @@ func (dynamicCodec) Encode(obj runtime.Object, w io.Writer) error {
// ContentConfig returns a restclient.ContentConfig for dynamic types.
func ContentConfig() restclient.ContentConfig {
var jsonInfo runtime.SerializerInfo
// TODO: api.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
// TODO: scheme.Codecs here should become "pkg/apis/server/scheme" which is the minimal core you need
// to talk to a kubernetes server
for _, info := range api.Codecs.SupportedMediaTypes() {
for _, info := range scheme.Codecs.SupportedMediaTypes() {
if info.MediaType == runtime.ContentTypeJSON {
jsonInfo = info
break
@@ -280,10 +285,10 @@ var defaultParameterEncoder runtime.ParameterCodec = parameterCodec{}
type versionedParameterEncoderWithV1Fallback struct{}
func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) {
ret, err := api.ParameterCodec.EncodeParameters(obj, to)
ret, err := scheme.ParameterCodec.EncodeParameters(obj, to)
if err != nil && runtime.IsNotRegisteredError(err) {
// fallback to v1
return api.ParameterCodec.EncodeParameters(obj, v1.SchemeGroupVersion)
return scheme.ParameterCodec.EncodeParameters(obj, v1.SchemeGroupVersion)
}
return ret, err
}

View File

@@ -21,7 +21,6 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/pkg/api"
restclient "k8s.io/client-go/rest"
)
@@ -73,9 +72,9 @@ func NewClientPool(config *restclient.Config, mapper meta.RESTMapper, apiPathRes
// Instantiates a new dynamic client pool with the given config.
func NewDynamicClientPool(cfg *restclient.Config) ClientPool {
// TODO: should use a dynamic RESTMapper built from the discovery results.
restMapper := api.Registry.RESTMapper()
return NewClientPool(cfg, restMapper, LegacyAPIPathResolverFunc)
// restMapper is not needed when using LegacyAPIPathResolverFunc
emptyMapper := meta.MultiRESTMapper{}
return NewClientPool(cfg, emptyMapper, LegacyAPIPathResolverFunc)
}
// ClientForGroupVersionResource uses the provided RESTMapper to identify the appropriate resource. Resource may

View File

@@ -90,9 +90,9 @@ func TestList(t *testing.T) {
"apiVersion": "vTest",
"kind": "rTestList",
},
Items: []*unstructured.Unstructured{
getObject("vTest", "rTest", "item1"),
getObject("vTest", "rTest", "item2"),
Items: []unstructured.Unstructured{
*getObject("vTest", "rTest", "item1"),
*getObject("vTest", "rTest", "item2"),
},
},
},
@@ -108,9 +108,9 @@ func TestList(t *testing.T) {
"apiVersion": "vTest",
"kind": "rTestList",
},
Items: []*unstructured.Unstructured{
getObject("vTest", "rTest", "item1"),
getObject("vTest", "rTest", "item2"),
Items: []unstructured.Unstructured{
*getObject("vTest", "rTest", "item1"),
*getObject("vTest", "rTest", "item2"),
},
},
},
@@ -191,7 +191,7 @@ func TestGet(t *testing.T) {
}
defer srv.Close()
got, err := cl.Resource(resource, tc.namespace).Get(tc.name)
got, err := cl.Resource(resource, tc.namespace).Get(tc.name, metav1.GetOptions{})
if err != nil {
t.Errorf("unexpected error when getting %q: %v", tc.name, err)
continue
@@ -556,3 +556,11 @@ func TestPatch(t *testing.T) {
}
}
}
func TestVersionedParameterEncoderWithV1Fallback(t *testing.T) {
enc := VersionedParameterEncoderWithV1Fallback
_, err := enc.EncodeParameters(&metav1.ListOptions{}, schema.GroupVersion{Group: "foo.bar.com", Version: "v4"})
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
}

31
examples/README.md Normal file
View File

@@ -0,0 +1,31 @@
# client-go Examples
This directory contains examples that cover various use cases and functionality
for client-go.
### Configuration
- [**Authenticate in cluster**](./in-cluster-client-configuration): Configure a
client while running inside the Kubernetes cluster.
- [**Authenticate out of cluster**](./out-of-cluster-client-configuration):
Configure a client to access a Kubernetes cluster from outside.
### Basics
- [**Managing resources with API**](./create-update-delete-deployment): Create,
get, update, delete a Deployment resource.
### Advanced Concepts
- [**Work queues**](./workqueue): Create a hotloop-free controller with the
rate-limited workqueue and the [informer framework][informer].
- [**Third-party resources (deprecated)**](./third-party-resources-deprecated):
Register a third-party resource type with the API, create/update/query this third-party
type, and write a controller that drives the cluster state based on the changes to
the third-party resources.
- [**Custom Resource Definition (successor of TPR)**](https://git.k8s.io/apiextensions-apiserver/examples/client-go):
Register a custom resource type with the API, create/update/query this custom
type, and write a controller that drives the cluster state based on the changes to
the custom resources.
[informer]: https://godoc.org/k8s.io/client-go/tools/cache#NewInformer

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "create-update-delete-deployment",
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
tags = ["automanaged"],
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/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
],
)

View File

@@ -0,0 +1,81 @@
# Create, Update & Delete Deployment
This example program demonstrates the fundamental operations for managing on
[Deployment][1] resources, such as `Create`, `List`, `Update` and `Delete`.
You can adopt the source code from this example to write programs that manage
other types of resources through the Kubernetes API.
## Running this example
Make sure you have a Kubernetes cluster and `kubectl` is configured:
kubectl get nodes
Compile this example on your workstation:
```
cd create-update-delete-deployment
go build -o ./app
```
Now, run this application on your workstation with your local kubeconfig file:
```
./app -kubeconfig=$HOME/.kube/config
```
Running this command will execute the following operations on your cluster:
1. **Create Deployment:** This will create a 2 replica Deployment. Verify with
`kubectl get pods`.
2. **Update Deployment:** This will update the Deployment resource created in
previous step to set the replica count to 1 and add annotations. You are
encouraged to inspect the retry loop that handles conflicts. Verify the new
replica count and `foo=bar` annotation with `kubectl describe deployment
demo`.
3. **List Deployments:** This will retrieve Deployments in the `default`
namespace and print their names and replica counts.
4. **Delete Deployment:** This will delete the Deployment object and its
dependent ReplicaSet resource. Verify with `kubectl get deployments`.
Each step is separated by an interactive prompt. You must hit the
<kbd>Return</kbd> key to proceeed to the next step. You can use these prompts as
a break to take time to run `kubectl` and inspect the result of the operations
executed.
You should see an output like the following:
```
Creating deployment...
Created deployment "demo-deployment".
-> Press Return key to continue.
Updating deployment...
Updated deployment...
-> Press Return key to continue.
Listing deployments in namespace "default":
* demo-deployment (1 replicas)
-> Press Return key to continue.
Deleting deployment...
Deleted deployment.
```
## Cleanup
Successfully running this program will clean the created artifacts. If you
terminate the program without completing, you can clean up the created
deployment with:
kubectl delete deploy demo-deployment
## Troubleshooting
If you are getting the following error, make sure Kubernetes version of your
cluster is v1.6 or above in `kubectl version`:
panic: the server could not find the requested resource
[1]: https://kubernetes.io/docs/user-guide/deployments/

View File

@@ -0,0 +1,165 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Note: the example only works with the code within the same release/branch.
package main
import (
"bufio"
"flag"
"fmt"
"os"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
apiv1 "k8s.io/client-go/pkg/api/v1"
appsv1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
"k8s.io/client-go/tools/clientcmd"
// 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"
)
func main() {
kubeconfig := flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
flag.Parse()
if *kubeconfig == "" {
panic("-kubeconfig not specified")
}
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
if err != nil {
panic(err)
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err)
}
deploymentsClient := clientset.AppsV1beta1().Deployments(apiv1.NamespaceDefault)
deployment := &appsv1beta1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "demo-deployment",
},
Spec: appsv1beta1.DeploymentSpec{
Replicas: int32Ptr(2),
Template: apiv1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"app": "demo",
},
},
Spec: apiv1.PodSpec{
Containers: []apiv1.Container{
{
Name: "web",
Image: "nginx:1.13",
Ports: []apiv1.ContainerPort{
{
Name: "http",
Protocol: apiv1.ProtocolTCP,
ContainerPort: 80,
},
},
},
},
},
},
},
}
// Create Deployment
fmt.Println("Creating deployment...")
result, err := deploymentsClient.Create(deployment)
if err != nil {
panic(err)
}
fmt.Printf("Created deployment %q.\n", result.GetObjectMeta().GetName())
// Update Deployment
prompt()
fmt.Println("Updating deployment...")
// You have two options to Update() this Deployment:
//
// 1. Modify the "deployment" variable and call: Update(deployment).
// This works like the "kubectl replace" command and it overwrites/loses changes
// made by other clients between you Create() and Update() the object.
// 2. Modify the "result" returned by Create()/Get() and retry Update(result) until
// you no longer get a conflict error. This way, you can preserve changes made
// by other clients between Create() and Update(). This is implemented below:
for {
result.Spec.Replicas = int32Ptr(1) // reduce replica count
result.Spec.Template.Annotations = map[string]string{ // add annotations
"foo": "bar",
}
if _, err := deploymentsClient.Update(result); errors.IsConflict(err) {
// Deployment is modified in the meanwhile, query the latest version
// and modify the retrieved object.
fmt.Println("encountered conflict, retrying")
result, err = deploymentsClient.Get("demo-deployment", metav1.GetOptions{})
if err != nil {
panic(fmt.Errorf("Get failed: %+v", err))
}
} else if err != nil {
panic(err)
} else {
break
}
// TODO: You should sleep here with an exponential backoff to avoid
// exhausting the apiserver, and add a limit/timeout on the retries to
// avoid getting stuck in this loop indefintiely.
}
fmt.Println("Updated deployment...")
// List Deployments
prompt()
fmt.Printf("Listing deployments in namespace %q:\n", apiv1.NamespaceDefault)
list, err := deploymentsClient.List(metav1.ListOptions{})
if err != nil {
panic(err)
}
for _, d := range list.Items {
fmt.Printf(" * %s (%d replicas)\n", d.Name, *d.Spec.Replicas)
}
// Delete Deployment
prompt()
fmt.Println("Deleting deployment...")
deletePolicy := metav1.DeletePropagationForeground
if err := deploymentsClient.Delete("demo-deployment", &metav1.DeleteOptions{
PropagationPolicy: &deletePolicy,
}); err != nil {
panic(err)
}
fmt.Println("Deleted deployment.")
}
func prompt() {
fmt.Printf("-> Press Return key to continue.")
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
break
}
if err := scanner.Err(); err != nil {
panic(err)
}
fmt.Println()
}
func int32Ptr(i int32) *int32 { return &i }

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "in-cluster-client-configuration",
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
tags = ["automanaged"],
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/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)

View File

@@ -0,0 +1,17 @@
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian
COPY ./app /app
ENTRYPOINT /app

View File

@@ -0,0 +1,50 @@
# Authenticating inside the cluster
This example shows you how to configure a client with client-go to authenticate
to the Kubernetes API from an application running inside the Kubernetes cluster.
client-go uses the [Service Account token][sa] mounted inside the Pod at the
`/var/run/secrets/kubernetes.io/serviceaccount` path when the
`rest.InClusterConfig()` is used.
## Running this example
First compile the application for Linux:
cd in-cluster-client-configuration
GOOS=linux go build -o ./app .
Then package it to a docker image using the provided Dockerfile to run it on
Kubernetes.
If you are running a [Minikube][mk] cluster, you can build this image directly
on the Docker engine of the Minikube node without pushing it to a registry. To
build the image on Minikube:
eval $(minikube docker-env)
docker build -t in-cluster .
If you are not using Minikube, you should build this image and push it to a registry
that your Kubernetes cluster can pull from.
Then, run the image in a Pod with a single instance Deployment:
$ kubectl run --rm -i demo --image=in-cluster --image-pull-policy=Never
There are 4 pods in the cluster
There are 4 pods in the cluster
There are 4 pods in the cluster
...
The example now runs on Kubernetes API and successfully queries the number of
pods in the cluster every 10 seconds.
### Clean up
To stop this example and clean up the pod, press <kbd>Ctrl</kbd>+<kbd>C</kbd> on
the `kubectl run` command and then run:
kubectl delete deployment demo
[sa]: https://kubernetes.io/docs/admin/authentication/#service-account-tokens
[mk]: https://kubernetes.io/docs/getting-started-guides/minikube/

View File

@@ -21,6 +21,7 @@ import (
"fmt"
"time"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
@@ -43,6 +44,21 @@ func main() {
panic(err.Error())
}
fmt.Printf("There are %d pods in the cluster\n", len(pods.Items))
// Examples for error handling:
// - Use helper functions like e.g. errors.IsNotFound()
// - And/or cast to StatusError and use its properties like e.g. ErrStatus.Message
_, err = clientset.CoreV1().Pods("default").Get("example-xxxxx", metav1.GetOptions{})
if errors.IsNotFound(err) {
fmt.Printf("Pod not found\n")
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {
fmt.Printf("Error getting pod %v\n", statusError.ErrStatus.Message)
} else if err != nil {
panic(err.Error())
} else {
fmt.Printf("Found pod\n")
}
time.Sleep(10 * time.Second)
}
}

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "out-of-cluster-client-configuration",
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
tags = ["automanaged"],
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/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
],
)

View File

@@ -0,0 +1,35 @@
# Authenticating outside the cluster
This example shows you how to configure a client with client-go to authenticate
to the Kubernetes API from an application running outside the Kubernetes
cluster.
You can use your kubeconfig file that contains the context information
of your cluster to initialize a client. The kubeconfig file is also used
by the `kubectl` command to authenticate to the clusters.
## Running this example
Make sure your `kubectl` is configured and pointed to a cluster. Run
`kubectl get nodes` to confirm.
Run this application with:
cd out-of-cluster-client-configuration
go build -o app .
./app
Running this application will use the kubeconfig file and then authenticate to the
cluster, and print the number of nodes in the cluster every 10 seconds:
$ ./app
There are 3 pods in the cluster
There are 3 pods in the cluster
There are 3 pods in the cluster
...
Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to quit this application.
> **Note:** You can use the `-kubeconfig` option to use a different config file. By default
this program picks up the default file used by kubectl (when `KUBECONFIG`
environment variable is not set).

View File

@@ -0,0 +1,85 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Note: the example only works with the code within the same release/branch.
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
"time"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
// 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"
)
func main() {
var kubeconfig *string
if home := homeDir(); home != "" {
kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
} else {
kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file")
}
flag.Parse()
// use the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
if err != nil {
panic(err.Error())
}
// create the clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err.Error())
}
for {
pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{})
if err != nil {
panic(err.Error())
}
fmt.Printf("There are %d pods in the cluster\n", len(pods.Items))
// Examples for error handling:
// - Use helper functions like e.g. errors.IsNotFound()
// - And/or cast to StatusError and use its properties like e.g. ErrStatus.Message
_, err = clientset.CoreV1().Pods("default").Get("example-xxxxx", metav1.GetOptions{})
if errors.IsNotFound(err) {
fmt.Printf("Pod not found\n")
} else if statusError, isStatus := err.(*errors.StatusError); isStatus {
fmt.Printf("Error getting pod %v\n", statusError.ErrStatus.Message)
} else if err != nil {
panic(err.Error())
} else {
fmt.Printf("Found pod\n")
}
time.Sleep(10 * time.Second)
}
}
func homeDir() string {
if h := os.Getenv("HOME"); h != "" {
return h
}
return os.Getenv("USERPROFILE") // windows
}

View File

@@ -1,51 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Note: the example only works with the code within the same release/branch.
package main
import (
"flag"
"fmt"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
func main() {
kubeconfig := flag.String("kubeconfig", "./config", "absolute path to the kubeconfig file")
flag.Parse()
// uses the current context in kubeconfig
config, err := clientcmd.BuildConfigFromFlags("", *kubeconfig)
if err != nil {
panic(err.Error())
}
// creates the clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err.Error())
}
for {
pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{})
if err != nil {
panic(err.Error())
}
fmt.Printf("There are %d pods in the cluster\n", len(pods.Items))
time.Sleep(10 * time.Second)
}
}

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
tags = ["automanaged"],
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-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"],
)

View File

@@ -1,9 +1,12 @@
# 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:
* How to register a new ThirdPartyResource (custom Resource type)
* How to create/get/list instances of your new Resource type (update/delete/etc work as well but are not demonstrated)
* How to setup a controller on Resource handling create/update/delete events
## Running

View File

@@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_test(
name = "go_default_test",
srcs = ["types_test.go"],
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//vendor/github.com/google/gofuzz:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/testing:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = [
"register.go",
"types.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
],
)

View File

@@ -0,0 +1,49 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// GroupName is the group name use in this package.
const GroupName = "tpr.client-go.k8s.io"
// SchemeGroupVersion is the group version used to register these objects.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
// addKnownTypes adds the set of types defined in this package to the supplied scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Example{},
&ExampleList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@@ -0,0 +1,53 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const ExampleResourcePlural = "examples"
type Example struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec ExampleSpec `json:"spec"`
Status ExampleStatus `json:"status,omitempty"`
}
type ExampleSpec struct {
Foo string `json:"foo"`
Bar bool `json:"bar"`
}
type ExampleStatus struct {
State ExampleState `json:"state,omitempty"`
Message string `json:"message,omitempty"`
}
type ExampleState string
const (
ExampleStateCreated ExampleState = "Created"
ExampleStateProcessed ExampleState = "Processed"
)
type ExampleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Example `json:"items"`
}

View File

@@ -0,0 +1,63 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
"math/rand"
"testing"
"github.com/google/gofuzz"
apitesting "k8s.io/apimachinery/pkg/api/testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
)
var _ runtime.Object = &Example{}
var _ metav1.ObjectMetaAccessor = &Example{}
var _ runtime.Object = &ExampleList{}
var _ metav1.ListMetaAccessor = &ExampleList{}
func exampleFuzzerFuncs(t apitesting.TestingCommon) []interface{} {
return []interface{}{
func(obj *ExampleList, c fuzz.Continue) {
c.FuzzNoCustom(obj)
obj.Items = make([]Example, c.Intn(10))
for i := range obj.Items {
c.Fuzz(&obj.Items[i])
}
},
}
}
// TestRoundTrip tests that the third-party kinds can be marshaled and unmarshaled correctly to/from JSON
// without the loss of information. Moreover, deep copy is tested.
func TestRoundTrip(t *testing.T) {
scheme := runtime.NewScheme()
codecs := serializer.NewCodecFactory(scheme)
AddToScheme(scheme)
seed := rand.Int63()
fuzzerFuncs := apitesting.MergeFuzzerFuncs(t, apitesting.GenericFuzzerFuncs(t, codecs), exampleFuzzerFuncs(t))
fuzzer := apitesting.FuzzerFor(fuzzerFuncs, rand.NewSource(seed))
apitesting.RoundTripSpecificKindWithoutProtobuf(t, SchemeGroupVersion.WithKind("Example"), scheme, codecs, fuzzer, nil)
apitesting.RoundTripSpecificKindWithoutProtobuf(t, SchemeGroupVersion.WithKind("ExampleList"), scheme, codecs, fuzzer, nil)
}

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"client.go",
"tpr.go",
],
tags = ["automanaged"],
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/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-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",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)

View File

@@ -0,0 +1,45 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/rest"
tprv1 "k8s.io/client-go/examples/third-party-resources-deprecated/apis/tpr/v1"
)
func NewClient(cfg *rest.Config) (*rest.RESTClient, *runtime.Scheme, error) {
scheme := runtime.NewScheme()
if err := tprv1.AddToScheme(scheme); err != nil {
return nil, nil, err
}
config := *cfg
config.GroupVersion = &tprv1.SchemeGroupVersion
config.APIPath = "/apis"
config.ContentType = runtime.ContentTypeJSON
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, nil, err
}
return client, scheme, nil
}

View File

@@ -0,0 +1,76 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"time"
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-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"
"k8s.io/client-go/rest"
// 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"
)
func CreateTPR(clientset kubernetes.Interface) error {
tpr := &v1beta1.ThirdPartyResource{
ObjectMeta: metav1.ObjectMeta{
Name: "example." + tprv1.GroupName,
},
Versions: []v1beta1.APIVersion{
{Name: tprv1.SchemeGroupVersion.Version},
},
Description: "An Example ThirdPartyResource",
}
_, err := clientset.ExtensionsV1beta1().ThirdPartyResources().Create(tpr)
return err
}
func WaitForExampleResource(exampleClient *rest.RESTClient) error {
return wait.Poll(100*time.Millisecond, 60*time.Second, func() (bool, error) {
_, err := exampleClient.Get().Namespace(apiv1.NamespaceDefault).Resource(tprv1.ExampleResourcePlural).DoRaw()
if err == nil {
return true, nil
}
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
})
}
func WaitForExampleInstanceProcessed(exampleClient *rest.RESTClient, name string) error {
return wait.Poll(100*time.Millisecond, 10*time.Second, func() (bool, error) {
var example tprv1.Example
err := exampleClient.Get().
Resource(tprv1.ExampleResourcePlural).
Namespace(apiv1.NamespaceDefault).
Name(name).
Do().Into(&example)
if err == nil && example.Status.State == tprv1.ExampleStateProcessed {
return true, nil
}
return false, err
})
}

View File

@@ -0,0 +1,22 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["controller.go"],
tags = ["automanaged"],
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-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",
],
)

View File

@@ -0,0 +1,126 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
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
type ExampleController struct {
ExampleClient *rest.RESTClient
ExampleScheme *runtime.Scheme
}
// Run starts an Example resource controller
func (c *ExampleController) Run(ctx context.Context) error {
fmt.Print("Watch Example objects\n")
// Watch Example objects
_, err := c.watchExamples(ctx)
if err != nil {
fmt.Printf("Failed to register watch for Example resource: %v\n", err)
return err
}
<-ctx.Done()
return ctx.Err()
}
func (c *ExampleController) watchExamples(ctx context.Context) (cache.Controller, error) {
source := cache.NewListWatchFromClient(
c.ExampleClient,
tprv1.ExampleResourcePlural,
apiv1.NamespaceAll,
fields.Everything())
_, controller := cache.NewInformer(
source,
// The object type.
&tprv1.Example{},
// resyncPeriod
// Every resyncPeriod, all resources in the cache will retrigger events.
// Set to 0 to disable the resync.
0,
// Your custom resource event handlers.
cache.ResourceEventHandlerFuncs{
AddFunc: c.onAdd,
UpdateFunc: c.onUpdate,
DeleteFunc: c.onDelete,
})
go controller.Run(ctx.Done())
return controller, nil
}
func (c *ExampleController) onAdd(obj interface{}) {
example := obj.(*tprv1.Example)
fmt.Printf("[CONTROLLER] OnAdd %s\n", example.ObjectMeta.SelfLink)
// NEVER modify objects from the store. It's a read-only, local cache.
// You can use exampleScheme.Copy() to make a deep copy of original object and modify this copy
// Or create a copy manually for better performance
copyObj, err := c.ExampleScheme.Copy(example)
if err != nil {
fmt.Printf("ERROR creating a deep copy of example object: %v\n", err)
return
}
exampleCopy := copyObj.(*tprv1.Example)
exampleCopy.Status = tprv1.ExampleStatus{
State: tprv1.ExampleStateProcessed,
Message: "Successfully processed by controller",
}
err = c.ExampleClient.Put().
Name(example.ObjectMeta.Name).
Namespace(example.ObjectMeta.Namespace).
Resource(tprv1.ExampleResourcePlural).
Body(exampleCopy).
Do().
Error()
if err != nil {
fmt.Printf("ERROR updating status: %v\n", err)
} else {
fmt.Printf("UPDATED status: %#v\n", exampleCopy)
}
}
func (c *ExampleController) onUpdate(oldObj, newObj interface{}) {
oldExample := oldObj.(*tprv1.Example)
newExample := newObj.(*tprv1.Example)
fmt.Printf("[CONTROLLER] OnUpdate oldObj: %s\n", oldExample.ObjectMeta.SelfLink)
fmt.Printf("[CONTROLLER] OnUpdate newObj: %s\n", newExample.ObjectMeta.SelfLink)
}
func (c *ExampleController) onDelete(obj interface{}) {
example := obj.(*tprv1.Example)
fmt.Printf("[CONTROLLER] OnDelete %s\n", example.ObjectMeta.SelfLink)
}

View File

@@ -0,0 +1,132 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Note: the example only works with the code within the same release/branch.
package main
import (
"context"
"flag"
"fmt"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
apiv1 "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
// 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-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() {
kubeconfig := flag.String("kubeconfig", "", "Path to a kube config. Only required if out-of-cluster.")
flag.Parse()
// Create the client config. Use kubeconfig if given, otherwise assume in-cluster.
config, err := buildConfig(*kubeconfig)
if err != nil {
panic(err)
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err)
}
// initialize third party resource if it does not exist
err = exampleclient.CreateTPR(clientset)
if err != nil && !apierrors.IsAlreadyExists(err) {
panic(err)
}
// make a new config for our extension's API group, using the first config as a baseline
exampleClient, exampleScheme, err := exampleclient.NewClient(config)
if err != nil {
panic(err)
}
// wait until TPR gets processed
err = exampleclient.WaitForExampleResource(exampleClient)
if err != nil {
panic(err)
}
// start a controller on instances of our TPR
controller := examplecontroller.ExampleController{
ExampleClient: exampleClient,
ExampleScheme: exampleScheme,
}
ctx, cancelFunc := context.WithCancel(context.Background())
defer cancelFunc()
go controller.Run(ctx)
// Create an instance of our TPR
example := &tprv1.Example{
ObjectMeta: metav1.ObjectMeta{
Name: "example1",
},
Spec: tprv1.ExampleSpec{
Foo: "hello",
Bar: true,
},
Status: tprv1.ExampleStatus{
State: tprv1.ExampleStateCreated,
Message: "Created, not processed yet",
},
}
var result tprv1.Example
err = exampleClient.Post().
Resource(tprv1.ExampleResourcePlural).
Namespace(apiv1.NamespaceDefault).
Body(example).
Do().Into(&result)
if err == nil {
fmt.Printf("CREATED: %#v\n", result)
} else if apierrors.IsAlreadyExists(err) {
fmt.Printf("ALREADY EXISTS: %#v\n", result)
} else {
panic(err)
}
// Poll until Example object is handled by controller and gets status updated to "Processed"
err = exampleclient.WaitForExampleInstanceProcessed(exampleClient, "example1")
if err != nil {
panic(err)
}
fmt.Print("PROCESSED\n")
// Fetch a list of our TPRs
exampleList := tprv1.ExampleList{}
err = exampleClient.Get().Resource(tprv1.ExampleResourcePlural).Do().Into(&exampleList)
if err != nil {
panic(err)
}
fmt.Printf("LIST: %#v\n", exampleList)
}
func buildConfig(kubeconfig string) (*rest.Config, error) {
if kubeconfig != "" {
return clientcmd.BuildConfigFromFlags("", kubeconfig)
}
return rest.InClusterConfig()
}

View File

@@ -1,167 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Note: the example only works with the code within the same release/branch.
package main
import (
"flag"
"fmt"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
// Only required to authenticate against GKE clusters
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
)
func main() {
kubeconfig := flag.String("kubeconfig", "", "Path to a kube config. Only required if out-of-cluster.")
flag.Parse()
// Create the client config. Use kubeconfig if given, otherwise assume in-cluster.
config, err := buildConfig(*kubeconfig)
if err != nil {
panic(err)
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err)
}
// initialize third party resource if it does not exist
tpr, err := clientset.ExtensionsV1beta1().ThirdPartyResources().Get("example.k8s.io", metav1.GetOptions{})
if err != nil {
if errors.IsNotFound(err) {
tpr := &v1beta1.ThirdPartyResource{
ObjectMeta: metav1.ObjectMeta{
Name: "example.k8s.io",
},
Versions: []v1beta1.APIVersion{
{Name: "v1"},
},
Description: "An Example ThirdPartyResource",
}
result, err := clientset.ExtensionsV1beta1().ThirdPartyResources().Create(tpr)
if err != nil {
panic(err)
}
fmt.Printf("CREATED: %#v\nFROM: %#v\n", result, tpr)
} else {
panic(err)
}
} else {
fmt.Printf("SKIPPING: already exists %#v\n", tpr)
}
// make a new config for our extension's API group, using the first config as a baseline
var tprconfig *rest.Config
tprconfig = config
configureClient(tprconfig)
tprclient, err := rest.RESTClientFor(tprconfig)
if err != nil {
panic(err)
}
var example Example
err = tprclient.Get().
Resource("examples").
Namespace(api.NamespaceDefault).
Name("example1").
Do().Into(&example)
if err != nil {
if errors.IsNotFound(err) {
// Create an instance of our TPR
example := &Example{
Metadata: metav1.ObjectMeta{
Name: "example1",
},
Spec: ExampleSpec{
Foo: "hello",
Bar: true,
},
}
var result Example
err = tprclient.Post().
Resource("examples").
Namespace(api.NamespaceDefault).
Body(example).
Do().Into(&result)
if err != nil {
panic(err)
}
fmt.Printf("CREATED: %#v\n", result)
} else {
panic(err)
}
} else {
fmt.Printf("GET: %#v\n", example)
}
// Fetch a list of our TPRs
exampleList := ExampleList{}
err = tprclient.Get().Resource("examples").Do().Into(&exampleList)
if err != nil {
panic(err)
}
fmt.Printf("LIST: %#v\n", exampleList)
}
func buildConfig(kubeconfig string) (*rest.Config, error) {
if kubeconfig != "" {
return clientcmd.BuildConfigFromFlags("", kubeconfig)
}
return rest.InClusterConfig()
}
func configureClient(config *rest.Config) {
groupversion := schema.GroupVersion{
Group: "k8s.io",
Version: "v1",
}
config.GroupVersion = &groupversion
config.APIPath = "/apis"
config.ContentType = runtime.ContentTypeJSON
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: api.Codecs}
schemeBuilder := runtime.NewSchemeBuilder(
func(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(
groupversion,
&Example{},
&ExampleList{},
)
return nil
})
metav1.AddToGroupVersion(api.Scheme, groupversion)
schemeBuilder.AddToScheme(api.Scheme)
}

View File

@@ -1,92 +0,0 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"encoding/json"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
type ExampleSpec struct {
Foo string `json:"foo"`
Bar bool `json:"bar"`
}
type Example struct {
metav1.TypeMeta `json:",inline"`
Metadata metav1.ObjectMeta `json:"metadata"`
Spec ExampleSpec `json:"spec"`
}
type ExampleList struct {
metav1.TypeMeta `json:",inline"`
Metadata metav1.ListMeta `json:"metadata"`
Items []Example `json:"items"`
}
// Required to satisfy Object interface
func (e *Example) GetObjectKind() schema.ObjectKind {
return &e.TypeMeta
}
// Required to satisfy ObjectMetaAccessor interface
func (e *Example) GetObjectMeta() metav1.Object {
return &e.Metadata
}
// Required to satisfy Object interface
func (el *ExampleList) GetObjectKind() schema.ObjectKind {
return &el.TypeMeta
}
// Required to satisfy ListMetaAccessor interface
func (el *ExampleList) GetListMeta() metav1.List {
return &el.Metadata
}
// The code below is used only to work around a known problem with third-party
// resources and ugorji. If/when these issues are resolved, the code below
// should no longer be required.
type ExampleListCopy ExampleList
type ExampleCopy Example
func (e *Example) UnmarshalJSON(data []byte) error {
tmp := ExampleCopy{}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
tmp2 := Example(tmp)
*e = tmp2
return nil
}
func (el *ExampleList) UnmarshalJSON(data []byte) error {
tmp := ExampleListCopy{}
err := json.Unmarshal(data, &tmp)
if err != nil {
return err
}
tmp2 := ExampleList(tmp)
*el = tmp2
return nil
}

33
examples/workqueue/BUILD Normal file
View File

@@ -0,0 +1,33 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "workqueue",
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
tags = ["automanaged"],
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait: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/tools/cache:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
"//vendor/k8s.io/client-go/util/workqueue:go_default_library",
],
)

View File

@@ -0,0 +1,17 @@
# Workqueue Example
This example demonstrates how to write a controller which follows the states
of watched resources.
It demonstrates how to:
* combine the workqueue with a cache to a full controller
* synchronize the controller on startup
The example is based on https://git.k8s.io/community/contributors/devel/controllers.md.
## Running
```
# if outside of the cluster
go run *.go -kubeconfig=/my/config -logtostderr=true
```

217
examples/workqueue/main.go Normal file
View File

@@ -0,0 +1,217 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"flag"
"fmt"
"time"
"github.com/golang/glog"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/workqueue"
)
type Controller struct {
indexer cache.Indexer
queue workqueue.RateLimitingInterface
informer cache.Controller
}
func NewController(queue workqueue.RateLimitingInterface, indexer cache.Indexer, informer cache.Controller) *Controller {
return &Controller{
informer: informer,
indexer: indexer,
queue: queue,
}
}
func (c *Controller) processNextItem() bool {
// Wait until there is a new item in the working queue
key, quit := c.queue.Get()
if quit {
return false
}
// Tell the queue that we are done with processing this key. This unblocks the key for other workers
// This allows safe parallel processing because two pods with the same key are never processed in
// parallel.
defer c.queue.Done(key)
// Invoke the method containing the business logic
err := c.syncToStdout(key.(string))
// Handle the error if something went wrong during the execution of the business logic
c.handleErr(err, key)
return true
}
// syncToStdout is the business logic of the controller. In this controller it simply prints
// information about the pod to stdout. In case an error happened, it has to simply return the error.
// The retry logic should not be part of the business logic.
func (c *Controller) syncToStdout(key string) error {
obj, exists, err := c.indexer.GetByKey(key)
if err != nil {
glog.Errorf("Fetching object with key %s from store failed with %v", key, err)
return err
}
if !exists {
// Below we will warm up our cache with a Pod, so that we will see a delete for one pod
fmt.Printf("Pod %s does not exist anymore\n", key)
} else {
// Note that you also have to check the uid if you have a local controlled resource, which
// is dependent on the actual instance, to detect that a Pod was recreated with the same name
fmt.Printf("Sync/Add/Update for Pod %s\n", obj.(*v1.Pod).GetName())
}
return nil
}
// handleErr checks if an error happened and makes sure we will retry later.
func (c *Controller) handleErr(err error, key interface{}) {
if err == nil {
// Forget about the #AddRateLimited history of the key on every successful synchronization.
// This ensures that future processing of updates for this key is not delayed because of
// an outdated error history.
c.queue.Forget(key)
return
}
// This controller retries 5 times if something goes wrong. After that, it stops trying.
if c.queue.NumRequeues(key) < 5 {
glog.Infof("Error syncing pod %v: %v", key, err)
// Re-enqueue the key rate limited. Based on the rate limiter on the
// queue and the re-enqueue history, the key will be processed later again.
c.queue.AddRateLimited(key)
return
}
c.queue.Forget(key)
// Report to an external entity that, even after several retries, we could not successfully process this key
runtime.HandleError(err)
glog.Infof("Dropping pod %q out of the queue: %v", key, err)
}
func (c *Controller) Run(threadiness int, stopCh chan struct{}) {
defer runtime.HandleCrash()
// Let the workers stop when we are done
defer c.queue.ShutDown()
glog.Info("Starting Pod controller")
go c.informer.Run(stopCh)
// Wait for all involved caches to be synced, before processing items from the queue is started
if !cache.WaitForCacheSync(stopCh, c.informer.HasSynced) {
runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync"))
return
}
for i := 0; i < threadiness; i++ {
go wait.Until(c.runWorker, time.Second, stopCh)
}
<-stopCh
glog.Info("Stopping Pod controller")
}
func (c *Controller) runWorker() {
for c.processNextItem() {
}
}
func main() {
var kubeconfig string
var master string
flag.StringVar(&kubeconfig, "kubeconfig", "", "absolute path to the kubeconfig file")
flag.StringVar(&master, "master", "", "master url")
flag.Parse()
// creates the connection
config, err := clientcmd.BuildConfigFromFlags(master, kubeconfig)
if err != nil {
glog.Fatal(err)
}
// creates the clientset
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
glog.Fatal(err)
}
// create the pod watcher
podListWatcher := cache.NewListWatchFromClient(clientset.Core().RESTClient(), "pods", v1.NamespaceDefault, fields.Everything())
// create the workqueue
queue := workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter())
// Bind the workqueue to a cache with the help of an informer. This way we make sure that
// whenever the cache is updated, the pod key is added to the workqueue.
// Note that when we finally process the item from the workqueue, we might see a newer version
// of the Pod than the version which was responsible for triggering the update.
indexer, informer := cache.NewIndexerInformer(podListWatcher, &v1.Pod{}, 0, cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
key, err := cache.MetaNamespaceKeyFunc(obj)
if err == nil {
queue.Add(key)
}
},
UpdateFunc: func(old interface{}, new interface{}) {
key, err := cache.MetaNamespaceKeyFunc(new)
if err == nil {
queue.Add(key)
}
},
DeleteFunc: func(obj interface{}) {
// IndexerInformer uses a delta queue, therefore for deletes we have to use this
// key function.
key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
if err == nil {
queue.Add(key)
}
},
}, cache.Indexers{})
controller := NewController(queue, indexer, informer)
// We can now warm up the cache for initial synchronization.
// Let's suppose that we knew about a pod "mypod" on our last run, therefore add it to the cache.
// If this pod is not there anymore, the controller will be notified about the removal after the
// cache has synchronized.
indexer.Add(&v1.Pod{
ObjectMeta: meta_v1.ObjectMeta{
Name: "mypod",
Namespace: v1.NamespaceDefault,
},
})
// Now let's start the controller
stop := make(chan struct{})
defer close(stop)
go controller.Run(1, stop)
// Wait forever
select {}
}

52
informers/BUILD Normal file
View File

@@ -0,0 +1,52 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"factory.go",
"generic.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/client-go/informers/admissionregistration:go_default_library",
"//vendor/k8s.io/client-go/informers/apps:go_default_library",
"//vendor/k8s.io/client-go/informers/autoscaling:go_default_library",
"//vendor/k8s.io/client-go/informers/batch:go_default_library",
"//vendor/k8s.io/client-go/informers/certificates:go_default_library",
"//vendor/k8s.io/client-go/informers/core:go_default_library",
"//vendor/k8s.io/client-go/informers/extensions:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/informers/networking:go_default_library",
"//vendor/k8s.io/client-go/informers/policy:go_default_library",
"//vendor/k8s.io/client-go/informers/rbac:go_default_library",
"//vendor/k8s.io/client-go/informers/settings:go_default_library",
"//vendor/k8s.io/client-go/informers/storage: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/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

View File

@@ -0,0 +1,44 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package admissionregistration
import (
v1alpha1 "k8s.io/client-go/informers/admissionregistration/v1alpha1"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
}
type group struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &group{f}
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.SharedInformerFactory)
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"externaladmissionhookconfiguration.go",
"initializerconfiguration.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,68 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1alpha1 "k8s.io/client-go/listers/admissionregistration/v1alpha1"
admissionregistration_v1alpha1 "k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// ExternalAdmissionHookConfigurationInformer provides access to a shared informer and lister for
// ExternalAdmissionHookConfigurations.
type ExternalAdmissionHookConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.ExternalAdmissionHookConfigurationLister
}
type externalAdmissionHookConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newExternalAdmissionHookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.AdmissionregistrationV1alpha1().ExternalAdmissionHookConfigurations().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.AdmissionregistrationV1alpha1().ExternalAdmissionHookConfigurations().Watch(options)
},
},
&admissionregistration_v1alpha1.ExternalAdmissionHookConfiguration{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *externalAdmissionHookConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration_v1alpha1.ExternalAdmissionHookConfiguration{}, newExternalAdmissionHookConfigurationInformer)
}
func (f *externalAdmissionHookConfigurationInformer) Lister() v1alpha1.ExternalAdmissionHookConfigurationLister {
return v1alpha1.NewExternalAdmissionHookConfigurationLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,68 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1alpha1 "k8s.io/client-go/listers/admissionregistration/v1alpha1"
admissionregistration_v1alpha1 "k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// InitializerConfigurationInformer provides access to a shared informer and lister for
// InitializerConfigurations.
type InitializerConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.InitializerConfigurationLister
}
type initializerConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newInitializerConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.AdmissionregistrationV1alpha1().InitializerConfigurations().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.AdmissionregistrationV1alpha1().InitializerConfigurations().Watch(options)
},
},
&admissionregistration_v1alpha1.InitializerConfiguration{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *initializerConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&admissionregistration_v1alpha1.InitializerConfiguration{}, newInitializerConfigurationInformer)
}
func (f *initializerConfigurationInformer) Lister() v1alpha1.InitializerConfigurationLister {
return v1alpha1.NewInitializerConfigurationLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,50 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package v1alpha1
import (
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// ExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurationInformer.
ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInformer
// InitializerConfigurations returns a InitializerConfigurationInformer.
InitializerConfigurations() InitializerConfigurationInformer
}
type version struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// ExternalAdmissionHookConfigurations returns a ExternalAdmissionHookConfigurationInformer.
func (v *version) ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInformer {
return &externalAdmissionHookConfigurationInformer{factory: v.SharedInformerFactory}
}
// InitializerConfigurations returns a InitializerConfigurationInformer.
func (v *version) InitializerConfigurations() InitializerConfigurationInformer {
return &initializerConfigurationInformer{factory: v.SharedInformerFactory}
}

18
informers/apps/BUILD Normal file
View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"controllerrevision.go",
"deployment.go",
"interface.go",
"statefulset.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,68 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package v1beta1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/apps/v1beta1"
apps_v1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// ControllerRevisionInformer provides access to a shared informer and lister for
// ControllerRevisions.
type ControllerRevisionInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ControllerRevisionLister
}
type controllerRevisionInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newControllerRevisionInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
return client.AppsV1beta1().ControllerRevisions(v1.NamespaceAll).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
return client.AppsV1beta1().ControllerRevisions(v1.NamespaceAll).Watch(options)
},
},
&apps_v1beta1.ControllerRevision{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apps_v1beta1.ControllerRevision{}, newControllerRevisionInformer)
}
func (f *controllerRevisionInformer) Lister() v1beta1.ControllerRevisionLister {
return v1beta1.NewControllerRevisionLister(f.Informer().GetIndexer())
}

View File

@@ -24,6 +24,8 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// ControllerRevisions returns a ControllerRevisionInformer.
ControllerRevisions() ControllerRevisionInformer
// Deployments returns a DeploymentInformer.
Deployments() DeploymentInformer
// StatefulSets returns a StatefulSetInformer.
@@ -39,6 +41,11 @@ func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// ControllerRevisions returns a ControllerRevisionInformer.
func (v *version) ControllerRevisions() ControllerRevisionInformer {
return &controllerRevisionInformer{factory: v.SharedInformerFactory}
}
// Deployments returns a DeploymentInformer.
func (v *version) Deployments() DeploymentInformer {
return &deploymentInformer{factory: v.SharedInformerFactory}

View File

@@ -0,0 +1,19 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/informers/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"horizontalpodautoscaler.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"horizontalpodautoscaler.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

19
informers/batch/BUILD Normal file
View File

@@ -0,0 +1,19 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/informers/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

27
informers/batch/v1/BUILD Normal file
View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"interface.go",
"job.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"cronjob.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"certificatesigningrequest.go",
"interface.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

18
informers/core/BUILD Normal file
View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/core/v1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

42
informers/core/v1/BUILD Normal file
View File

@@ -0,0 +1,42 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"componentstatus.go",
"configmap.go",
"endpoints.go",
"event.go",
"interface.go",
"limitrange.go",
"namespace.go",
"node.go",
"persistentvolume.go",
"persistentvolumeclaim.go",
"pod.go",
"podtemplate.go",
"replicationcontroller.go",
"resourcequota.go",
"secret.go",
"service.go",
"serviceaccount.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/core/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"daemonset.go",
"deployment.go",
"ingress.go",
"interface.go",
"podsecuritypolicy.go",
"replicaset.go",
"thirdpartyresource.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -21,6 +21,7 @@ package informers
import (
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
admissionregistration "k8s.io/client-go/informers/admissionregistration"
apps "k8s.io/client-go/informers/apps"
autoscaling "k8s.io/client-go/informers/autoscaling"
batch "k8s.io/client-go/informers/batch"
@@ -28,6 +29,7 @@ import (
core "k8s.io/client-go/informers/core"
extensions "k8s.io/client-go/informers/extensions"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
networking "k8s.io/client-go/informers/networking"
policy "k8s.io/client-go/informers/policy"
rbac "k8s.io/client-go/informers/rbac"
settings "k8s.io/client-go/informers/settings"
@@ -73,6 +75,28 @@ func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
}
}
// WaitForCacheSync waits for all started informers' cache were synced.
func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool {
informers := func() map[reflect.Type]cache.SharedIndexInformer {
f.lock.Lock()
defer f.lock.Unlock()
informers := map[reflect.Type]cache.SharedIndexInformer{}
for informerType, informer := range f.informers {
if f.startedInformers[informerType] {
informers[informerType] = informer
}
}
return informers
}()
res := map[reflect.Type]bool{}
for informType, informer := range informers {
res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced)
}
return res
}
// InternalInformerFor returns the SharedIndexInformer for obj using an internal
// client.
func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer {
@@ -95,19 +119,26 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
type SharedInformerFactory interface {
internalinterfaces.SharedInformerFactory
ForResource(resource schema.GroupVersionResource) (GenericInformer, error)
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
Admissionregistration() admissionregistration.Interface
Apps() apps.Interface
Autoscaling() autoscaling.Interface
Batch() batch.Interface
Certificates() certificates.Interface
Core() core.Interface
Extensions() extensions.Interface
Networking() networking.Interface
Policy() policy.Interface
Rbac() rbac.Interface
Settings() settings.Interface
Storage() storage.Interface
}
func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface {
return admissionregistration.New(f)
}
func (f *sharedInformerFactory) Apps() apps.Interface {
return apps.New(f)
}
@@ -132,6 +163,10 @@ func (f *sharedInformerFactory) Extensions() extensions.Interface {
return extensions.New(f)
}
func (f *sharedInformerFactory) Networking() networking.Interface {
return networking.New(f)
}
func (f *sharedInformerFactory) Policy() policy.Interface {
return policy.New(f)
}

View File

@@ -22,6 +22,7 @@ import (
"fmt"
schema "k8s.io/apimachinery/pkg/runtime/schema"
api_v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1"
v1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
v1 "k8s.io/client-go/pkg/apis/autoscaling/v1"
v2alpha1 "k8s.io/client-go/pkg/apis/autoscaling/v2alpha1"
@@ -29,8 +30,9 @@ import (
batch_v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
certificates_v1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
extensions_v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
networking_v1 "k8s.io/client-go/pkg/apis/networking/v1"
policy_v1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
rbac_v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
rbac_v1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1"
settings_v1alpha1 "k8s.io/client-go/pkg/apis/settings/v1alpha1"
storage_v1 "k8s.io/client-go/pkg/apis/storage/v1"
@@ -64,7 +66,15 @@ func (f *genericInformer) Lister() cache.GenericLister {
// TODO extend this to unknown resources with a client pool
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=Apps, Version=V1beta1
// Group=Admissionregistration, Version=V1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("externaladmissionhookconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().ExternalAdmissionHookConfigurations().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("initializerconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1alpha1().InitializerConfigurations().Informer()}, nil
// Group=Apps, Version=V1beta1
case v1beta1.SchemeGroupVersion.WithResource("controllerrevisions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().ControllerRevisions().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("deployments"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().Deployments().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("statefulsets"):
@@ -138,18 +148,22 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case extensions_v1beta1.SchemeGroupVersion.WithResource("thirdpartyresources"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().ThirdPartyResources().Informer()}, nil
// Group=Networking, Version=V1
case networking_v1.SchemeGroupVersion.WithResource("networkpolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil
// Group=Policy, Version=V1beta1
case policy_v1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil
// Group=Rbac, Version=V1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("clusterroles"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("clusterroles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoles().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoleBindings().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("roles"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("roles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().Roles().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("rolebindings"):
case rbac_v1alpha1.SchemeGroupVersion.WithResource("rolebindings"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().RoleBindings().Informer()}, nil
// Group=Rbac, Version=V1beta1

View File

@@ -0,0 +1,19 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["factory_interfaces.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/informers/networking/v1:go_default_library",
],
)

View File

@@ -0,0 +1,44 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package networking
import (
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
v1 "k8s.io/client-go/informers/networking/v1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1 provides access to shared informers for resources in V1.
V1() v1.Interface
}
type group struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &group{f}
}
// V1 returns a new v1.Interface.
func (g *group) V1() v1.Interface {
return v1.New(g.SharedInformerFactory)
}

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"interface.go",
"networkpolicy.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,43 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package v1
import (
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// NetworkPolicies returns a NetworkPolicyInformer.
NetworkPolicies() NetworkPolicyInformer
}
type version struct {
internalinterfaces.SharedInformerFactory
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory) Interface {
return &version{f}
}
// NetworkPolicies returns a NetworkPolicyInformer.
func (v *version) NetworkPolicies() NetworkPolicyInformer {
return &networkPolicyInformer{factory: v.SharedInformerFactory}
}

View File

@@ -0,0 +1,68 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was automatically generated by informer-gen
package v1
import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1 "k8s.io/client-go/listers/networking/v1"
networking_v1 "k8s.io/client-go/pkg/apis/networking/v1"
cache "k8s.io/client-go/tools/cache"
time "time"
)
// NetworkPolicyInformer provides access to a shared informer and lister for
// NetworkPolicies.
type NetworkPolicyInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.NetworkPolicyLister
}
type networkPolicyInformer struct {
factory internalinterfaces.SharedInformerFactory
}
func newNetworkPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
sharedIndexInformer := cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options meta_v1.ListOptions) (runtime.Object, error) {
return client.NetworkingV1().NetworkPolicies(meta_v1.NamespaceAll).List(options)
},
WatchFunc: func(options meta_v1.ListOptions) (watch.Interface, error) {
return client.NetworkingV1().NetworkPolicies(meta_v1.NamespaceAll).Watch(options)
},
},
&networking_v1.NetworkPolicy{},
resyncPeriod,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
)
return sharedIndexInformer
}
func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networking_v1.NetworkPolicy{}, newNetworkPolicyInformer)
}
func (f *networkPolicyInformer) Lister() v1.NetworkPolicyLister {
return v1.NewNetworkPolicyLister(f.Informer().GetIndexer())
}

18
informers/policy/BUILD Normal file
View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/informers/policy/v1beta1:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"interface.go",
"poddisruptionbudget.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

19
informers/rbac/BUILD Normal file
View File

@@ -0,0 +1,19 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/informers/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/informers/rbac/v1beta1:go_default_library",
],
)

View File

@@ -0,0 +1,30 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"clusterrole.go",
"clusterrolebinding.go",
"interface.go",
"role.go",
"rolebinding.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,30 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"clusterrole.go",
"clusterrolebinding.go",
"interface.go",
"role.go",
"rolebinding.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

18
informers/settings/BUILD Normal file
View File

@@ -0,0 +1,18 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/informers/settings/v1alpha1:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"interface.go",
"podpreset.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

19
informers/storage/BUILD Normal file
View File

@@ -0,0 +1,19 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["interface.go"],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/informers/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/informers/storage/v1beta1:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"interface.go",
"storageclass.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"interface.go",
"storageclass.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/listers/storage/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
],
)

View File

@@ -1 +1 @@
9497139cb62015905ba5b3d11836f2b0c117ff80
84dfa6a4e3c655bb3cf63756d1674dff1976fe06

43
kubernetes/BUILD Normal file
View File

@@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"clientset.go",
"doc.go",
],
tags = ["automanaged"],
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/client-go/discovery:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/util/flowcontrol:go_default_library",
],
)

View File

@@ -19,6 +19,7 @@ package kubernetes
import (
glog "github.com/golang/glog"
discovery "k8s.io/client-go/discovery"
admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
authenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1"
@@ -31,6 +32,7 @@ import (
certificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
rbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1"
@@ -43,6 +45,9 @@ import (
type Interface interface {
Discovery() discovery.DiscoveryInterface
AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface
// Deprecated: please explicitly pick a version if possible.
Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface
CoreV1() corev1.CoreV1Interface
// Deprecated: please explicitly pick a version if possible.
Core() corev1.CoreV1Interface
@@ -71,6 +76,9 @@ type Interface interface {
ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Extensions() extensionsv1beta1.ExtensionsV1beta1Interface
NetworkingV1() networkingv1.NetworkingV1Interface
// Deprecated: please explicitly pick a version if possible.
Networking() networkingv1.NetworkingV1Interface
PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface
// Deprecated: please explicitly pick a version if possible.
Policy() policyv1beta1.PolicyV1beta1Interface
@@ -91,6 +99,7 @@ type Interface interface {
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
*admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Client
*corev1.CoreV1Client
*appsv1beta1.AppsV1beta1Client
*authenticationv1.AuthenticationV1Client
@@ -103,6 +112,7 @@ type Clientset struct {
*batchv2alpha1.BatchV2alpha1Client
*certificatesv1beta1.CertificatesV1beta1Client
*extensionsv1beta1.ExtensionsV1beta1Client
*networkingv1.NetworkingV1Client
*policyv1beta1.PolicyV1beta1Client
*rbacv1beta1.RbacV1beta1Client
*rbacv1alpha1.RbacV1alpha1Client
@@ -111,6 +121,23 @@ type Clientset struct {
*storagev1.StorageV1Client
}
// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
if c == nil {
return nil
}
return c.AdmissionregistrationV1alpha1Client
}
// Deprecated: Admissionregistration retrieves the default version of AdmissionregistrationClient.
// Please explicitly pick a version.
func (c *Clientset) Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
if c == nil {
return nil
}
return c.AdmissionregistrationV1alpha1Client
}
// CoreV1 retrieves the CoreV1Client
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
if c == nil {
@@ -279,6 +306,23 @@ func (c *Clientset) Extensions() extensionsv1beta1.ExtensionsV1beta1Interface {
return c.ExtensionsV1beta1Client
}
// NetworkingV1 retrieves the NetworkingV1Client
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
if c == nil {
return nil
}
return c.NetworkingV1Client
}
// Deprecated: Networking retrieves the default version of NetworkingClient.
// Please explicitly pick a version.
func (c *Clientset) Networking() networkingv1.NetworkingV1Interface {
if c == nil {
return nil
}
return c.NetworkingV1Client
}
// PolicyV1beta1 retrieves the PolicyV1beta1Client
func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface {
if c == nil {
@@ -379,6 +423,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
}
var cs Clientset
var err error
cs.AdmissionregistrationV1alpha1Client, err = admissionregistrationv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.CoreV1Client, err = corev1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@@ -427,6 +475,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
if err != nil {
return nil, err
}
cs.NetworkingV1Client, err = networkingv1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.PolicyV1beta1Client, err = policyv1beta1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@@ -464,6 +516,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.AdmissionregistrationV1alpha1Client = admissionregistrationv1alpha1.NewForConfigOrDie(c)
cs.CoreV1Client = corev1.NewForConfigOrDie(c)
cs.AppsV1beta1Client = appsv1beta1.NewForConfigOrDie(c)
cs.AuthenticationV1Client = authenticationv1.NewForConfigOrDie(c)
@@ -476,6 +529,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
cs.BatchV2alpha1Client = batchv2alpha1.NewForConfigOrDie(c)
cs.CertificatesV1beta1Client = certificatesv1beta1.NewForConfigOrDie(c)
cs.ExtensionsV1beta1Client = extensionsv1beta1.NewForConfigOrDie(c)
cs.NetworkingV1Client = networkingv1.NewForConfigOrDie(c)
cs.PolicyV1beta1Client = policyv1beta1.NewForConfigOrDie(c)
cs.RbacV1beta1Client = rbacv1beta1.NewForConfigOrDie(c)
cs.RbacV1alpha1Client = rbacv1alpha1.NewForConfigOrDie(c)
@@ -490,6 +544,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.AdmissionregistrationV1alpha1Client = admissionregistrationv1alpha1.New(c)
cs.CoreV1Client = corev1.New(c)
cs.AppsV1beta1Client = appsv1beta1.New(c)
cs.AuthenticationV1Client = authenticationv1.New(c)
@@ -502,6 +557,7 @@ func New(c rest.Interface) *Clientset {
cs.BatchV2alpha1Client = batchv2alpha1.New(c)
cs.CertificatesV1beta1Client = certificatesv1beta1.New(c)
cs.ExtensionsV1beta1Client = extensionsv1beta1.New(c)
cs.NetworkingV1Client = networkingv1.New(c)
cs.PolicyV1beta1Client = policyv1beta1.New(c)
cs.RbacV1beta1Client = rbacv1beta1.New(c)
cs.RbacV1alpha1Client = rbacv1alpha1.New(c)

89
kubernetes/fake/BUILD Normal file
View File

@@ -0,0 +1,89 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"clientset_generated.go",
"doc.go",
"register.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/discovery:go_default_library",
"//vendor/k8s.io/client-go/discovery/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2alpha1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/batch/v2alpha1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/networking/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/settings/v1alpha1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1/fake:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake:go_default_library",
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authentication/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authentication/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authorization/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authorization/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/testing:go_default_library",
],
)

View File

@@ -22,6 +22,8 @@ import (
"k8s.io/client-go/discovery"
fakediscovery "k8s.io/client-go/discovery/fake"
kubernetes "k8s.io/client-go/kubernetes"
admissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1"
fakeadmissionregistrationv1alpha1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1/fake"
appsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1"
fakeappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1/fake"
authenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1"
@@ -46,6 +48,8 @@ import (
fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake"
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake"
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake"
policyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
fakepolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1/fake"
rbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1"
@@ -66,7 +70,7 @@ import (
// without applying any validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
o := testing.NewObjectTracker(registry, scheme, codecs.UniversalDecoder())
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
@@ -74,7 +78,7 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
}
fakePtr := testing.Fake{}
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o, registry.RESTMapper()))
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o))
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
@@ -94,6 +98,16 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
var _ kubernetes.Interface = &Clientset{}
// AdmissionregistrationV1alpha1 retrieves the AdmissionregistrationV1alpha1Client
func (c *Clientset) AdmissionregistrationV1alpha1() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
}
// Admissionregistration retrieves the AdmissionregistrationV1alpha1Client
func (c *Clientset) Admissionregistration() admissionregistrationv1alpha1.AdmissionregistrationV1alpha1Interface {
return &fakeadmissionregistrationv1alpha1.FakeAdmissionregistrationV1alpha1{Fake: &c.Fake}
}
// CoreV1 retrieves the CoreV1Client
func (c *Clientset) CoreV1() corev1.CoreV1Interface {
return &fakecorev1.FakeCoreV1{Fake: &c.Fake}
@@ -194,6 +208,16 @@ func (c *Clientset) Extensions() extensionsv1beta1.ExtensionsV1beta1Interface {
return &fakeextensionsv1beta1.FakeExtensionsV1beta1{Fake: &c.Fake}
}
// NetworkingV1 retrieves the NetworkingV1Client
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
}
// Networking retrieves the NetworkingV1Client
func (c *Clientset) Networking() networkingv1.NetworkingV1Interface {
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}
}
// PolicyV1beta1 retrieves the PolicyV1beta1Client
func (c *Clientset) PolicyV1beta1() policyv1beta1.PolicyV1beta1Interface {
return &fakepolicyv1beta1.FakePolicyV1beta1{Fake: &c.Fake}

View File

@@ -17,52 +17,75 @@ limitations under the License.
package fake
import (
announced "k8s.io/apimachinery/pkg/apimachinery/announced"
registered "k8s.io/apimachinery/pkg/apimachinery/registered"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
core "k8s.io/client-go/pkg/api/install"
apps "k8s.io/client-go/pkg/apis/apps/install"
authentication "k8s.io/client-go/pkg/apis/authentication/install"
authorization "k8s.io/client-go/pkg/apis/authorization/install"
autoscaling "k8s.io/client-go/pkg/apis/autoscaling/install"
batch "k8s.io/client-go/pkg/apis/batch/install"
certificates "k8s.io/client-go/pkg/apis/certificates/install"
extensions "k8s.io/client-go/pkg/apis/extensions/install"
policy "k8s.io/client-go/pkg/apis/policy/install"
rbac "k8s.io/client-go/pkg/apis/rbac/install"
settings "k8s.io/client-go/pkg/apis/settings/install"
storage "k8s.io/client-go/pkg/apis/storage/install"
os "os"
corev1 "k8s.io/client-go/pkg/api/v1"
admissionregistrationv1alpha1 "k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1"
appsv1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
authenticationv1 "k8s.io/client-go/pkg/apis/authentication/v1"
authenticationv1beta1 "k8s.io/client-go/pkg/apis/authentication/v1beta1"
authorizationv1 "k8s.io/client-go/pkg/apis/authorization/v1"
authorizationv1beta1 "k8s.io/client-go/pkg/apis/authorization/v1beta1"
autoscalingv1 "k8s.io/client-go/pkg/apis/autoscaling/v1"
autoscalingv2alpha1 "k8s.io/client-go/pkg/apis/autoscaling/v2alpha1"
batchv1 "k8s.io/client-go/pkg/apis/batch/v1"
batchv2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
certificatesv1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
extensionsv1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
networkingv1 "k8s.io/client-go/pkg/apis/networking/v1"
policyv1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
rbacv1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
rbacv1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1"
settingsv1alpha1 "k8s.io/client-go/pkg/apis/settings/v1alpha1"
storagev1 "k8s.io/client-go/pkg/apis/storage/v1"
storagev1beta1 "k8s.io/client-go/pkg/apis/storage/v1beta1"
)
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var registry = registered.NewOrDie(os.Getenv("KUBE_API_VERSIONS"))
var groupFactoryRegistry = make(announced.APIGroupFactoryRegistry)
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
Install(groupFactoryRegistry, registry, scheme)
AddToScheme(scheme)
}
// Install registers the API group and adds types to a scheme
func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *registered.APIRegistrationManager, scheme *runtime.Scheme) {
core.Install(groupFactoryRegistry, registry, scheme)
apps.Install(groupFactoryRegistry, registry, scheme)
authentication.Install(groupFactoryRegistry, registry, scheme)
authorization.Install(groupFactoryRegistry, registry, scheme)
autoscaling.Install(groupFactoryRegistry, registry, scheme)
batch.Install(groupFactoryRegistry, registry, scheme)
certificates.Install(groupFactoryRegistry, registry, scheme)
extensions.Install(groupFactoryRegistry, registry, scheme)
policy.Install(groupFactoryRegistry, registry, scheme)
rbac.Install(groupFactoryRegistry, registry, scheme)
settings.Install(groupFactoryRegistry, registry, scheme)
storage.Install(groupFactoryRegistry, registry, scheme)
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kuberentes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
admissionregistrationv1alpha1.AddToScheme(scheme)
corev1.AddToScheme(scheme)
appsv1beta1.AddToScheme(scheme)
authenticationv1.AddToScheme(scheme)
authenticationv1beta1.AddToScheme(scheme)
authorizationv1.AddToScheme(scheme)
authorizationv1beta1.AddToScheme(scheme)
autoscalingv1.AddToScheme(scheme)
autoscalingv2alpha1.AddToScheme(scheme)
batchv1.AddToScheme(scheme)
batchv2alpha1.AddToScheme(scheme)
certificatesv1beta1.AddToScheme(scheme)
extensionsv1beta1.AddToScheme(scheme)
networkingv1.AddToScheme(scheme)
policyv1beta1.AddToScheme(scheme)
rbacv1beta1.AddToScheme(scheme)
rbacv1alpha1.AddToScheme(scheme)
settingsv1alpha1.AddToScheme(scheme)
storagev1beta1.AddToScheme(scheme)
storagev1.AddToScheme(scheme)
}

View File

@@ -1,42 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package kubernetes
// These imports are the API groups the client will support.
import (
"fmt"
"k8s.io/client-go/pkg/api"
_ "k8s.io/client-go/pkg/api/install"
_ "k8s.io/client-go/pkg/apis/apps/install"
_ "k8s.io/client-go/pkg/apis/authentication/install"
_ "k8s.io/client-go/pkg/apis/authorization/install"
_ "k8s.io/client-go/pkg/apis/autoscaling/install"
_ "k8s.io/client-go/pkg/apis/batch/install"
_ "k8s.io/client-go/pkg/apis/certificates/install"
_ "k8s.io/client-go/pkg/apis/extensions/install"
_ "k8s.io/client-go/pkg/apis/policy/install"
_ "k8s.io/client-go/pkg/apis/rbac/install"
_ "k8s.io/client-go/pkg/apis/settings/install"
_ "k8s.io/client-go/pkg/apis/storage/install"
)
func init() {
if missingVersions := api.Registry.ValidateEnvRequestedVersions(); len(missingVersions) != 0 {
panic(fmt.Sprintf("KUBE_API_VERSIONS contains versions that are not installed: %q.", missingVersions))
}
}

43
kubernetes/scheme/BUILD Normal file
View File

@@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"register.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/client-go/pkg/api/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/apps/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authentication/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authentication/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authorization/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/authorization/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/autoscaling/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/batch/v2alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/networking/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/policy/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/rbac/v1beta1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/settings/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/storage/v1beta1:go_default_library",
],
)

View File

@@ -22,6 +22,7 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
corev1 "k8s.io/client-go/pkg/api/v1"
admissionregistrationv1alpha1 "k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1"
appsv1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
authenticationv1 "k8s.io/client-go/pkg/apis/authentication/v1"
authenticationv1beta1 "k8s.io/client-go/pkg/apis/authentication/v1beta1"
@@ -33,6 +34,7 @@ import (
batchv2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
certificatesv1beta1 "k8s.io/client-go/pkg/apis/certificates/v1beta1"
extensionsv1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
networkingv1 "k8s.io/client-go/pkg/apis/networking/v1"
policyv1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
rbacv1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
rbacv1beta1 "k8s.io/client-go/pkg/apis/rbac/v1beta1"
@@ -65,6 +67,7 @@ func init() {
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func AddToScheme(scheme *runtime.Scheme) {
admissionregistrationv1alpha1.AddToScheme(scheme)
corev1.AddToScheme(scheme)
appsv1beta1.AddToScheme(scheme)
authenticationv1.AddToScheme(scheme)
@@ -77,6 +80,7 @@ func AddToScheme(scheme *runtime.Scheme) {
batchv2alpha1.AddToScheme(scheme)
certificatesv1beta1.AddToScheme(scheme)
extensionsv1beta1.AddToScheme(scheme)
networkingv1.AddToScheme(scheme)
policyv1beta1.AddToScheme(scheme)
rbacv1beta1.AddToScheme(scheme)
rbacv1alpha1.AddToScheme(scheme)

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"admissionregistration_client.go",
"doc.go",
"externaladmissionhookconfiguration.go",
"generated_expansion.go",
"initializerconfiguration.go",
],
tags = ["automanaged"],
deps = [
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
"//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//vendor/k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)

View File

@@ -0,0 +1,93 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/client-go/kubernetes/scheme"
v1alpha1 "k8s.io/client-go/pkg/apis/admissionregistration/v1alpha1"
rest "k8s.io/client-go/rest"
)
type AdmissionregistrationV1alpha1Interface interface {
RESTClient() rest.Interface
ExternalAdmissionHookConfigurationsGetter
InitializerConfigurationsGetter
}
// AdmissionregistrationV1alpha1Client is used to interact with features provided by the admissionregistration.k8s.io group.
type AdmissionregistrationV1alpha1Client struct {
restClient rest.Interface
}
func (c *AdmissionregistrationV1alpha1Client) ExternalAdmissionHookConfigurations() ExternalAdmissionHookConfigurationInterface {
return newExternalAdmissionHookConfigurations(c)
}
func (c *AdmissionregistrationV1alpha1Client) InitializerConfigurations() InitializerConfigurationInterface {
return newInitializerConfigurations(c)
}
// NewForConfig creates a new AdmissionregistrationV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*AdmissionregistrationV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AdmissionregistrationV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new AdmissionregistrationV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *AdmissionregistrationV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new AdmissionregistrationV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *AdmissionregistrationV1alpha1Client {
return &AdmissionregistrationV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs}
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *AdmissionregistrationV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

Some files were not shown because too many files have changed in this diff Show More