Skip to content

Commit be200e2

Browse files
authored
Merge pull request #1447 from roycaihw/pull-master-into-release-17.0
Pull master into release-17.0
2 parents 2a1d096 + b53d54f commit be200e2

24 files changed

+718
-42
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!-- Thanks for sending a pull request! Here are some tips for you:
2+
3+
1. If this is your first time, please read our contributor guidelines: https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
4+
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request. For reference on required PR/issue labels, read here:
5+
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
6+
3. Ensure you have added or ran the appropriate tests for your PR: https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
7+
4. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
8+
5. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
9+
-->
10+
11+
#### What type of PR is this?
12+
13+
<!--
14+
Add one of the following kinds:
15+
/kind bug
16+
/kind cleanup
17+
/kind documentation
18+
/kind feature
19+
/kind design
20+
21+
Optionally add one or more of the following kinds if applicable:
22+
/kind api-change
23+
/kind deprecation
24+
/kind failing-test
25+
/kind flake
26+
/kind regression
27+
-->
28+
29+
#### What this PR does / why we need it:
30+
31+
#### Which issue(s) this PR fixes:
32+
<!--
33+
*Automatically closes linked issue when PR is merged.
34+
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
35+
_If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
36+
-->
37+
Fixes #
38+
39+
#### Special notes for your reviewer:
40+
41+
#### Does this PR introduce a user-facing change?
42+
<!--
43+
If no, just write "NONE" in the release-note block below.
44+
If yes, a release note is required:
45+
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
46+
47+
For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
48+
-->
49+
```release-note
50+
51+
```
52+
53+
#### Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
54+
55+
<!--
56+
This section can be blank if this pull request does not require a release note.
57+
58+
When adding links which point to resources within git repositories, like
59+
KEPs or supporting documentation, please reference a specific commit and avoid
60+
linking directly to the master branch. This ensures that links reference a
61+
specific point in time, rather than a document that may change over time.
62+
63+
See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files
64+
65+
Please use the following format for linking documentation:
66+
- [KEP]: <link>
67+
- [Usage]: <link>
68+
- [Other doc]: <link>
69+
-->
70+
```docs
71+
72+
```

.github/workflows/test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
11+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
1212

1313
steps:
1414
- uses: actions/checkout@v2
1515
with:
1616
submodules: true
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2.1.4
18+
uses: actions/setup-python@v2.2.2
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies

.travis.yml

+53-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: python
2-
dist: xenial
2+
dist: bionic
33
services:
44
- docker
55

