Kong / Kong/deck

bug: failures when creating a workspace via deck sync

Open
#783 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
505
Forks
137
Avg merge
3d 5h
Merged PRs (30d)
20

Description

In a PostgreSQL-backed hybrid deployment of Kong Gateway 2.8.1.4, the deck sync command fails when the target workspace (either via _workspace in the deck file or the --workspace flag) does not yet exist.

When a deck file has a workspace that does not exist, it successfully creates the workspace and then fails any subsequent actions.

$ deck version
decK v1.15.1 (bb70f8f) 
$ deck sync -s kong/small_workspace.yaml
creating workspace small-workspace
Error: building state: add defaults to plugin 'kafka-log': retrieve schema for kafka-log from Kong: HTTP status 404 (message: "Workspace 'small-workspace' not found")

Re-running the exact same command a moment later successfully syncs the state file.

small_workspace.yaml
_workspace: small-workspace
_format_version: '1.1'
plugins:
  - name: kafka-log
    config:
      producer_async: false
      topic: kongRequestLogRaw
      bootstrap_servers:
        - host: kafka-broker.service.company.com
          port: 9092
  - name: prometheus
    config:
      per_consumer: false

It seems a reasonable solution would be for deck sync to consider the --db-update-propagation-delay flag after creating a workspace here. Based on the description of that flag ("artificial delay (in seconds) that is injected between insert operations for related entities"), it seems like an oversight that it's ignored at all (if not the root of this bug).

(NB: simultaneously reported in support ticket #00030766 but posted here for posterity and for the specific fix suggestion)

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start in cmd/common.go around lines 197-209 and reproduce with the provided small_workspace.yaml using deck sync against a PostgreSQL-backed hybrid deployment. Trace how workspace creation and --db-update-propagation-delay interact, then verify that subsequent actions succeed on the first run and add or update a regression test for the initial sync.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
cli, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.