# apphub-configurator
[](https://pypi.org/project/apphub-configurator)
[](https://pypi.org/project/apphub-configurator)
-----
## Table of Contents
- [Installation](#installation)
- [Overview](#overview)
- [Examples](#Examples)
- [License](#license)
## Installation
```console
pip install apphub-configurator
```
## Overview
This package contains a notebook and the python modules to support the generation of ApplicationHub configurations for a minikube cluster. For more information about ApplicationHub please check this [link](https://github.com/EOEPCA/application-hub-context)
## Examples:
Find more examples if you need from this [link](https://github.com/EOEPCA/application-hub-context/tree/ESAEOEPCA-236/config-generator/apphub-configurator/examples)
### Step 1: Setup the environment
To begin using the `apphub-configurator` package, import the required functions from the package:
```python
from apphub_configurator.helpers import load_config_map, load_manifests, create_init_container, load_init_script
```
### Step 2: Example of configuration generation
Here is an overview of the functions and how to use them to generate configurations:
1. **Loading Kubernetes Manifests:**
Use `load_manifests()` to load the required Kubernetes manifests. This function takes the following parameters:
- `name`: The name of the manifest.
- `key`: The key used to reference the manifest.
- `file_path`: The file path to the manifest YAML file.
Example usage:
```python
load_manifests(name="example-name", key="example-key", file_path="path/to/manifest.yaml")
```
2. **Creating Volumes:**
You can create a Kubernetes `Volume` by specifying the following:
- `name`: The name of the volume.
- `size`: The size of the volume (e.g., `"50Gi"`).
- `claim_name`: The claim name for the volume.
- `mount_path`: The path where the volume should be mounted.
Example usage:
```python
Volume(
name="workspace-volume",
size="50Gi",
claim_name="workspace-claim",
mount_path="/workspace"
)
```
3. **Loading ConfigMaps:**
Use `load_config_map()` to load configuration maps. It requires the following parameters:
- `name`: The name of the config map.
- `key`: The key for the configuration map.
- `file_name`: The file path to the configuration file.
- `mount_path`: The path where the config map should be mounted.
Example usage:
```python
load_config_map(name="bash-login", key="bash-login", file_name="path/to/bash-login", mount_path="/etc/profile.d/bash-login.sh")
```
4. **Creating Init Containers:**
The `create_init_container()` function allows you to define init containers with the following parameters:
- `image`: The container image to use.
- `volume`: The volume associated with the container.
- `mount_path`: The path where the volume will be mounted inside the container.
Example usage:
```python
create_init_container(image="example-image", volume=your_volume, mount_path="/calrissian")
```
5. **Creating Profiles:**
You can create a `Profile` by defining its parameters such as `id`, `groups`, `definition`, and others. The profile can include volumes, config maps, init containers, and manifests.
Example usage:
```python
Profile(
id="profile_1",
definition=ProfileDefinition(
display_name="Example Profile",
description="This profile configures an example service",
default=True
),
volumes=[your_volume],
config_maps=[your_config_map],
init_containers=[your_init_container],
manifests=[your_manifest]
)
```
6. **Generating the Configuration:**
After defining your profiles and configurations, you can use the `Config` class to generate the final configuration. This configuration can be saved to a YAML file.
Example usage:
```python
config = Config(profiles=[your_profile])
with open("generated_config.yml", "w") as file:
yaml.dump(config.dict(), file)
```
## License
`apphub-configurator` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "apphub-configurator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "EOEPCA, configuration, kubernetes",
"author": null,
"author_email": "Parham Membari <parham.membari@terradue.com>",
"download_url": "https://files.pythonhosted.org/packages/6d/ab/44a85be5b4d78e6f2b73889faa24ca4204200b119064525e048800589e17/apphub_configurator-0.0.6.tar.gz",
"platform": null,
"description": "# apphub-configurator\n\n[](https://pypi.org/project/apphub-configurator)\n[](https://pypi.org/project/apphub-configurator)\n\n-----\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Overview](#overview)\n- [Examples](#Examples)\n- [License](#license)\n\n## Installation\n\n```console\npip install apphub-configurator\n```\n## Overview\nThis package contains a notebook and the python modules to support the generation of ApplicationHub configurations for a minikube cluster. For more information about ApplicationHub please check this [link](https://github.com/EOEPCA/application-hub-context)\n\n## Examples:\n\nFind more examples if you need from this [link](https://github.com/EOEPCA/application-hub-context/tree/ESAEOEPCA-236/config-generator/apphub-configurator/examples)\n\n### Step 1: Setup the environment\n\nTo begin using the `apphub-configurator` package, import the required functions from the package:\n\n```python\nfrom apphub_configurator.helpers import load_config_map, load_manifests, create_init_container, load_init_script\n```\n\n### Step 2: Example of configuration generation\n\nHere is an overview of the functions and how to use them to generate configurations:\n\n1. **Loading Kubernetes Manifests:**\n Use `load_manifests()` to load the required Kubernetes manifests. This function takes the following parameters:\n - `name`: The name of the manifest.\n - `key`: The key used to reference the manifest.\n - `file_path`: The file path to the manifest YAML file.\n\n Example usage:\n ```python\n load_manifests(name=\"example-name\", key=\"example-key\", file_path=\"path/to/manifest.yaml\")\n ```\n\n2. **Creating Volumes:**\n You can create a Kubernetes `Volume` by specifying the following:\n - `name`: The name of the volume.\n - `size`: The size of the volume (e.g., `\"50Gi\"`).\n - `claim_name`: The claim name for the volume.\n - `mount_path`: The path where the volume should be mounted.\n\n Example usage:\n ```python\n Volume(\n name=\"workspace-volume\",\n size=\"50Gi\",\n claim_name=\"workspace-claim\",\n mount_path=\"/workspace\"\n )\n ```\n\n3. **Loading ConfigMaps:**\n Use `load_config_map()` to load configuration maps. It requires the following parameters:\n - `name`: The name of the config map.\n - `key`: The key for the configuration map.\n - `file_name`: The file path to the configuration file.\n - `mount_path`: The path where the config map should be mounted.\n\n Example usage:\n ```python\n load_config_map(name=\"bash-login\", key=\"bash-login\", file_name=\"path/to/bash-login\", mount_path=\"/etc/profile.d/bash-login.sh\")\n ```\n\n4. **Creating Init Containers:**\n The `create_init_container()` function allows you to define init containers with the following parameters:\n - `image`: The container image to use.\n - `volume`: The volume associated with the container.\n - `mount_path`: The path where the volume will be mounted inside the container.\n\n Example usage:\n ```python\n create_init_container(image=\"example-image\", volume=your_volume, mount_path=\"/calrissian\")\n ```\n\n5. **Creating Profiles:**\n You can create a `Profile` by defining its parameters such as `id`, `groups`, `definition`, and others. The profile can include volumes, config maps, init containers, and manifests.\n\n Example usage:\n ```python\n Profile(\n id=\"profile_1\",\n definition=ProfileDefinition(\n display_name=\"Example Profile\",\n description=\"This profile configures an example service\",\n default=True\n ),\n volumes=[your_volume],\n config_maps=[your_config_map],\n init_containers=[your_init_container],\n manifests=[your_manifest]\n )\n ```\n\n6. **Generating the Configuration:**\n After defining your profiles and configurations, you can use the `Config` class to generate the final configuration. This configuration can be saved to a YAML file.\n\n Example usage:\n ```python\n config = Config(profiles=[your_profile])\n with open(\"generated_config.yml\", \"w\") as file:\n yaml.dump(config.dict(), file)\n ```\n\n\n## License\n\n`apphub-configurator` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
"bugtrack_url": null,
"license": null,
"summary": "apphub-configurator",
"version": "0.0.6",
"project_urls": {
"Documentation": "https://github.com/EOEPCA/application-hub-context/tree/ESAEOEPCA-236/config-generator/apphub-configurator#readme",
"Examples": "https://github.com/EOEPCA/application-hub-context/tree/ESAEOEPCA-236/config-generator/apphub-configurator/examples",
"Issues": "https://github.com/EOEPCA/application-hub-context/issues",
"Source": "https://github.com/EOEPCA/application-hub-context/tree/ESAEOEPCA-236/config-generator/apphub-configurator"
},
"split_keywords": [
"eoepca",
" configuration",
" kubernetes"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6f79f5b5e9a60f59a20f1dd8afdbf3d4fd42efce4e53397c705c9c79650a1372",
"md5": "1d222752d0b130a9c3cf5d1bcd61b0b6",
"sha256": "e6ec6cbbd6e0a8759d8ff943ee40e0b67d99a2763d8da62edb0d80c87c072961"
},
"downloads": -1,
"filename": "apphub_configurator-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1d222752d0b130a9c3cf5d1bcd61b0b6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5859,
"upload_time": "2025-01-30T14:36:28",
"upload_time_iso_8601": "2025-01-30T14:36:28.666639Z",
"url": "https://files.pythonhosted.org/packages/6f/79/f5b5e9a60f59a20f1dd8afdbf3d4fd42efce4e53397c705c9c79650a1372/apphub_configurator-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6dab44a85be5b4d78e6f2b73889faa24ca4204200b119064525e048800589e17",
"md5": "619823081dca38a74ab13a6fa3ef990d",
"sha256": "ae487f0d93f21a189825cfe904110875d2f0ac0c914ce4c89bc60b2ab9a1c972"
},
"downloads": -1,
"filename": "apphub_configurator-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "619823081dca38a74ab13a6fa3ef990d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4658,
"upload_time": "2025-01-30T14:36:27",
"upload_time_iso_8601": "2025-01-30T14:36:27.589419Z",
"url": "https://files.pythonhosted.org/packages/6d/ab/44a85be5b4d78e6f2b73889faa24ca4204200b119064525e048800589e17/apphub_configurator-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-30 14:36:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EOEPCA",
"github_project": "application-hub-context",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "kubernetes",
"specs": [
[
"==",
"31.0.0"
]
]
},
{
"name": "loguru",
"specs": [
[
"==",
"0.7.2"
]
]
}
],
"lcname": "apphub-configurator"
}