From a741f76ff964a9ad12785440e9fb2019fd991e1b Mon Sep 17 00:00:00 2001 From: diazjj <jjdiaz@cttc.es> Date: Fri, 28 Jun 2024 13:18:15 +0200 Subject: [PATCH] Updated the Manifest files and deployment scripts for DLT --- deploy/all.sh | 2 +- manifests/dltservice.yaml | 205 ++++++++++++++---- my_deploy.sh | 2 +- .../{automation/DockerFiles => }/Dockerfile | 0 src/dlt/gateway/README.md | 2 +- 5 files changed, 162 insertions(+), 49 deletions(-) rename src/dlt/gateway/{automation/DockerFiles => }/Dockerfile (100%) diff --git a/deploy/all.sh b/deploy/all.sh index c169bc92c..e77ff22ae 100755 --- a/deploy/all.sh +++ b/deploy/all.sh @@ -27,7 +27,7 @@ export TFS_REGISTRY_IMAGES=${TFS_REGISTRY_IMAGES:-"http://localhost:32000/tfs/"} # If not already set, set the list of components, separated by spaces, you want to build images for, and deploy. # By default, only basic components are deployed -export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device ztp monitoring pathcomp service slice nbi webui load_generator"} +export TFS_COMPONENTS=${TFS_COMPONENTS:-"context device ztp monitoring pathcomp service slice nbi webui load_generator dlt"} # If not already set, set the tag you want to use for your images. export TFS_IMAGE_TAG=${TFS_IMAGE_TAG:-"dev"} diff --git a/manifests/dltservice.yaml b/manifests/dltservice.yaml index 34f0d53c3..5362fe6ab 100644 --- a/manifests/dltservice.yaml +++ b/manifests/dltservice.yaml @@ -12,10 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. +apiVersion: v1 +kind: ConfigMap +metadata: + name: dlt-config + namespace: dlt +data: + CHANNEL_NAME: "channel1" + CHAINCODE_NAME: "adrenalineDLT" + MSP_ID: "Org1MSP" + PEER_ENDPOINT: "PEER_IP:PORT" + PEER_HOST_ALIAS: "peer0.org1.adrenaline.com" + CRYPTO_PATH: "/test-network/organizations/peerOrganizations/org1.adrenaline.com" + KEY_DIRECTORY_PATH: "/test-network/organizations/peerOrganizations/org1.adrenaline.com/users/User1@org1.adrenaline.com/msp/keystore" + CERT_DIRECTORY_PATH: "/test-network/organizations/peerOrganizations/org1.adrenaline.com/users/User1@org1.adrenaline.com/msp/signcerts" + TLS_CERT_PATH: "/test-network/organizations/peerOrganizations/org1.adrenaline.com/peers/peer0.org1.adrenaline.com/tls/ca.crt" + +--- + apiVersion: apps/v1 kind: Deployment metadata: name: dltservice + namespace: dlt spec: selector: matchLabels: @@ -27,62 +46,156 @@ spec: spec: terminationGracePeriodSeconds: 5 containers: - - name: connector - image: labs.etsi.org:5050/tfs/controller/dlt-connector:latest - imagePullPolicy: Always - ports: - - containerPort: 8080 - - containerPort: 9192 - env: - - name: LOG_LEVEL - value: "INFO" + - name: connector + image: labs.etsi.org:5050/tfs/controller/dlt-connector:latest + imagePullPolicy: Always + ports: + - containerPort: 8080 + - containerPort: 9192 + env: + - name: LOG_LEVEL + value: "INFO" ## for debug purposes #- name: DLT_GATEWAY_HOST # value: "mock-blockchain.tfs-bchain.svc.cluster.local" #- name: DLT_GATEWAY_PORT # value: "50051" - readinessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - livenessProbe: - exec: - command: ["/bin/grpc_health_probe", "-addr=:8080"] - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - cpu: 500m - memory: 512Mi - - name: gateway - image: labs.etsi.org:5050/tfs/controller/dlt-gateway:latest - imagePullPolicy: Always - ports: - - containerPort: 50051 - #readinessProbe: - # httpGet: - # path: /health - # port: 8081 - # initialDelaySeconds: 5 - # timeoutSeconds: 5 - #livenessProbe: - # httpGet: - # path: /health - # port: 8081 - # initialDelaySeconds: 5 - # timeoutSeconds: 5 - resources: - requests: - cpu: 200m - memory: 512Mi - limits: - cpu: 700m - memory: 1024Mi + readinessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:8080"] + livenessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:8080"] + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 500m + memory: 512Mi + - name: gateway + image: labs.etsi.org:5050/tfs/controller/dlt-gateway:latest + imagePullPolicy: Always + ports: + - containerPort: 50051 + resources: + requests: + cpu: 200m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi + volumeMounts: + - mountPath: /test-network + name: dlt-volume + readOnly: true + env: + - name: CHANNEL_NAME + valueFrom: + configMapKeyRef: + name: dlt-config + key: CHANNEL_NAME + - name: CHAINCODE_NAME + valueFrom: + configMapKeyRef: + name: dlt-config + key: CHAINCODE_NAME + - name: MSP_ID + valueFrom: + configMapKeyRef: + name: dlt-config + key: MSP_ID + - name: PEER_ENDPOINT + valueFrom: + configMapKeyRef: + name: dlt-config + key: PEER_ENDPOINT + - name: PEER_HOST_ALIAS + valueFrom: + configMapKeyRef: + name: dlt-config + key: PEER_HOST_ALIAS + - name: CRYPTO_PATH + valueFrom: + configMapKeyRef: + name: dlt-config + key: CRYPTO_PATH + - name: KEY_DIRECTORY_PATH + valueFrom: + configMapKeyRef: + name: dlt-config + key: KEY_DIRECTORY_PATH + - name: CERT_DIRECTORY_PATH + valueFrom: + configMapKeyRef: + name: dlt-config + key: CERT_DIRECTORY_PATH + - name: TLS_CERT_PATH + valueFrom: + configMapKeyRef: + name: dlt-config + key: TLS_CERT_PATH + volumes: + - name: dlt-volume + persistentVolumeClaim: + claimName: dlt-pvc + --- + +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: dlt-pvc + namespace: dlt +spec: + accessModes: + - ReadOnlyMany + resources: + requests: + storage: 1Gi + +--- + +apiVersion: v1 +kind: PersistentVolume +metadata: + name: dlt-pv +spec: + capacity: + storage: 1Gi + accessModes: + - ReadOnlyMany + persistentVolumeReclaimPolicy: Retain + hostPath: + path: "/home/cttc/test-network" + claimRef: + namespace: dlt + name: dlt-pvc + +--- + +apiVersion: v1 +kind: Service +metadata: + name: gatewayservice + namespace: dlt +spec: + selector: + app: dltservice + ports: + - protocol: TCP + port: 50051 + targetPort: 50051 + nodePort: 32001 + type: NodePort + +--- + apiVersion: v1 kind: Service metadata: name: dltservice + namespace: dlt labels: app: dltservice spec: diff --git a/my_deploy.sh b/my_deploy.sh index 8417f6eae..7cd94d136 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -20,7 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. -export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator" +export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator dlt" # Uncomment to activate Monitoring #export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring" diff --git a/src/dlt/gateway/automation/DockerFiles/Dockerfile b/src/dlt/gateway/Dockerfile similarity index 100% rename from src/dlt/gateway/automation/DockerFiles/Dockerfile rename to src/dlt/gateway/Dockerfile diff --git a/src/dlt/gateway/README.md b/src/dlt/gateway/README.md index 7206289ec..401e17864 100644 --- a/src/dlt/gateway/README.md +++ b/src/dlt/gateway/README.md @@ -54,4 +54,4 @@ Make the necessary changes to the environment variables inside the **configmap.y ./deploy_dlt_gateway.sh ``` -Once the Kubernetes service is deployed, TFS can perform gRPC requests to as usual. \ No newline at end of file +Once the Kubernetes service is deployed, TFS can perform gRPC requests to as usual. \ No newline at end of file -- GitLab