Loading manifests/monitoringservice.yaml→manifests/monitoring.yaml +6 −6 Original line number Diff line number Diff line apiVersion: apps/v1 kind: Deployment metadata: name: monitoringservice name: monitoring spec: selector: matchLabels: app: monitoringservice app: monitoring template: metadata: labels: app: monitoringservice app: monitoring spec: terminationGracePeriodSeconds: 5 containers: - name: server image: myregistrydomain.com/monitoringservice image: registry.gitlab.com/teraflow-h2020/controller/monitoring:latest ports: - containerPort: 8080 env: Loading @@ -39,11 +39,11 @@ spec: apiVersion: v1 kind: Service metadata: name: monitoringservice name: monitoring spec: type: ClusterIP selector: app: monitoringservice app: monitoring ports: - name: grpc port: 8080 Loading src/monitoring/.gitlab-ci.yml +29 −20 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ build monitoring: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: build before_script: Loading @@ -17,13 +16,13 @@ build monitoring: - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml # test if the Docker image can be pulled from the gitlab registry test monitoring pull: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: test needs: Loading @@ -38,13 +37,13 @@ test monitoring pull: - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml # test if the Docker image can be executed test monitoring run: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: test needs: Loading @@ -52,7 +51,7 @@ test monitoring run: before_script: - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi script: - docker run -d -p 7070:7070 --name monitoring --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker run -d -p 7070:7070 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker ps after_script: - docker stop monitoring Loading @@ -62,6 +61,7 @@ test monitoring run: - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml # apply unit test to the monitoring component Loading @@ -75,33 +75,42 @@ test monitoring pytest: - build monitoring script: - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ - docker run -v "$PWD/src/monitoring/tests:/opt/results" monitoring-test:latest - docker run -v "$PWD/src/$IMAGE_NAME/tests:/opt/results" $IMAGE_NAME_TEST:$IMAGE_TAG rules: - changes: - src/$IMAGE_NAME/*.{py,in,yml} - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml artifacts: when: always reports: junit: src/monitoring/tests/report.xml junit: src/$IMAGE_NAME/tests/report.xml # Deployment of the monitoring service in Kubernetes Cluster #deploy monitoring development: # variables: # IMAGE_NAME: 'monitoring' # name of the microservice # IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) # stage: deploy # needs: # - build monitoring # - test monitoring run # script: # - kubectl version # - kubectl get all # - kubectl apply -f "manifests/monitoringservice.yaml" # - kubectl get all # when: manual deploy monitoring development: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: deploy needs: - build monitoring - test monitoring run script: - kubectl version - kubectl get all - kubectl apply -f "manifests/$IMAGE_NAME.yaml" - kubectl get all when: manual rules: - changes: - src/$IMAGE_NAME/*.{py,in,yml} - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml Loading
manifests/monitoringservice.yaml→manifests/monitoring.yaml +6 −6 Original line number Diff line number Diff line apiVersion: apps/v1 kind: Deployment metadata: name: monitoringservice name: monitoring spec: selector: matchLabels: app: monitoringservice app: monitoring template: metadata: labels: app: monitoringservice app: monitoring spec: terminationGracePeriodSeconds: 5 containers: - name: server image: myregistrydomain.com/monitoringservice image: registry.gitlab.com/teraflow-h2020/controller/monitoring:latest ports: - containerPort: 8080 env: Loading @@ -39,11 +39,11 @@ spec: apiVersion: v1 kind: Service metadata: name: monitoringservice name: monitoring spec: type: ClusterIP selector: app: monitoringservice app: monitoring ports: - name: grpc port: 8080 Loading
src/monitoring/.gitlab-ci.yml +29 −20 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ build monitoring: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: build before_script: Loading @@ -17,13 +16,13 @@ build monitoring: - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml # test if the Docker image can be pulled from the gitlab registry test monitoring pull: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: test needs: Loading @@ -38,13 +37,13 @@ test monitoring pull: - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml # test if the Docker image can be executed test monitoring run: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_NAME_TEST: 'monitoring-test' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: test needs: Loading @@ -52,7 +51,7 @@ test monitoring run: before_script: - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi script: - docker run -d -p 7070:7070 --name monitoring --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker run -d -p 7070:7070 --name $IMAGE_NAME --network=teraflowbridge --rm "$IMAGE_NAME:$IMAGE_TAG" - docker ps after_script: - docker stop monitoring Loading @@ -62,6 +61,7 @@ test monitoring run: - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml # apply unit test to the monitoring component Loading @@ -75,33 +75,42 @@ test monitoring pytest: - build monitoring script: - docker build -t "$IMAGE_NAME_TEST:$IMAGE_TAG" -f ./src/$IMAGE_NAME/tests/Dockerfile ./src/ - docker run -v "$PWD/src/monitoring/tests:/opt/results" monitoring-test:latest - docker run -v "$PWD/src/$IMAGE_NAME/tests:/opt/results" $IMAGE_NAME_TEST:$IMAGE_TAG rules: - changes: - src/$IMAGE_NAME/*.{py,in,yml} - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml artifacts: when: always reports: junit: src/monitoring/tests/report.xml junit: src/$IMAGE_NAME/tests/report.xml # Deployment of the monitoring service in Kubernetes Cluster #deploy monitoring development: # variables: # IMAGE_NAME: 'monitoring' # name of the microservice # IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) # stage: deploy # needs: # - build monitoring # - test monitoring run # script: # - kubectl version # - kubectl get all # - kubectl apply -f "manifests/monitoringservice.yaml" # - kubectl get all # when: manual deploy monitoring development: variables: IMAGE_NAME: 'monitoring' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: deploy needs: - build monitoring - test monitoring run script: - kubectl version - kubectl get all - kubectl apply -f "manifests/$IMAGE_NAME.yaml" - kubectl get all when: manual rules: - changes: - src/$IMAGE_NAME/*.{py,in,yml} - src/$IMAGE_NAME/Dockerfile - src/$IMAGE_NAME/tests/*.py - src/$IMAGE_NAME/tests/Dockerfile - manifests/$IMAGE_NAME.yaml - .gitlab-ci.yml