Skip to content

Commit 7989f48

Browse files
committed
[FLINK-36257][K8S] Remove legacy k8s labels
1 parent aac4e8b commit 7989f48

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/resources/KubernetesLeaderElector.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
import java.util.concurrent.Executors;
4444
import java.util.concurrent.TimeUnit;
4545

46-
import static org.apache.flink.kubernetes.utils.Constants.LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY;
47-
4846
/**
4947
* Represent {@link KubernetesLeaderElector} in kubernetes. {@link LeaderElector#run()} is a
5048
* blocking call. It should be run in the IO executor, not the main thread. The lifecycle is bound
@@ -104,8 +102,7 @@ public KubernetesLeaderElector(
104102
// ConfigMaps.
105103
.withLabels(
106104
KubernetesUtils.getConfigMapLabels(
107-
leaderConfig.getClusterId(),
108-
LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY))
105+
leaderConfig.getClusterId()))
109106
.build(),
110107
leaderConfig.getLockIdentity()))
111108
.withRenewDeadline(leaderConfig.getRenewDeadline())

flink-kubernetes/src/main/java/org/apache/flink/kubernetes/utils/KubernetesUtils.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
import static org.apache.flink.kubernetes.utils.Constants.DNS_POLICY_DEFAULT;
8989
import static org.apache.flink.kubernetes.utils.Constants.DNS_POLICY_HOSTNETWORK;
9090
import static org.apache.flink.kubernetes.utils.Constants.JOB_GRAPH_STORE_KEY_PREFIX;
91-
import static org.apache.flink.kubernetes.utils.Constants.LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY;
9291
import static org.apache.flink.kubernetes.utils.Constants.LEADER_ADDRESS_KEY;
9392
import static org.apache.flink.kubernetes.utils.Constants.LEADER_SESSION_ID_KEY;
9493
import static org.apache.flink.kubernetes.utils.Constants.SUBMITTED_JOBGRAPH_FILE_PREFIX;
@@ -192,13 +191,10 @@ public static Map<String, String> getCommonLabels(String clusterId) {
192191
* the resources.
193192
*
194193
* @param clusterId cluster id
195-
* @param type the config map use case. It could only be {@link
196-
* Constants#LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY} now.
197194
* @return Return ConfigMap labels.
198195
*/
199-
public static Map<String, String> getConfigMapLabels(String clusterId, String type) {
196+
public static Map<String, String> getConfigMapLabels(String clusterId) {
200197
final Map<String, String> labels = new HashMap<>(getCommonLabels(clusterId));
201-
labels.put(Constants.LABEL_CONFIGMAP_TYPE_KEY, type);
202198
return Collections.unmodifiableMap(labels);
203199
}
204200

@@ -561,9 +557,7 @@ public static void createConfigMapIfItDoesNotExist(
561557
new ConfigMapBuilder()
562558
.withNewMetadata()
563559
.withName(configMapName)
564-
.withLabels(
565-
getConfigMapLabels(
566-
clusterId, LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY))
560+
.withLabels(getConfigMapLabels(clusterId))
567561
.endMetadata()
568562
.build());
569563

flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/resources/KubernetesLeaderElectorITCase.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import java.util.UUID;
3737

3838
import static org.apache.flink.core.testutils.FlinkAssertions.assertThatFuture;
39-
import static org.apache.flink.kubernetes.utils.Constants.LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY;
40-
import static org.apache.flink.kubernetes.utils.Constants.LABEL_CONFIGMAP_TYPE_KEY;
4139
import static org.assertj.core.api.Assertions.assertThat;
4240

4341
/**
@@ -153,12 +151,7 @@ void testClusterConfigMapLabelsAreSet() throws Exception {
153151

154152
assertThat(kubeClient.getConfigMap(configMapName))
155153
.hasValueSatisfying(
156-
configMap ->
157-
assertThat(configMap.getLabels())
158-
.hasSize(3)
159-
.containsEntry(
160-
LABEL_CONFIGMAP_TYPE_KEY,
161-
LABEL_CONFIGMAP_TYPE_HIGH_AVAILABILITY));
154+
configMap -> assertThat(configMap.getLabels()).hasSize(2));
162155
} finally {
163156
leaderElector.stop();
164157
}

0 commit comments

Comments
 (0)