Skip to content

Commit

Permalink
add ACLs before removing ACLs
Browse files Browse the repository at this point in the history
  • Loading branch information
tball-dev committed May 4, 2022
1 parent a9f725f commit 98e28c6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.devshawn.kafka.gitops.manager;

import com.devshawn.kafka.gitops.config.ManagerConfig;
import com.devshawn.kafka.gitops.domain.plan.AclPlan;
import com.devshawn.kafka.gitops.domain.plan.DesiredPlan;
import com.devshawn.kafka.gitops.domain.plan.TopicConfigPlan;
import com.devshawn.kafka.gitops.domain.plan.TopicPlan;
Expand Down Expand Up @@ -63,7 +64,9 @@ private void applyTopicConfiguration(TopicPlan topicPlan, TopicConfigPlan topicC
}

public void applyAcls(DesiredPlan desiredPlan) {
desiredPlan.getAclPlans().forEach(aclPlan -> {
List<AclPlan> modifiableAclPlan = new ArrayList<>(desiredPlan.getAclPlans());
modifiableAclPlan.sort(Comparator.comparing(AclPlan::getAction));
modifiableAclPlan.forEach(aclPlan -> {
if (aclPlan.getAction() == PlanAction.ADD) {
LogUtil.printAclPreApply(aclPlan);
kafkaService.createAcl(aclPlan.getAclDetails().toAclBinding());
Expand Down

0 comments on commit 98e28c6

Please sign in to comment.