Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command "deck file kong2kic" Kong configuration file to Kong Ingress Controller manifests. #1019

Closed
wants to merge 1 commit into from

Conversation

battlebyte
Copy link
Collaborator

New command "deck file kong2kic" Kong configuration file to Kong Ingress Controller manifests.

Currently, only ingress controller manifests are supported. Output format is always YAML.

Usage:
  deck file kong2kic [flags]

Flags:
  -a, --api string           [ingress|gateway] (default "ingress")
  -h, --help                 help for kong2kic
  -i, --input-file string    Kong spec file to process. Use - to read from stdin. (default "-")
  -o, --output-file string   Output file to write. Use - to write to stdout. (default "-")
  • Global Plugins map to KongClusterPlugins
  • Kong Services map to K8s Services. Kong Routes map to K8s Ingresses. To specify Kong specific features, K8s Ingress and Service resources eventually have a KongIngress resource associated to them.
  • Kong Consumer entities map to KongConsumer manifests.

@battlebyte battlebyte requested a review from a team September 5, 2023 10:28
@CLAassistant
Copy link

CLAassistant commented Sep 5, 2023

CLA assistant check
All committers have signed the CLA.

@battlebyte
Copy link
Collaborator Author

Last commit adds JSON output and can generate manifests using annotations for proxy and route (now default) or using KongIngress CRD. Code refactored to use builder + director pattern.

commit 6f67f80
Author: battlebyte <[email protected]>
Date:   Wed Sep 20 11:47:51 2023 +0200

    Added JSON output, annotation output.

    Tests and bug fix for consumer groups
    Lint fixes

commit 996bb84
Merge: 227f6b3 5b73a99
Author: battlebyte <[email protected]>
Date:   Tue Sep 12 14:52:47 2023 +0200

    Merge branch 'main' of github.com:battlebyte/deck

commit 227f6b3
Author: battlebyte <[email protected]>
Date:   Tue Sep 12 14:52:19 2023 +0200

    Fix MTLS transformation.

commit 5b73a99
Merge: 97d1626 b193a18
Author: Jordi Fernandez <[email protected]>
Date:   Tue Sep 12 10:36:01 2023 +0200

    Merge branch 'Kong:main' into main

commit 97d1626
Author: battlebyte <[email protected]>
Date:   Tue Sep 12 10:34:55 2023 +0200

    More tests. Minor bug fixes.

commit b193a18
Author: Gabriele Gerbino <[email protected]>
Date:   Thu Sep 7 17:51:38 2023 +0200

    chore: bump changelog for v1.26.1

commit 444876b
Author: Gabriele Gerbino <[email protected]>
Date:   Wed Aug 30 18:04:37 2023 +0200

    fix: raise error if files have different Runtime Groups

