summaryrefslogtreecommitdiffstats
path: root/external-schema-repo-generator/README.md
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2021-02-09 11:04:39 +0100
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2021-02-11 12:14:35 +0100
commit1898455d2fdd4c4f1f4914119e123babed60ce61 (patch)
treec230e0f4e69e5f454ebfc12d1445431c6fbe2b4a /external-schema-repo-generator/README.md
parenta111aa071b81aaaed46e6dbc105a248152cd9ed4 (diff)
Update script to generate spec per branch
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> Issue-ID: DCAEGEN2-2619 Change-Id: I8308af63b726a36f2661566cdd08a1f366052d57
Diffstat (limited to 'external-schema-repo-generator/README.md')
-rw-r--r--external-schema-repo-generator/README.md100
1 files changed, 57 insertions, 43 deletions
diff --git a/external-schema-repo-generator/README.md b/external-schema-repo-generator/README.md
index 1ac06b2..8e959ce 100644
--- a/external-schema-repo-generator/README.md
+++ b/external-schema-repo-generator/README.md
@@ -2,8 +2,8 @@ StndDefined schemas ConfigMap generator
=======================================
## Description
-StndDefined schemas Kubernetes ConfigMap generator is a Makefile with two targets running shell scripts: 'generate' and
-'install'. This Makefile may be used by VES Collector users to generate and install ConfigMap containing schemas
+StndDefined schemas Kubernetes ConfigMap generator is a Makefile with shell scripts: 'generate', 'install', 'clean' ane 'utils'.
+This Makefile may be used by VES Collector users to generate and install ConfigMap containing schemas
and mapping file for stndDefined validation in VES pod. Additionally script creates file with snippets containing
auto-generated configuration of volumes finally mounted in VES deployment. Process of generation of ConfigMap spec file
is configurable via environment.config file.
@@ -25,10 +25,12 @@ as schemas and attached to ConfigMap spec.
### Generator tool files integration
It is recommended to consider files of this tool as a unity and not split them when moving generator through
-environments. Generator tool files that are required are:
+environments. Generator tool files that are required are located in `generator` directory:
- Makefile
- install.sh
- generate.sh
+- utils.sh
+- clean.sh
- environment.config
## Instruction
@@ -37,8 +39,10 @@ environments. Generator tool files that are required are:
Before running any target from Makefile, configuration in *environment.config* must be properly prepared. Description of
the configurable properties is below.
-- **SPEC_CONFIGMAP_FILENAME** - Filename name of ConfigMap spec that will be generated.
-- **K8S_CONFIGMAP_NAME** - Kubernetes name of ConfigMap that will be generated and installed.
+- **GENERATION_DIRECTORY** - Directory in which generated files will be located.
+- **EXTERNAL_REPO_CONFIGMAP_FILENAME_PREFIX** - Prefix for file name of ConfigMap spec, that will be generated.
+- **EXTERNAL_REPO_CONFIGMAP_DIRECTORY** - Directory inside *GENERATION_DIRECTORY*, in which generated specs will be located.
+- **EXTERNAL_REPO_CONFIGMAP_NAME_PREFIX** - Prefix for Kubernetes name of ConfigMap, that will be generated and installed.
- **SNIPPET_FILENAME** - Filename of snippet with autogenerated content that should be added to VES deployment.
- **REPOSITORY_URL_HTTPS** - URL to remote Git repository which lets cloning repository via HTTPS.
@@ -53,13 +57,26 @@ VES.
### Running commands
-To run ConfigMap spec generation as well as snippet file used for mounting ConfigMap to specific Deployment use:
+
+#### All
+
+To generate and install ConfigMaps run:
+
+```
+make all
+```
+
+#### Generation
+
+To run ConfigMaps spec generation as well as snippet file used for mounting ConfigMap to specific Deployment use:
```
make generate
```
-To run ConfigMap installation in Kubernetes use:
+#### Installation
+
+To run ConfigMaps installation in Kubernetes use:
**NOTE**: Remember about running this command on RKE node.
@@ -67,16 +84,23 @@ To run ConfigMap installation in Kubernetes use:
make install
```
-**NOTE**: It is possible that ConfigMap with selected K8S_CONFIGMAP_NAME already exists in Kubernetes. In such situation
-either regenerate spec with new K8S_CONFIGMAP_NAME or remove existing ConfigMap from Kubernetes and install spec again.
-To remove ConfigMap from Kubernetes use:
+**NOTE**: It is possible that ConfigMap with selected K8S_CONFIGMAP_NAME already exists in Kubernetes.
+In such situation existing ConfigMap will be replaced.
+
+**NOTE**: If ConfigMap is bigger than one megabyte it won't be installed
+and warning will be displayed during installation.
+
+#### Cleaning
+
+To remove generated files use:
+
```
-kubectl -n onap delete configmap <CONFIGMAP_NAME>
+make clean
```
## ConfigMap validation
-After running the script ConfigMap spec file is generated in current working directory.
-Spec file can be manually validated via any text editor. The last file included in spec is schema-map.json file with
+After running the script ConfigMap spec file is generated in selected (be default `genereted`) directory.
+Spec files can be manually validated via any text editor. The last generated file includes in spec is schema-map.json file with
mappings of external URLs to prepared local URLs.
To check whether it has been created use command:
@@ -85,11 +109,11 @@ To check whether it has been created use command:
kubectl -n onap get configmap | grep <CONFIGMAP_NAME>
```
-A ConfigMap with configured name should be visible on the list.
+A ConfigMaps with configured name should be visible on the list.
## Mounting ConfigMap into VES Collector
-To mount created ConfigMap in VES, its deployment must be edited. It can be done with:
+To mount created ConfigMaps in VES, its deployment must be edited. It can be done with:
```
kubectl -n onap edit deployment dep-dcae-ves-collector
```
@@ -110,16 +134,18 @@ when pasting snippets. Use ``:set paste `` to turn paste mode on. To close paste
```
volumeMounts:
- - ...
- - mountPath: /opt/app/VESCollector/etc/externalRepoCustom
- name: custom-3gpp-schemas
+ - mountPath: /opt/app/VESCollector/etc/externalRepo
+ name: custom-3gpp-schemas
+ - mountPath: /opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/tree/branch/OpenAPI
+ name: branch-custom-3gpp-schemas
+ - ...
```
- mountPath - Directory context for schemas. **NOTE**: must be the same as configuration of VES Collector property
*collector.externalSchema.schemasLocation* in *collector.properties*. This property might be modified via Consul UI,
later after changes in deployment.
- - name - Name of ConfigMap volume. Must be the same as set in the 2. step in *name* field.
+ - name - Name of ConfigMap volume. For schema map must be the same as set in the 2. step in *name* field.
2. Add volumes element
@@ -131,32 +157,20 @@ when pasting snippets. Use ``:set paste `` to turn paste mode on. To close paste
```
volumes:
- - configMap:
- defaultMode: 420
- items:
- - key: schema-map.json
- path: schema-map.json
- - key: SA88-Rel16-faultMnS.yaml
- path: 3gpp/rep/sa5/data-models/SA88-Rel16/OpenAPI/faultMnS.yaml
- - ...
- name: stnd-defined-configmap
- name: custom-3gpp-schemas
- - ...
+ - configMap:
+ defaultMode: 420
+ name: schema-map-stnd-defined-configmap
+ name: custom-3gpp-schemas
+ - configMap:
+ defaultMode: 420
+ name: branch-stnd-defined-configmap
+ name: branch-custom-3gpp-schemas
+ - ...
```
Fields description:
- - name - Name of ConfigMap volume. Must be the same as set in the 1. step in *name* field.
- - configMap.name - name of installed Kubernetes ConfigMap described in K8S_CONFIGMAP_NAME configuration setting
- - configMap.items[].key - name of mounted file from installed previously ConfigMap.
- **NOTE**: Not every schema from ConfigMap must be listed in *items* (warning message will be logged on VES startup if
- so), but mapping file named as described in MAPPING_FILE_NAME setting is required for correct stndDefined validation
- in VES.
- - configMap.items[].path: Relative path from *mountPath* from step 1 which describes location of schema location in
- VES container.
- **NOTE 1**: For correct schemas detection in VES Collector *path* of each schema must be the same as its localURL in
- mapping file. Mapping file is included as the last file in generated ConfigMap spec.
- **NOTE 2**: For correct mapping file detection in VES Collector its *path* must be the same as in property
- *collector.externalSchema.mappingFileLocation* in *collector.properties*. This property might be modified via Consul
- UI, later after changes in deployment.
+ - name - Name of ConfigMap volume. Consist of branch name and *name* field. Must be same as name in 1. step
+ - configMap.name - name of installed Kubernetes ConfigMap consist of schema-map or branch name
+ and K8S_CONFIGMAP_NAME from configuration setting
3. Save and close an editor, K8S will automatically detect changes, terminate old VES Pod and deploy new one with
mounted ConfigMap. Correctness of new VES Pod initialization and mounting ConfigMap can be tracked using