From b4340a767f9b73c3b0a137f077623998703642dd Mon Sep 17 00:00:00 2001 From: Rick Spurgeon Date: Wed, 26 Jul 2023 12:43:40 -0500 Subject: [PATCH] WIP: Adding workflow for jwt plugin --- .github/workflows/stage-changes-for-kong.yaml | 21 +++++++++++++------ platform/kong/patches.yaml | 8 +++++++ platform/kong/platform-kong-base.yaml | 2 ++ 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 platform/kong/platform-kong-base.yaml diff --git a/.github/workflows/stage-changes-for-kong.yaml b/.github/workflows/stage-changes-for-kong.yaml index b915f95..1e3cc0a 100644 --- a/.github/workflows/stage-changes-for-kong.yaml +++ b/.github/workflows/stage-changes-for-kong.yaml @@ -73,7 +73,8 @@ jobs: run: | deck file openapi2kong -s flight-data/flights/openapi.yaml | \ deck file patch flight-data/flights/kong/patches.yaml | \ - deck file add-tags -o .github/artifacts/kong/flight-data-flights-kong.yaml --selector "$.services[*]" --selector "$.services[*].routes[*]" flight-data + deck file add-tags -o .github/artifacts/kong/flight-data-flights-kong.yaml \ + --selector "$.services[*]" --selector "$.services[*].routes[*]" flight-data - name: Convert Routes API to Kong @@ -82,7 +83,8 @@ jobs: run: | deck file openapi2kong -s flight-data/routes/openapi.yaml | \ deck file patch flight-data/routes/kong/patches.yaml | \ - deck file add-tags -o .github/artifacts/kong/flight-data-routes-kong.yaml --selector "$.services[*]" --selector "$.services[*].routes[*]" flight-data + deck file add-tags -o .github/artifacts/kong/flight-data-routes-kong.yaml \ + --selector "$.services[*]" --selector "$.services[*].routes[*]" flight-data - name: Convert Bookings API to Kong # In two steps, convert the OpenAPI Spec to a Kong declarative configuration @@ -90,7 +92,8 @@ jobs: run: | deck file openapi2kong -s sales/bookings/openapi.yaml | \ deck file patch sales/bookings/kong/patches.yaml | \ - deck file add-tags -o .github/artifacts/kong/sales-bookings-kong.yaml --selector "$.services[*]" --selector "$.services[*].routes[*]" sales + deck file add-tags -o .github/artifacts/kong/sales-bookings-kong.yaml \ + --selector "$.services[*]" --selector "$.services[*].routes[*]" sales - name: Convert Customers API to Kong # In two steps, convert the OpenAPI Spec to a Kong declarative configuration @@ -98,19 +101,25 @@ jobs: run: | deck file openapi2kong -s sales/customer/openapi.yaml | \ deck file patch sales/customer/kong/patches.yaml | \ - deck file add-tags -o .github/artifacts/kong/sales-customer-kong.yaml --selector "$.services[*]" --selector "$.services[*].routes[*]" sales + deck file add-tags -o .github/artifacts/kong/sales-customer-kong.yaml --selector "$.services[*]" \ + --selector "$.services[*].routes[*]" sales - name: Combine Kong Configurations # Combine all the previous OAS->Kong configurations into one and put it in a well known place run: | - deck file merge .github/artifacts/kong/*-kong.yaml -o .github/artifacts/kong/kong-combined.yaml + cp platform/kong/platform-kong-base.yaml .github/artifacts/kong/ + deck file merge \ + .github/artifacts/kong/*-kong.yaml \ + .github/artifacts/kong/platform-kong-base.yaml \ + -o .github/artifacts/kong/kong-combined.yaml - name: Platform Team Kong Additions # The platform team has their own things to add to the final Kong configuration # The platform/kong/.generated/kong.yaml is the final product and is stored in the repository # Storing the generated file in the repo is intentional, it should help with PR reviews, transparency, and debugging run: | - deck file merge .github/artifacts/kong/kong-combined.yaml platform/kong/plugins/* platform/kong/vaults/* | deck file patch -o platform/kong/.generated/kong.yaml platform/kong/patches.yaml + deck file merge .github/artifacts/kong/kong-combined.yaml platform/kong/plugins/* platform/kong/vaults/* | \ + deck file patch -o platform/kong/.generated/kong.yaml platform/kong/patches.yaml - name: Upload Artifacts # Artifacts are the files that are built along the way of the pipeline but are not committed to the repo diff --git a/platform/kong/patches.yaml b/platform/kong/patches.yaml index c07ac1e..d246c7d 100644 --- a/platform/kong/patches.yaml +++ b/platform/kong/patches.yaml @@ -8,3 +8,11 @@ patches: values: protocols: - https + # Add default settings for plugin configs + - selectors: + - $._plugin_configs + values: + default-jwt: + name: jwt + config: + enabled: true diff --git a/platform/kong/platform-kong-base.yaml b/platform/kong/platform-kong-base.yaml new file mode 100644 index 0000000..3bb30d7 --- /dev/null +++ b/platform/kong/platform-kong-base.yaml @@ -0,0 +1,2 @@ +# This will be used as the base file for the Kong configuration. +_plugin_configs: {}