Skip to content

Commit 5fdd7f2

Browse files
committed
fixed pipeline issue
1 parent c86ec95 commit 5fdd7f2

File tree

3 files changed

+126
-2
lines changed

3 files changed

+126
-2
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ RUN pip3 install --upgrade --no-cache-dir setuptools pip
4141

4242
# Specific Python dependencies installation
4343
RUN PYCURL_SSL_LIBRARY=openssl \
44-
pip install --no-cache-dir -r /tmp/requirements.txt
44+
pip install --no-cache-dir -r /tmp/requirements.txt &&\
45+
pip install --no-cache-dir "tornado==6.5.0"
46+
4547

4648
# Check and correct requirejs version
4749
RUN sed -i 's/"version": "[^"]*"/"version": "2.3.7"/' /usr/local/share/jupyterhub/static/components/requirejs/package.json

apphub-configurator/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66
name = "apphub-configurator"
77
dynamic = ["version"]
88
description = "apphub-configurator"
9-
readme = "../docs/configuration.md"
9+
readme = "../docs/README.md"
1010
requires-python = ">=3.10"
1111
license = "Apache-2.0"
1212
keywords = ["kubernetes", "configuration", "EOEPCA"]

docs/README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# apphub-configurator
2+
3+
[![PyPI - Version](https://img.shields.io/pypi/v/apphub-configurator.svg)](https://pypi.org/project/apphub-configurator)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/apphub-configurator.svg)](https://pypi.org/project/apphub-configurator)
5+
6+
-----
7+
8+
## Table of Contents
9+
10+
- [Installation](#installation)
11+
- [Overview](#overview)
12+
- [Examples](#Examples)
13+
- [License](#license)
14+
15+
## Installation
16+
17+
```console
18+
pip install apphub-configurator
19+
```
20+
## Overview
21+
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)
22+
23+
## Examples:
24+
25+
Find more examples if you need from this [link](https://github.com/EOEPCA/application-hub-context/tree/ESAEOEPCA-236/config-generator/apphub-configurator/examples)
26+
27+
### Step 1: Setup the environment
28+
29+
To begin using the `apphub-configurator` package, import the required functions from the package:
30+
31+
```python
32+
from apphub_configurator.helpers import load_config_map, load_manifests, create_init_container, load_init_script
33+
```
34+
35+
### Step 2: Example of configuration generation
36+
37+
Here is an overview of the functions and how to use them to generate configurations:
38+
39+
1. **Loading Kubernetes Manifests:**
40+
Use `load_manifests()` to load the required Kubernetes manifests. This function takes the following parameters:
41+
- `name`: The name of the manifest.
42+
- `key`: The key used to reference the manifest.
43+
- `file_path`: The file path to the manifest YAML file.
44+
45+
Example usage:
46+
```python
47+
load_manifests(name="example-name", key="example-key", file_path="path/to/manifest.yaml")
48+
```
49+
50+
2. **Creating Volumes:**
51+
You can create a Kubernetes `Volume` by specifying the following:
52+
- `name`: The name of the volume.
53+
- `size`: The size of the volume (e.g., `"50Gi"`).
54+
- `claim_name`: The claim name for the volume.
55+
- `mount_path`: The path where the volume should be mounted.
56+
57+
Example usage:
58+
```python
59+
Volume(
60+
name="workspace-volume",
61+
size="50Gi",
62+
claim_name="workspace-claim",
63+
mount_path="/workspace"
64+
)
65+
```
66+
67+
3. **Loading ConfigMaps:**
68+
Use `load_config_map()` to load configuration maps. It requires the following parameters:
69+
- `name`: The name of the config map.
70+
- `key`: The key for the configuration map.
71+
- `file_name`: The file path to the configuration file.
72+
- `mount_path`: The path where the config map should be mounted.
73+
74+
Example usage:
75+
```python
76+
load_config_map(name="bash-login", key="bash-login", file_name="path/to/bash-login", mount_path="/etc/profile.d/bash-login.sh")
77+
```
78+
79+
4. **Creating Init Containers:**
80+
The `create_init_container()` function allows you to define init containers with the following parameters:
81+
- `image`: The container image to use.
82+
- `volume`: The volume associated with the container.
83+
- `mount_path`: The path where the volume will be mounted inside the container.
84+
85+
Example usage:
86+
```python
87+
create_init_container(image="example-image", volume=your_volume, mount_path="/calrissian")
88+
```
89+
90+
5. **Creating Profiles:**
91+
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.
92+
93+
Example usage:
94+
```python
95+
Profile(
96+
id="profile_1",
97+
definition=ProfileDefinition(
98+
display_name="Example Profile",
99+
description="This profile configures an example service",
100+
default=True
101+
),
102+
volumes=[your_volume],
103+
config_maps=[your_config_map],
104+
init_containers=[your_init_container],
105+
manifests=[your_manifest]
106+
)
107+
```
108+
109+
6. **Generating the Configuration:**
110+
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.
111+
112+
Example usage:
113+
```python
114+
config = Config(profiles=[your_profile])
115+
with open("generated_config.yml", "w") as file:
116+
yaml.dump(config.dict(), file)
117+
```
118+
119+
120+
## License
121+
122+
`apphub-configurator` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

0 commit comments

Comments
 (0)