This is an automated email from the ASF dual-hosted git repository. ramackri pushed a commit to branch RANGER-5658-patch in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 3c7965fdd3d26f3180c518a5eae01dea79d8a5e5 Author: ramk <[email protected]> AuthorDate: Mon Jun 29 19:36:25 2026 +0530 RANGER-5658: Remove obsolete atlas.kafka.zookeeper.connect requirement from Tag Sync. Tag Sync consumes Atlas notifications via kafka-clients (bootstrap.servers only). The legacy zookeeper.connect property was never used by Atlas KafkaNotification but was still required at startup and in installer templates. Co-authored-by: Cursor <[email protected]> --- dev-support/README-RANGER-5658-PR.md | 71 ++++++++++++++++++++++ tagsync/conf/templates/installprop2xml.properties | 1 - tagsync/scripts/install.properties | 3 +- tagsync/scripts/setup.py | 3 - .../tagsync/source/atlas/AtlasTagSource.java | 30 ++++----- .../source/atlas/AtlasTagSourceConfigTest.java | 57 +++++++++++++++++ 6 files changed, 144 insertions(+), 21 deletions(-) diff --git a/dev-support/README-RANGER-5658-PR.md b/dev-support/README-RANGER-5658-PR.md new file mode 100644 index 000000000..044a80ec3 --- /dev/null +++ b/dev-support/README-RANGER-5658-PR.md @@ -0,0 +1,71 @@ +# RANGER-5658 — Remove obsolete atlas.kafka.zookeeper.connect from Tag Sync + +Single reference for the Jira ticket, GitHub PR, and reviewers. + +**Jira:** [RANGER-5658](https://issues.apache.org/jira/browse/RANGER-5658) +**Branch:** `RANGER-5658-patch` + +| Field | Value | +|-------|--------| +| **PR title** | `RANGER-5658: Remove obsolete atlas.kafka.zookeeper.connect requirement from Tag Sync` | +| **Copy target** | Paste [Jira / PR description](#jira--pr-description-copy-from-here) below into Jira **Description** and/or GitHub PR body | + +--- + +## Jira / PR description (copy from here) + +Remove the legacy `atlas.kafka.zookeeper.connect` configuration requirement from Ranger Tag Sync's Atlas Kafka source. + +Tag Sync consumes Atlas entity notifications via `kafka-clients` using `atlas.kafka.bootstrap.servers` and `atlas.kafka.entities.group.id`. The `zookeeper.connect` property was never used by Atlas 2.4 `KafkaNotification` for consumer creation; Ranger only validated that it was set. With Kafka 3.9.x and KRaft brokers, clients do not use ZooKeeper for consumption. + +### Changes + +- Drop `TAGSYNC_ATLAS_ZOOKEEPER_ENDPOINT` constant and startup validation from `AtlasTagSource` +- Extract `validateRequiredAtlasKafkaProperties()` for unit testing +- Remove `TAG_SOURCE_ATLAS_KAFKA_ZOOKEEPER_CONNECT` from `install.properties`, `installprop2xml.properties`, and `setup.py` + +### Out of scope + +- Tag Sync HA (`ranger-tagsync.server.ha.zookeeper.*`) — unchanged; still requires ZooKeeper when HA is enabled +- Atlas REST tag source — unaffected + +### Upgrade note + +Existing deployments may still have `atlas.kafka.zookeeper.connect` in `conf/atlas-application.properties`; it is harmless and can be removed manually. New installs no longer generate or require it. + +--- + +## Test plan + +### Unit tests + +```bash +mvn test -pl tagsync -Drat.skip=true \ + -Dtest=AtlasTagSourceConfigTest \ + -Dsurefire.failIfNoSpecifiedTests=false +``` + +| Test | Verifies | +|------|----------| +| `validateRequiredAtlasKafkaProperties_acceptsBootstrapAndGroupWithoutZookeeper` | No ZK property required when bootstrap + group are set | +| `validateRequiredAtlasKafkaProperties_rejectsMissingBootstrapServers` | Bootstrap servers still mandatory | +| `validateRequiredAtlasKafkaProperties_rejectsMissingConsumerGroup` | Consumer group still mandatory | + +### Manual / integration (recommended) + +- [ ] Fresh Tag Sync install with Atlas Kafka source — `conf/atlas-application.properties` has no `zookeeper.connect` +- [ ] Tag Sync starts and consumes Atlas entity notifications from Kafka 3.9.x (KRaft) +- [ ] Upgrade: existing install with legacy `zookeeper.connect` still starts +- [ ] Tag Sync HA smoke test (if `ranger-tagsync.server.ha.enabled=true`) — leader election unchanged + +--- + +## Files changed + +| File | Change | +|------|--------| +| `tagsync/src/main/java/.../AtlasTagSource.java` | Remove ZK validation; add `validateRequiredAtlasKafkaProperties()` | +| `tagsync/src/test/java/.../AtlasTagSourceConfigTest.java` | Unit tests for required Kafka properties | +| `tagsync/scripts/install.properties` | Remove `TAG_SOURCE_ATLAS_KAFKA_ZOOKEEPER_CONNECT` | +| `tagsync/conf/templates/installprop2xml.properties` | Remove install → Atlas mapping | +| `tagsync/scripts/setup.py` | Stop writing `atlas.kafka.zookeeper.connect` | diff --git a/tagsync/conf/templates/installprop2xml.properties b/tagsync/conf/templates/installprop2xml.properties index d6f289a55..aea6537ee 100644 --- a/tagsync/conf/templates/installprop2xml.properties +++ b/tagsync/conf/templates/installprop2xml.properties @@ -24,7 +24,6 @@ TAG_SOURCE_ATLAS_ENABLED = ranger.tagsync.source.atlas TAG_SOURCE_ATLAS_KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR = atlas.kafka.offsets.topic.replication.factor TAG_SOURCE_ATLAS_KAFKA_BOOTSTRAP_SERVERS = atlas.kafka.bootstrap.servers -TAG_SOURCE_ATLAS_KAFKA_ZOOKEEPER_CONNECT = atlas.kafka.zookeeper.connect TAG_SOURCE_ATLAS_KAFKA_ENTITIES_GROUP_ID = atlas.kafka.entities.group.id TAG_SOURCE_ATLAS_KAFKA_SERVICE_NAME = atlas.kafka.sasl.kerberos.service.name diff --git a/tagsync/scripts/install.properties b/tagsync/scripts/install.properties index ae2e555eb..278df0ff8 100644 --- a/tagsync/scripts/install.properties +++ b/tagsync/scripts/install.properties @@ -27,9 +27,8 @@ TAG_DEST_RANGER_SSL_CONFIG_FILENAME = TAG_SOURCE_ATLAS_ENABLED = true -# Endpoint specifications needed by Atlas +# Kafka settings for Atlas notification consumer (bootstrap.servers only; no ZooKeeper) TAG_SOURCE_ATLAS_KAFKA_BOOTSTRAP_SERVERS = localhost:6667 -TAG_SOURCE_ATLAS_KAFKA_ZOOKEEPER_CONNECT = localhost:2181 TAG_SOURCE_ATLAS_KAFKA_ENTITIES_GROUP_ID = ranger_entities_consumer TAG_SOURCE_ATLAS_KAFKA_SERVICE_NAME = kafka diff --git a/tagsync/scripts/setup.py b/tagsync/scripts/setup.py index 1fbf5f181..df98f87c0 100755 --- a/tagsync/scripts/setup.py +++ b/tagsync/scripts/setup.py @@ -68,7 +68,6 @@ initPrefixList = ['S99', 'K00'] TAGSYNC_ATLAS_KAFKA_ENDPOINTS_KEY = 'TAG_SOURCE_ATLAS_KAFKA_BOOTSTRAP_SERVERS' -TAGSYNC_ATLAS_ZOOKEEPER_ENDPOINT_KEY = 'TAG_SOURCE_ATLAS_KAFKA_ZOOKEEPER_CONNECT' TAGSYNC_ATLAS_KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR_KEY = 'TAG_SOURCE_ATLAS_KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR' TAGSYNC_ATLAS_CONSUMER_GROUP_KEY = 'TAG_SOURCE_ATLAS_KAFKA_ENTITIES_GROUP_ID' @@ -231,8 +230,6 @@ def convertInstallPropsToXML(props): newKey = directKeyMap[k] if (k == TAGSYNC_ATLAS_KAFKA_ENDPOINTS_KEY): atlasOutFile.write(newKey + "=" + v + "\n") - elif (k == TAGSYNC_ATLAS_ZOOKEEPER_ENDPOINT_KEY): - atlasOutFile.write(newKey + "=" + v + "\n") elif (k == TAGSYNC_ATLAS_KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR_KEY): atlasOutFile.write(newKey + "=" + v + "\n") elif (k == TAGSYNC_ATLAS_CONSUMER_GROUP_KEY): diff --git a/tagsync/src/main/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSource.java b/tagsync/src/main/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSource.java index eeeccaf4a..780845e39 100644 --- a/tagsync/src/main/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSource.java +++ b/tagsync/src/main/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSource.java @@ -48,9 +48,8 @@ public class AtlasTagSource extends AbstractTagSource { private static final Logger LOG = LoggerFactory.getLogger(AtlasTagSource.class); public static final String TAGSYNC_ATLAS_PROPERTIES_FILE_NAME = "atlas-application.properties"; - public static final String TAGSYNC_ATLAS_KAFKA_ENDPOINTS = "atlas.kafka.bootstrap.servers"; - public static final String TAGSYNC_ATLAS_ZOOKEEPER_ENDPOINT = "atlas.kafka.zookeeper.connect"; - public static final String TAGSYNC_ATLAS_CONSUMER_GROUP = "atlas.kafka.entities.group.id"; + public static final String TAGSYNC_ATLAS_KAFKA_ENDPOINTS = "atlas.kafka.bootstrap.servers"; + public static final String TAGSYNC_ATLAS_CONSUMER_GROUP = "atlas.kafka.entities.group.id"; public static final int MAX_WAIT_TIME_IN_MILLIS = 1000; private int maxBatchSize; @@ -88,18 +87,7 @@ public boolean initialize(Properties properties) { } if (ret) { - if (StringUtils.isBlank(atlasProperties.getProperty(TAGSYNC_ATLAS_KAFKA_ENDPOINTS))) { - ret = false; - LOG.error("Value of property '{}' is not specified!", TAGSYNC_ATLAS_KAFKA_ENDPOINTS); - } - if (StringUtils.isBlank(atlasProperties.getProperty(TAGSYNC_ATLAS_ZOOKEEPER_ENDPOINT))) { - ret = false; - LOG.error("Value of property '{}' is not specified!", TAGSYNC_ATLAS_ZOOKEEPER_ENDPOINT); - } - if (StringUtils.isBlank(atlasProperties.getProperty(TAGSYNC_ATLAS_CONSUMER_GROUP))) { - ret = false; - LOG.error("Value of property '{}' is not specified!", TAGSYNC_ATLAS_CONSUMER_GROUP); - } + ret = validateRequiredAtlasKafkaProperties(atlasProperties); } if (ret) { @@ -116,6 +104,18 @@ public boolean initialize(Properties properties) { return ret; } + boolean validateRequiredAtlasKafkaProperties(Properties atlasProperties) { + if (StringUtils.isBlank(atlasProperties.getProperty(TAGSYNC_ATLAS_KAFKA_ENDPOINTS))) { + LOG.error("Value of property '{}' is not specified!", TAGSYNC_ATLAS_KAFKA_ENDPOINTS); + return false; + } + if (StringUtils.isBlank(atlasProperties.getProperty(TAGSYNC_ATLAS_CONSUMER_GROUP))) { + LOG.error("Value of property '{}' is not specified!", TAGSYNC_ATLAS_CONSUMER_GROUP); + return false; + } + return true; + } + @Override public boolean start() { LOG.debug("==> AtlasTagSource.start()"); diff --git a/tagsync/src/test/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSourceConfigTest.java b/tagsync/src/test/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSourceConfigTest.java new file mode 100644 index 000000000..37285751f --- /dev/null +++ b/tagsync/src/test/java/org/apache/ranger/tagsync/source/atlas/AtlasTagSourceConfigTest.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.ranger.tagsync.source.atlas; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Properties; + +public class AtlasTagSourceConfigTest { + private final AtlasTagSource tagSource = new AtlasTagSource(); + + @Test + public void validateRequiredAtlasKafkaProperties_acceptsBootstrapAndGroupWithoutZookeeper() { + Properties atlasProperties = new Properties(); + + atlasProperties.setProperty(AtlasTagSource.TAGSYNC_ATLAS_KAFKA_ENDPOINTS, "kafka1:9092,kafka2:9092"); + atlasProperties.setProperty(AtlasTagSource.TAGSYNC_ATLAS_CONSUMER_GROUP, "ranger_entities_consumer"); + + Assertions.assertTrue(tagSource.validateRequiredAtlasKafkaProperties(atlasProperties)); + } + + @Test + public void validateRequiredAtlasKafkaProperties_rejectsMissingBootstrapServers() { + Properties atlasProperties = new Properties(); + + atlasProperties.setProperty(AtlasTagSource.TAGSYNC_ATLAS_CONSUMER_GROUP, "ranger_entities_consumer"); + + Assertions.assertFalse(tagSource.validateRequiredAtlasKafkaProperties(atlasProperties)); + } + + @Test + public void validateRequiredAtlasKafkaProperties_rejectsMissingConsumerGroup() { + Properties atlasProperties = new Properties(); + + atlasProperties.setProperty(AtlasTagSource.TAGSYNC_ATLAS_KAFKA_ENDPOINTS, "kafka1:9092"); + + Assertions.assertFalse(tagSource.validateRequiredAtlasKafkaProperties(atlasProperties)); + } +}
