Skip to content

Commit 25098cc

Browse files
committed
Merge branch 'develop' of github.com:MetaCell/cloud-harness into develop
2 parents 7692d9b + f81447b commit 25098cc

94 files changed

Lines changed: 1800 additions & 1812 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ skaffold.yaml
1717
/deployment.yaml
1818
.hypothesis
1919
__pycache__
20-
.env
20+
.env
21+
/.venv
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "__APP_NAME__",
3+
"scripts": {
4+
"dev": "vite",
5+
"start": "DOMAIN=http://localhost:5000 vite",
6+
"start:dev": "DOMAIN=https://test.ch.metacell.us vite",
7+
"start:local": "DOMAIN=http://samples.ch vite",
8+
"prebuild": "eslint .",
9+
"build": "vite build"
10+
}
11+
}

applications/samples/backend/samples/controllers/test_controller.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ def ping(): # noqa: E501
2222
2323
:rtype: str
2424
"""
25+
26+
import os
27+
28+
expected_environment_variables = {
29+
'WORKERS': '3',
30+
'ENVIRONMENT_TEST_A': 'value',
31+
'ENVIRONMENT_TEST_B': '123',
32+
}
33+
34+
for key, expected_value in expected_environment_variables.items():
35+
try:
36+
environment_value = os.environ[key]
37+
if environment_value != expected_value:
38+
raise Exception(f'Expected environment variable {key} to be {expected_value}, but got {environment_value}')
39+
except KeyError:
40+
raise Exception(f'Expected to have an environment variable {key} defined')
41+
2542
import time
2643
return time.time()
2744

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
harness:
2-
secured: true
2+
secured: false
33
dependencies:
44
soft: []
55
hard: []
6+
use_services: []
67

applications/samples/deploy/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ harness:
3939
env:
4040
- name: WORKERS
4141
value: "3"
42+
envmap:
43+
ENVIRONMENT_TEST_A: "value"
44+
ENVIRONMENT_TEST_B: 123
4245
dependencies:
4346
soft:
4447
- workflows

deployment-configuration/helm/templates/auto-deployments.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ spec:
6666
{{- if .app.harness.env }}
6767
{{- .app.harness.env | toYaml | nindent 8 }}
6868
{{- end }}
69+
{{- range $name, $value := .app.harness.envmap }}
70+
- name: {{ $name | quote }}
71+
value: {{ $value | quote }}
72+
{{- end }}
6973
{{ if .app.harness.livenessProbe }}
7074
livenessProbe:
7175
httpGet:

docs/applications/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ The most important configuration entries are the following:
109109
- `postgres`: postgres specific configurations
110110
- `mongo`: mongo specific configurations
111111
- `neo4j`: neo4j specific configurations
112-
- `env` (`{name, value}[]`): add custom environment variables
112+
- `envmap`: add custom environment variables
113+
- `<environment_variable_name>`: `<environment_variable_value>`
114+
- ...
115+
- `env` (`{name, value}[]`): add custom environment variables (deprecated, please use `envmap`)
113116
- `resources`: mount files from
114117
- `use_services` (`{name, src, dst}[]`): create reverse proxy endpoints in the ingress for the listed applications on [subdomain].[Values.domain]/proxy/[name]. Useful to avoid CORS requests from frontend clients
115118
- `readinessProbe`: defines a a url to use as a readiness probe
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# CloudHarness Environment Variables
2+
3+
CloudHarness has support for adding environment variables for an application which will be available to all containers within the application pod.
4+
5+
## Automatically included environment variables
6+
7+
The following environment variables are included in each container by default:
8+
- `CH_CURRENT_APP_NAME`: the name of the application
9+
- Any environment variables defined in the root `.Values.env`
10+
- If `accounts` is an included application:
11+
- `CH_ACCOUNTS_CLIENT_SECRET`: the client secret for the accounts
12+
- `CH_ACCOUNTS_REALM`: the accounts realm
13+
- `CH_ACCOUNTS_AUTH_DOMAIN`: the auth domain for the accounts
14+
- `CH_ACCOUNTS_CLIENT_ID`: the client id for the accounts
15+
- `DOMAIN`: the domain for the accounts
16+
17+
## Environment variables definition in CloudHarness
18+
19+
Environment variables are defined in the application values.yaml file in the `envmap` section under the `harness` section.
20+
Example
21+
22+
```yaml
23+
harness:
24+
envmap:
25+
ENV_VARIABLE_A: <value>
26+
...
27+
```
28+
29+
Each key in the `envmap` will add an environment variable with a name matching the key and a value equal to the value provided. The value can be any primitive type, but will be quoted as a string within the deployment template.
30+
31+
### (Deprecated) Setting with `env`
32+
33+
Environment variables can be defined by using the `env` section under the `harness` section. This functionality is deprecated but not yet obsoleted, and use of `envmap` should be preferred over this approach.
34+
Example
35+
36+
```yaml
37+
harness:
38+
env:
39+
- name: ENV_VARIABLE_A
40+
value: <value>
41+
...
42+
```
43+
44+
Each element of the `env` sequence will add an environment variable named `name` with value set from `value`.
45+
46+
This functionality was deprecated as cloud harness cannot merge arrays, so if an environment variable needed changing in a specific environment the entire array must be reproduced to change the single variable.

docs/model/ApiTestsConfig.md

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,33 @@
1-
# cloudharness_model.model.api_tests_config.ApiTestsConfig
1+
# ApiTestsConfig
22

3-
## Model Type Info
4-
Input Type | Accessed Type | Description | Notes
5-
------------ | ------------- | ------------- | -------------
6-
dict, frozendict.frozendict, | frozendict.frozendict, | |
7-
8-
### Dictionary Keys
9-
Key | Input Type | Accessed Type | Description | Notes
10-
------------ | ------------- | ------------- | ------------- | -------------
11-
**[checks](#checks)** | list, tuple, | tuple, | One of the Schemathesis checks: - not_a_server_error. The response has 5xx HTTP status; - status_code_conformance. The response status is not defined in the API schema; - content_type_conformance. The response content type is not defined in the API schema; - response_schema_conformance. The response content does not conform to the schema defined for this specific response; - response_headers_conformance. The response headers does not contain all defined headers. |
12-
**autotest** | bool, | BoolClass, | Specify whether to run the common smoke tests |
13-
**enabled** | bool, | BoolClass, | Enables api tests for this application (default: false) |
14-
**[runParams](#runParams)** | list, tuple, | tuple, | Additional schemathesis parameters | [optional]
15-
**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional]
16-
17-
# checks
18-
19-
One of the Schemathesis checks: - not_a_server_error. The response has 5xx HTTP status; - status_code_conformance. The response status is not defined in the API schema; - content_type_conformance. The response content type is not defined in the API schema; - response_schema_conformance. The response content does not conform to the schema defined for this specific response; - response_headers_conformance. The response headers does not contain all defined headers.
203

21-
## Model Type Info
22-
Input Type | Accessed Type | Description | Notes
23-
------------ | ------------- | ------------- | -------------
24-
list, tuple, | tuple, | One of the Schemathesis checks: - not_a_server_error. The response has 5xx HTTP status; - status_code_conformance. The response status is not defined in the API schema; - content_type_conformance. The response content type is not defined in the API schema; - response_schema_conformance. The response content does not conform to the schema defined for this specific response; - response_headers_conformance. The response headers does not contain all defined headers. |
25-
26-
### Tuple Items
27-
Class Name | Input Type | Accessed Type | Description | Notes
28-
------------- | ------------- | ------------- | ------------- | -------------
29-
items | str, | str, | |
304

31-
# runParams
5+
## Properties
326

33-
Additional schemathesis parameters
34-
35-
## Model Type Info
36-
Input Type | Accessed Type | Description | Notes
7+
Name | Type | Description | Notes
378
------------ | ------------- | ------------- | -------------
38-
list, tuple, | tuple, | Additional schemathesis parameters |
39-
40-
### Tuple Items
41-
Class Name | Input Type | Accessed Type | Description | Notes
42-
------------- | ------------- | ------------- | ------------- | -------------
43-
items | str, | str, | |
9+
**enabled** | **bool** | Enables api tests for this application (default: false) |
10+
**autotest** | **bool** | Specify whether to run the common smoke tests |
11+
**run_params** | **List[str]** | Additional schemathesis parameters | [optional]
12+
**checks** | **List[str]** | One of the Schemathesis checks: - not_a_server_error. The response has 5xx HTTP status; - status_code_conformance. The response status is not defined in the API schema; - content_type_conformance. The response content type is not defined in the API schema; - response_schema_conformance. The response content does not conform to the schema defined for this specific response; - response_headers_conformance. The response headers does not contain all defined headers. |
13+
14+
## Example
15+
16+
```python
17+
from cloudharness_model.models.api_tests_config import ApiTestsConfig
18+
19+
# TODO update the JSON string below
20+
json = "{}"
21+
# create an instance of ApiTestsConfig from a JSON string
22+
api_tests_config_instance = ApiTestsConfig.from_json(json)
23+
# print the JSON string representation of the object
24+
print ApiTestsConfig.to_json()
25+
26+
# convert the object into a dict
27+
api_tests_config_dict = api_tests_config_instance.to_dict()
28+
# create an instance of ApiTestsConfig from a dict
29+
api_tests_config_form_dict = api_tests_config.from_dict(api_tests_config_dict)
30+
```
31+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
4432

45-
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
4633

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
1-
# cloudharness_model.model.application_accounts_config.ApplicationAccountsConfig
1+
# ApplicationAccountsConfig
22

3-
## Model Type Info
4-
Input Type | Accessed Type | Description | Notes
5-
------------ | ------------- | ------------- | -------------
6-
dict, frozendict.frozendict, | frozendict.frozendict, | |
7-
8-
### Dictionary Keys
9-
Key | Input Type | Accessed Type | Description | Notes
10-
------------ | ------------- | ------------- | ------------- | -------------
11-
**[roles](#roles)** | list, tuple, | tuple, | Specify roles to be created in this deployment specific for this application | [optional]
12-
**[users](#users)** | list, tuple, | tuple, | Defines test users to be added to the deployment, specific for this application | [optional]
13-
**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional]
143

15-
# roles
164

17-
Specify roles to be created in this deployment specific for this application
5+
## Properties
186

19-
## Model Type Info
20-
Input Type | Accessed Type | Description | Notes
7+
Name | Type | Description | Notes
218
------------ | ------------- | ------------- | -------------
22-
list, tuple, | tuple, | Specify roles to be created in this deployment specific for this application |
9+
**roles** | **List[str]** | Specify roles to be created in this deployment specific for this application | [optional]
10+
**users** | [**List[ApplicationUser]**](ApplicationUser.md) | Defines test users to be added to the deployment, specific for this application | [optional]
2311

24-
### Tuple Items
25-
Class Name | Input Type | Accessed Type | Description | Notes
26-
------------- | ------------- | ------------- | ------------- | -------------
27-
items | str, | str, | |
12+
## Example
2813

29-
# users
14+
```python
15+
from cloudharness_model.models.application_accounts_config import ApplicationAccountsConfig
3016

31-
Defines test users to be added to the deployment, specific for this application
32-
33-
## Model Type Info
34-
Input Type | Accessed Type | Description | Notes
35-
------------ | ------------- | ------------- | -------------
36-
list, tuple, | tuple, | Defines test users to be added to the deployment, specific for this application |
17+
# TODO update the JSON string below
18+
json = "{}"
19+
# create an instance of ApplicationAccountsConfig from a JSON string
20+
application_accounts_config_instance = ApplicationAccountsConfig.from_json(json)
21+
# print the JSON string representation of the object
22+
print ApplicationAccountsConfig.to_json()
3723

38-
### Tuple Items
39-
Class Name | Input Type | Accessed Type | Description | Notes
40-
------------- | ------------- | ------------- | ------------- | -------------
41-
[**ApplicationUser**](ApplicationUser.md) | [**ApplicationUser**](ApplicationUser.md) | [**ApplicationUser**](ApplicationUser.md) | |
24+
# convert the object into a dict
25+
application_accounts_config_dict = application_accounts_config_instance.to_dict()
26+
# create an instance of ApplicationAccountsConfig from a dict
27+
application_accounts_config_form_dict = application_accounts_config.from_dict(application_accounts_config_dict)
28+
```
29+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
4230

43-
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
4431

0 commit comments

Comments
 (0)