Skip to content

Refactor API-Platform GW setup#768

Open
AnoshanJ wants to merge 18 commits intowso2:mainfrom
AnoshanJ:feat/unify-gw
Open

Refactor API-Platform GW setup#768
AnoshanJ wants to merge 18 commits intowso2:mainfrom
AnoshanJ:feat/unify-gw

Conversation

@AnoshanJ
Copy link
Copy Markdown
Contributor

@AnoshanJ AnoshanJ commented Apr 28, 2026

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

The platform used two separate gateways (obs-gateway for trace ingestion and wso2-amp-ai-gateway-extension for AI gateway registration) that are redundant — both use the same operator, CRDs, and namespace. The obs-gateway was a raw CR with no Agent Manager registration or bootstrap pattern, and its configuration was scattered across static YAML files applied via kubectl apply instead of being managed through Helm.

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

  • Unify into a single gateway: Replace both obs-gateway and wso2-amp-ai-gateway-extension with a new wso2-amp-api-platform-gateway-extension Helm chart that serves as the single API Platform Gateway for both ingress (agent traffic) and egress (trace ingestion)
  • Adopt bootstrap pattern: The new chart includes a bootstrap job that registers the gateway with Agent Manager and generates a token, matching the pattern established by the AI gateway extension
  • Consolidate configuration into Helm values: Gateway operator config (JWT auth, key managers, rate limiting) is now part of the chart's values.yaml and rendered via gateway-config.yaml template, eliminating the need for separate ConfigMap files
  • Make trait backend configurable: The api-management trait template now uses Helm-templated gateway.backendHost/gateway.backendPort values instead of a hardcoded obs-gateway service name
  • Update console for regular gateway type: The Organization Gateway UI now handles regular type gateways alongside ai type
  • Remove obsolete artifacts: Delete obs-gateway.yaml, api-platform-operator-full-config.yaml, api-platform-operator-local-config.yaml, and the old wso2-amp-ai-gateway-extension chart
  • Update all references: OTEL exporter endpoints, setup scripts, port-forward scripts, quick-start installer, release config, and documentation all point to the new unified gateway (a

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features

    • Added API Platform Gateway Helm chart and bootstrap/install flow.
  • Chores

    • New setup sequence: run port-forward in a separate terminal, then run the gateway setup.
    • Updated tracing/observability endpoints and renamed the traces API to amp-otel-collector-tracing-rest-api.
    • Gateway UI renamed from “AI Gateways” to “Gateways”; list now shows all gateways with a Type column and updated labels/placeholders.

AnoshanJ added 11 commits April 28, 2026 11:52
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

📝 Walkthrough

Walkthrough

Introduces an API Platform Gateway flow: adds a new Helm chart and bootstrap Job, updates configs and scripts to install and manage the API Platform Gateway, replaces observability gateway artifacts, and adds a Makefile target plus orchestration scripts for gateway setup and port-forwarding.

Changes

Cohort / File(s) Summary
Makefile / Setup scripts
Makefile, deployments/scripts/setup-gateway.sh, deployments/scripts/setup-openchoreo.sh, deployments/quick-start/install.sh, deployments/quick-start/install-helpers.sh
Adds setup-gateway make target and script; shifts gateway provisioning from static kubectl applies to Helm-driven installation; defers some gateway installs; updates install flow and messaging.
New Helm chart: API Platform Gateway Extension
deployments/helm-charts/wso2-amp-api-platform-gateway-extension/Chart.yaml, .../templates/_helpers.tpl, .../templates/gateway-bootstrap-job.yaml, .../templates/gateway-config.yaml, .../templates/gateway-cr.yaml, .../values.yaml, .../values-dev.yaml
Adds chart metadata, helpers, bootstrap Job for registration/token provisioning, templated ConfigMap/CR, security contexts, and comprehensive values for bootstrapping and runtime.
Platform resources / Trait parameterization
deployments/helm-charts/wso2-amp-platform-resources-extension/templates/component-traits/api-management-trait.yaml, deployments/helm-charts/wso2-amp-platform-resources-extension/values.yaml
Replaces hardcoded gateway backend host/port with configurable gateway.backendHost/gateway.backendPort values.
Observability / OTEL updates
agent-manager-service/config/config_loader.go, deployments/helm-charts/wso2-agent-manager/values.yaml, deployments/values/otel-collector-rest-api.yaml, deployments/scripts/port-forward.sh, deployments/values/obs-gateway.yaml
Redirects OTEL exporter endpoints to API Platform Gateway host; renames OTEL RestApi resource; updates port-forward to target api-platform-default-default service; removes obs-gateway APIGateway manifest.
Release config / compose
.github/release-config.json, deployments/docker-compose.yml
Replaces AI-gateway chart reference with API Platform Gateway chart in release config; updates docker-compose extra_hosts to resolve api-platform-gateway.amp.localhost.
Console UI — Gateways pages
console/workspaces/libs/types/src/api/gateways.ts, console/workspaces/pages/gateways/src/* (AddAIGateway.Organization.tsx, Gateways.Organization.tsx, index.ts, subComponents/*)
Renames UI copy from “AI Gateway(s)” to generic “Gateway(s)”; broadens GatewayType to include lowercase variants; removes AI-only listing filter and adds Type column + chips; minor placeholder/text updates.
Quick-start / Docs
documentation/docs/getting-started/_partials/_amp-installation.mdx, documentation/docs/getting-started/on-k3d.mdx, documentation/docs/getting-started/on-your-environment.mdx
Removes inline GwOperatorConfig helper and inline gateway deploy steps; documents deferral to API Platform Gateway extension (renamed Step 7); updates port-forward instructions, TLS troubleshooting, and artifact references to new chart and resource names.

Sequence Diagram

sequenceDiagram
    participant User
    participant Setup as setup-gateway.sh
    participant AgentMgr as Agent Manager
    participant Thunder as Thunder IDP
    participant APIPlatform as API Platform (APIGateway)
    participant K8s as Kubernetes

    User->>Setup: run setup-gateway.sh
    Setup->>AgentMgr: poll /healthz (60s timeout)
    AgentMgr-->>Setup: healthy
    Setup->>Thunder: request JWT (client creds)
    Thunder-->>Setup: JWT
    Setup->>APIPlatform: check gateway exists
    APIPlatform-->>Setup: not found / needs registration
    Setup->>APIPlatform: register gateway & request token
    APIPlatform-->>Setup: registration token
    Setup->>K8s: create Secret (token) in openchoreo-data-plane
    K8s-->>Setup: Secret created
    Setup->>K8s: install Helm chart & wait for APIGateway Programmed (180s)
    K8s-->>Setup: Programmed / ready
    Setup->>User: success (port-forward + apply OTEL manifest)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

🐰 I nibble charts and bootstrap seeds,
I hop from obs to platform deeds,
Scripts hum, tokens safely kept,
Helm sings while resources are prepped,
A tiny rabbit cheers this leap! 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description is incomplete with only section headers and template placeholders; critical sections like Goals, Approach, User stories, Release note, Documentation, and others lack substantive content. Complete all required template sections with detailed information: describe the goals, implementation approach, affected user stories, release notes, documentation links, testing details, security confirmations, and any migration steps needed.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Refactor API-Platform GW setup' directly describes a main architectural change visible across the PR: replacing the AI Gateway and Observability Gateway setup with a unified API Platform Gateway extension.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
deployments/scripts/setup-openchoreo.sh (1)

365-390: ⚠️ Potential issue | 🟠 Major

Scope RBAC verbs to least privilege instead of wildcard *.

verbs: ["*"] for restapis, apigateways, and backends grants unnecessary cluster-wide mutation power to cluster-agent-dataplane. Please narrow this to required verbs.

🔒 Suggested RBAC tightening
 rules:
   - apiGroups: ["gateway.api-platform.wso2.com"]
     resources: ["restapis", "apigateways"]
-    verbs: ["*"]
+    verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
   - apiGroups: ["gateway.kgateway.dev"]
     resources: ["backends"]
-    verbs: ["*"]
+    verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/scripts/setup-openchoreo.sh` around lines 365 - 390, Replace the
wildcard verbs in the ClusterRole named wso2-api-platform-gateway-module: update
the rules for resources "restapis" and "apigateways" (apiGroup
"gateway.api-platform.wso2.com") and "backends" (apiGroup
"gateway.kgateway.dev") to use least-privilege verb lists instead of ["*"]; for
example, restrict read-only operations to ["get","list","watch"] and scope
mutation verbs to only those actually required (e.g.,
["create","update","patch","delete"] as needed) so that the ServiceAccount
cluster-agent-dataplane in namespace openchoreo-data-plane only receives the
minimal necessary permissions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/_helpers.tpl`:
- Around line 56-61: The template define
"wso2-amp-gateway-extension.apiGatewayName" can emit mixed/upper-case components
(.Values.agentManager.orgName and .Values.gateway.environment) which may violate
DNS-1123; update the printf pipeline to apply the lower filter to those
components (and ensure the final result is lowercased) before
truncation/trimSuffix so the generated name always uses lowercase characters
while preserving the existing fallback on .Values.gateway.name.
- Around line 75-102: The templates "wso2-amp-gateway-extension.idpClientIdEnv"
and "wso2-amp-gateway-extension.idpClientSecretEnv" currently reference
.Values.agentManager.idp.existingSecretClientIdKey and
.Values.agentManager.idp.existingSecretClientSecretKey without validation;
update the secretKeyRef.key usages to wrap those values with the Helm required
function (e.g. required "message"
.Values.agentManager.idp.existingSecretClientIdKey) when
.Values.agentManager.idp.existingSecret is true so Helm fails with a clear error
if the key is unset, and provide a descriptive error string for each required
call to indicate which key is missing.

In
`@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-config.yaml`:
- Line 34: The template currently hardcodes insecure_skip_verify: true in
gateway-config.yaml which disables TLS verification; change the template to not
hardcode this value and instead read a values key (e.g.,
apiGateway.controlPlane.tls.insecureSkipVerify) so operators can set it; update
gateway-config.yaml to use the chart value for insecure_skip_verify and add
insecureSkipVerify: false as the default in values.yaml under
apiGateway.controlPlane.tls to preserve secure defaults.

In `@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/values.yaml`:
- Around line 26-34: Remove the plaintext default by clearing the hardcoded
idp.clientSecret value and rely on idp.existingSecret (and
idp.existingSecretClientIdKey / idp.existingSecretClientSecretKey) for
production; update the values under the idp section so clientSecret is empty and
add a comment indicating that existingSecret should be used instead of shipping
a default secret (referencing idp.clientSecret, idp.existingSecret,
idp.existingSecretClientIdKey, idp.existingSecretClientSecretKey).

In `@deployments/scripts/port-forward.sh`:
- Around line 58-64: The summary block later still advertises the old
"Observability Gateway" link; update that banner to reference "API Platform
Gateway" and its new ports (HTTP 22893 and HTTPS 22894) so the printed URLs
match the port-forward commands that target
svc/api-platform-default-default-gateway-gateway-runtime; find the
summary/summary-printing section that mentions "Observability Gateway" and
replace the label and port numbers/URLs accordingly (ensure both HTTP and HTTPS
entries match 22893 and 22894).

In `@deployments/scripts/setup-gateway.sh`:
- Around line 45-49: The script currently prints a success message immediately
after launching kubectl port-forward into the background (using
PORT_FORWARD_PID) without verifying it started correctly; modify the block that
runs kubectl port-forward to capture its PID (PORT_FORWARD_PID), wait a short
period, then check that the process is still running and that kubectl did not
exit with an error (e.g., test the PID with kill -0 or check the process exists
and/or inspect the command's exit status), and if the check fails, print an
error and exit non‑zero; ensure the success echo ("✅ Port-forward established")
only runs when the liveness check of PORT_FORWARD_PID confirms the port-forward
is alive.
- Around line 53-55: The kubectl readiness check is waiting for the wrong
RestApi resource name; update the kubectl wait invocation that currently targets
"restapi/traces-api-secure" to wait on
"restapi/amp-otel-collector-tracing-rest-api" (the resource created by the otel
manifest) and adjust the corresponding success message to match that resource
name so the script recognizes the actual programmed API.

In `@deployments/values/otel-collector-rest-api.yaml`:
- Around line 4-7: The deployment manifest renamed the RestApi to
amp-otel-collector-tracing-rest-api but the bootstrap script still waits on
restapi/traces-api-secure; update deployments/scripts/setup-gateway.sh so its
wait/ready check targets the new RestApi name
(amp-otel-collector-tracing-rest-api) instead of restapi/traces-api-secure,
ensuring any kubectl/oc wait or resource polling logic references the new
resource identifier and namespace openchoreo-data-plane.

In `@Makefile`:
- Around line 50-60: The post-setup printed "Next steps" order is reversed
causing users to run make port-forward before the gateway exists; update the
Makefile echo block so the recommended sequence shows "1. make setup-gateway"
first and "2. make port-forward" second (refer to the echo lines that print "📊
Next steps — install the API Platform Gateway:" and the two following echo lines
listing "make port-forward" and "make setup-gateway") so users run setup-gateway
before port-forward.

---

Outside diff comments:
In `@deployments/scripts/setup-openchoreo.sh`:
- Around line 365-390: Replace the wildcard verbs in the ClusterRole named
wso2-api-platform-gateway-module: update the rules for resources "restapis" and
"apigateways" (apiGroup "gateway.api-platform.wso2.com") and "backends"
(apiGroup "gateway.kgateway.dev") to use least-privilege verb lists instead of
["*"]; for example, restrict read-only operations to ["get","list","watch"] and
scope mutation verbs to only those actually required (e.g.,
["create","update","patch","delete"] as needed) so that the ServiceAccount
cluster-agent-dataplane in namespace openchoreo-data-plane only receives the
minimal necessary permissions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8fd95062-fe0b-4522-a27f-138b51508a98

📥 Commits

Reviewing files that changed from the base of the PR and between abc5b15 and a4f64b3.

📒 Files selected for processing (18)
  • Makefile
  • agent-manager-service/config/config_loader.go
  • deployments/helm-charts/wso2-agent-manager/values.yaml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/Chart.yaml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/_helpers.tpl
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-bootstrap-job.yaml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-config.yaml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-cr.yaml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/values-dev.yaml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/values.yaml
  • deployments/helm-charts/wso2-amp-platform-resources-extension/templates/component-traits/api-management-trait.yaml
  • deployments/helm-charts/wso2-amp-platform-resources-extension/values.yaml
  • deployments/quick-start/install.sh
  • deployments/scripts/port-forward.sh
  • deployments/scripts/setup-gateway.sh
  • deployments/scripts/setup-openchoreo.sh
  • deployments/values/obs-gateway.yaml
  • deployments/values/otel-collector-rest-api.yaml
💤 Files with no reviewable changes (1)
  • deployments/values/obs-gateway.yaml

Comment on lines +56 to +61
{{- define "wso2-amp-gateway-extension.apiGatewayName" -}}
{{- if .Values.gateway.name }}
{{- .Values.gateway.name }}
{{- else }}
{{- printf "api-platform-%s-%s" .Values.agentManager.orgName .Values.gateway.environment | trunc 63 | trimSuffix "-" }}
{{- end }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n --context 3 'orgName|environment|apiGatewayName|gateway\.name|pattern' deployments/helm-charts/wso2-amp-api-platform-gateway-extension
fd -t f 'values.schema.json' deployments/helm-charts/wso2-amp-api-platform-gateway-extension

Repository: wso2/agent-manager

Length of output: 14368


Add lower filter to sanitize APIGateway name components.

agentManager.orgName and gateway.environment lack validation constraints in the values schema, so uppercase or mixed-case inputs will produce invalid Kubernetes resource names. Apply the lowercase filter to ensure the generated name always conforms to DNS-1123 requirements.

Fix
-{{- printf "api-platform-%s-%s" .Values.agentManager.orgName .Values.gateway.environment | trunc 63 | trimSuffix "-" }}
+{{- printf "api-platform-%s-%s" .Values.agentManager.orgName .Values.gateway.environment | lower | trunc 63 | trimSuffix "-" }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- define "wso2-amp-gateway-extension.apiGatewayName" -}}
{{- if .Values.gateway.name }}
{{- .Values.gateway.name }}
{{- else }}
{{- printf "api-platform-%s-%s" .Values.agentManager.orgName .Values.gateway.environment | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "wso2-amp-gateway-extension.apiGatewayName" -}}
{{- if .Values.gateway.name }}
{{- .Values.gateway.name }}
{{- else }}
{{- printf "api-platform-%s-%s" .Values.agentManager.orgName .Values.gateway.environment | lower | trunc 63 | trimSuffix "-" }}
{{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/_helpers.tpl`
around lines 56 - 61, The template define
"wso2-amp-gateway-extension.apiGatewayName" can emit mixed/upper-case components
(.Values.agentManager.orgName and .Values.gateway.environment) which may violate
DNS-1123; update the printf pipeline to apply the lower filter to those
components (and ensure the final result is lowercased) before
truncation/trimSuffix so the generated name always uses lowercase characters
while preserving the existing fallback on .Values.gateway.name.

Comment on lines +75 to +102
{{- define "wso2-amp-gateway-extension.idpClientIdEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ .Values.agentManager.idp.existingSecretClientIdKey }}
{{- else }}
- name: IDP_CLIENT_ID
value: {{ .Values.agentManager.idp.clientId | quote }}
{{- end }}
{{- end }}

{{/*
Resolve the IDP client secret from secret or direct value
*/}}
{{- define "wso2-amp-gateway-extension.idpClientSecretEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ .Values.agentManager.idp.existingSecretClientSecretKey }}
{{- else }}
- name: IDP_CLIENT_SECRET
value: {{ .Values.agentManager.idp.clientSecret | quote }}
{{- end }}
{{- end }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n --context 3 'existingSecretClientIdKey|existingSecretClientSecretKey|existingSecret|idp:' deployments/helm-charts/wso2-amp-api-platform-gateway-extension
fd -t f 'values.schema.json' deployments/helm-charts/wso2-amp-api-platform-gateway-extension

Repository: wso2/agent-manager

Length of output: 5016


🏁 Script executed:

# Search for any schema or validation files in the chart
find deployments/helm-charts/wso2-amp-api-platform-gateway-extension -type f \( -name "*.json" -o -name "Chart.yaml" -o -name "*.md" \) | head -20

Repository: wso2/agent-manager

Length of output: 137


🏁 Script executed:

# Look for any validation or documentation related to the IDP configuration
rg -n "existingSecret|idp|schema|required" deployments/helm-charts/wso2-amp-api-platform-gateway-extension/Chart.yaml deployments/helm-charts/wso2-amp-api-platform-gateway-extension/README.md 2>/dev/null || echo "No matches or files not found"

Repository: wso2/agent-manager

Length of output: 92


🏁 Script executed:

# Check the full values.yaml structure to understand dependency relationships
cat -n deployments/helm-charts/wso2-amp-api-platform-gateway-extension/values.yaml | head -50

Repository: wso2/agent-manager

Length of output: 2780


🏁 Script executed:

# See if there are any other templates that use these values and how they handle validation
rg -n "existingSecretClientIdKey|existingSecretClientSecretKey" deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates

Repository: wso2/agent-manager

Length of output: 382


Use required to validate secret key names when existingSecret is enabled.

When agentManager.idp.existingSecret is set, the templates reference existingSecretClientIdKey and existingSecretClientSecretKey without validation. If either is empty or unset, Helm renders a blank secretKeyRef.key, breaking the pod spec at admission time.

While values.yaml provides defaults (client-id and client-secret), these only work if the referenced secret uses those exact key names. For secrets with different key names, explicit validation prevents broken deployments. Apply the required function to enforce that these keys are explicitly set whenever existingSecret is used:

Suggested fix
-      key: {{ .Values.agentManager.idp.existingSecretClientIdKey }}
+      key: {{ required "agentManager.idp.existingSecretClientIdKey is required when agentManager.idp.existingSecret is set" .Values.agentManager.idp.existingSecretClientIdKey }}
...
-      key: {{ .Values.agentManager.idp.existingSecretClientSecretKey }}
+      key: {{ required "agentManager.idp.existingSecretClientSecretKey is required when agentManager.idp.existingSecret is set" .Values.agentManager.idp.existingSecretClientSecretKey }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- define "wso2-amp-gateway-extension.idpClientIdEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ .Values.agentManager.idp.existingSecretClientIdKey }}
{{- else }}
- name: IDP_CLIENT_ID
value: {{ .Values.agentManager.idp.clientId | quote }}
{{- end }}
{{- end }}
{{/*
Resolve the IDP client secret from secret or direct value
*/}}
{{- define "wso2-amp-gateway-extension.idpClientSecretEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ .Values.agentManager.idp.existingSecretClientSecretKey }}
{{- else }}
- name: IDP_CLIENT_SECRET
value: {{ .Values.agentManager.idp.clientSecret | quote }}
{{- end }}
{{- end }}
{{- define "wso2-amp-gateway-extension.idpClientIdEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ required "agentManager.idp.existingSecretClientIdKey is required when agentManager.idp.existingSecret is set" .Values.agentManager.idp.existingSecretClientIdKey }}
{{- else }}
- name: IDP_CLIENT_ID
value: {{ .Values.agentManager.idp.clientId | quote }}
{{- end }}
{{- end }}
{{/*
Resolve the IDP client secret from secret or direct value
*/}}
{{- define "wso2-amp-gateway-extension.idpClientSecretEnv" -}}
{{- if .Values.agentManager.idp.existingSecret }}
- name: IDP_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.agentManager.idp.existingSecret }}
key: {{ required "agentManager.idp.existingSecretClientSecretKey is required when agentManager.idp.existingSecret is set" .Values.agentManager.idp.existingSecretClientSecretKey }}
{{- else }}
- name: IDP_CLIENT_SECRET
value: {{ .Values.agentManager.idp.clientSecret | quote }}
{{- end }}
{{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/_helpers.tpl`
around lines 75 - 102, The templates "wso2-amp-gateway-extension.idpClientIdEnv"
and "wso2-amp-gateway-extension.idpClientSecretEnv" currently reference
.Values.agentManager.idp.existingSecretClientIdKey and
.Values.agentManager.idp.existingSecretClientSecretKey without validation;
update the secretKeyRef.key usages to wrap those values with the Helm required
function (e.g. required "message"
.Values.agentManager.idp.existingSecretClientIdKey) when
.Values.agentManager.idp.existingSecret is true so Helm fails with a clear error
if the key is unset, and provide a descriptive error string for each required
call to indicate which key is missing.

path: ./data/gateway.db
controlplane:
insecure_skip_verify: false
insecure_skip_verify: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Do not hardcode insecure_skip_verify: true for control-plane TLS.

This disables certificate verification globally and weakens gateway-to-control-plane trust guarantees.

🔒 Suggested fix
-            insecure_skip_verify: true
+            insecure_skip_verify: {{ .Values.apiGateway.controlPlane.tls.insecureSkipVerify | default false }}
# values.yaml (add under apiGateway.controlPlane.tls)
insecureSkipVerify: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
insecure_skip_verify: true
insecure_skip_verify: {{ .Values.apiGateway.controlPlane.tls.insecureSkipVerify | default false }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-config.yaml`
at line 34, The template currently hardcodes insecure_skip_verify: true in
gateway-config.yaml which disables TLS verification; change the template to not
hardcode this value and instead read a values key (e.g.,
apiGateway.controlPlane.tls.insecureSkipVerify) so operators can set it; update
gateway-config.yaml to use the chart value for insecure_skip_verify and add
insecureSkipVerify: false as the default in values.yaml under
apiGateway.controlPlane.tls to preserve secure defaults.

Comment on lines +26 to +34
idp:
tokenUrl: "http://amp-thunder-extension-service.amp-thunder.svc.cluster.local:8090/oauth2/token"
clientId: "amp-api-client"
clientSecret: "amp-api-client-secret" # Prefer existingSecret; only set this for local/dev use
# Reference an existing secret for IDP credentials (recommended for production).
# When set, clientId and clientSecret above are ignored.
existingSecret: ""
existingSecretClientIdKey: "client-id"
existingSecretClientSecretKey: "client-secret"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid shipping a plaintext default clientSecret in chart values.

Keeping a concrete secret value in defaults increases secret leakage risk and weakens baseline security posture.

🔒 Suggested fix
   idp:
     tokenUrl: "http://amp-thunder-extension-service.amp-thunder.svc.cluster.local:8090/oauth2/token"
     clientId: "amp-api-client"
-    clientSecret: "amp-api-client-secret"  # Prefer existingSecret; only set this for local/dev use
+    clientSecret: ""
     # Reference an existing secret for IDP credentials (recommended for production).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/helm-charts/wso2-amp-api-platform-gateway-extension/values.yaml`
around lines 26 - 34, Remove the plaintext default by clearing the hardcoded
idp.clientSecret value and rely on idp.existingSecret (and
idp.existingSecretClientIdKey / idp.existingSecretClientSecretKey) for
production; update the values under the idp section so clientSecret is empty and
add a comment indicating that existingSecret should be used instead of shipping
a default secret (referencing idp.clientSecret, idp.existingSecret,
idp.existingSecretClientIdKey, idp.existingSecretClientSecretKey).

Comment thread deployments/scripts/port-forward.sh Outdated
Comment on lines +45 to +49
echo "🔌 Setting up port-forward for gateway... (port 22893)"
kubectl port-forward -n openchoreo-data-plane apigateway/api-platform-default-default 22893:22893 > /dev/null 2>&1 &
PORT_FORWARD_PID=$!
sleep 2
echo "✅ Port-forward established (PID: $PORT_FORWARD_PID)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Port-forward is reported as successful without verifying the process is alive.

If kubectl port-forward exits immediately, the script still prints success, which masks setup failures.

🛠️ Suggested fix
 kubectl port-forward -n openchoreo-data-plane apigateway/api-platform-default-default 22893:22893 > /dev/null 2>&1 &
 PORT_FORWARD_PID=$!
 sleep 2
-echo "✅ Port-forward established (PID: $PORT_FORWARD_PID)"
+if kill -0 "$PORT_FORWARD_PID" 2>/dev/null; then
+    echo "✅ Port-forward established (PID: $PORT_FORWARD_PID)"
+else
+    echo "❌ Port-forward failed to start"
+    exit 1
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "🔌 Setting up port-forward for gateway... (port 22893)"
kubectl port-forward -n openchoreo-data-plane apigateway/api-platform-default-default 22893:22893 > /dev/null 2>&1 &
PORT_FORWARD_PID=$!
sleep 2
echo "✅ Port-forward established (PID: $PORT_FORWARD_PID)"
echo "🔌 Setting up port-forward for gateway... (port 22893)"
kubectl port-forward -n openchoreo-data-plane apigateway/api-platform-default-default 22893:22893 > /dev/null 2>&1 &
PORT_FORWARD_PID=$!
sleep 2
if kill -0 "$PORT_FORWARD_PID" 2>/dev/null; then
echo "✅ Port-forward established (PID: $PORT_FORWARD_PID)"
else
echo "❌ Port-forward failed to start"
exit 1
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/scripts/setup-gateway.sh` around lines 45 - 49, The script
currently prints a success message immediately after launching kubectl
port-forward into the background (using PORT_FORWARD_PID) without verifying it
started correctly; modify the block that runs kubectl port-forward to capture
its PID (PORT_FORWARD_PID), wait a short period, then check that the process is
still running and that kubectl did not exit with an error (e.g., test the PID
with kill -0 or check the process exists and/or inspect the command's exit
status), and if the check fails, print an error and exit non‑zero; ensure the
success echo ("✅ Port-forward established") only runs when the liveness check of
PORT_FORWARD_PID confirms the port-forward is alive.

Comment on lines +53 to +55
echo "⏳ Waiting for RestApi to be programmed..."
if kubectl wait --for=condition=Programmed restapi/traces-api-secure -n openchoreo-data-plane --timeout=120s; then
echo "✅ RestApi is programmed"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

RestApi readiness check waits on the wrong resource name.

The applied manifest (deployments/values/otel-collector-rest-api.yaml) creates restapi/amp-otel-collector-tracing-rest-api, so waiting on restapi/traces-api-secure will timeout even when the API is healthy.

🛠️ Suggested fix
-if kubectl wait --for=condition=Programmed restapi/traces-api-secure -n openchoreo-data-plane --timeout=120s; then
+if kubectl wait --for=condition=Programmed restapi/amp-otel-collector-tracing-rest-api -n openchoreo-data-plane --timeout=120s; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "⏳ Waiting for RestApi to be programmed..."
if kubectl wait --for=condition=Programmed restapi/traces-api-secure -n openchoreo-data-plane --timeout=120s; then
echo "✅ RestApi is programmed"
echo "⏳ Waiting for RestApi to be programmed..."
if kubectl wait --for=condition=Programmed restapi/amp-otel-collector-tracing-rest-api -n openchoreo-data-plane --timeout=120s; then
echo "✅ RestApi is programmed"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/scripts/setup-gateway.sh` around lines 53 - 55, The kubectl
readiness check is waiting for the wrong RestApi resource name; update the
kubectl wait invocation that currently targets "restapi/traces-api-secure" to
wait on "restapi/amp-otel-collector-tracing-rest-api" (the resource created by
the otel manifest) and adjust the corresponding success message to match that
resource name so the script recognizes the actual programmed API.

Comment on lines +4 to +7
name: amp-otel-collector-tracing-rest-api
namespace: openchoreo-data-plane
spec:
displayName: traces-api-secure
displayName: amp-otel-collector-tracing-rest-api
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep the wait target in sync with the renamed RestApi.

deployments/scripts/setup-gateway.sh still waits on restapi/traces-api-secure; renaming the manifest here means the bootstrap script will watch the wrong resource and report a false timeout.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/values/otel-collector-rest-api.yaml` around lines 4 - 7, The
deployment manifest renamed the RestApi to amp-otel-collector-tracing-rest-api
but the bootstrap script still waits on restapi/traces-api-secure; update
deployments/scripts/setup-gateway.sh so its wait/ready check targets the new
RestApi name (amp-otel-collector-tracing-rest-api) instead of
restapi/traces-api-secure, ensuring any kubectl/oc wait or resource polling
logic references the new resource identifier and namespace
openchoreo-data-plane.

Comment thread Makefile
Comment on lines +50 to +60
@echo "✅ Setup finished!"
@echo ""
@echo "🌐 Access your services:"
@echo " Console: http://localhost:3000"
@echo " API: http://localhost:8080"
@echo " Traces Observer Service: http://localhost:9098"
@echo " Database: localhost:5432"
@echo ""
@echo "📊 To access OpenChoreo services, run:"
@echo " make port-forward"
@echo "📊 Next steps — install the API Platform Gateway:"
@echo " 1. make port-forward (in a separate terminal)"
@echo " 2. make setup-gateway"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Swap the post-setup order.

make port-forward will fail until the gateway service exists, so the instructions currently tell users to run the commands in the wrong order.

Suggested fix
-	`@echo` "📊 Next steps — install the API Platform Gateway:"
-	`@echo` "   1. make port-forward     (in a separate terminal)"
-	`@echo` "   2. make setup-gateway"
+	`@echo` "📊 Next steps — install the API Platform Gateway:"
+	`@echo` "   1. make setup-gateway"
+	`@echo` "   2. make port-forward     (in a separate terminal)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@echo "✅ Setup finished!"
@echo ""
@echo "🌐 Access your services:"
@echo " Console: http://localhost:3000"
@echo " API: http://localhost:8080"
@echo " Traces Observer Service: http://localhost:9098"
@echo " Database: localhost:5432"
@echo ""
@echo "📊 To access OpenChoreo services, run:"
@echo " make port-forward"
@echo "📊 Next steps — install the API Platform Gateway:"
@echo " 1. make port-forward (in a separate terminal)"
@echo " 2. make setup-gateway"
`@echo` "✅ Setup finished!"
`@echo` ""
`@echo` "🌐 Access your services:"
`@echo` " Console: http://localhost:3000"
`@echo` " API: http://localhost:8080"
`@echo` " Traces Observer Service: http://localhost:9098"
`@echo` " Database: localhost:5432"
`@echo` ""
`@echo` "📊 Next steps — install the API Platform Gateway:"
`@echo` " 1. make setup-gateway"
`@echo` " 2. make port-forward (in a separate terminal)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 50 - 60, The post-setup printed "Next steps" order is
reversed causing users to run make port-forward before the gateway exists;
update the Makefile echo block so the recommended sequence shows "1. make
setup-gateway" first and "2. make port-forward" second (refer to the echo lines
that print "📊 Next steps — install the API Platform Gateway:" and the two
following echo lines listing "make port-forward" and "make setup-gateway") so
users run setup-gateway before port-forward.

Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
Signed-off-by: Anoshan Jayahanthan <101160077+AnoshanJ@users.noreply.github.com>
@AnoshanJ AnoshanJ changed the title Refactor ingress gateway setup Refactor API-Platform GW setup Apr 28, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
deployments/quick-start/install-helpers.sh (1)

371-371: ⚠️ Potential issue | 🟡 Minor

Missing log_info fallback function.

The script defines fallback implementations for log_error (line 68) and log_warning (line 74) but not for log_info. If the sourcing script doesn't provide log_info, this line will fail with "command not found".

Proposed fix — add fallback for log_info
 if ! declare -f log_warning >/dev/null 2>&1; then
     log_warning() {
         echo "WARNING: $1" >&2
     }
 fi
+
+if ! declare -f log_info >/dev/null 2>&1; then
+    log_info() {
+        echo "INFO: $1"
+    }
+fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/quick-start/install-helpers.sh` at line 371, The script calls
log_info but lacks a fallback; add a default no-op or stdout wrapper function
named log_info analogous to the existing log_error and log_warning fallbacks so
the script won't fail when the caller doesn't provide log_info; locate the
existing fallback definitions for log_error and log_warning and implement the
same pattern for log_info (same function name: log_info) to ensure safe logging
calls.
🧹 Nitpick comments (2)
console/workspaces/pages/gateways/src/subComponents/AIGatewaysTable.tsx (1)

342-349: Normalize gateway type once and reuse the derived flag.

The inline toUpperCase() check is duplicated in this component (and also in ViewGateway). Derive isAIGateway once to reduce repetition and prevent divergence.

Proposed local cleanup
+                const isAIGateway = gateway.gatewayType.toUpperCase() === "AI";
                 return (
                   <ListingTable.Row
                     key={gateway.uuid}
@@
                     <ListingTable.Cell align="center">
                       <Chip
-                        label={gateway.gatewayType?.toUpperCase() === "AI" ? "AI" : "Regular"}
+                        label={isAIGateway ? "AI" : "Regular"}
                         size="small"
                         variant="outlined"
-                        color={gateway.gatewayType?.toUpperCase() === "AI" ? "info" : "default"}
+                        color={isAIGateway ? "info" : "default"}
                       />
                     </ListingTable.Cell>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@console/workspaces/pages/gateways/src/subComponents/AIGatewaysTable.tsx`
around lines 342 - 349, Derive a single normalized flag (e.g., const isAIGateway
= (gateway.gatewayType || "").toUpperCase() === "AI") near the top of the
component and use that flag for both the label and color props instead of
repeating gateway.gatewayType?.toUpperCase() inline; update the
ListingTable.Cell/Chip usage here and mirror the same refactor in ViewGateway to
reuse isAIGateway so behavior stays consistent and duplication is removed.
console/workspaces/pages/gateways/src/AddAIGateway.Organization.tsx (1)

123-126: Drop local mutation onError to keep error UX centralized.

This local onError only logs to console and can conflict with global React Query error handling patterns used across the app.

Proposed simplification
     createGateway(
       {
         params: { orgName: orgId ?? "" },
         body: payload,
       },
       {
         onSuccess: (data) => {
           const viewPath = generatePath(
             absoluteRouteMap.children.org.children.gateways.children.view.path,
             { orgId: orgId ?? "", gatewayId: data.uuid }
           );
           navigate(viewPath);
         },
-        onError: (e: unknown) => {
-          // eslint-disable-next-line no-console
-          console.error("Failed to create gateway:", e);
-        },
       }
     );

Based on learnings: In TSX React components that use React Query, implement global error handling for mutations via QueryClient cache callbacks and remove per-mutation onError handlers for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@console/workspaces/pages/gateways/src/AddAIGateway.Organization.tsx` around
lines 123 - 126, Remove the local mutation onError handler in
AddAIGateway.Organization.tsx (the inline onError: (e: unknown) =>
console.error(...) block) so the mutation no longer logs to console; rely on the
app's global React Query error handling (e.g., QueryClient/QueryCache onError
callbacks or setDefaultOptions) instead, and ensure no other per-mutation error
side-effects remain in the createGateway mutation or its surrounding handler
code.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@console/workspaces/libs/types/src/api/gateways.ts`:
- Line 21: GatewayType currently allows lowercase values ("ai"/"regular") that
don't match the backend enum; update the type definition for GatewayType to only
the backend-allowed string literals ("AI" and "REGULAR") so compile-time checks
prevent sending invalid values; locate the GatewayType alias in this file and
remove the lowercase alternatives, then run type checks to ensure callers are
updated to use "AI" or "REGULAR".

---

Outside diff comments:
In `@deployments/quick-start/install-helpers.sh`:
- Line 371: The script calls log_info but lacks a fallback; add a default no-op
or stdout wrapper function named log_info analogous to the existing log_error
and log_warning fallbacks so the script won't fail when the caller doesn't
provide log_info; locate the existing fallback definitions for log_error and
log_warning and implement the same pattern for log_info (same function name:
log_info) to ensure safe logging calls.

---

Nitpick comments:
In `@console/workspaces/pages/gateways/src/AddAIGateway.Organization.tsx`:
- Around line 123-126: Remove the local mutation onError handler in
AddAIGateway.Organization.tsx (the inline onError: (e: unknown) =>
console.error(...) block) so the mutation no longer logs to console; rely on the
app's global React Query error handling (e.g., QueryClient/QueryCache onError
callbacks or setDefaultOptions) instead, and ensure no other per-mutation error
side-effects remain in the createGateway mutation or its surrounding handler
code.

In `@console/workspaces/pages/gateways/src/subComponents/AIGatewaysTable.tsx`:
- Around line 342-349: Derive a single normalized flag (e.g., const isAIGateway
= (gateway.gatewayType || "").toUpperCase() === "AI") near the top of the
component and use that flag for both the label and color props instead of
repeating gateway.gatewayType?.toUpperCase() inline; update the
ListingTable.Cell/Chip usage here and mirror the same refactor in ViewGateway to
reuse isAIGateway so behavior stays consistent and duplication is removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7b46ef22-523e-4dd3-a131-60f173780fde

📥 Commits

Reviewing files that changed from the base of the PR and between a4f64b3 and 6bfd948.

📒 Files selected for processing (17)
  • .github/release-config.json
  • console/workspaces/libs/types/src/api/gateways.ts
  • console/workspaces/pages/gateways/src/AddAIGateway.Organization.tsx
  • console/workspaces/pages/gateways/src/Gateways.Organization.tsx
  • console/workspaces/pages/gateways/src/index.ts
  • console/workspaces/pages/gateways/src/subComponents/AIGatewaysTable.tsx
  • console/workspaces/pages/gateways/src/subComponents/AddAIGatewayForm.tsx
  • console/workspaces/pages/gateways/src/subComponents/EditGatewayDrawer.tsx
  • console/workspaces/pages/gateways/src/subComponents/ViewGateway.tsx
  • deployments/docker-compose.yml
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-cr.yaml
  • deployments/quick-start/install-helpers.sh
  • deployments/quick-start/install.sh
  • deployments/scripts/port-forward.sh
  • documentation/docs/getting-started/_partials/_amp-installation.mdx
  • documentation/docs/getting-started/on-k3d.mdx
  • documentation/docs/getting-started/on-your-environment.mdx
✅ Files skipped from review due to trivial changes (7)
  • console/workspaces/pages/gateways/src/Gateways.Organization.tsx
  • .github/release-config.json
  • console/workspaces/pages/gateways/src/subComponents/AddAIGatewayForm.tsx
  • deployments/docker-compose.yml
  • console/workspaces/pages/gateways/src/subComponents/EditGatewayDrawer.tsx
  • deployments/helm-charts/wso2-amp-api-platform-gateway-extension/templates/gateway-cr.yaml
  • console/workspaces/pages/gateways/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • deployments/quick-start/install.sh

import type { ListQuery, OrgPathParams, PaginationMeta } from "./common";

export type GatewayType = "AI" | "REGULAR";
export type GatewayType = "AI" | "REGULAR" | "ai" | "regular";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep GatewayType aligned with the backend enum contract.

The API model now accepts "ai"/"regular" at type level, but the backend contract only declares "AI" and "REGULAR" as allowed values. This can let invalid request/query values compile and fail at runtime.

Proposed fix
-export type GatewayType = "AI" | "REGULAR" | "ai" | "regular";
+export type GatewayType = "AI" | "REGULAR";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export type GatewayType = "AI" | "REGULAR" | "ai" | "regular";
export type GatewayType = "AI" | "REGULAR";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@console/workspaces/libs/types/src/api/gateways.ts` at line 21, GatewayType
currently allows lowercase values ("ai"/"regular") that don't match the backend
enum; update the type definition for GatewayType to only the backend-allowed
string literals ("AI" and "REGULAR") so compile-time checks prevent sending
invalid values; locate the GatewayType alias in this file and remove the
lowercase alternatives, then run type checks to ensure callers are updated to
use "AI" or "REGULAR".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants