diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-29 09:42:40 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-29 09:42:40 +0000 |
commit | fde68b39a412bea383c443be66e51bab4e798f2e (patch) | |
tree | 6251d21f829891f60a1beb624a0731b0173560a1 | |
parent | e14e8b0f94ded875f0fb0b2a347afe68a6c722d6 (diff) |
automatic import of python-kuber
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-kuber.spec | 454 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 456 insertions, 0 deletions
@@ -0,0 +1 @@ +/kuber-1.17.0.tar.gz diff --git a/python-kuber.spec b/python-kuber.spec new file mode 100644 index 0000000..3072801 --- /dev/null +++ b/python-kuber.spec @@ -0,0 +1,454 @@ +%global _empty_manifest_terminate_build 0 +Name: python-kuber +Version: 1.17.0 +Release: 1 +Summary: Accelerated Kubernetes configuration and package management with Python. +License: MIT +URL: https://github.com/sernst/kuber +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/dc/cd/42264ecff65d8eb1f7700e38fbf5e4cb8d5f6198be6b5a0efbcbafc23fcd/kuber-1.17.0.tar.gz +BuildArch: noarch + +Requires: python3-PyYAML +Requires: python3-kubernetes +Requires: python3-requests +Requires: python3-semver + +%description +[](https://pypi.python.org/pypi/kuber) +[](https://kuber.readthedocs.io/en/latest/?badge=latest) +[](https://gitlab.com/swernst/kuber/commits/master) +[](https://gitlab.com/swernst/kuber/commits/master) +[](https://github.com/psf/black) +[](https://gitlab.com/pycqa/flake8) +[](http://mypy-lang.org/) + +# Kuber + +kuber is Python library for the management of Kubernetes resources. It's +ideal for collectively managing groups of resources throughout their +lifecycle. Resource definitions can be created and managed entirely in Python +code (the pure-Python approach), but kuber is most effective when used in a +hybrid fashion that combines configuration files and Python code. +kuber also integrates and maintains compatibility with the lower-level official +[Kubernetes Python client](https://github.com/kubernetes-client/python), +while abstracting basic CRUD operations into higher level constructs +more inline with the behaviors of tools like *kubectl* and *helm*. + +## Key Functionality + +Here are some key things that kuber does well: + +- A flexible workflow for managing Kubernetes resource configuration in Python + code. +- The ability to load resources directly from YAML or JSON configuration files, + modify them in code and then use them or save them back to YAML/JSON files. +- Resource bundling for managing groups of resource configurations collectively. +- CRUD operations exposed directly on the resource objects to reduce the + overhead in managing low-level clients. +- Convenience functions that simplify common operations, e.g. managing + containers within pods from the root resource. +- Very thorough type-hinting and object structure to support creating accurate + resource configurations and catch errors before runtime. +- All resources and sub-resources support used in `with` blocks as context + managers to simplify making multiple changes to a sub-resource. +- Simultaneous support for multiple Kubernetes API versions. Manage multiple + Kubernetes API versions (e.g. while promoting new versions from development + to production) without having to pin and switch Python environments. + +## Installation + +kuber available for installation with [pip](https://pypi.org/project/pip/): + +```bash +$ pip install kuber +``` + +## Quickstart + +kuber can be used to manage individual resources or a group of resources +collectively. kuber is also very flexible about how resources are created - +either directly from Python or by loading and parsing YAML/JSON configuration +files. The first example shows the multi-resource management path: + +```python +import kuber +from kuber.latest import apps_v1 + +# Create a bundle and load all resource definitions from the +# `app_configs` directory as well as the `app-secret.yaml` +# configuration file from the local `secrets` directory. +resource_bundle = ( + kuber.create_bundle() + .add_directory("app_configs") + .add_file("secrets/app-secret.yaml") +) + +# Modify the metadata labels on all resources in the bundle. +for resource in resource_bundle.resources: + resource.metadata.labels.update(environment="production") + +# Update the replica count of the loaded deployment named +# "my-app" to the desired initial count. +d: apps_v1.Deployment = resource_bundle.get( + name="my-app", + kind="Deployment" +) +d.spec.replicas = 20 + +# Load the current `kubeconfig` cluster configuration into +# kuber for interaction with the cluster. +kuber.load_access_config() + +# Turn this bundle script into a file that can be called from +# the command line to carry out CRUD operations on all the +# resources contained within it collectively. For example, +# to create the resources in this bundle, call this script +# file with a create argument. +resource_bundle.cli() +``` + +Or managing resources individually: + +```python +from kuber.latest import batch_v1 + +job = batch_v1.Job() + +# Populate metadata using context manager syntax for brevity. +with job.metadata as md: + md.name = "my-job" + md.namespace = "jobs" + md.labels.update( + component="backend-tasks", + environment="production" + ) + +# Add a container to the job spec. +job.spec.append_container( + name="main", + image="my-registry.com/projects/my-job:1.0.1", + image_pull_policy="Always", + env=[batch_v1.EnvVar("ENVIRONMENT", "production")] +) + +# Print the resulting YAML configuration for display. This +# could also be saved somewhere to use later as the +# configuration file to deploy to the cluster in cases +# like a multi-stage CI pipeline. +print(job.to_yaml()) +``` + +Check out the [kuber documentation](https://kuber.readthedocs.io/en/latest/) +for more details and examples. + + +%package -n python3-kuber +Summary: Accelerated Kubernetes configuration and package management with Python. +Provides: python-kuber +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-kuber +[](https://pypi.python.org/pypi/kuber) +[](https://kuber.readthedocs.io/en/latest/?badge=latest) +[](https://gitlab.com/swernst/kuber/commits/master) +[](https://gitlab.com/swernst/kuber/commits/master) +[](https://github.com/psf/black) +[](https://gitlab.com/pycqa/flake8) +[](http://mypy-lang.org/) + +# Kuber + +kuber is Python library for the management of Kubernetes resources. It's +ideal for collectively managing groups of resources throughout their +lifecycle. Resource definitions can be created and managed entirely in Python +code (the pure-Python approach), but kuber is most effective when used in a +hybrid fashion that combines configuration files and Python code. +kuber also integrates and maintains compatibility with the lower-level official +[Kubernetes Python client](https://github.com/kubernetes-client/python), +while abstracting basic CRUD operations into higher level constructs +more inline with the behaviors of tools like *kubectl* and *helm*. + +## Key Functionality + +Here are some key things that kuber does well: + +- A flexible workflow for managing Kubernetes resource configuration in Python + code. +- The ability to load resources directly from YAML or JSON configuration files, + modify them in code and then use them or save them back to YAML/JSON files. +- Resource bundling for managing groups of resource configurations collectively. +- CRUD operations exposed directly on the resource objects to reduce the + overhead in managing low-level clients. +- Convenience functions that simplify common operations, e.g. managing + containers within pods from the root resource. +- Very thorough type-hinting and object structure to support creating accurate + resource configurations and catch errors before runtime. +- All resources and sub-resources support used in `with` blocks as context + managers to simplify making multiple changes to a sub-resource. +- Simultaneous support for multiple Kubernetes API versions. Manage multiple + Kubernetes API versions (e.g. while promoting new versions from development + to production) without having to pin and switch Python environments. + +## Installation + +kuber available for installation with [pip](https://pypi.org/project/pip/): + +```bash +$ pip install kuber +``` + +## Quickstart + +kuber can be used to manage individual resources or a group of resources +collectively. kuber is also very flexible about how resources are created - +either directly from Python or by loading and parsing YAML/JSON configuration +files. The first example shows the multi-resource management path: + +```python +import kuber +from kuber.latest import apps_v1 + +# Create a bundle and load all resource definitions from the +# `app_configs` directory as well as the `app-secret.yaml` +# configuration file from the local `secrets` directory. +resource_bundle = ( + kuber.create_bundle() + .add_directory("app_configs") + .add_file("secrets/app-secret.yaml") +) + +# Modify the metadata labels on all resources in the bundle. +for resource in resource_bundle.resources: + resource.metadata.labels.update(environment="production") + +# Update the replica count of the loaded deployment named +# "my-app" to the desired initial count. +d: apps_v1.Deployment = resource_bundle.get( + name="my-app", + kind="Deployment" +) +d.spec.replicas = 20 + +# Load the current `kubeconfig` cluster configuration into +# kuber for interaction with the cluster. +kuber.load_access_config() + +# Turn this bundle script into a file that can be called from +# the command line to carry out CRUD operations on all the +# resources contained within it collectively. For example, +# to create the resources in this bundle, call this script +# file with a create argument. +resource_bundle.cli() +``` + +Or managing resources individually: + +```python +from kuber.latest import batch_v1 + +job = batch_v1.Job() + +# Populate metadata using context manager syntax for brevity. +with job.metadata as md: + md.name = "my-job" + md.namespace = "jobs" + md.labels.update( + component="backend-tasks", + environment="production" + ) + +# Add a container to the job spec. +job.spec.append_container( + name="main", + image="my-registry.com/projects/my-job:1.0.1", + image_pull_policy="Always", + env=[batch_v1.EnvVar("ENVIRONMENT", "production")] +) + +# Print the resulting YAML configuration for display. This +# could also be saved somewhere to use later as the +# configuration file to deploy to the cluster in cases +# like a multi-stage CI pipeline. +print(job.to_yaml()) +``` + +Check out the [kuber documentation](https://kuber.readthedocs.io/en/latest/) +for more details and examples. + + +%package help +Summary: Development documents and examples for kuber +Provides: python3-kuber-doc +%description help +[](https://pypi.python.org/pypi/kuber) +[](https://kuber.readthedocs.io/en/latest/?badge=latest) +[](https://gitlab.com/swernst/kuber/commits/master) +[](https://gitlab.com/swernst/kuber/commits/master) +[](https://github.com/psf/black) +[](https://gitlab.com/pycqa/flake8) +[](http://mypy-lang.org/) + +# Kuber + +kuber is Python library for the management of Kubernetes resources. It's +ideal for collectively managing groups of resources throughout their +lifecycle. Resource definitions can be created and managed entirely in Python +code (the pure-Python approach), but kuber is most effective when used in a +hybrid fashion that combines configuration files and Python code. +kuber also integrates and maintains compatibility with the lower-level official +[Kubernetes Python client](https://github.com/kubernetes-client/python), +while abstracting basic CRUD operations into higher level constructs +more inline with the behaviors of tools like *kubectl* and *helm*. + +## Key Functionality + +Here are some key things that kuber does well: + +- A flexible workflow for managing Kubernetes resource configuration in Python + code. +- The ability to load resources directly from YAML or JSON configuration files, + modify them in code and then use them or save them back to YAML/JSON files. +- Resource bundling for managing groups of resource configurations collectively. +- CRUD operations exposed directly on the resource objects to reduce the + overhead in managing low-level clients. +- Convenience functions that simplify common operations, e.g. managing + containers within pods from the root resource. +- Very thorough type-hinting and object structure to support creating accurate + resource configurations and catch errors before runtime. +- All resources and sub-resources support used in `with` blocks as context + managers to simplify making multiple changes to a sub-resource. +- Simultaneous support for multiple Kubernetes API versions. Manage multiple + Kubernetes API versions (e.g. while promoting new versions from development + to production) without having to pin and switch Python environments. + +## Installation + +kuber available for installation with [pip](https://pypi.org/project/pip/): + +```bash +$ pip install kuber +``` + +## Quickstart + +kuber can be used to manage individual resources or a group of resources +collectively. kuber is also very flexible about how resources are created - +either directly from Python or by loading and parsing YAML/JSON configuration +files. The first example shows the multi-resource management path: + +```python +import kuber +from kuber.latest import apps_v1 + +# Create a bundle and load all resource definitions from the +# `app_configs` directory as well as the `app-secret.yaml` +# configuration file from the local `secrets` directory. +resource_bundle = ( + kuber.create_bundle() + .add_directory("app_configs") + .add_file("secrets/app-secret.yaml") +) + +# Modify the metadata labels on all resources in the bundle. +for resource in resource_bundle.resources: + resource.metadata.labels.update(environment="production") + +# Update the replica count of the loaded deployment named +# "my-app" to the desired initial count. +d: apps_v1.Deployment = resource_bundle.get( + name="my-app", + kind="Deployment" +) +d.spec.replicas = 20 + +# Load the current `kubeconfig` cluster configuration into +# kuber for interaction with the cluster. +kuber.load_access_config() + +# Turn this bundle script into a file that can be called from +# the command line to carry out CRUD operations on all the +# resources contained within it collectively. For example, +# to create the resources in this bundle, call this script +# file with a create argument. +resource_bundle.cli() +``` + +Or managing resources individually: + +```python +from kuber.latest import batch_v1 + +job = batch_v1.Job() + +# Populate metadata using context manager syntax for brevity. +with job.metadata as md: + md.name = "my-job" + md.namespace = "jobs" + md.labels.update( + component="backend-tasks", + environment="production" + ) + +# Add a container to the job spec. +job.spec.append_container( + name="main", + image="my-registry.com/projects/my-job:1.0.1", + image_pull_policy="Always", + env=[batch_v1.EnvVar("ENVIRONMENT", "production")] +) + +# Print the resulting YAML configuration for display. This +# could also be saved somewhere to use later as the +# configuration file to deploy to the cluster in cases +# like a multi-stage CI pipeline. +print(job.to_yaml()) +``` + +Check out the [kuber documentation](https://kuber.readthedocs.io/en/latest/) +for more details and examples. + + +%prep +%autosetup -n kuber-1.17.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-kuber -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 1.17.0-1 +- Package Spec generated @@ -0,0 +1 @@ +956b189a3f6866873eaa0fdf16281b5a kuber-1.17.0.tar.gz |