Skip to content

Commit

Permalink
add workspace param in fetch last good config
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Jan 9, 2024
1 parent 4b9d152 commit 5088eb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions internal/dataplane/configfetcher/config_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ type DefaultKongLastGoodConfigFetcher struct {
// - Services, Routes, and Consumers - based on their names. It ensures that IDs remain
// stable across restarts of the controller.
fillIDs bool
// workspace is the workspace name used in generating deterministic IDs. Only used when fillIDs = true.
workspace string
}

func NewDefaultKongLastGoodConfigFetcher(fillIDs bool) *DefaultKongLastGoodConfigFetcher {
func NewDefaultKongLastGoodConfigFetcher(fillIDs bool, workspace string) *DefaultKongLastGoodConfigFetcher {

Check failure on line 41 in internal/dataplane/configfetcher/config_fetcher.go

View workflow job for this annotation

GitHub Actions / tools

unused-parameter: parameter 'workspace' seems to be unused, consider removing or renaming it as _ (revive)

Check failure on line 41 in internal/dataplane/configfetcher/config_fetcher.go

View workflow job for this annotation

GitHub Actions / linters / lint

unused-parameter: parameter 'workspace' seems to be unused, consider removing or renaming it as _ (revive)
return &DefaultKongLastGoodConfigFetcher{
config: dump.Config{},
fillIDs: fillIDs,
Expand Down Expand Up @@ -94,7 +96,7 @@ func (cf *DefaultKongLastGoodConfigFetcher) TryFetchingValidConfigFromGateways(
}
if goodKongState != nil {
if cf.fillIDs {
goodKongState.FillIDs(logger, "")
goodKongState.FillIDs(logger, cf.workspace)
}
cf.lastValidState = goodKongState
logger.V(util.DebugLevel).Info("Last good configuration fetched from Kong node", "url", clientUsed.BaseRootURL())
Expand Down
2 changes: 1 addition & 1 deletion internal/dataplane/configfetcher/config_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestTryFetchingValidConfigFromGateways(t *testing.T) {
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
fetcher := NewDefaultKongLastGoodConfigFetcher(false)
fetcher := NewDefaultKongLastGoodConfigFetcher(false, "")
state, ok := fetcher.LastValidConfig()
require.False(t, ok)
require.Nil(t, state)
Expand Down
2 changes: 1 addition & 1 deletion internal/manager/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func Run(

updateStrategyResolver := sendconfig.NewDefaultUpdateStrategyResolver(kongConfig, logger)
configurationChangeDetector := sendconfig.NewDefaultConfigurationChangeDetector(logger)
kongConfigFetcher := configfetcher.NewDefaultKongLastGoodConfigFetcher(translatorFeatureFlags.FillIDs)
kongConfigFetcher := configfetcher.NewDefaultKongLastGoodConfigFetcher(translatorFeatureFlags.FillIDs, c.KongWorkspace)
dataplaneClient, err := dataplane.NewKongClient(
logger,
time.Duration(c.ProxyTimeoutSeconds*float32(time.Second)),
Expand Down

0 comments on commit 5088eb3

Please sign in to comment.