Skip to content

Commit

Permalink
fix policy creation for upgrading
Browse files Browse the repository at this point in the history
  • Loading branch information
jm96441n committed Apr 17, 2024
1 parent 2405bf6 commit 09cc033
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion control-plane/api-gateway/cache/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ func (c *Cache) ensurePolicy(client *api.Client, gatewayName string) (string, er
if err != nil {
return "", err
}

// on an upgrade the cache will be empty so we need to write the policy to the cache
c.gatewayNameToPolicy[gatewayName] = existing
return existing.ID, nil
}

Expand Down Expand Up @@ -389,6 +392,8 @@ func (c *Cache) ensurePolicy(client *api.Client, gatewayName string) (string, er
return "", err
}

// update cache with existing policy
c.gatewayNameToPolicy[gatewayName] = existing
return existing.ID, nil
}

Expand Down Expand Up @@ -429,7 +434,8 @@ func (c *Cache) ensureRole(client *api.Client, gatewayName string) (string, erro
}

if aclRole != nil {
return cachedRole.Name, nil
c.gatewayNameToRole[gatewayName] = aclRole
return aclRole.Name, nil
}

return createRole()
Expand Down

0 comments on commit 09cc033

Please sign in to comment.