Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Topic deletion policies would enable operations to control which topics cannot be deleted even when request authorizeroperators to control how to proceed when topic deletions are requested.

Implementations of this policy could be used:

  • As additional safeguard when deletion of internal topics is requested, even when a requester is authorized (i.e. has an ACL allowing to deleted).
    • A policy would be useful to avoid the deletion in this case, e.g. deleting Kafka internal topics  __consumer_offsets or application internal topics like Connect internal topics.
    • Authorizer implementations tend to prefer coarse grained permissions to reduce the number of ACLs (e.g. Confluent RBAC which includes Delete as  part of ResourceOwner) which includes both permissions to create and  delete, making it harder to rely only on the Authorizer.
  • To validate against a registry when a topic is deleted, e.g. for cross domain usage.
  • To implement retry-based or flag-based mechanisms to safeguard topic deletion.


There has been related KIPs that included this proposal:

...

Code Block
languagejava
package org.apache.kafka.server.policy;

public interface DeleteTopicPolicy extends Configurable, AutoCloseable {

    class RequestMetadata {
        private final String topic;
        private final Uuid id; 

        public RequestMetadata(String topic, Uuid id) {
            this.topic = topic;
            this.id = id;
        }

        public String topic() {
            return topic;
        }

        public Uuid id() {
            return id;
        }
    }

    void validate(RequestMetadata requestMetadata) throws PolicyViolationException;

}

...