commit 55fb115
Author: Gabriele <[email protected]>
Date:   Wed Sep 6 11:42:22 2023 +0200

    fix: correct consumers validation when custom_id is used (#1012)

commit 02db446
Author: lena-larionova <[email protected]>
Date:   Wed Aug 30 09:47:01 2023 -0700

    fix: change go-apiops in examples to deck file

commit 7498358
Author: battlebyte <[email protected]>
Date:   Tue Sep 5 12:22:44 2023 +0200

    Update call to file.GetContentFromFiles

commit 88f3c05
Merge: 2189389 20ef81e
Author: battlebyte <[email protected]>
Date:   Tue Sep 5 12:13:00 2023 +0200

    Merge branch 'main' of github.com:battlebyte/deck

commit 2189389
Author: battlebyte <[email protected]>
Date:   Tue Sep 5 11:51:01 2023 +0200

    New command "deck file kong2kic"

commit a6021d9
Author: battlebyte <[email protected]>
Date:   Tue Sep 5 11:49:14 2023 +0200

    New command "deck file kong2kic".

commit d40b3cb
Author: battlebyte <[email protected]>
Date:   Mon Aug 28 09:20:46 2023 +0200

    check plugin.name is not nil

commit bbe6575
Merge: 664b305 b2e6218
Author: Jordi Fernandez <[email protected]>
Date:   Mon Aug 28 09:19:23 2023 +0200

    Merge pull request #1 from mod42/main

    crashed because by use of InstanceName instead of Name

commit 20ef81e
Author: lena-larionova <[email protected]>
Date:   Fri Aug 11 12:11:53 2023 -0700

    fix: remove errant comma from CLI example

commit b2e6218
Author: mod42 <[email protected]>
Date:   Fri Aug 11 18:11:24 2023 +0200

    crashed because by use of InstanceName instead of Name

commit 574122f
Author: Gabriele Gerbino <[email protected]>
Date:   Thu Aug 10 17:11:53 2023 +0200

    fix: set default strip_path to true

    In the past decK had to set the default value of the `strip_path`
    field to [false](https://github.com/Kong/deck/blob/v1.26.0/utils/constants.go#L22)
    because of some limitation in the library used for defaults injection:
    this was a workaround to allow this field to be set to `false`.
    Then, if the field was not set in the configuration, the field was then
    turned into `true` at runtime via inspection of the Kong Admin API.

    This commit changes the decK default for the `strip_path` field to `true`,
    since now the underlying library has fixed the issue that triggered
    this workaround in the first place.

commit 63b9742
Author: Gabriele Gerbino <[email protected]>
Date:   Wed Aug 9 18:37:15 2023 +0200

    chore: bump changelog for v1.26.0

commit ea2ab92
Author: Gabriele <[email protected]>
Date:   Wed Aug 9 18:29:46 2023 +0200

    feat: enable Consumer Groups scoped Plugins with Konnect (#994)

commit 10c8698
Author: Gabriele <[email protected]>
Date:   Wed Aug 9 16:10:42 2023 +0200

    fix: remove old konnect authentication fallback (#995)

    decK used to require to work with both "old" and "new" Konnect.
    This requirement is now obsolete, since the "old" Konnect
    doesn't exist anymore, so it is the need of this fallback
    mechanism.

    This commit removes such mechanism.

commit d11d04d
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Aug 9 04:06:18 2023 +0000

    chore(deps): bump golang from 1.20.7 to 1.21.0

    Bumps golang from 1.20.7 to 1.21.0.

    ---
    updated-dependencies:
    - dependency-name: golang
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit b248a0f
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Aug 8 04:48:25 2023 +0000

    chore(deps): bump alpine from 3.18.2 to 3.18.3

    Bumps alpine from 3.18.2 to 3.18.3.

    ---
    updated-dependencies:
    - dependency-name: alpine
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 328ae94
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Jul 20 04:57:41 2023 +0000

    chore(deps): bump k8s.io/code-generator from 0.27.3 to 0.27.4

    Bumps [k8s.io/code-generator](https://github.com/kubernetes/code-generator) from 0.27.3 to 0.27.4.
    - [Commits](kubernetes/code-generator@v0.27.3...v0.27.4)

    ---
    updated-dependencies:
    - dependency-name: k8s.io/code-generator
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit a784700
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Fri Aug 4 14:07:11 2023 +0000

    chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.6 to 3.23.7

    Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.6 to 3.23.7.
    - [Release notes](https://github.com/shirou/gopsutil/releases)
    - [Commits](shirou/gopsutil@v3.23.6...v3.23.7)

    ---
    updated-dependencies:
    - dependency-name: github.com/shirou/gopsutil/v3
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 36b6a3c
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Aug 2 04:03:55 2023 +0000

    chore(deps): bump golang from 1.20.6 to 1.20.7

    Bumps golang from 1.20.6 to 1.20.7.

    ---
    updated-dependencies:
    - dependency-name: golang
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit c823413
Author: Patryk Małek <[email protected]>
Date:   Fri Aug 4 16:38:28 2023 +0200

    tests: use testing helpers for env and cleanup (#992)

commit af7eaa2
Author: Gabriele <[email protected]>
Date:   Fri Aug 4 16:05:45 2023 +0200

    feat: support scoping plugins to consumer-groups

commit 3e4196d
Author: Patryk Małek <[email protected]>
Date:   Wed Aug 2 13:04:57 2023 +0200

    chore: mark file/kong_json_schema.json as generated code

commit 664b305
Author: battlebyte <[email protected]>
Date:   Tue Aug 1 15:56:14 2023 +0200

    fix test

commit 6075281
Author: battlebyte <[email protected]>
Date:   Tue Aug 1 15:51:30 2023 +0200

    convert command kong gateway to ingress controller

commit 37196ea
Author: lena-larionova <[email protected]>
Date:   Fri Jul 28 14:40:23 2023 -0700

    fix: typo in global konnect-token-file flag

commit 86497a5
Author: Gabriele <[email protected]>
Date:   Fri Jul 28 18:01:21 2023 +0200

    fix: use same API to pull Consumer Groups from Konnect and Kong (#984)

commit 6342b2b
Author: Gabriele Gerbino <[email protected]>
Date:   Thu Jul 27 11:32:57 2023 +0200

    fix: correct consumers handling when custom_id is used

    Right now, when a consumer has the `username` equal to the
    `custom_id` of another consumer, decK fails because of the
    way the consumers are handled in the internal in-memory DB.

    ```
    _format_version: "3.0"
    consumers:
    - custom_id: foo
      id: ce49186d-7670-445d-a218-897631b29ada
      username: Foo
    - custom_id: bar
      id: 7820f383-7b77-4fcc-af7f-14ff3e256693
      username: foo
    ```

    ```
    $ deck sync
    Error: inserting consumer into state: inserting consumer Foo: entity already exists
    ```

    This commit fixes this defect by modifying the way consumers are
    looked up in the in-memory DB.

commit d734514
Author: Thijs Schreijer <[email protected]>
Date:   Thu Jul 27 16:34:17 2023 +0200

    feat(render): add new command to render final file (#963)

    Co-authored-by: Vincent Le Goff <[email protected]>

commit aee76dd
Author: Gabriele <[email protected]>
Date:   Thu Jul 27 13:30:28 2023 +0200

    fix: correct diffs when comparing objects with empty tags (#985)

    Right now, when some declarative configuration having empty tags
    on any of its entities is deployed, subsequent `diff` / `sync`
    will show misleading results:

    ```
    $ cat kong.yaml
    _format_version: "3.0"
    services:
      - name: foo
        protocol: http
        host: foo
        port: 8000
        tags: []

    $ deck sync
    creating service foo
    Summary:
      Created: 1
      Updated: 0
      Deleted: 0

    $ deck sync
    updating service foo  {
       "connect_timeout": 60000,
       "enabled": true,
       "host": "foo",
       "id": "afadd2ed-2bcd-49fc-9000-adb58cd11b50",
       "name": "foo",
       "port": 8000,
       "protocol": "http",
       "read_timeout": 60000,
       "retries": 5,
       "write_timeout": 60000
     }

    Summary:
      Created: 0
      Updated: 1
      Deleted: 0
    ```

    The second `deck sync` run is showing an update without an actual diff.
    This is due to the way empty tags are treated internally in decK.

    This commit fixes this defect.

commit b6fdeb2
Merge: 5ac84d4 b1fde70
Author: battlebyte <[email protected]>
Date:   Wed Jul 26 15:30:50 2023 +0200

    Merge remote-tracking branch 'origin/main'

commit 24ef372
Author: Thijs Schreijer <[email protected]>
Date:   Wed Jul 26 13:37:31 2023 +0200

    fix(ci): set the codecov token to reduce flakiness (#983)

commit d3f0a67
Author: Gabriele Gerbino <[email protected]>
Date:   Mon Jul 24 16:25:01 2023 +0200

    chore: update release date for v1.24.0

commit b1fde70
Author: Gabriele Gerbino <[email protected]>
Date:   Wed Jul 19 17:46:59 2023 +0200

    chore: update changelog with missing changes for 1.24.0

commit ab90fbb
Author: Gabriele Gerbino <[email protected]>
Date:   Wed Jul 19 14:48:05 2023 +0200

    tests: restrict diff test scope to avoid failure due to schema changes

commit e337551
Author: Grzegorz Burzyński <[email protected]>
Date:   Wed Jul 19 13:44:18 2023 +0200

    feat: handle certificates:snis relation for Konnect

commit 237adbb
Author: Gabriele Gerbino <[email protected]>
Date:   Wed Jul 19 07:19:23 2023 +0200

    chore: update changelog for 1.24.0

commit fa6bd5f
Author: Gabriele Gerbino <[email protected]>
Date:   Tue Jul 18 21:47:30 2023 +0200

    feat: improve error logs when running sync/diff/validate

    Currently decK doesn't return very useful and descriptive
    errors when configuration files are validated. This is
    particularly painful when the configuration is distributed
    in several files and the error doesn't specificy which
    file contains the error.

    Let's take for example the following files:

    ```
    $ cat services.yaml
    services:
    - name: svc1
      host: mockbin.org
      foo: bar

    consumers:
    - username: good
    - name: bad
    ```

    If we run decK, it will return some obscure and incomplete errors:

    ```
    $ deck sync -s services.yaml -s consumers.yaml
    Error: reading file: validating file content: 1 errors occurred:
            services.0: Additional property foo is not allowed
    ```

    This commit is going to improve the way decK handles
    configuration validation error logging in order to provide
    a more useful description of the problems.
    When running decK with the new functionality, the following will
    be returned:

    ```
    $ ./deck sync -s services.yaml -s consumers.yaml
    Error: 2 errors occurred:
    	reading file services.yaml: validating file content: 1 errors occurred:
    	validation error: object="bar", err=services.0: Additional property foo is not allowed

    	reading file consumers.yaml: validating file content: 3 errors occurred:
    	validation error: object={"name":"bad"}, err=consumers.1: Must validate at least one schema (anyOf)
    	validation error: object={"name":"bad"}, err=consumers.1: username is required
    	validation error: object="bad", err=consumers.1: Additional property name is not allowed
    ```

commit 70ae4dc
Author: Thijs Schreijer <[email protected]>
Date:   Wed Jul 19 14:37:27 2023 +0200

    chore(deps): bump go-apiops to v0.1.20 (#977)

commit 7352609
Author: DanielRailean <[email protected]>
Date:   Wed Jul 19 11:50:00 2023 +0200

    feat: add option to enable JSON output for diff/sync  (#798)

commit d3ceb4b
Author: Thijs Schreijer <[email protected]>
Date:   Tue Jul 18 20:53:24 2023 +0200

    revert(convert): remove convert from file subcommand (#975)

commit d19b622
Author: Thijs Schreijer <[email protected]>
Date:   Tue Jul 18 20:28:17 2023 +0200

    feat(patch): append to array entries (#974)

commit 5d19fe6
Author: Thijs Schreijer <[email protected]>
Date:   Tue Jul 18 20:05:43 2023 +0200

    fix(cli): fix indentation in file-patch cli command (#972)

commit 3de0874
Author: Gabriele <[email protected]>
Date:   Tue Jul 18 19:49:00 2023 +0200

    chore: add 3.3 to test matrix (#973)

commit e4a674c
Author: Thijs Schreijer <[email protected]>
Date:   Tue Jul 18 13:17:24 2023 +0200

    chore(deps): bump go-apiops to 0.1.18 (#970)

commit 7322889
Author: Thijs Schreijer <[email protected]>
Date:   Tue Jul 18 13:17:08 2023 +0200

    chore(validate): remove validate again from file subcommand (#971)

commit 9aa351b
Author: lena-larionova <[email protected]>
Date:   Tue Jul 18 00:32:51 2023 -0700

    docs(apiops): Clean up command text for new file commands (#968)

commit 4926a01
Author: Thijs Schreijer <[email protected]>
Date:   Mon Jul 17 22:49:45 2023 +0200

    fix(cli): oas2kong would not parse the --format flag (#966)

commit 95bc95f
Author: Thijs Schreijer <[email protected]>
Date:   Thu Jul 13 15:48:54 2023 +0200

    chore(cli): move 'convert' command under 'file' sub-command

commit c79ba72
Author: Thijs Schreijer <[email protected]>
Date:   Mon Jun 12 15:53:01 2023 +0200

    feat(apiops): integrate go-apiops

commit 5ac84d4
Merge: 0781948 5bbd6a8
Author: battlebyte <[email protected]>
Date:   Wed Jul 12 12:02:28 2023 +0200

    Merge remote-tracking branch 'origin/main'

commit 5bbd6a8
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Jul 12 04:20:53 2023 +0000

    chore(deps): bump golang from 1.20.5 to 1.20.6

    Bumps golang from 1.20.5 to 1.20.6.

    ---
    updated-dependencies:
    - dependency-name: golang
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 4959e75
Author: Gabriele Gerbino <[email protected]>
Date:   Wed Jul 5 19:02:42 2023 +0200

    chore: use EE script to setup 'validate-kong-release' job

commit a18a9ef
Author: Fero <[email protected]>
Date:   Wed Jul 5 12:52:31 2023 -0400

    chore: add license for Kong Gateway release validation

    This commit adds the license to allow for enterprise testing and also
    shortens the run name to make it more readable via the actions tab.

commit a1cbe89
Author: Fero <[email protected]>
Date:   Wed Jul 5 12:40:38 2023 -0400

    chore: add a GitHub action for validating Kong Gateway images

    This commit adds a workflow with two inputs to supply the Kong Gateway
    image and decK branch to test against.

commit 508f7d7
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Jun 22 19:29:56 2023 +0000

    chore(deps): bump github.com/hashicorp/go-retryablehttp

    Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.2 to 0.7.4.
    - [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md)
    - [Commits](hashicorp/go-retryablehttp@v0.7.2...v0.7.4)

    ---
    updated-dependencies:
    - dependency-name: github.com/hashicorp/go-retryablehttp
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 25a6621
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Jul 3 04:13:19 2023 +0000

    chore(deps): bump github.com/shirou/gopsutil/v3 from 3.23.4 to 3.23.6

    Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.4 to 3.23.6.
    - [Release notes](https://github.com/shirou/gopsutil/releases)
    - [Commits](shirou/gopsutil@v3.23.4...v3.23.6)

    ---
    updated-dependencies:
    - dependency-name: github.com/shirou/gopsutil/v3
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 1afa985
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Jun 22 19:30:00 2023 +0000

    chore(deps): bump golang.org/x/sync from 0.2.0 to 0.3.0

    Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.2.0 to 0.3.0.
    - [Commits](golang/sync@v0.2.0...v0.3.0)

    ---
    updated-dependencies:
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit fd21781
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Jun 14 04:57:43 2023 +0000

    chore(deps): bump docker/metadata-action from 4.4.0 to 4.6.0

    Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4.4.0 to 4.6.0.
    - [Release notes](https://github.com/docker/metadata-action/releases)
    - [Commits](docker/metadata-action@v4.4.0...v4.6.0)

    ---
    updated-dependencies:
    - dependency-name: docker/metadata-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 01c8be9
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Jun 13 04:57:37 2023 +0000

    chore(deps): bump golangci/golangci-lint-action from 3.4.0 to 3.6.0

    Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.4.0 to 3.6.0.
    - [Release notes](https://github.com/golangci/golangci-lint-action/releases)
    - [Commits](golangci/golangci-lint-action@v3.4.0...v3.6.0)

    ---
    updated-dependencies:
    - dependency-name: golangci/golangci-lint-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <[email protected]>

commit 69aa892
Author: Gabriele Gerbino <[email protected]>
Date:   Mon Jul 3 15:42:53 2023 +0200

    chore: update changelog for 1.23.0

commit 3555a9a
Author: Thijs Schreijer <[email protected]>
Date:   Mon Jul 3 15:33:50 2023 +0200

    feat(proxy): honor the proxy environment variables (#952)

    Co-authored-by: Gabriele Gerbino <[email protected]>

commit 0781948
Author: battlebyte <[email protected]>
Date:   Fri Jun 30 17:07:12 2023 +0200

    Marshal to yaml. Tests expected in files.

commit 3e7faee
Author: battlebyte <[email protected]>
Date:   Fri Jun 30 10:58:55 2023 +0200

    Remove comments

commit e940db0
Author: battlebyte <[email protected]>
Date:   Thu Jun 29 14:50:16 2023 +0200

    decK to kubernetes manifests implementation.
@Tieske
Copy link
Member

Tieske commented Oct 10, 2023

replaced by #1050

@Tieske Tieske closed this Oct 10, 2023
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