Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Automated release of 24.0.0 snapshot upstream master 1661179298 #1882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7d0cd17
It turns out SSL sockets can buffer data such that the select method …
iciclespider Apr 30, 2022
f1dfdbb
used unittest.mock instead of mock
harshitasao May 23, 2022
5645c57
add a cronjob crud example
xg0719 Jun 5, 2022
63b2250
update changelog
yliaog Jun 6, 2022
7dfd36b
added compatibility for 1.24.1
yliaog Jun 6, 2022
c76f0df
Merge pull request #1785 from iciclespider/fix-port-forward-hang
k8s-ci-robot Jun 7, 2022
768f520
Merge pull request #1820 from yliaog/master
k8s-ci-robot Jun 7, 2022
0724d16
Bump actions/setup-python from 3 to 4
dependabot[bot] Jun 9, 2022
1f59210
update changelog with release notes from master branch
yliaog Jun 13, 2022
0227abe
Merge pull request #1825 from kubernetes-client/dependabot/github_act…
k8s-ci-robot Jun 13, 2022
46c0768
Merge pull request #1828 from yliaog/master
k8s-ci-robot Jun 13, 2022
3a3e402
Bump helm/kind-action from 1.2.0 to 1.3.0
dependabot[bot] Jun 15, 2022
da50723
Merge pull request #1831 from kubernetes-client/dependabot/github_act…
k8s-ci-robot Jun 15, 2022
e0dfc6b
Add interactive configuration to exec provider.
brendandburns Jun 16, 2022
9c79d2b
Revert "Add interactive configuration to exec provider."
brendandburns Jun 16, 2022
c9ad883
Add interactive configuration to exec provider.
brendandburns Jun 16, 2022
f17a26a
update changelog with release notes from master branch
yliaog Jun 21, 2022
d963980
added compatibility matrix for 1.24.2 release.
yliaog Jun 21, 2022
0986337
Merge pull request #1839 from yliaog/master
k8s-ci-robot Jun 22, 2022
cc03f4e
example annotate deployment
showjason Jun 23, 2022
3165e80
Merge pull request #1843 from showjason/annotate-deployment
k8s-ci-robot Jun 23, 2022
13c4c76
Check availability of poll method before using
Akasurde Jun 30, 2022
2677e9c
Merge pull request #1848 from Akasurde/i1753
k8s-ci-robot Jul 4, 2022
5529ded
Fix DynamicClient.server_side_apply
kariya-mitsuru Jun 24, 2022
f412089
Merge branch 'kubernetes-client:master' into master
xg0719 Jul 6, 2022
7d40da7
add a cronjob crud example
xg0719 Jul 6, 2022
e8a10b1
Merge pull request #1850 from kariya-mitsuru/fix-server-side-apply
k8s-ci-robot Jul 6, 2022
ab58e5c
Merge branch 'kubernetes-client:master' into master
xg0719 Jul 7, 2022
51badbc
Add 'usedforsecurity=False' parameter to md5 call
efussi Jul 7, 2022
d593fc6
change BatchV1beta1Api to BatchV1Api
xg0719 Jul 9, 2022
64a1086
Merge pull request #1833 from brendandburns/master
k8s-ci-robot Jul 11, 2022
2c5f775
Merge pull request #1854 from efussi/master
k8s-ci-robot Jul 13, 2022
5195b65
Merge branch 'kubernetes-client:master' into master
xg0719 Jul 18, 2022
74e8516
Merge pull request #1852 from xg0719/master
k8s-ci-robot Jul 18, 2022
9742e7a
Deploy docs as wiki
Rishit-dagli Jul 19, 2022
0553bba
Merge pull request #1860 from Rishit-dagli/Rishit-dagli-wiki
k8s-ci-robot Jul 19, 2022
e5ca5ae
fix issue #1782 Resolve load_kube_config TMP file issue
tobewithyou1996 Aug 3, 2022
17372b7
Remove duplicate
akfmdl Aug 8, 2022
1ea41ec
Merge pull request #1874 from akfmdl/Feat/remove-duplicate-comments
k8s-ci-robot Aug 8, 2022
ada96fa
Merge pull request #1871 from tobewithyou1996/master
k8s-ci-robot Aug 15, 2022
e3c0042
Merge pull request #1804 from harshitasao/issue-1790
k8s-ci-robot Aug 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/deploy-wiki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy Wiki

on:
push:
paths:
- 'kubernetes/docs/**'
branches:
- master

jobs:
deploy-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install rsync
run: |
sudo apt install rsync grsync
- name: Clone Wiki
run: |
git config --global --add safe.directory "/github/workspace"
git config --global --add safe.directory "/github/workspace/wiki"
git clone https://github.com/kubernetes-client/python.wiki.git wiki
message=$(git log -1 --format=%B)
- name: Copy to wiki repository
run: |
rsync -av --delete kubernetes/docs/ wiki/ --exclude .git
- name: Push wiki
run: |
cd wiki
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "$message"
git push

4 changes: 2 additions & 2 deletions .github/workflows/e2e-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
submodules: true
- name: Create Kind Cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.3.0
with:
cluster_name: kubernetes-python-e2e-master-${{ matrix.python-version }}
# The kind version to be used to spin the cluster up
Expand All @@ -30,7 +30,7 @@ jobs:
# as we sync with Kubernetes upstream
config: .github/workflows/kind-configs/cluster-1.18.yaml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-release-11.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
submodules: true
- name: Create Kind Cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.3.0
with:
cluster_name: kubernetes-python-e2e-release-11.0-${{ matrix.python-version }}
# The kind version to be used to spin the cluster up
Expand All @@ -30,7 +30,7 @@ jobs:
# as we sync with Kubernetes upstream
config: .github/workflows/kind-configs/cluster-1.15.yaml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-release-12.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
submodules: true
- name: Create Kind Cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.3.0
with:
cluster_name: kubernetes-python-e2e-release-12.0-${{ matrix.python-version }}
# The kind version to be used to spin the cluster up
Expand All @@ -30,7 +30,7 @@ jobs:
# as we sync with Kubernetes upstream
config: .github/workflows/kind-configs/cluster-1.16.yaml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-release-17.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
submodules: true
- name: Create Kind Cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.3.0
with:
cluster_name: kubernetes-python-e2e-release-17.0-${{ matrix.python-version }}
# The kind version to be used to spin the cluster up
Expand All @@ -30,7 +30,7 @@ jobs:
# as we sync with Kubernetes upstream
config: .github/workflows/kind-configs/cluster-1.17.yaml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-release-18.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
submodules: true
- name: Create Kind Cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.3.0
with:
cluster_name: kubernetes-python-e2e-release-18.0-${{ matrix.python-version }}
# The kind version to be used to spin the cluster up
Expand All @@ -30,7 +30,7 @@ jobs:
# as we sync with Kubernetes upstream
config: .github/workflows/kind-configs/cluster-1.18.yaml
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# v24.0.0-snapshot
# v24.2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will have a v25 client soon as Kubernetes 1.25 gets released. Do you think you can wait for that instead of having a patch release to v24?

cc @yliaog


Kubernetes API Version: v1.24.2

### Uncategorized
- The dynamic client now support the `_request_timeout` parameter to configure connection and request timeouts. (#1732, @philipp-sontag-by)

# v24.1.0b1

Kubernetes API Version: v1.24.1

### Uncategorized
- The dynamic client now support the `_request_timeout` parameter to configure connection and request timeouts. (#1732, @philipp-sontag-by)

# v24.1.0a1

Kubernetes API Version: v1.24.1

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ supported versions of Kubernetes clusters.
- [client 21.y.z](https://pypi.org/project/kubernetes/21.7.0/): Kubernetes 1.20 or below (+-), Kubernetes 1.21 (✓), Kubernetes 1.22 or above (+-)
- [client 22.y.z](https://pypi.org/project/kubernetes/22.6.0/): Kubernetes 1.21 or below (+-), Kubernetes 1.22 (✓), Kubernetes 1.23 or above (+-)
- [client 23.y.z](https://pypi.org/project/kubernetes/23.6.0/): Kubernetes 1.22 or below (+-), Kubernetes 1.23 (✓), Kubernetes 1.24 or above (+-)
- [client 24.y.z](https://pypi.org/project/kubernetes/24.2.0/): Kubernetes 1.23 or below (+-), Kubernetes 1.24 (✓), Kubernetes 1.25 or above (+-)

> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explanation of why there is no v13-v16 release.

Expand Down Expand Up @@ -138,11 +139,13 @@ between client-python versions.
| 20.0 Alpha/Beta | Kubernetes main repo, 1.20 branch | ✗ |
| 20.0 | Kubernetes main repo, 1.20 branch | ✗ |
| 21.0 Alpha/Beta | Kubernetes main repo, 1.21 branch | ✗ |
| 21.0 | Kubernetes main repo, 1.21 branch | |
| 21.0 | Kubernetes main repo, 1.21 branch | |
| 22.0 Alpha/Beta | Kubernetes main repo, 1.22 branch | ✗ |
| 22.0 | Kubernetes main repo, 1.22 branch | ✓ |
| 23.0 Alpha/Beta | Kubernetes main repo, 1.23 branch | ✗ |
| 23.0 | Kubernetes main repo, 1.23 branch | ✓ |
| 24.0 Alpha/Beta | Kubernetes main repo, 1.24 branch | ✗ |
| 24.0 | Kubernetes main repo, 1.24 branch | ✓ |

> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explanation of why there is no v13-v16 release.

Expand Down
88 changes: 88 additions & 0 deletions examples/annotate_deployment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""
This example covers the following:
- Create deployment
- Annotate deployment
"""


from kubernetes import client, config
import time


def create_deployment_object():
container = client.V1Container(
name="nginx-sample",
image="nginx",
image_pull_policy="IfNotPresent",
ports=[client.V1ContainerPort(container_port=80)],
)
# Template
template = client.V1PodTemplateSpec(
metadata=client.V1ObjectMeta(labels={"app": "nginx"}),
spec=client.V1PodSpec(containers=[container]))
# Spec
spec = client.V1DeploymentSpec(
replicas=1,
selector=client.V1LabelSelector(
match_labels={"app": "nginx"}
),
template=template)
# Deployment
deployment = client.V1Deployment(
api_version="apps/v1",
kind="Deployment",
metadata=client.V1ObjectMeta(name="deploy-nginx"),
spec=spec)

return deployment


def create_deployment(apps_v1_api, deployment_object):
# Create the Deployment in default namespace
# You can replace the namespace with you have created
apps_v1_api.create_namespaced_deployment(
namespace="default", body=deployment_object
)


def annotate_deployment(apps_v1_api, deployment_name, annotations):
# Annotate the Deployment in default namespace
# You can replace the namespace with you have created
apps_v1_api.patch_namespaced_deployment(
name=deployment_name, namespace='default', body=annotations)


def main():
# Loading the local kubeconfig
config.load_kube_config()
apps_v1_api = client.AppsV1Api()
deployment_obj = create_deployment_object()

create_deployment(apps_v1_api, deployment_obj)
time.sleep(1)
before_annotating = apps_v1_api.read_namespaced_deployment(
'deploy-nginx', 'default')
print('Before annotating, annotations: %s' %
before_annotating.metadata.annotations)

annotations = [
{
'op': 'add', # You can try different operations like 'replace', 'add' and 'remove'
'path': '/metadata/annotations',
'value': {
'deployment.kubernetes.io/str': 'nginx',
'deployment.kubernetes.io/int': '5'
}
}
]

annotate_deployment(apps_v1_api, 'deploy-nginx', annotations)
time.sleep(1)
after_annotating = apps_v1_api.read_namespaced_deployment(
name='deploy-nginx', namespace='default')
print('After annotating, annotations: %s' %
after_annotating.metadata.annotations)


if __name__ == "__main__":
main()
128 changes: 128 additions & 0 deletions examples/cronjob_crud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import json
import time

from kubernetes import client, config

config.load_kube_config()


def create_namespaced_cron_job(namespace='default', body=None):
cronjob_json = body
if body is None:
print('body is required!')
exit(0)
name = body['metadata']['name']
if judge_crontab_exists(namespace, name):
print(f'{name} exists, please do not repeat!')
else:
v1 = client.BatchV1Api()
ret = v1.create_namespaced_cron_job(namespace=namespace, body=cronjob_json, pretty=True,
_preload_content=False, async_req=False)
ret_dict = json.loads(ret.data)
print(f'create succeed\n{json.dumps(ret_dict)}')


def delete_namespaced_cron_job(namespace='default', name=None):
if name is None:
print('name is required!')
exit(0)
if not judge_crontab_exists(namespace, name):
print(f"{name} doesn't exists, please enter a new one!")
else:
v1 = client.BatchV1Api()
ret = v1.delete_namespaced_cron_job(name=name, namespace=namespace, _preload_content=False, async_req=False)
ret_dict = json.loads(ret.data)
print(f'delete succeed\n{json.dumps(ret_dict)}')


def patch_namespaced_cron_job(namespace='default', body=None):
cronjob_json = body
if body is None:
print('body is required!')
exit(0)
name = body['metadata']['name']
if judge_crontab_exists(namespace, name):
v1 = client.BatchV1Api()
ret = v1.patch_namespaced_cron_job(name=name, namespace=namespace, body=cronjob_json,
_preload_content=False, async_req=False)
ret_dict = json.loads(ret.data)
print(f'patch succeed\n{json.dumps(ret_dict)}')
else:
print(f"{name} doesn't exists, please enter a new one!")


def get_cronjob_list(namespace='default'):
v1 = client.BatchV1Api()
ret = v1.list_namespaced_cron_job(namespace=namespace, pretty=True, _preload_content=False)
cron_job_list = json.loads(ret.data)
print(f'cronjob number={len(cron_job_list["items"])}')
return cron_job_list["items"]


def judge_crontab_exists(namespace, name):
cron_job_list = get_cronjob_list(namespace)
for cron_job in cron_job_list:
if name == cron_job['metadata']['name']:
return True
return False


def get_cronjob_body(namespace, name, command):
body = {
"apiVersion": "batch/v1",
"kind": "CronJob",
"metadata": {
"name": name,
"namespace": namespace
},
"spec": {
"schedule": "*/1 * * * *",
"concurrencyPolicy": "Allow",
"suspend": False,
"jobTemplate": {
"spec": {
"template": {
"spec": {
"containers": [
{
"name": name,
"image": "busybox:1.35",
"command": command
}
],
"restartPolicy": "Never"
}
}
}
},
"successfulJobsHistoryLimit": 3,
"failedJobsHistoryLimit": 1
}
}
return body


if __name__ == '__main__':
# get
cronjob_list = get_cronjob_list()

# delete
delete_namespaced_cron_job('default', 'hostname')
time.sleep(2)

# create
container_command = [
"/bin/sh",
"-c",
"date; echo Hello from the Kubernetes cluster; hostname"
]
hostname_json = get_cronjob_body('default', 'hostname', container_command)
create_namespaced_cron_job('default', hostname_json)

# update
container_command[2] = "date; echo this is patch; hostname"
hostname_json = get_cronjob_body('default', 'hostname', container_command)
patch_namespaced_cron_job('default', hostname_json)
Loading