Metadata-Version: 2.3
Name: kube-ops
Version: 1.1.1
Summary: Kubernetes OOP
Project-URL: Homepage, https://github.com/myback/kube-ops
Project-URL: Bug Tracker, https://github.com/myback/kube-ops/issues
Author-email: myback <54638513+myback@users.noreply.github.com>
License: MIT License
        
        Copyright (c) 2023 myback.space
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.11
Requires-Dist: kubernetes~=30.1.0
Requires-Dist: pyyaml~=6.0.1
Description-Content-Type: text/markdown

# kube-py
Use OOP to manage Kubernetes objects 

### Usages
```python
import kube_ops

# Create configmap
cm = kube_ops.ConfigMap("nginx")
cm.set(NGINX_ENTRYPOINT_QUIET_LOGS=True)
cm.create()

# Create secret with type kubernetes.io/tls
sec = kube_ops.SecretTLS("nginx")
with open("server.crt") as f:
    crt = f.read()
with open("server.key") as f:
    key = f.read()
sec.set(crt, key)
sec.create()

# Make container
container = kube_ops.Container("nginx")
container.set_image("nginx:alpine")
## Add port to container
container.add_port("http", 80)
## Make envFrom link to configmap and add to the container
env = kube_ops.env_from_configmap(cm.name)
container.add_env_from(env)

# Make deployment
deploy = kube_ops.Deployment("nginx-test", container)
deploy.add_volume_to_container(container.name, kube_ops.empty_dir(), "/mnt")

## Set labels
lbl = dict(key="value", app="nginx", name="nginx-test")
deploy.set_labels(**lbl)
deploy.set_pod_labels(**lbl)
deploy.set_selector_match_labels(**lbl)

## Add secret as volume to deployment
sec_vol = kube_ops.volume_from_secret(sec.name)
deploy.add_volume_to_container(sec.name, sec_vol, "/etc/nginx/certs")

## Create deployment
deploy.create()

## Create service from deployment definition
deploy.service().create()
```
