Commit bfb97c64 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'rename_endpoint_to_align_with_agenk_modules' into 'master'

Rename internal API endpoint

See merge request gitlab-org/gitlab!50703
parents 78bbe251 f94a76b2
...@@ -459,11 +459,11 @@ Cluster. ...@@ -459,11 +459,11 @@ Cluster.
| `alert` | Hash | yes | Alerts detail. Currently same format as [3rd party alert](../operations/incident_management/alert_integrations.md#customize-the-alert-payload-outside-of-gitlab). | | `alert` | Hash | yes | Alerts detail. Currently same format as [3rd party alert](../operations/incident_management/alert_integrations.md#customize-the-alert-payload-outside-of-gitlab). |
```plaintext ```plaintext
POST internal/kubernetes/modules/cilium/network_alert POST internal/kubernetes/modules/cilium_alert
``` ```
Example Request: Example Request:
```shell ```shell
curl --request POST --header "Gitlab-Kas-Api-Request: <JWT token>" --header "Authorization: Bearer <agent token>" --header "Content-Type: application/json" --data '"{\"alert\":{\"title\":\"minimal\",\"message\":\"network problem\",\"evalMatches\":[{\"value\":1,\"metric\":\"Count\",\"tags\":{}}]}}"' "http://localhost:3000/api/v4/internal/kubernetes/modules/cilium/network_alert" curl --request POST --header "Gitlab-Kas-Api-Request: <JWT token>" --header "Authorization: Bearer <agent token>" --header "Content-Type: application/json" --data '"{\"alert\":{\"title\":\"minimal\",\"message\":\"network problem\",\"evalMatches\":[{\"value\":1,\"metric\":\"Count\",\"tags\":{}}]}}"' "http://localhost:3000/api/v4/internal/kubernetes/modules/cilium_alert"
``` ```
---
title: Rename internal api endpoint in order align it with the new logic shared among
agentk modules.
merge_request: 50703
author:
type: changed
...@@ -9,7 +9,7 @@ module EE ...@@ -9,7 +9,7 @@ module EE
namespace 'kubernetes' do namespace 'kubernetes' do
before { check_agent_token } before { check_agent_token }
namespace 'modules/cilium/network_alert' do namespace 'modules/cilium_alert' do
desc 'POST network alerts' do desc 'POST network alerts' do
detail 'Creates network alert' detail 'Creates network alert'
end end
...@@ -25,7 +25,7 @@ module EE ...@@ -25,7 +25,7 @@ module EE
forbidden! unless project.feature_available?(:cilium_alerts) forbidden! unless project.feature_available?(:cilium_alerts)
result = ::AlertManagement::NetworkAlertService.new(agent.project, params[:alert]).execute result = ::AlertManagement::NetworkAlertService.new(project, params[:alert]).execute
status result.http_status status result.http_status
end end
......
...@@ -51,9 +51,9 @@ RSpec.describe API::Internal::Kubernetes do ...@@ -51,9 +51,9 @@ RSpec.describe API::Internal::Kubernetes do
end end
end end
describe 'POST /internal/kubernetes/modules/cilium/network_alert' do describe 'POST /internal/kubernetes/modules/cilium_alert' do
def send_request(headers: {}, params: {}) def send_request(headers: {}, params: {})
post api('/internal/kubernetes/modules/cilium/network_alert'), params: params, headers: headers.reverse_merge(jwt_auth_headers) post api('/internal/kubernetes/modules/cilium_alert'), params: params, headers: headers.reverse_merge(jwt_auth_headers)
end end
include_examples 'authorization' include_examples 'authorization'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment