Skip to content

Move removal of Data ConfigMaps out of loop  #141

@rg2011

Description

@rg2011

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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions