From fb14519975f2ebc2850a5dc3793a5eb892214013 Mon Sep 17 00:00:00 2001 From: Tao Yi Date: Tue, 30 Jul 2024 14:43:57 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Jakub Warczarek --- CHANGELOG.md | 2 +- internal/dataplane/configfetcher/config_fetcher.go | 2 +- internal/dataplane/kongstate/customentity.go | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1abcebbd0ab..65d6056a649 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,7 +113,7 @@ Adding a new version? You'll need three changes: Konnect speparately, and avoids one blocking the other. [#6341](https://github.com/Kong/kubernetes-ingress-controller/pull/6341) [#6349](https://github.com/Kong/kubernetes-ingress-controller/pull/6349) -- `KongCustomEntity` is now included in last valid configuration retrieved from +- `KongCustomEntity` is now included in the last valid configuration retrieved from Kong gateways. [#6305](https://github.com/Kong/kubernetes-ingress-controller/pull/6305) diff --git a/internal/dataplane/configfetcher/config_fetcher.go b/internal/dataplane/configfetcher/config_fetcher.go index 3a6f99547cd..a5e86d6fe62 100644 --- a/internal/dataplane/configfetcher/config_fetcher.go +++ b/internal/dataplane/configfetcher/config_fetcher.go @@ -119,7 +119,7 @@ func (cf *DefaultKongLastGoodConfigFetcher) TryFetchingValidConfigFromGateways( ) for _, client := range gatewayClients { logger.V(logging.DebugLevel).Info("Fetching configuration", "url", client.BaseRootURL()) - // copy dump configuration and add custom entity types for fetching config with custom entities + // Copy the dump configuration and add custom entity types to fetch config with custom entities. config := cf.config config.CustomEntityTypes = customEntityTypes rs, err := cf.getKongRawState(ctx, client.AdminAPIClient(), config) diff --git a/internal/dataplane/kongstate/customentity.go b/internal/dataplane/kongstate/customentity.go index ab8e87087d0..fda39923a8c 100644 --- a/internal/dataplane/kongstate/customentity.go +++ b/internal/dataplane/kongstate/customentity.go @@ -232,8 +232,7 @@ func (ks *KongState) AddCustomEntity(entityType string, schema EntitySchema, e C // CustomEntityTypes returns types of translated custom entities included in the KongState. func (ks *KongState) CustomEntityTypes() []string { - return lo.MapToSlice(ks.CustomEntities, func(entityType string, _ *KongCustomEntityCollection) string { - return entityType + return lo.Keys(ks.CustomEntities) }) }