{"id":15492261,"url":"https://github.com/asyrjasalo/kongman","last_synced_at":"2025-10-12T04:32:15.251Z","repository":{"id":62574538,"uuid":"158943642","full_name":"asyrjasalo/kongman","owner":"asyrjasalo","description":"Declare the Kong you want, with yaml","archived":true,"fork":false,"pushed_at":"2024-03-20T15:31:13.000Z","size":242,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-14T09:37:32.178Z","etag":null,"topics":["admin","async","cli","kong","yaml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asyrjasalo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-24T14:23:13.000Z","updated_at":"2024-07-28T11:29:58.000Z","dependencies_parsed_at":"2024-10-02T08:10:01.379Z","dependency_job_id":null,"html_url":"https://github.com/asyrjasalo/kongman","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyrjasalo%2Fkongman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyrjasalo%2Fkongman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyrjasalo%2Fkongman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asyrjasalo%2Fkongman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asyrjasalo","download_url":"https://codeload.github.com/asyrjasalo/kongman/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236166147,"owners_count":19105811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admin","async","cli","kong","yaml"],"created_at":"2024-10-02T07:59:49.838Z","updated_at":"2025-10-12T04:32:09.971Z","avatar_url":"https://github.com/asyrjasalo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kongman (fork of aio-kong)\n\nDeclare the [Kong](https://konghq.com/kong-community-edition) you want,\nwith `yaml`. Stop manual `curl`s and maintaining docs of them.\n\nManages resources via Kong Admin API (REST,\n[async HTTP](https://aiohttp.readthedocs.io/en/stable), JSON).\nIncludes [example](https://github.com/asyrjasalo/kongman/blob/master/examples/kadmin.yaml) to add authorization to the Admin API itself.\n\n### Changelog\n\nSome changes backwards incompatible with [aio-kong](https://github.com/lendingblock/aio-kong) by [Luca Sbardella](https://github.com/lsbardel).\n\n- Patch tests (SNI, consumer) to pass on Kong 0.14.x and 1.0.0rc4\n- Add [docker-compose stack](https://github.com/asyrjasalo/kongpose) for tests\n- Add `make` rules `test`, `retest`, `build`, `install`, `publish_pypi`, ...\n- Add creating `.venvs/` for dev and release, handled by `make` rules\n- Add pytest plugins: `clarity`, `instafail` and `spec`, tests run in dev venv\n- Add tools in dev venv: `pur` for reqs and `black`, `flake8`, `mypy` for code\n- Add tools in release venv: `wheel` for bdist and `twine` for publish PyPis\n- Add `--output` to limit output to a JSON property (for scripts), or have `None`\n- Add `examples/` for Kong Admin API loopback and example endpoint via it\n- Add `KONG_ADMIN_URL`, defaults to `http://localhost:8001`\n- Add `KONG_ADMIN_KEY` to use Kong Admin API via loopback and key-auth\n- Add `--admin-url` and `--admin-key` to take precedence over above two\n- Remove `KONG_URL` **BWIC**\n- Remove `--ip` **BWIC**\n\nTODO:\n\n- Add compatibility for \u003c0.14 Kongs, PR the \u003e=0.14 parts back to aio-kong\n\n\n## Installation\n\nFrom [PyPI](https://pypi.org/project/kong-incubator):\n\n    pip install --upgrade kong-incubator\n\nPython \u003e= 3.6 required.\n\n\n## Usage\n\n`KONG_ADMIN_URL` defaults [http://localhost:8001](http://localhost:8001).\n\nCreate or upgrade [resources](https://github.com/asyrjasalo/kongman/blob/master/examples/mockbin.yaml) (is a proxy to [Mockbin](http://mockbin.org)):\n\n    kong-incubator --yaml examples/mockbin.yaml\n\nGenerate a random `key` for its consumer:\n\n    kong-incubator --key-auth mocker\n\nOutput consumer only if `key` has been already set.\n\nRunning with a changed `--yaml` only upgrades the changed parts.\nResources been removed from the file are not deleted from Kong.\nTo delete a resource from Kong, add `ensure: absent` for it in YAML.\n\nFor list of all options, run without any:\n\n```\n$ kong-incubator\n\nUsage: kong-incubator [OPTIONS]\n\nOptions:\n  --admin-url TEXT  Kong Admin API URL.\n                    Default: http://localhost:8001\n                    Precedence over KONG_ADMIN_URL\n  --admin-key TEXT  Kong Admin API apikey if required.\n                    Default: None\n                    Precedence over KONG_ADMIN_KEY\n  --key-auth TEXT   Consumer to generate a key or output the existing.\n  --yaml FILENAME   Defines one or many Kong resources by their target\n                    state.\n  --output TEXT     If given, restrict output to this JSON property, or\n                    None.\n                    By default, output everything.\n  --version         Output version and exit.\n  --help            Show this message and exit.\n```\n\n### Securing Kong Admin API\n\nCreates [Kong Admin API Loopback](https://docs.konghq.com/0.14.x/secure-admin-api/#kong-api-loopback) requiring key-auth:\n\n    kong-incubator --yaml examples/kadmin.yaml\n    kong-incubator --key-auth root --output key\n\nFrom now on, manage Kong via the loopback (checks request header `apikey`):\n\n    export KONG_ADMIN_URL=http://localhost:8000/kadmin\n    export KONG_ADMIN_KEY={{thekeyabove}}\n    kong-incubator --yaml ..\n\nOptions `--admin-url` or `--admin-key` can be used over, or to take precedence:\n\n    export KONG_ADMIN_URL=http://localhost:8000/kadmin\n    kong-incubator --admin-key={{thekeyabove}} --yaml ..\n\nIn Kubernetes/OpenShift, remove routes to 8001 and 8444.\n\n### Use as lib\n\n```python\nimport json\nfrom kong.client import Kong\n\nasync with Kong() as cli:\n    services = await cli.services.get_list()\n    print(json.dumps(services, indent=4))\n```\n\n\n## Development\n\nTests assume you have Kong Admin API running at\n[http://localhost:8001](http://localhost:8001).\n\nIf you have `docker-compose` available, you can run `make dc` to get\n[kongpose/](https://github.com/asyrjasalo/kongpose/blob/master/docker-compose.yml)\nas a git submodule and start it on background for tests.\nUse `make dc_rm` to stop and remove the stack, including the volumes for DBs.\n\nRun `make` as a shortcut for three other rules:\n\n- `make test` creates `.venvs/dev` and installs requirements, also dev.\n  To re-run only the failed tests if any, otherwise all, use\n  `make retest` which skips installation of requirements(-dev).\n  Both clean up the Kong resources they create.\n\n- `make build` recreates `.venvs/release` on each run,\n  installs build tools there and builds source and wheel dists ready to publish.\n\n- `make install` installs the package from source tree.\n  No need reinstalling after source edits as the package is installed editable.\n\nYou can `make --jobs` to run the above rules parallel, hence on 3 CPU cores.\n\nRun `make pur` to [update requirements(-dev)](https://github.com/alanhamlett/pip-update-requirements) locked versions for the dependencies that have them.\n\nMoreover, run `make {{tool}}` for\n[black](https://black.readthedocs.io/en/stable/),\n[flake8](http://flake8.pycqa.org/en/latest/) or\n[mypy](http://mypy-lang.org/). Settings for `flake8` and `mypy`, as well as\n[pytest](https://docs.pytest.org/en/latest/) are in their own config files\nas they do not yet support `pyproject.toml`, like `black`.\n\nRun `make clean` to remove `.venvs/`, `build/`, `dist/` and source tree caches.\n\nSee `make help` for all rules:\n\n```\nall                            Run test, build and install (default goal)\nblack                          Reformat source code in-place\nbuild                          Build source dist and wheel\nclean                          Remove .venvs, builds, dists, and caches\ndc_rm                          Stop and remove docker-compose env and volumes\ndc                             Start docker-compose env on background\nflake8                         Run flake8 for static code analysis\ninstall                        Install package from source tree, as --editable\ninstall_pypi                   Install the latest PyPI release\ninstall_test                   Install the latest test.pypi.org release\nmypy                           Run mypy for static type checking\npublish_pypi                   Publish dists to PyPI\npublish_test                   Publish dists to test.pypi.org\npur                            Update requirements(-dev) for locked versions\nretest                         Run failed tests only, if none, run all\ntest                           Run tests, installs requirements(-dev) first\nuninstall                      Uninstall the package, regardless of its origin\n```\n\n### Publish\n\n[Twine](https://twine.readthedocs.io/en/latest) included to upload over HTTPS.\n\nTo [Test PyPI](https://test.pypi.org/project/kong-incubator):\n\n    make publish_test\n\nTo [PyPI](https://pypi.org/project/kong-incubator)\n\n    make publish_pypi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasyrjasalo%2Fkongman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasyrjasalo%2Fkongman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasyrjasalo%2Fkongman/lists"}