Compare commits

...

21 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
44453c3eab
Merge pull request #1704 from yliaog/automated-release-of-22.6.0-upstream-release-22.0-1644864656
Some checks failed
Kubernetes Python Client - Validation / build (3.10) (push) Has been cancelled
Kubernetes Python Client - Validation / build (3.6) (push) Has been cancelled
Kubernetes Python Client - Validation / build (3.7) (push) Has been cancelled
Kubernetes Python Client - Validation / build (3.8) (push) Has been cancelled
Kubernetes Python Client - Validation / build (3.9, coverage) (push) Has been cancelled
Automated release of 22.6.0 upstream release 22.0 1644864656
2022-02-14 11:01:45 -08:00
Yu Liao
770cbee8f6 Updated the compatibility matrix and maintenance status 2022-02-14 10:54:26 -08:00
Yu Liao
16ec19d5a8 generated client change 2022-02-14 10:52:15 -08:00
Yu Liao
382484f3e6 update version constants for 22.6.0 release 2022-02-14 10:52:15 -08:00
Yu Liao
c0b3d3ba8e update changelog with release notes from master branch 2022-02-14 10:52:15 -08:00
antonblr
115a9706d8 Generate and upload code coverage 2022-02-14 10:52:15 -08:00
Venu Karnati
649c5fe59a Async fix for Dynamic Client 2022-02-14 10:52:15 -08:00
dependabot[bot]
386ff934f4 Bump actions/setup-python from 2.3.1 to 2.3.2
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2.3.1...v2.3.2)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 10:52:15 -08:00
Kubernetes Prow Robot
4e83cb78b5
Merge pull request #1695 from yliaog/automated-release-of-22.6.0b1-upstream-release-22.0-1644255027
Automated release of 22.6.0b1 upstream release 22.0 1644255027
2022-02-08 13:34:35 -08:00
Yu Liao
9ec2a3f131 generated client change 2022-02-07 10:14:14 -08:00
Yu Liao
4cb1f87e91 update version constants for 22.6.0b1 release 2022-02-07 10:14:14 -08:00
Yu Liao
85a258a4c3 update changelog with release notes from master branch 2022-02-07 10:14:14 -08:00
Yu Liao
87614465d5 removed docs and scripts around submodules. submodules are no longer
used.
2022-02-07 10:14:14 -08:00
Huan-Ting,Chen
0cac1054cb add e2e_test for create_from_directory 2022-02-07 10:14:14 -08:00
Huan-Ting,Chen
5535f09c84 feat: add create from directory support 2022-02-07 10:14:14 -08:00
Kubernetes Prow Robot
f88c760f24
Merge pull request #1691 from yliaog/automated-release-of-22.6.0a1-upstream-release-22.0-1643658718
Automated release of 22.6.0a1 upstream release 22.0 1643658718
2022-01-31 13:07:54 -08:00
Yu Liao
a7b34246c3 Update the compatibility matrix and maintenance status 2022-01-31 12:43:35 -08:00
Yu Liao
f9dfc11e52 generated client change 2022-01-31 11:52:30 -08:00
Yu Liao
dc191c11fe update changelog 2022-01-31 11:52:01 -08:00
Yu Liao
56309b93a0 update version constants for 22.6.0a1 release 2022-01-31 11:52:00 -08:00
Haowei Cai (Roy)
873e8fd0d1
Merge pull request #1690 from yliaog/release-22.0
Release 22.0
2022-01-31 11:49:24 -08:00
28 changed files with 323 additions and 154 deletions

View File

@ -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@v2.3.1
uses: actions/setup-python@v2.3.2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

View File

@ -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@v2.3.1
uses: actions/setup-python@v2.3.2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

View File

@ -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@v2.3.1
uses: actions/setup-python@v2.3.2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

View File

@ -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@v2.3.1
uses: actions/setup-python@v2.3.2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

View File

@ -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@v2.3.1
uses: actions/setup-python@v2.3.2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

View File

