diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a809f2ae1d6c7d8ff850167983fb74f999dd130..9b7fdd838de475b6a30282ee0927df154a022c8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,10 +30,12 @@ variables: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.clients/oss/oss-client-jvm labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.clients/telemetry/telemetry-api-jvm labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/pkg-manager.helm/pkg-manager + labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/service.monitor/service-monitor labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/sonata/sonata-core-jvm labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/cart/hypo-portal-jvm labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/web/hypo-portal + lint: stage: lint image: @@ -320,6 +322,8 @@ get_images: FABRIC_API=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $FABRIC_API_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) - | PORTAL=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $PORTAL_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) + - | + MONITOR=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $MONITOR_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) - echo "TMF_API=$TMF_API" > build.env - echo "SONATA=$SONATA" >> build.env - echo "PKG_MANAGER=$PKG_MANAGER" >> build.env @@ -330,6 +334,7 @@ get_images: - echo "REGISTRY_API=$REGISTRY_API" >> build.env - echo "FABRIC_API=$FABRIC_API" >> build.env - echo "PORTAL=$PORTAL" >> build.env + - echo "MONITOR=$MONITOR" >> build.env artifacts: paths: - build.env @@ -360,10 +365,11 @@ update_values: - echo $REGISTRY_API - echo $FABRIC_API - echo $PORTAL + - echo $MONITOR - python3 -m pip install ruamel.yaml script: - pwd - - python3 scripts/helm_update_etsi.py $PKG_MANAGER $OSS_CLIENT $SONATA $TMF_API $PORTAL_CART $TELEMETRY_CLIENT $PEERING_API $REGISTRY_API $FABRIC_API $PORTAL --bump-chart --file=./charts/hypo/values.yaml + - python3 scripts/helm_update_etsi.py $PKG_MANAGER $OSS_CLIENT $SONATA $TMF_API $PORTAL_CART $TELEMETRY_CLIENT $PEERING_API $REGISTRY_API $FABRIC_API $PORTAL $MONITOR --bump-chart --file=./charts/hypo/values.yaml - git add . - git config --global user.email $GITLAB_USER_EMAIL - git config --global user.name $GITLAB_USER_NAME @@ -849,6 +855,10 @@ nightly_compare_failed_images_job: printf '%s\n' "${PORTAL_URL:-}" ;; + */service-monitor) + printf '%s\n' "${MONITOR_URL:-}" + ;; + *) printf '%s\n' "" ;; diff --git a/charts/hypo/templates/service-monitor/deployment.yaml b/charts/hypo/templates/service-monitor/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..63e176e1c5aac3050eac98d80f660b09c6a5f361 --- /dev/null +++ b/charts/hypo/templates/service-monitor/deployment.yaml @@ -0,0 +1,71 @@ +{{ $serviceMonitor := index .Values "service-monitor" }} +{{- if $serviceMonitor.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "hypo.service-monitor.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: +{{ include "hypo.labels" . | nindent 4 }} + app: {{ template "hypo.service-monitor.fullname" . }} +spec: + replicas: {{ $serviceMonitor.replicaCount }} + selector: + matchLabels: +{{ include "hypo.selectorLabels" . | nindent 6 }} + app: {{ template "hypo.service-monitor.fullname" . }} + template: + metadata: + {{- with $serviceMonitor.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + app: {{ template "hypo.service-monitor.fullname" . }} + {{- include "hypo.labels" . | nindent 8 }} + {{- with $serviceMonitor.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + initContainers: + - name: wait-for-kafka + image: busybox:latest + imagePullPolicy: IfNotPresent + securityContext: + capabilities: + add: + - NET_ADMIN + command: + - sh + - -c + - | + echo "Attempting to set MTU..." + ip link set dev eth0 mtu 1000 + echo "Current MTU is: $(cat /sys/class/net/eth0/mtu)" + until nc -z -w 1 {{ template "hypo.kafka.url" . }} {{ .Values.kafka.service.ports.client }}; do + echo "Sleeping for Kafka" + sleep 1 + done + echo "ready!" + {{- with $serviceMonitor.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ $serviceMonitor.name }} + image: "{{ $serviceMonitor.image.repository }}:{{ $serviceMonitor.image.tag }}" + imagePullPolicy: {{ $serviceMonitor.image.pullPolicy }} + env: + - name: KAFKA_BROKERS + value: {{ template "hypo.kafka.url" . }}:{{ .Values.kafka.service.ports.client }} + resources: + {{- toYaml $serviceMonitor.resources | nindent 12 }} + {{- with $serviceMonitor.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $serviceMonitor.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end -}} diff --git a/charts/hypo/values.yaml b/charts/hypo/values.yaml index 970bdada919902fb2d538a6cc9cbca340c070db2..08d5ab831205db167db85802026875f1968bc85a 100644 --- a/charts/hypo/values.yaml +++ b/charts/hypo/values.yaml @@ -515,6 +515,51 @@ fabric-api: tolerations: [] +service-monitor: + enabled: true + name: service-monitor + replicaCount: 1 + image: + repository: + labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/service.monitor/service-monitor + pullPolicy: Always + tag: "latest" + + imagePullSecrets: + - name: regcred + nameOverride: "" + fullnameOverride: "" + + podAnnotations: {} + podLabels: {} + + podSecurityContext: {} + + containerPort: 8880 + + # service: + # type: NodePort + # port: 8880 + # nodePort: 30095 + + securityContext: {} + + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + volumes: [] + volumeMounts: [] + + nodeSelector: {} + + tolerations: [] + + infinispan: enabled: true diff --git a/scripts/get_tags.sh b/scripts/get_tags.sh index c0d3b108de7a22b19d9165bfb4407d0f9f3cff04..a1e1cee30effab591255c64174ae734ac06a7003 100755 --- a/scripts/get_tags.sh +++ b/scripts/get_tags.sh @@ -25,6 +25,7 @@ PEERING_API_URL="https://labs.etsi.org/rep/api/v4/projects/468/registry/reposito REGISTRY_API_URL="https://labs.etsi.org/rep/api/v4/projects/469/registry/repositories/3018/tags?page=1&per_page=500" FABRIC_API_URL="https://labs.etsi.org/rep/api/v4/projects/467/registry/repositories/3011/tags?page=1&per_page=500" PORTAL_URL="https://labs.etsi.org/rep/api/v4/projects/466/registry/repositories/3038/tags?page=1&per_page=500" +MONITOR_URL="https://labs.etsi.org/rep/api/v4/projects/480/registry/repositories/3119/tags?page=1&per_page=500" # Get TMF_API version TMF_API=$(curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" --url "$TMF_API_URL" | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) @@ -56,6 +57,9 @@ FABRIC_API=$(curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" --url $FABRIC_API_URL # Get Portal version PORTAL=$(curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" --url $PORTAL_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) +# Get Service Monitor version +MONITOR=$(curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" --url $MONITOR_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1) + # Write versions to build.env echo "TMF_API=$TMF_API" > build.env @@ -68,9 +72,10 @@ echo "PEERING_API=$PEERING_API" >> build.env echo "REGISTRY_API=$REGISTRY_API" >> build.env echo "FABRIC_API=$FABRIC_API" >> build.env echo "PORTAL=$PORTAL" >> build.env +echo "MONITOR=$MONITOR" >> build.env # Notify the user echo "Version information written to build.env" #Remember to then run: #source build.env -#python3 scripts/helm_update.py $PKG_MANAGER $OSS_CLIENT $SONATA $TMF_API $PORTAL_CART $TELEMETRY_CLIENT $PEERING_API $REGISTRY_API $FABRIC_API $PORTAL --file=./charts/hypo/values.yaml +#python3 scripts/helm_update.py $PKG_MANAGER $OSS_CLIENT $SONATA $TMF_API $PORTAL_CART $TELEMETRY_CLIENT $PEERING_API $REGISTRY_API $FABRIC_API $PORTAL $MONITOR --file=./charts/hypo/values.yaml diff --git a/scripts/helm_update.py b/scripts/helm_update.py index 93ee1230dfbaf951566ab34b7937c2ac571652b8..89d001c2bd29324899046ed99b0c0bb848c4936e 100644 --- a/scripts/helm_update.py +++ b/scripts/helm_update.py @@ -81,7 +81,7 @@ def main(): print("--------------------------------------") # Adding all of our microservices - microservices = ["pkg-manager", "oss-client", "tmf-api", "sonata", "portal-cart", "telemetry-client", "peering-api", "registry-api", "fabric-api", "portal"] + microservices = ["pkg-manager", "oss-client", "tmf-api", "sonata", "portal-cart", "telemetry-client", "peering-api", "registry-api", "fabric-api", "portal", "service-monitor"] tag_changed = False chart_updated = False # Track if chart has been updated already diff --git a/scripts/helm_update_etsi.py b/scripts/helm_update_etsi.py index 1e0523046bacbef962a6956daa76362177b67310..09f41e140646249830b4546b1c919a3b13ae3db6 100644 --- a/scripts/helm_update_etsi.py +++ b/scripts/helm_update_etsi.py @@ -82,7 +82,7 @@ def main(): print("--------------------------------------") # Adding all of our microservices - microservices = ["pkg-manager", "oss-client", "tmf-api", "sonata", "portal-cart", "telemetry-client", "peering-api", "registry-api", "fabric-api", "portal"] + microservices = ["pkg-manager", "oss-client", "tmf-api", "sonata", "portal-cart", "telemetry-client", "peering-api", "registry-api", "fabric-api", "portal", "service-monitor"] tag_changed = False chart_updated = False # Track if chart has been updated already