azure-devopsazure-pipelinesmicroservicesazure-pipelines-yamlkong

How to set up kong service and routes from yaml file in Azure devops pipeline


So I have this yaml file with kong service, routes and plugins for a microservice:

_format_version: "1.1"
_info:
  defaults: {}
  select_tags:
    - ms-planning-and-finance
services:
  - connect_timeout: 60000
    enabled: true
    host: ms-planning-and-finance-svc.pdgr-business-services.svc.cluster.local
    name: planning-and-finance-api
    path: /api/planning-and-finance
    port: 4002
    protocol: http
    read_timeout: 60000
    retries: 5
    routes:
      - https_redirect_status_code: 426
        name: planning-and-finance
        path_handling: v0
        paths:
          - /api/planning-and-finance
        plugins:
          - config:
              bearer_only: "yes"
              client_id: ...
              client_secret: ...
        ...
        ...

and I have its CICD pipeline configured in Azure devops (a YAML pipeline), which has a kong step where it creates the service, routes and plugins by using CURL (http PUT and POST requests).

Now Im trying to update that step so it becomes simpler, in the sense that I would like to use that kong.yaml file above to create everything "at once". I'm still researching on this but I haven't found anything useful so far...

How can I "call" that kong.yaml file from my azure yaml pipeline, in order to create those kong resources?

Haven't found anything useful so far...


Solution

  • After some better research, we configured deck in the agent we're using.

    So now the pipelines will call that to sync the changes in the yaml file with the ones currently in the kong gateway. More specifically, it uses deck to:

    • Ping the connection to kong (tests if it connects to the endpoint successfully);
    • Validates the state YAML file with the configurations to update/create in kong;
    • Syncs the changes in the state file with the current kong configuration.

    (deck CLI reference)