@@ -13,9 +13,16 @@ jobs:
1313
include:
1414
- stage: verify-tag
1515
python: 3.7
16+
arch: ppc64le
1617
script: >
1718
[ "v$(python -c 'from scripts.constants import CLIENT_VERSION; print(CLIENT_VERSION)')" == "${TRAVIS_TAG}" ] &&
1819
[[ "${TRAVIS_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(([ab]|dev|rc)[0-9]+)?$ ]]
20+
- stage: verify-tag
21+
python: 3.7
22+
script: >
23+
[ "v$(python -c 'from scripts.constants import CLIENT_VERSION; print(CLIENT_VERSION)')" == "${TRAVIS_TAG}" ] &&
24+
[[ "${TRAVIS_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(([ab]|dev|rc)[0-9]+)?$ ]]
25+
1926
- stage: test
2027
python: 2.7
2128
env: TOXENV=update-pycodestyle
@@ -43,8 +50,53 @@ jobs:
4350
env: TOXENV=py38
4451
- python: 3.8
4552
env: TOXENV=py38-functional
53+
- python: 3.9
54+
env: TOXENV=py39
55+
- python: 3.9
56+
env: TOXENV=py39-functional
57+
- stage: deploy
58+
script: skip
59+
deploy:
60+
provider: pypi
61+
user: __token__
62+
password:
63+
secure: gY5Rixj7mWHC9XP5qV5DfWGdX4ZVwCEUElnQA2OeIg235I3eMBqRFM4Q/SKwAG2DzgIWNKsXXVQsZHp7BAjWFMFVQloiU7zohuBRToJUim9U1RaqAjUIr4OU7JPtXenAl5zyyBdywvJiG8UZ4wmt1DBYtdpozQvOwDXvOxNTmElKh5mfDhiSsipmFr2198NtIhiRVC+CZliZsi6osUkt+G6yl9CW+SJU3otgzdaS+VBP26HO0kWHMJiDKvQoIl/Q50IqJUWieFhCLh7lSV71VNVEmM4bMcYK8cAv3zMZHo6REKHF7xrF5tzYMXqpmEGt6L798d2H4BISr6BIlYgiYCatjyE9hxih9iBzGs0XaGUUFD8u1iuzOQI76a5dapG/DixQrGD2o9Gn/Qw6Zp9USIuKZSWUn5hSobwxJUKVNy+afpaJNQUb2W9Hj+jMXAnBDodCzo3nu+QF8GN72cmk3uqVyKUVABtI4kNe3qcEx3DyKfoh7aqJrgydeaRwESKuZ41l5CA+vqXSbbNW8z1MYDYgVdwEyRFsLg6aQk5pPsxuiILaaGy13TUndhuC+GuKcW6wCDf6WpUAwwGAF8+sz4hZ1pfSUdE3F8nfDBW3Bv+G9cB/cKkWJ2vOd9httRrvir8qUc/xPP5aW4pacnfNCQ04Iep/k4PCAdYJDtVGhCY=
64+
skip_existing: true
65+
on:
66+
tags: true
67+
repo: kubernetes-client/python
68+
distributions: sdist bdist_wheel
69+
70+
- stage: test
71+
python: 2.7
72+
env: TOXENV=update-pycodestyle
73+
arch: ppc64le
74+
- python: 3.7
75+
env: TOXENV=docs
76+
arch: ppc64le
77+
- python: 2.7
78+
env: TOXENV=coverage,codecov
79+
arch: ppc64le
80+
- python: 2.7
81+
env: TOXENV=py27
82+
arch: ppc64le
83+
- python: 3.5
84+
env: TOXENV=py35
85+
arch: ppc64le
86+
- python: 3.6
87+
env: TOXENV=py36
88+
arch: ppc64le
89+
- python: 3.7
90+
env: TOXENV=py37
91+
arch: ppc64le
92+
- python: 3.8
93+
env: TOXENV=py38
94+
- python: 3.9
95+
env: TOXENV=py39
96+
arch: ppc64le
4697
- stage: deploy
4798
script: skip
99+
arch: ppc64le
48100
deploy:
49101
provider: pypi
50102
user: __token__

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# v17.17.0b1
2+
3+
Kubernetes API Version: 1.17.17
4+
5+
Changelog since v17.14.0a1:
6+
7+
**New Feature:**
8+
- Add Python 3.9 to build [kubernetes-client/python#1311](https://github.com/kubernetes-client/python/pull/1311)
9+
- Enable leaderelection [kubernetes-client/python#1363](https://github.com/kubernetes-client/python/pull/1363)
10+
11+
**Bug Fix:**
12+
- fix: load cache error when CacheDecoder object is not callable [kubernetes-client/python-base#226](https://github.com/kubernetes-client/python-base/pull/226)
13+
- raise exception when an empty config file is passed to load_kube_config [kubernetes-client/python-base#223](https://github.com/kubernetes-client/python-base/pull/223)
14+
- Fix bug with Watch and 410 retries [kubernetes-client/python-base#227](https://github.com/kubernetes-client/python-base/pull/227)
15+
116
# v17.14.0a1
217

318
Kubernetes API Version: 1.17.14

devel/submodules.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ git submodule update --init
2323
If you changed [kubernetes-client/python-base](https://github.com/kubernetes-client/python-base) and want to pull your changes into this repo run this command:
2424

2525
```bash
26-
git submodule update --remote
26+
scripts/update-submodule.sh
2727
```
2828

29-
Once updated, you should create a new PR to commit changes to the repository.
29+
After the script finishes, please create a commit "generated python-base update" and send a PR to this repository.
+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Copyright 2021 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
Uses a Custom Resource Definition (CRD) to create a Custom Resource (CR), in this case
17+
a CronTab. This example use an example CRD from this tutorial:
18+
https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
19+
20+
Apply the following yaml manifest to create a cluster-scoped CustomResourceDefinition (CRD)
21+
22+
apiVersion: apiextensions.k8s.io/v1
23+
kind: CustomResourceDefinition
24+
metadata:
25+
name: crontabs.stable.example.com
26+
spec:
27+
group: stable.example.com
28+
versions:
29+
- name: v1
30+
served: true
31+
storage: true
32+
schema:
33+
openAPIV3Schema:
34+
type: object
35+
properties:
36+
spec:
37+
type: object
38+
properties:
39+
cronSpec:
40+
type: string
41+
image:
42+
type: string
43+
replicas:
44+
type: integer
45+
scope: Cluster
46+
names:
47+
plural: crontabs
48+
singular: crontab
49+
kind: CronTab
50+
shortNames:
51+
- ct
52+
"""
53+
54+
from pprint import pprint
55+
56+
from kubernetes import client, config
57+
58+
59+
def main():
60+
config.load_kube_config()
61+
62+
api = client.CustomObjectsApi()
63+
64+
# definition of custom resource
65+
test_resource = {
66+
"apiVersion": "stable.example.com/v1",
67+
"kind": "CronTab",
68+
"metadata": {"name": "test-crontab"},
69+
"spec": {"cronSpec": "* * * * */5", "image": "my-awesome-cron-image"},
70+
}
71+
72+
# patch to update the `spec.cronSpec` field
73+
cronspec_patch = {
74+
"spec": {"cronSpec": "* * * * */15", "image": "my-awesome-cron-image"}
75+
}
76+
77+
# patch to add the `metadata.labels` field
78+
metadata_label_patch = {
79+
"metadata": {
80+
"labels": {
81+
"foo": "bar",
82+
}
83+
}
84+
}
85+
86+
# create a cluster scoped resource
87+
created_resource = api.create_cluster_custom_object(
88+
group="stable.example.com",
89+
version="v1",
90+
plural="crontabs",
91+
body=test_resource,
92+
)
93+
print("[INFO] Custom resource `test-crontab` created!\n")
94+
95+
# get the cluster scoped resource
96+
resource = api.get_cluster_custom_object(
97+
group="stable.example.com",
98+
version="v1",
99+
name="test-crontab",
100+
plural="crontabs",
101+
)
102+
print("%s\t\t%s" % ("NAME", "CRON-SPEC"))
103+
print(
104+
"%s\t%s\n" %
105+
(resource["metadata"]["name"],
106+
resource["spec"]["cronSpec"]))
107+
108+
# patch the `spec.cronSpec` field of the custom resource
109+
patched_resource = api.patch_cluster_custom_object(
110+
group="stable.example.com",
111+
version="v1",
112+
plural="crontabs",
113+
name="test-crontab",
114+
body=cronspec_patch,
115+
)
116+
print("[INFO] Custom resource `test-crontab` patched to update the cronSpec schedule!\n")
117+
print("%s\t\t%s" % ("NAME", "PATCHED-CRON-SPEC"))
118+
print(
119+
"%s\t%s\n" %
120+
(patched_resource["metadata"]["name"],
121+
patched_resource["spec"]["cronSpec"]))
122+
123+
# patch the `metadata.labels` field of the custom resource
124+
patched_resource = api.patch_cluster_custom_object(
125+
group="stable.example.com",
126+
version="v1",
127+
plural="crontabs",
128+
name="test-crontab",
129+
body=metadata_label_patch,
130+
)
131+
print("[INFO] Custom resource `test-crontab` patched to apply new metadata labels!\n")
132+
print("%s\t\t%s" % ("NAME", "PATCHED_LABELS"))
133+
print(
134+
"%s\t%s\n" %
135+
(patched_resource["metadata"]["name"],
136+
patched_resource["metadata"]["labels"]))
137+
138+
# delete the custom resource "test-crontab"
139+
api.delete_cluster_custom_object(
140+
group="stable.example.com",
141+
version="v1",
142+
name="test-crontab",
143+
plural="crontabs",
144+
body=client.V1DeleteOptions(),
145+
)
146+
print("[INFO] Custom resource `test-crontab` deleted!")
147+
148+
149+
if __name__ == "__main__":
150+
main()

examples/deployment_create.py

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
"""
16+
Creates a deployment using AppsV1Api from file nginx-deployment.yaml.
17+
"""
18+
1519
from os import path
1620

1721
import yaml

0 commit comments

Comments
 (0)