Commit 531519ea authored by Dimitrios Laskaratos's avatar Dimitrios Laskaratos
Browse files

Merge branch 'main' into 'dev'

# Conflicts:
#   README.md
#   srm-deployment.yaml
parents 548d9d14 a48e0e8a
Loading
Loading
Loading
Loading
+101 −8
Original line number Diff line number Diff line
@@ -23,12 +23,105 @@ SRM supports the following CAMARA functions:

SRM can be deployed in a Kubernetes cluster by executing the file _srm-deployment.yaml_ located in the root folder. This file will create a SRM Deployment resource and its supporting native K8s Service. The following table contains the necesssary environment variables for the Kubernetes adapter. If you have defined a custom adapter, include your variables accordingly.

| Edge Cloud Management API  | Description |
### Adapter environment variables

| Kubernetes  | aerOS | i2Edge |
| ------------- | ------------- |-------------|
| KUBERNETES_MASTER_PORT (eg. 10.10.10.10) | | FLAVOUR_ID |
| EMP_STORAGE_URI  | aerOS_HLO_TOKEN  |
| KUBERNETES_MASTER_TOKEN |  aerOS_ACCESS_TOKEN | - |

### Common environment variables
| Name | Description|
| ------------- | ------------- |
|  KUBERNETES_MASTER_IP |  Root url of the Kubernetes apiserver (eg. 10.10.10.10)|
| KUBERNETES_MASTER_PORT  |  Port of the Kubernetes apiserver (eg. 16443)|
| EMP_STORAGE_URI  | Root url of the management database, if deployed  |
|  KUBERNETES_MASTER_TOKEN | Token with which all access to K8s apiserver will authenticated  |
| ADAPTER_BASE_URL| Base address for the edge cloud adapter |
| ARTIFACT_MANAGER_ADDRESS |  Address of the Artefact Manager |
| EDGE_CLOUD_ADAPTER_NAME  | The adapter SRM is going to use throughout its lifecycle. For direct access to K8s just type 'kubernetes'  |
| EDGE_CLOUD_ADAPTER_NAME  | The adapter SRM is going to use throughout its lifecycle.|
| PLATFORM_PROVIDER| The Edge Cloud infrastructure provider|
| NETWORK_ADAPTER_NAME | The Network function exposure adapter|
| NETWORK_ADAPTER_BASE_URL | The address of the network adapter|

## Usage

Assuming an instance of Open Exposure Gateway (OEG) is running so that CAMARA APIs are accessible, here are a few request examples with responses, all CAMARA compatible:

### Get all registered apps

_curl -X GET http://[OEG_root_url]/apps_

Example response:

_[
  {
    "appId": "68503f9fe81dc7441fdaae94",
    "appRepo": {
      "imagePath": "mongo:4.4.18"
    },
    "componentSpec": [
      {
        "componentName": "mongodb",
        "networkInterfaces": [
          {
            "port": 27017,
            "protocol": "TCP"
          }
        ]
      }
    ],
    "name": "mongodb",
    "packageType": "QCOW2"
  },
  {
    "appId": "685122aa8fff437507ec8932",
    "appRepo": {
      "imagePath": "nginx"
    },
    "componentSpec": [
      {
        "componentName": "nginx",
        "networkInterfaces": [
          {
            "port": 80,
            "protocol": "TCP"
          },
          {
            "port": 443,
            "protocol": "TCP"
          }
        ]
      }
    ],
    "name": "nginx",
    "packageType": "QCOW2"
  }
]_

### Register app metadata

_curl -X POST http://[OEG_root_url]/apps --data '{"name": "nginx", "version": "1", "packageType": "QCOW2", "appRepo": {"imagePath": "nginx", "type": "PRIVATEREPO"}
, "componentSpec": [{"componentName": "nginx", "networkInterfaces": [{"protocol": "TCP", "port": 80, "interfaceId": "Uj6qThvzkegxa3L4b88", "visibilityType": "VISIBILITY_EXTERNAL"}, {"protoco
l": "TCP", "port": 443, "interfaceId": "Uj6qThvzkegxa3L4b88", "visibilityType": "VISIBILITY_EXTERNAL"}]}]}' -H "Content-Type: application/json"_

Example Response:

_{
  "appId": "685bdc7dc2db24cc0e8927dc"
}_

### Instantiate registered app

_curl -X POST http://[OEG_root_url]/appinstances --data '{"appId": "685bdc7dc2db24cc0e8927dc", "name": "nginx-test", "appZones": [{"EdgeCloudZone":{"edgeCloudZoneI
d": "f39c5ea3-f4e3-472f-b080-2f3b81c39995", "edgeCloudZoneName": "k3d-sunriseop-agent-2", "edgeCloudProvider": "ISI"}}]}' -H "Content-Type: application/json"_

Example Response:

_{
  "appId": "685bdc7dc2db24cc0e8927dc",
  "appInstanceId": "f3b7788a-e133-46c7-9cbd-7a8501123567",
  "appProvider": null,
  "componentEndpointInfo": {},
  "edgeCloudZoneId": "zorro-solutions",
  "kubernetesClusterRef": "",
  "name": "nginx-test",
  "status": "unknown"
}_
 No newline at end of file
+17 −11
Original line number Diff line number Diff line
@@ -33,25 +33,31 @@ spec:
      containers:
        - env:
            - name: KUBERNETES_MASTER_IP
              value: 146.124.106.200
              value: 
            - name: KUBERNETES_MASTER_PORT
              value: "16443"
            - name: KUBERNETES_USERNAME
              value: cluster-admin
              value: 
            - name: K8S_NAMESPACE
              value: sunrise6g            
              value:    
            - name: KUBERNETES_USERNAME
              value: 
            - name: EMP_STORAGE_URI
              value: mongodb://mongosrm:27017
              value: 
            - name: KUBERNETES_MASTER_TOKEN
              value: T3FRNnNVK25FY3I5ZHlNYmxrSEFpd2VPcW5WTlliTnRVNVo3bitNY1B3az0K
              value: 
            - name: ARTIFACT_MANAGER_ADDRESS
              value: http://artefact-manager-service:8000
              value: 
            - name: EDGE_CLOUD_ADAPTER_NAME
              value: kubernetes
              value: 
            - name: ADAPTER_BASE_URL
              value: 146.124.106.200
              value: 
            - name: NETWORK_ADAPTER_NAME
              value:
            - name: NETWORK_ADAPTER_BASE_URL    
              value: 
            - name: SCS_AS_ID
              value:
            - name: PLATFORM_PROVIDER
              value: ICOM
              value: 
          image: ghcr.io/sunriseopenoperatorplatform/srm/srm:1.0.1
          name: srmcontroller
          ports: