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
This commit is contained in:
commit
4e83cb78b5
@ -1,3 +1,10 @@
|
||||
# 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
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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.
|
||||
@ -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.6.0a1
|
||||
- Package version: 22.6.0b1
|
||||
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
|
||||
|
||||
## Requirements.
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
__project__ = 'kubernetes'
|
||||
# The version is auto-updated. Please do not edit.
|
||||
__version__ = "22.6.0a1"
|
||||
__version__ = "22.6.0b1"
|
||||
|
||||
import kubernetes.client
|
||||
import kubernetes.config
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__version__ = "22.6.0a1"
|
||||
__version__ = "22.6.0b1"
|
||||
|
||||
# import apis into sdk package
|
||||
from kubernetes.client.api.well_known_api import WellKnownApi
|
||||
|
||||
@ -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.6.0a1/python'
|
||||
self.user_agent = 'OpenAPI-Generator/22.6.0b1/python'
|
||||
self.client_side_validation = configuration.client_side_validation
|
||||
|
||||
def __enter__(self):
|
||||
|
||||
@ -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.6.0a1".\
|
||||
"SDK Package Version: 22.6.0b1".\
|
||||
format(env=sys.platform, pyversion=sys.version)
|
||||
|
||||
def get_host_settings(self):
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -18,13 +18,13 @@ import sys
|
||||
KUBERNETES_BRANCH = "release-1.22"
|
||||
|
||||
# client version for packaging and releasing.
|
||||
CLIENT_VERSION = "22.6.0a1"
|
||||
CLIENT_VERSION = "22.6.0b1"
|
||||
|
||||
# Name of the release package
|
||||
PACKAGE_NAME = "kubernetes"
|
||||
|
||||
# Stage of development, mainly used in setup.py's classifiers.
|
||||
DEVELOPMENT_STATUS = "3 - Alpha"
|
||||
DEVELOPMENT_STATUS = "4 - Beta"
|
||||
|
||||
|
||||
# If called directly, return the constant value given
|
||||
|
||||
@ -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
|
||||
4
setup.py
4
setup.py
@ -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.6.0a1"
|
||||
CLIENT_VERSION = "22.6.0b1"
|
||||
PACKAGE_NAME = "kubernetes"
|
||||
DEVELOPMENT_STATUS = "3 - Alpha"
|
||||
DEVELOPMENT_STATUS = "4 - Beta"
|
||||
|
||||
# To install the library, run the following
|
||||
#
|
||||
|
||||
Loading…
Reference in New Issue
Block a user