[Bug]: An artifact removed from an immutable gateway's files still shows as deployed in the control plane

Open
#4,161 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
57/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, sqlite
Domain
api, backend

Research direction

Read gateway/gateway-controller/cmd/controller/main.go around line 168, pkg/immutable/loader.go, and pkg/controlplane/sync.go around line 695 to trace startup loading and deployment sync. Reproduce with immutable mode, deployment sync enabled, and two annotated REST API files; remove one and restart the controller. Done when the control plane reports that API as UNDEPLOYED after restart.

Written by the indexing model from the issue text.

Description

Area/Gateway Aspect/Other Severity/Minor Type/Bug
Please select the area the issue is related to

Gateway

Please select the aspect the issue is related to

Aspect/Other (Anything else which does not match above categories)

Description

An immutable gateway pushes the artifacts it loads from files to the control plane, and they show as deployed there. When a file is removed and the gateway restarts, the gateway no longer serves that artifact, but it never tells the control plane. The control plane keeps showing the deployment as DEPLOYED with no undeploy.

Observed (deployment sync enabled)

  • Two REST API files, a and b, each with the gateway.api-platform.wso2.com/project-id annotation. After a restart, both appear in the control plane, and b's deployment is DEPLOYED.
  • I changed a's display name, removed b's file, and restarted gateway-controller.
    • The control plane received a's new display name, so the push after the restart did happen.
    • The gateway's GET /rest-apis/b answers 404.
    • The control plane's GET /api/v0.9/rest-apis/b/deployments still lists DEPLOYED and no UNDEPLOYED.

Expected
After the restart, the control plane shows b's deployment on that gateway as undeployed.

Cause

  • Immutable mode deletes the SQLite database on every boot (gateway/gateway-controller/cmd/controller/main.go:168), so the gateway has no record of what it served before.
  • The loader only creates what is in the files (pkg/immutable/loader.go). The connect-time push sends only the artifacts the gateway still has (pkg/controlplane/sync.go:695), so nothing reports b as undeployed.
Steps to Reproduce
  1. Start an immutable gateway (SQLite, [immutable_gateway] enabled = true) connected to platform-api with deployment sync on. Give it two REST API files with the project-id annotation of an existing project.
  2. Check that both APIs show a DEPLOYED deployment in the control plane.
  3. Remove one file and restart gateway-controller.
  4. The control plane still shows that API's deployment as DEPLOYED.
Severity Level of the Issue

Severity/Minor (Non-critical functionality. Can be fixed in future releases)

Environment Details (with versions)

Current main (0ee943ff4). Platform-api and gateway built from source and run by the IT suite (tests/framework), with the gateway on SQLite, on macOS with Rancher Desktop.

Dominant language
Go
Stars
85
Forks
137
Avg merge
1d 12h
Merged PRs (30d)
247

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wso2/api-platform

All issues in wso2/api-platform

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.