@ -4,18 +4,20 @@ on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.6", "3.7", "3.8", "3.10"]
include:
- python-version: "3.9"
use_coverage: 'coverage'
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.3.1
uses: actions/setup-python@v2.3.2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
@ -31,5 +33,18 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install Tox and any other packages
run: pip install tox
- name: Run Tox
- name: Test without coverage
if: "! matrix.use_coverage"
run: tox -e py # Run tox using the version of Python in `PATH`
- name: Test with coverage
if: "matrix.use_coverage"
run: tox -e py-coverage
- name: Upload coverage to Codecov
if: "matrix.use_coverage"
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
verbose: true

View File

@ -1,6 +1,23 @@
# v22.0.0-snapshot
# v22.6.0
Kubernetes API Version: v1.22.5
Kubernetes API Version: v1.22.6
### Bug or Regression
- Notable feature additions for async creation of Custom resources using dynamic Client (#1697, @venukarnati92)
### Feature
- Add `utils.create_from_directory` for creating all yaml files in a directory (#1683, @dingyiyi0226)
# v22.6.0b1
Kubernetes API Version: v1.22.6
### Feature
- Add `utils.create_from_directory` for creating all yaml files in a directory (#1683, @dingyiyi0226)
# v22.6.0a1
Kubernetes API Version: v1.22.6
### API Change
- Kube-apiserver: Fixes handling of CRD schemas containing literal null values in enums (#104988, @liggitt) [SIG API Machinery, Apps and Network]

View File

@ -91,6 +91,7 @@ supported versions of Kubernetes clusters.
- [client 19.y.z](https://pypi.org/project/kubernetes/19.15.0/): Kubernetes 1.18 or below (+-), Kubernetes 1.19 (✓), Kubernetes 1.20 or above (+-)
- [client 20.y.z](https://pypi.org/project/kubernetes/20.13.0/): Kubernetes 1.19 or below (+-), Kubernetes 1.20 (✓), Kubernetes 1.21 or above (+-)
- [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 (+-)
> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explanation of why there is no v13-v16 release.
@ -137,6 +138,8 @@ between client-python versions.
| 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 | ✓ |
| 22.0 Alpha/Beta | Kubernetes main repo, 1.22 branch | ✗ |
| 22.0 | Kubernetes main repo, 1.22 branch | ✓ |
> See [here](#homogenizing-the-kubernetes-python-client-versions) for an explanation of why there is no v13-v16 release.

6
codecov.yml Normal file
View File

@ -0,0 +1,6 @@
# reference: https://docs.codecov.io/docs/codecovyml-reference
coverage:
status:
patch: true
project: false
comment: false

View File

@ -17,11 +17,7 @@ are a higher than expected number of issues there can be multiple releases
## Automated release
### 1. (Optional) Update submodules
Update submodules by referring to this [link](https://github.com/kubernetes-client/python/blob/master/devel/submodules.md#update-submodule). Commit the changes and open a pull request.
### 2. Run the release script and send a PR
### 1. Run the release script and send a PR
Generate a Github personal access token following instruction
[link](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
@ -49,11 +45,11 @@ $ KUBERNETES_BRANCH=release-1.${MINOR_VERSION} CLIENT_VERSION=${MINOR_VERSION}.$
Checkout the generated local branch (named "automated-release-of-xxx") to
continue with the remaining steps.
### 3. README (not required for snapshots)
### 2. README (not required for snapshots)
Update the compatibility matrix and maintenance status in the README file.
### 4. Submit pull request
### 3. Submit pull request
For snapshots, create a PR against the master repo.
@ -62,17 +58,13 @@ For actual releases, create:
- a second PR against the master branch to cherrypick the CHANGELOG and README
changes.
### 5. (Repo admin) Create release branch
### 4. (Repo admin) Create release branch
After merging a new snapshot, create a release branch from the master branch.
## (Deprecated) Manual release
### 1. Update submodules
Update submodules by referring to this [link](https://github.com/kubernetes-client/python/blob/master/devel/submodules.md#update-submodule). Commit the changes and open a pull request.
### 2. Create or update release branch
### 1. Create or update release branch
The release branch name should have release-x.x format. All minor and pre-releases
should be on the same branch. To update an existing branch with master (only for
@ -89,7 +81,7 @@ git pull -X theirs upstream master
You may need to fix some conflicts. For auto-generated files, you can commit
either version. They will be updated to the current version in the next step.
### 3. Update release tags
### 2. Update release tags
Release tags are in the "scripts/constants.py" file. These are the constants you
may need to update:
@ -126,7 +118,7 @@ apply the manual fixes.***
git push upstream $RELEASE_BRANCH
```
### 4. Hot issues
### 3. Hot issues
Use the `scripts/apply-hotfixes.sh` script to apply the fixes below in one step.
**As mentioned above, the script should be run after finishing the section "Update release tags". Also, ensure a clean working directory before applying the script.**
@ -152,7 +144,7 @@ For more details, see [#974](https://github.com/kubernetes-client/python/issues/
5. Add tests for the default `Configuration` behavior (ref: https://github.com/kubernetes-client/python/pull/1303 and https://github.com/kubernetes-client/python/pull/1285). The commit [1ffa61d0650e4c93e0d7f0becd2c54797eafd407](https://github.com/kubernetes-client/python/pull/1285/commits/1ffa61d0650e4c93e0d7f0becd2c54797eafd407) should be cherry-picked.
### 5. CHANGELOG
### 4. CHANGELOG
Make sure the change logs are up to date [here](https://github.com/kubernetes-client/python/blob/master/CHANGELOG.md).
If they are not, follow commits added after the last release and update/commit
@ -160,7 +152,7 @@ the change logs to master.
Then based on the release, follow one of next two steps.
### 6. README
### 5. README
Update the compatibility matrix and maintenance status in the README file.

View File

@ -1,29 +0,0 @@
# Submodules
To comply with [client library structure requirement](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/csi-client-structure-proposal.md),
python client base utilities is moved into the [kubernetes-client/python-base](https://github.com/kubernetes-client/python-base) repo. `git submodules` is being used to handle dependency to that repo.
This document will provide basic steps to get submodules working.
# Clone repo
To clone the repo, you need to pass the `recursive` parameter to make the clone also get submodules:
```bash
git clone --recursive https://github.com/kubernetes-client/python.git
```
if you have already cloned the repo with no `--recursive` option, you can run this command to get submodules:
```bash
git submodule update --init
```
# Update submodule
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:
```bash
scripts/update-submodule.sh
```
After the script finishes, please create a commit "generated python-base update" and send a PR to this repository.

View File

@ -4,7 +4,7 @@ No description provided (generated by Openapi Generator https://github.com/opena
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: release-1.22
- Package version: 22.0.0-snapshot
- Package version: 22.6.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
## Requirements.
@ -60,6 +60,8 @@ configuration.api_key['authorization'] = 'YOUR_API_KEY'
# Defining host is optional and default to http://localhost
configuration.host = "http://localhost"
# Defining host is optional and default to http://localhost
configuration.host = "http://localhost"
# Enter a context with an instance of the API kubernetes.client
with kubernetes.client.ApiClient(configuration) as api_client:
# Create an instance of the API class

View File

@ -14,7 +14,7 @@
__project__ = 'kubernetes'
# The version is auto-updated. Please do not edit.
__version__ = "22.0.0-snapshot"
__version__ = "22.6.0"
import kubernetes.client
import kubernetes.config

View File

@ -267,7 +267,7 @@ class DynamicClient(object):
# Authentication setting
auth_settings = ['BearerToken']
return self.client.call_api(
api_response = self.client.call_api(
path,
method.upper(),
path_params,
@ -281,6 +281,10 @@ class DynamicClient(object):
_preload_content=False,
_return_http_data_only=params.get('_return_http_data_only', True)
)
if params.get('async_req'):
return api_response.get()
else:
return api_response
def validate(self, definition, version=None, strict=False):
"""validate checks a kubernetes resource definition

View File

@ -135,6 +135,121 @@ class TestDynamicClient(unittest.TestCase):
changeme_api = client.resources.get(
api_version='apps.example.com/v1', kind='ClusterChangeMe')
def test_async_namespaced_custom_resources(self):
client = DynamicClient(api_client.ApiClient(configuration=self.config))
with self.assertRaises(ResourceNotFoundError):
changeme_api = client.resources.get(
api_version='apps.example.com/v1', kind='ChangeMe')
crd_api = client.resources.get(
api_version='apiextensions.k8s.io/v1beta1',
kind='CustomResourceDefinition')
name = 'changemes.apps.example.com'
crd_manifest = {
'apiVersion': 'apiextensions.k8s.io/v1beta1',
'kind': 'CustomResourceDefinition',
'metadata': {
'name': name,
},
'spec': {
'group': 'apps.example.com',
'names': {
'kind': 'ChangeMe',
'listKind': 'ChangeMeList',
'plural': 'changemes',
'singular': 'changeme',
},
'scope': 'Namespaced',
'version': 'v1',
'subresources': {
'status': {}
}
}
}
async_resp = crd_api.create(crd_manifest, async_req=True)
self.assertEqual(name, async_resp.metadata.name)
self.assertTrue(async_resp.status)
async_resp = crd_api.get(
name=name,
async_req=True
)
self.assertEqual(name, async_resp.metadata.name)
self.assertTrue(async_resp.status)
try:
changeme_api = client.resources.get(
api_version='apps.example.com/v1', kind='ChangeMe')
except ResourceNotFoundError:
# Need to wait a sec for the discovery layer to get updated
time.sleep(2)
changeme_api = client.resources.get(
api_version='apps.example.com/v1', kind='ChangeMe')
async_resp = changeme_api.get(async_req=True)
self.assertEqual(async_resp.items, [])
changeme_name = 'custom-resource' + short_uuid()
changeme_manifest = {
'apiVersion': 'apps.example.com/v1',
'kind': 'ChangeMe',
'metadata': {
'name': changeme_name,
},
'spec': {}
}
async_resp = changeme_api.create(body=changeme_manifest, namespace='default', async_req=True)
self.assertEqual(async_resp.metadata.name, changeme_name)
async_resp = changeme_api.get(name=changeme_name, namespace='default', async_req=True)
self.assertEqual(async_resp.metadata.name, changeme_name)
changeme_manifest['spec']['size'] = 3
async_resp = changeme_api.patch(
body=changeme_manifest,
namespace='default',
content_type='application/merge-patch+json',
async_req=True
)
self.assertEqual(async_resp.spec.size, 3)
async_resp = changeme_api.get(name=changeme_name, namespace='default', async_req=True)
self.assertEqual(async_resp.spec.size, 3)
async_resp = changeme_api.get(namespace='default', async_req=True)
self.assertEqual(len(async_resp.items), 1)
async_resp = changeme_api.get(async_req=True)
self.assertEqual(len(async_resp.items), 1)
async_resp = changeme_api.delete(
name=changeme_name,
namespace='default',
async_req=True
)
async_resp = changeme_api.get(namespace='default', async_req=True)
self.assertEqual(len(async_resp.items), 0)
async_resp = changeme_api.get(async_req=True)
self.assertEqual(len(async_resp.items), 0)
async_resp = crd_api.delete(
name=name,
async_req=True
)
time.sleep(2)
client.resources.invalidate_cache()
with self.assertRaises(ResourceNotFoundError):
changeme_api = client.resources.get(
api_version='apps.example.com/v1', kind='ChangeMe')
def test_namespaced_custom_resources(self):
client = DynamicClient(api_client.ApiClient(configuration=self.config))

View File

@ -14,7 +14,7 @@
from __future__ import absolute_import
__version__ = "22.0.0-snapshot"
__version__ = "22.6.0"
# import apis into sdk package
from kubernetes.client.api.well_known_api import WellKnownApi

View File

@ -78,7 +78,7 @@ class ApiClient(object):
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/22.0.0-snapshot/python'
self.user_agent = 'OpenAPI-Generator/22.6.0/python'
self.client_side_validation = configuration.client_side_validation
def __enter__(self):

View File

@ -350,7 +350,7 @@ class Configuration(object):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: release-1.22\n"\
"SDK Package Version: 22.0.0-snapshot".\
"SDK Package Version: 22.6.0".\
format(env=sys.platform, pyversion=sys.version)
def get_host_settings(self):

View File

@ -288,6 +288,28 @@ class TestUtils(unittest.TestCase):
core_api.delete_namespaced_service(name="mock-4",
namespace="default", body={})
# Tests for creating multi-resource from directory
def test_create_multi_resource_from_directory(self):
"""
Should be able to create a service and a replication controller
from a directory
"""
k8s_client = client.api_client.ApiClient(configuration=self.config)
utils.create_from_directory(
k8s_client, self.path_prefix + "multi-resource/")
core_api = client.CoreV1Api(k8s_client)
svc = core_api.read_namespaced_service(name="mock",
namespace="default")
self.assertIsNotNone(svc)
ctr = core_api.read_namespaced_replication_controller(
name="mock", namespace="default")
self.assertIsNotNone(ctr)
core_api.delete_namespaced_replication_controller(
name="mock", namespace="default", propagation_policy="Background")
core_api.delete_namespaced_service(name="mock",
namespace="default", body={})
# Tests for multi-resource yaml objects
def test_create_from_multi_resource_yaml(self):

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: mock
spec:
replicas: 1
selector:
app: mock
template:
metadata:
labels:
app: mock
spec:
containers:
- name: mock-container
image: k8s.gcr.io/pause:2.0
ports:
- containerPort: 9949
protocol: TCP

View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: mock
labels:
app: mock
spec:
ports:
- port: 99
protocol: TCP
targetPort: 9949
selector:
app: mock

View File

@ -15,5 +15,5 @@
from __future__ import absolute_import
from .create_from_yaml import (FailToCreateError, create_from_dict,
create_from_yaml)
create_from_yaml, create_from_directory)
from .quantity import parse_quantity

View File

@ -14,7 +14,7 @@
import re
from os import path
import os
import yaml
@ -24,6 +24,76 @@ UPPER_FOLLOWED_BY_LOWER_RE = re.compile('(.)([A-Z][a-z]+)')
LOWER_OR_NUM_FOLLOWED_BY_UPPER_RE = re.compile('([a-z0-9])([A-Z])')
def create_from_directory(
k8s_client,
yaml_dir=None,
verbose=False,
namespace="default",
**kwargs):
"""
Perform an action from files from a directory. Pass True for verbose to
print confirmation information.
Input:
k8s_client: an ApiClient object, initialized with the client args.
yaml_dir: string. Contains the path to directory.
verbose: If True, print confirmation from the create action.
Default is False.
namespace: string. Contains the namespace to create all
resources inside. The namespace must preexist otherwise
the resource creation will fail. If the API object in
the yaml file already contains a namespace definition
this parameter has no effect.
Available parameters for creating <kind>:
:param async_req bool
:param bool include_uninitialized: If true, partially initialized
resources are included in the response.
:param str pretty: If 'true', then the output is pretty printed.
:param str dry_run: When present, indicates that modifications
should not be persisted. An invalid or unrecognized dryRun
directive will result in an error response and no further
processing of the request.
Valid values are: - All: all dry run stages will be processed
Returns:
The list containing the created kubernetes API objects.
Raises:
FailToCreateError which holds list of `client.rest.ApiException`
instances for each object that failed to create.
"""
if not yaml_dir:
raise ValueError(
'`yaml_dir` argument must be provided')
elif not os.path.isdir(yaml_dir):
raise ValueError(
'`yaml_dir` argument must be a path to directory')
files = [os.path.join(yaml_dir, i) for i in os.listdir(yaml_dir)
if os.path.isfile(os.path.join(yaml_dir, i))]
if not files:
raise ValueError(
'`yaml_dir` contains no files')
failures = []
k8s_objects_all = []
for file in files:
try:
k8s_objects = create_from_yaml(k8s_client, file,
verbose=verbose,
namespace=namespace,
**kwargs)
k8s_objects_all.append(k8s_objects)
except FailToCreateError as failure:
failures.extend(failure.api_exceptions)
if failures:
raise FailToCreateError(failures)
return k8s_objects_all
def create_from_yaml(
k8s_client,
yaml_file=None,
@ -87,7 +157,7 @@ def create_from_yaml(
yml_document_all = yaml_objects
return create_with(yml_document_all)
elif yaml_file:
with open(path.abspath(yaml_file)) as f:
with open(os.path.abspath(yaml_file)) as f:
yml_document_all = yaml.safe_load_all(f)
return create_with(yml_document_all)
else:

View File

@ -18,13 +18,13 @@ import sys
KUBERNETES_BRANCH = "release-1.22"
# client version for packaging and releasing.
CLIENT_VERSION = "22.0.0-snapshot"
CLIENT_VERSION = "22.6.0"
# Name of the release package
PACKAGE_NAME = "kubernetes"
# Stage of development, mainly used in setup.py's classifiers.
DEVELOPMENT_STATUS = "3 - Alpha"
DEVELOPMENT_STATUS = "5 - Production/Stable"
# If called directly, return the constant value given

View File

@ -1,73 +0,0 @@
#!/bin/bash
# Copyright 2021 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.
# Update python-base submodule and collect release notes.
# Usage:
#
# $ scripts/update-submodule.sh
#
# # To update the release notes for a specific release (e.g. v18.17.0a1):
# $ TARGET_RELEASE="v18.17.0a1" scripts/update-submodule.sh
#
# After the script finishes, please create a commit "generated python-base update"
# and send a PR to this repository.
# TODO(roycaihw): make the script send a PR
set -o errexit
set -o nounset
set -o pipefail
repo_root="$(git rev-parse --show-toplevel)"
declare -r repo_root
cd "${repo_root}"
source scripts/util/changelog.sh
source scripts/util/common.sh
util::common::check_sed
go install k8s.io/release/cmd/release-notes@latest
TARGET_RELEASE=${TARGET_RELEASE:-"v$(grep "^CLIENT_VERSION = \"" scripts/constants.py | sed "s/CLIENT_VERSION = \"//g" | sed "s/\"//g")"}
# update submodule
git submodule update --remote
# download release notes
start_sha=$(git diff | grep "^-Subproject commit " | sed 's/-Subproject commit //g')
end_sha=$(git diff | grep "^+Subproject commit " | sed 's/+Subproject commit //g')
output="/tmp/python-base-relnote-$(date +%s).md"
release-notes --dependencies=false --org kubernetes-client --repo python-base --start-sha $start_sha --end-sha $end_sha --output $output
if [ -s $output ]; then
sed -i 's/(\[\#/(\[kubernetes-client\/python-base\#/g' $output
# update changelog
IFS_backup=$IFS
IFS=$'\n'
sections=($(grep "^### " $output))
IFS=$IFS_backup
for section in "${sections[@]}"; do
# ignore section titles and empty lines; replace newline with liternal "\n"
release_notes=$(sed -n "/$section/,/###/{/###/!p}" $output | sed -n "{/^$/!p}" | sed ':a;N;$!ba;s/\n/\\n/g')
util::changelog::write_changelog "$TARGET_RELEASE" "$section" "$release_notes"
done
rm -f $output
echo "Successfully updated CHANGELOG for submodule."
else
echo "No CHANGELOG for submodule."
fi

View File

@ -16,9 +16,9 @@ from setuptools import setup
# Do not edit these constants. They will be updated automatically
# by scripts/update-client.sh.
CLIENT_VERSION = "22.0.0-snapshot"
CLIENT_VERSION = "22.6.0"
PACKAGE_NAME = "kubernetes"
DEVELOPMENT_STATUS = "3 - Alpha"
DEVELOPMENT_STATUS = "5 - Production/Stable"
# To install the library, run the following
#

View File

@ -9,7 +9,6 @@ mock>=2.0.0
sphinx>=1.4 # BSD
recommonmark
sphinx_markdown_tables
codecov>=1.4.0
pycodestyle
autopep8
isort

14
tox.ini
View File

@ -11,8 +11,11 @@ deps = -r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
commands =
python -V
!functional: pytest -vvv -s --ignore=kubernetes/e2e_test
!functional: pytest -vvv -s {env:_TOX_COVERAGE_RUN:} --ignore=kubernetes/e2e_test
functional: {toxinidir}/scripts/kube-init.sh pytest -vvv -s []
coverage: python -m coverage xml
setenv =
coverage: _TOX_COVERAGE_RUN=--cov=kubernetes/watch --cov=kubernetes/config
[testenv:docs]
commands =
@ -21,12 +24,3 @@ commands =
[testenv:update-pycodestyle]
commands =
{toxinidir}/scripts/update-pycodestyle.sh
[testenv:coverage]
commands =
python -V
pytest --cov=kubernetes/watch --cov=kubernetes/config kubernetes/watch kubernetes/config
[testenv:codecov]
commands =
codecov