Skip to content

Commit

Permalink
Merge 09cc033 into backport/NET-8412-fix-acl-policy-creation-for-upgr…
Browse files Browse the repository at this point in the history
…ade/thoroughly-renewing-wasp
  • Loading branch information
hc-github-team-consul-core authored Apr 19, 2024
2 parents 54f1bb3 + 09cc033 commit 9d0aad2
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 9d0aad2

Please sign in to comment.