Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move removal of Data ConfigMaps out of loop #141

Open
rg2011 opened this issue Mar 31, 2022 · 0 comments
Open

Move removal of Data ConfigMaps out of loop #141

rg2011 opened this issue Mar 31, 2022 · 0 comments

Comments

@rg2011
Copy link
Contributor

rg2011 commented Mar 31, 2022

When a data Configmap is removed, pkg.configmap.Sync loops on the keys of the ConfigMap and sends a remove request to OPA (PatchData) once per key. But the path in the request is always the same, so effectively it is trying to remove the same object several times:

path := fmt.Sprintf("%v/%v", cm.Namespace, cm.Name)
for key := range cm.Data {
id := fmt.Sprintf("%v/%v", path, key)
if isPolicy {
if err := s.opa.DeletePolicy(id); err != nil {
logrus.Errorf("Failed to delete policy %v: %v", id, err)
}
} else {
if err := s.opa.PatchData(path, "remove", nil); err != nil {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant