From 63bd29887775386545bdd64013ea0032798d0590 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Thu, 16 Jan 2025 17:47:02 +0100 Subject: [PATCH 1/6] Added CAPIF_HOSTNAME variable to invoker, provider, loggin and publish service. --- .../templates/deployment.yaml | 2 ++ .../ocf-api-invoker-management/values.yaml | 1 + .../templates/deployment.yaml | 2 ++ .../ocf-api-provider-management/values.yaml | 1 + .../templates/deployment.yaml | 8 ++++---- .../charts/ocf-events/templates/deployment.yaml | 10 ++++++---- helm/capif/charts/ocf-events/values.yaml | 1 + .../templates/deployment.yaml | 10 ++++++---- .../charts/ocf-publish-service-api/values.yaml | 1 + .../ocf-register/templates/deployment.yaml | 16 ++++++++-------- helm/scripts/install_capif.sh | 4 ++++ 11 files changed, 36 insertions(+), 20 deletions(-) diff --git a/helm/capif/charts/ocf-api-invoker-management/templates/deployment.yaml b/helm/capif/charts/ocf-api-invoker-management/templates/deployment.yaml index 5b210cb2..70508d9f 100644 --- a/helm/capif/charts/ocf-api-invoker-management/templates/deployment.yaml +++ b/helm/capif/charts/ocf-api-invoker-management/templates/deployment.yaml @@ -42,6 +42,8 @@ spec: env: - name: MONITORING value: {{ quote .Values.env.monitoring }} + - name: CAPIF_HOSTNAME + value: {{ quote .Values.env.capifHostname }} - name: VAULT_HOSTNAME value: {{ quote .Values.env.vaultHostname }} - name: VAULT_PORT diff --git a/helm/capif/charts/ocf-api-invoker-management/values.yaml b/helm/capif/charts/ocf-api-invoker-management/values.yaml index 4b19037c..0fbda233 100644 --- a/helm/capif/charts/ocf-api-invoker-management/values.yaml +++ b/helm/capif/charts/ocf-api-invoker-management/values.yaml @@ -16,6 +16,7 @@ fullnameOverride: "" env: monitoring: "true" + capifHostname: capif vaultHostname: vault vaultPort: 8200 vaultAccessToken: dev-only-token diff --git a/helm/capif/charts/ocf-api-provider-management/templates/deployment.yaml b/helm/capif/charts/ocf-api-provider-management/templates/deployment.yaml index 7f95b9d6..b335dc75 100644 --- a/helm/capif/charts/ocf-api-provider-management/templates/deployment.yaml +++ b/helm/capif/charts/ocf-api-provider-management/templates/deployment.yaml @@ -42,6 +42,8 @@ spec: env: - name: MONITORING value: {{ quote .Values.env.monitoring }} + - name: CAPIF_HOSTNAME + value: {{ quote .Values.env.capifHostname }} - name: VAULT_HOSTNAME value: {{ quote .Values.env.vaultHostname }} - name: VAULT_PORT diff --git a/helm/capif/charts/ocf-api-provider-management/values.yaml b/helm/capif/charts/ocf-api-provider-management/values.yaml index 18225264..b38cb0fd 100644 --- a/helm/capif/charts/ocf-api-provider-management/values.yaml +++ b/helm/capif/charts/ocf-api-provider-management/values.yaml @@ -16,6 +16,7 @@ fullnameOverride: "" env: monitoring: "true" + capifHostname: capif vaultHostname: vault vaultPort: 8200 vaultAccessToken: dev-only-token diff --git a/helm/capif/charts/ocf-auditing-api-logs/templates/deployment.yaml b/helm/capif/charts/ocf-auditing-api-logs/templates/deployment.yaml index 8248606b..32f3ac26 100644 --- a/helm/capif/charts/ocf-auditing-api-logs/templates/deployment.yaml +++ b/helm/capif/charts/ocf-auditing-api-logs/templates/deployment.yaml @@ -40,10 +40,10 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP env: - - name: MONITORING - value: {{ quote .Values.env.monitoring }} - - name: LOG_LEVEL - value: {{ quote .Values.env.logLevel }} + - name: MONITORING + value: {{ quote .Values.env.monitoring }} + - name: LOG_LEVEL + value: {{ quote .Values.env.logLevel }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/capif/charts/ocf-events/templates/deployment.yaml b/helm/capif/charts/ocf-events/templates/deployment.yaml index 50b58cc9..e550d6f6 100644 --- a/helm/capif/charts/ocf-events/templates/deployment.yaml +++ b/helm/capif/charts/ocf-events/templates/deployment.yaml @@ -40,10 +40,12 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP env: - - name: MONITORING - value: {{ quote .Values.env.monitoring }} - - name: LOG_LEVEL - value: {{ quote .Values.env.logLevel }} + - name: MONITORING + value: {{ quote .Values.env.monitoring }} + - name: CAPIF_HOSTNAME + value: {{ quote .Values.env.capifHostname }} + - name: LOG_LEVEL + value: {{ quote .Values.env.logLevel }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/capif/charts/ocf-events/values.yaml b/helm/capif/charts/ocf-events/values.yaml index 9fb7b06d..0b145db0 100644 --- a/helm/capif/charts/ocf-events/values.yaml +++ b/helm/capif/charts/ocf-events/values.yaml @@ -16,6 +16,7 @@ fullnameOverride: "" env: monitoring: "true" + capifHostname: capif mongoInitdbRootUsername: root mongoInitdbRootPassword: example logLevel: "INFO" diff --git a/helm/capif/charts/ocf-publish-service-api/templates/deployment.yaml b/helm/capif/charts/ocf-publish-service-api/templates/deployment.yaml index ceced651..7df0807d 100644 --- a/helm/capif/charts/ocf-publish-service-api/templates/deployment.yaml +++ b/helm/capif/charts/ocf-publish-service-api/templates/deployment.yaml @@ -40,10 +40,12 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP env: - - name: MONITORING - value: {{ quote .Values.env.monitoring }} - - name: LOG_LEVEL - value: {{ quote .Values.env.logLevel }} + - name: MONITORING + value: {{ quote .Values.env.monitoring }} + - name: CAPIF_HOSTNAME + value: {{ quote .Values.env.capifHostname }} + - name: LOG_LEVEL + value: {{ quote .Values.env.logLevel }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/capif/charts/ocf-publish-service-api/values.yaml b/helm/capif/charts/ocf-publish-service-api/values.yaml index 0e243db2..f22c2b28 100644 --- a/helm/capif/charts/ocf-publish-service-api/values.yaml +++ b/helm/capif/charts/ocf-publish-service-api/values.yaml @@ -16,6 +16,7 @@ fullnameOverride: "" env: monitoring: "true" + capifHostname: capif mongoInitdbRootUsername: root mongoInitdbRootPassword: example logLevel: "INFO" diff --git a/helm/capif/charts/ocf-register/templates/deployment.yaml b/helm/capif/charts/ocf-register/templates/deployment.yaml index ffe49edc..6ab2477d 100644 --- a/helm/capif/charts/ocf-register/templates/deployment.yaml +++ b/helm/capif/charts/ocf-register/templates/deployment.yaml @@ -43,14 +43,14 @@ spec: containerPort: {{ .Values.service.port }} protocol: TCP env: - - name: VAULT_HOSTNAME - value: {{ quote .Values.env.vaultHostname }} - - name: VAULT_PORT - value: {{ quote .Values.env.vaultPort }} - - name: VAULT_ACCESS_TOKEN - value: {{ quote .Values.env.vaultAccessToken }} - - name: LOG_LEVEL - value: {{ quote .Values.env.logLevel }} + - name: VAULT_HOSTNAME + value: {{ quote .Values.env.vaultHostname }} + - name: VAULT_PORT + value: {{ quote .Values.env.vaultPort }} + - name: VAULT_ACCESS_TOKEN + value: {{ quote .Values.env.vaultAccessToken }} + - name: LOG_LEVEL + value: {{ quote .Values.env.logLevel }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/scripts/install_capif.sh b/helm/scripts/install_capif.sh index 11614cde..74b1146a 100755 --- a/helm/scripts/install_capif.sh +++ b/helm/scripts/install_capif.sh @@ -43,6 +43,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-api-invoker-management.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-api-invoker-management-api \ --set ocf-api-invoker-management.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-api-invoker-management.env.monitoring="true" \ +--set ocf-api-invoker-management.env.capifHostname=$CAPIF_HOSTNAME \ --set ocf-api-invoker-management.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ --set ocf-api-invoker-management.env.vaultPort=$VAULT_PORT \ --set ocf-api-invoker-management.env.vaultAccessToken=$VAULT_ACCESS_TOKEN \ @@ -50,6 +51,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-api-provider-management.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-api-provider-management-api \ --set ocf-api-provider-management.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-api-provider-management.env.monitoring="true" \ +--set ocf-api-provider-management.env.capifHostname=$CAPIF_HOSTNAME \ --set ocf-api-provider-management.env.vaultHostname=$VAULT_INTERNAL_HOSTNAME \ --set ocf-api-provider-management.env.logLevel="DEBUG" \ --set ocf-api-provider-management.env.vaultPort=$VAULT_PORT \ @@ -57,6 +59,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-events.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-events-api \ --set ocf-events.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-events.env.monitoring="true" \ +--set ocf-events.env.capifHostname=$CAPIF_HOSTNAME \ --set ocf-events.env.logLevel="DEBUG" \ --set ocf-routing-info.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-routing-info-api \ --set ocf-routing-info.image.tag=$CAPIF_IMAGE_TAG \ @@ -92,6 +95,7 @@ helm $KUBECONFIG upgrade --install -n $CAPIF_NAMESPACE $CAPIF_NAME_VERSION_CHART --set ocf-publish-service-api.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-publish-service-api \ --set ocf-publish-service-api.image.tag=$CAPIF_IMAGE_TAG \ --set ocf-publish-service-api.env.monitoring="true" \ +--set ocf-publish-service-api.env.capifHostname=$CAPIF_HOSTNAME \ --set ocf-publish-service-api.env.logLevel="DEBUG" \ --set ocf-discover-service-api.image.repository=$CAPIF_DOCKER_REGISTRY/ocf-discover-service-api \ --set ocf-discover-service-api.image.tag=$CAPIF_IMAGE_TAG \ -- GitLab From a56a1237c37cc2bc0c5b0ba8e2bff66b98baa4da Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Fri, 17 Jan 2025 09:37:35 +0100 Subject: [PATCH 2/6] Add some testing logs --- .../register/register_service/core/register_operations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/register/register_service/core/register_operations.py b/services/register/register_service/core/register_operations.py index 7fa99ec6..db1b2755 100644 --- a/services/register/register_service/core/register_operations.py +++ b/services/register/register_service/core/register_operations.py @@ -73,10 +73,12 @@ class RegisterOperations: mycol = self.db.get_col_by_name(self.db.capif_users) try: - + current_app.logger.debug(f"Request Helper service to remove user related information") url = f"https://{self.config["ccf"]["url"]}{self.config["ccf"]["helper_remove_user"]}{uuid}" + current_app.logger.debug(f"Url {url}") requests.delete(url, cert=("certs/superadmin.crt", "certs/superadmin.key"), verify="certs/ca_root.crt", timeout=int(os.getenv("TIMEOUT"))) + current_app.logger.debug(f"Removing User with uuid {uuid} from db") mycol.delete_one({"uuid": uuid}) current_app.logger.debug(f"User with uuid {uuid} removed successfully") return jsonify(message="User removed successfully"), 204 -- GitLab From 1ef2e9a27e60cbc31cc458646b0a20bf3361eb0a Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Fri, 17 Jan 2025 12:55:06 +0100 Subject: [PATCH 3/6] Add some testing logs --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b90f2bf3..7754eca5 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ or http://:8083/ (if accessed from another host) ``` + # FAQ Documentation Frequently asked questions can be found here: [FAQ Directory] -- GitLab From aaa5280223837b77ae9cb6167b231aa9a1eee430 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Fri, 17 Jan 2025 13:28:23 +0100 Subject: [PATCH 4/6] just push --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7754eca5..74a32c28 100644 --- a/README.md +++ b/README.md @@ -159,3 +159,4 @@ Frequently asked questions can be found here: [FAQ Directory] [Testing with Robot Framework]: ./docs/testing_with_robot/README.md "Testing with Robot Framework" [FAQ Directory]: https://ocf.etsi.org/documentation/latest/FAQ/ "FAQ Url" [OCF Documentation]: https://ocf.etsi.org/documentation/latest/ "OCF Documentation" + -- GitLab From 623bfb1c68142f758feb666b30fdb6c9dc8971b6 Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Fri, 17 Jan 2025 13:54:17 +0100 Subject: [PATCH 5/6] setup default TIMEOUT for some request --- .../TS29222_CAPIF_Events_API/capif_events/core/notifications.py | 2 +- .../capif_security/core/notification.py | 2 +- services/register/register_service/core/register_operations.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py b/services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py index 37aab4b3..6288c338 100644 --- a/services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py +++ b/services/TS29222_CAPIF_Events_API/capif_events/core/notifications.py @@ -67,7 +67,7 @@ class Notifications(): def request_post(self, url, data): headers = {'content-type': 'application/json'} - return requests.post(url, json={'text': str(data.to_str())}, headers=headers, timeout=os.getenv("TIMEOUT")) + return requests.post(url, json={'text': str(data.to_str())}, headers=headers, timeout=os.getenv("TIMEOUT", "30")) async def send_request(self, url, data): async with aiohttp.ClientSession() as session: diff --git a/services/TS29222_CAPIF_Security_API/capif_security/core/notification.py b/services/TS29222_CAPIF_Security_API/capif_security/core/notification.py index 16618da5..60715592 100644 --- a/services/TS29222_CAPIF_Security_API/capif_security/core/notification.py +++ b/services/TS29222_CAPIF_Security_API/capif_security/core/notification.py @@ -11,4 +11,4 @@ class Notifications(): def request_post(self, url, data): headers = {'content-type': 'application/json'} - return requests.post(url, json={'text': str(data.to_str())}, headers=headers, timeout=int(os.getenv("TIMEOUT"))) \ No newline at end of file + return requests.post(url, json={'text': str(data.to_str())}, headers=headers, timeout=int(os.getenv("TIMEOUT", "30"))) diff --git a/services/register/register_service/core/register_operations.py b/services/register/register_service/core/register_operations.py index db1b2755..937ce0bd 100644 --- a/services/register/register_service/core/register_operations.py +++ b/services/register/register_service/core/register_operations.py @@ -76,7 +76,7 @@ class RegisterOperations: current_app.logger.debug(f"Request Helper service to remove user related information") url = f"https://{self.config["ccf"]["url"]}{self.config["ccf"]["helper_remove_user"]}{uuid}" current_app.logger.debug(f"Url {url}") - requests.delete(url, cert=("certs/superadmin.crt", "certs/superadmin.key"), verify="certs/ca_root.crt", timeout=int(os.getenv("TIMEOUT"))) + requests.delete(url, cert=("certs/superadmin.crt", "certs/superadmin.key"), verify="certs/ca_root.crt", timeout=int(os.getenv("TIMEOUT", "30"))) current_app.logger.debug(f"Removing User with uuid {uuid} from db") mycol.delete_one({"uuid": uuid}) -- GitLab From c50bf813d376b733dfced092a471d53dc5764e9e Mon Sep 17 00:00:00 2001 From: Jorge Moratinos Salcines Date: Fri, 17 Jan 2025 14:00:54 +0100 Subject: [PATCH 6/6] Updated TIMEOUT variable on register, events and security --- helm/capif/charts/ocf-events/templates/deployment.yaml | 2 ++ helm/capif/charts/ocf-events/values.yaml | 1 + helm/capif/charts/ocf-register/templates/deployment.yaml | 2 ++ helm/capif/charts/ocf-register/values.yaml | 1 + helm/capif/charts/ocf-security/templates/deployment.yaml | 2 ++ helm/capif/charts/ocf-security/values.yaml | 1 + 6 files changed, 9 insertions(+) diff --git a/helm/capif/charts/ocf-events/templates/deployment.yaml b/helm/capif/charts/ocf-events/templates/deployment.yaml index e550d6f6..90933d3b 100644 --- a/helm/capif/charts/ocf-events/templates/deployment.yaml +++ b/helm/capif/charts/ocf-events/templates/deployment.yaml @@ -46,6 +46,8 @@ spec: value: {{ quote .Values.env.capifHostname }} - name: LOG_LEVEL value: {{ quote .Values.env.logLevel }} + - name: TIMEOUT + value: {{ quote .Values.env.timeout }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/capif/charts/ocf-events/values.yaml b/helm/capif/charts/ocf-events/values.yaml index 0b145db0..56e03a9d 100644 --- a/helm/capif/charts/ocf-events/values.yaml +++ b/helm/capif/charts/ocf-events/values.yaml @@ -20,6 +20,7 @@ env: mongoInitdbRootUsername: root mongoInitdbRootPassword: example logLevel: "INFO" + timeout: "30" serviceAccount: # Specifies whether a service account should be created diff --git a/helm/capif/charts/ocf-register/templates/deployment.yaml b/helm/capif/charts/ocf-register/templates/deployment.yaml index 6ab2477d..23ef72ca 100644 --- a/helm/capif/charts/ocf-register/templates/deployment.yaml +++ b/helm/capif/charts/ocf-register/templates/deployment.yaml @@ -51,6 +51,8 @@ spec: value: {{ quote .Values.env.vaultAccessToken }} - name: LOG_LEVEL value: {{ quote .Values.env.logLevel }} + - name: TIMEOUT + value: {{ quote .Values.env.timeout }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/capif/charts/ocf-register/values.yaml b/helm/capif/charts/ocf-register/values.yaml index 71b49d93..1773a6b8 100644 --- a/helm/capif/charts/ocf-register/values.yaml +++ b/helm/capif/charts/ocf-register/values.yaml @@ -22,6 +22,7 @@ env: vaultAccessToken: dev-only-token capifHostname: capif-test.example.int logLevel: "INFO" + timeout: "30" serviceAccount: # Specifies whether a service account should be created diff --git a/helm/capif/charts/ocf-security/templates/deployment.yaml b/helm/capif/charts/ocf-security/templates/deployment.yaml index 48ab7640..dd0805c6 100644 --- a/helm/capif/charts/ocf-security/templates/deployment.yaml +++ b/helm/capif/charts/ocf-security/templates/deployment.yaml @@ -52,6 +52,8 @@ spec: value: {{ quote .Values.env.vaultAccessToken }} - name: LOG_LEVEL value: {{ quote .Values.env.logLevel }} + - name: TIMEOUT + value: {{ quote .Values.env.timeout }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/helm/capif/charts/ocf-security/values.yaml b/helm/capif/charts/ocf-security/values.yaml index cdccc702..ab77f812 100644 --- a/helm/capif/charts/ocf-security/values.yaml +++ b/helm/capif/charts/ocf-security/values.yaml @@ -23,6 +23,7 @@ env: mongoInitdbRootUsername: root mongoInitdbRootPassword: example logLevel: "INFO" + timeout: "30" serviceAccount: # Specifies whether a service account should be created -- GitLab