-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/v3.0-develop' into summer-ospp#12017-sync-3.0
# Conflicts: # console-ui/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js
- Loading branch information
Showing
51 changed files
with
3,425 additions
and
351 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
config/src/main/java/com/alibaba/nacos/config/server/model/event/IstioConfigChangeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 1999-2023 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed 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 com.alibaba.nacos.config.server.model.event; | ||
|
||
public class IstioConfigChangeEvent extends ConfigDataChangeEvent { | ||
|
||
public final String content; | ||
|
||
public final String type; | ||
|
||
public IstioConfigChangeEvent(String dataId, String group, long gmtModified, String content, String type) { | ||
super(dataId, group, gmtModified); | ||
this.content = content; | ||
this.type = type; | ||
} | ||
|
||
public IstioConfigChangeEvent(boolean isBeta, String dataId, String group, String tenant, long gmtModified, | ||
String content, String type) { | ||
super(isBeta, dataId, group, tenant, gmtModified); | ||
this.content = content; | ||
this.type = type; | ||
} | ||
|
||
public IstioConfigChangeEvent(boolean isBeta, String dataId, String group, long gmtModified, String content, | ||
String type) { | ||
super(isBeta, dataId, group, gmtModified); | ||
this.content = content; | ||
this.type = type; | ||
} | ||
|
||
public IstioConfigChangeEvent(boolean isBeta, String dataId, String group, String tenant, String tag, | ||
long gmtModified, String content, String type) { | ||
super(isBeta, dataId, group, tenant, tag, gmtModified); | ||
this.content = content; | ||
this.type = type; | ||
} | ||
|
||
public IstioConfigChangeEvent(String dataId, String group, String tenant, boolean isBatch, long gmtModified, | ||
String content, String type) { | ||
super(dataId, group, tenant, isBatch, gmtModified); | ||
this.content = content; | ||
this.type = type; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
config/src/main/java/com/alibaba/nacos/config/server/utils/ConfigTagUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 1999-2023 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed 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 com.alibaba.nacos.config.server.utils; | ||
|
||
import java.util.Arrays; | ||
|
||
public class ConfigTagUtil { | ||
|
||
public static final String VIRTUAL_SERVICE = "virtual-service"; | ||
|
||
public static final String DESTINATION_RULE = "destination-rule"; | ||
|
||
private static final String TAGS_DELIMITER = ","; | ||
|
||
private static final String HYPHEN = "-"; | ||
|
||
/** | ||
* <p>Checks if config tags contains "virtual-service" or "destination-rule".</p> | ||
* @param configTags the tags to check | ||
* @return {@code true} if the config tags contains "virtual-service" or "destination-rule". | ||
*/ | ||
public static boolean isIstio(String configTags) { | ||
if (configTags == null) { | ||
return false; | ||
} | ||
if (configTags.isEmpty()) { | ||
return false; | ||
} | ||
return Arrays.stream(configTags.split(TAGS_DELIMITER)) | ||
.map(tag -> tag.trim().replaceAll(HYPHEN, "")) | ||
.anyMatch(tag -> tag.equalsIgnoreCase(VIRTUAL_SERVICE.replaceAll(HYPHEN, "")) | ||
|| tag.equalsIgnoreCase(DESTINATION_RULE.replaceAll(HYPHEN, ""))); | ||
} | ||
|
||
/** | ||
* <p>Gets the type of Istio from the config tags.</p> | ||
* @param configTags the tags to check | ||
* @return the type of Istio if it is found, {@code null} otherwise. | ||
* @throws IllegalArgumentException if configTags is null. | ||
*/ | ||
public static String getIstioType(String configTags) { | ||
if (configTags == null) { | ||
throw new IllegalArgumentException("configTags cannot be null."); | ||
} | ||
|
||
if (configTags.isEmpty()) { | ||
return null; | ||
} | ||
|
||
return Arrays.stream(configTags.split(TAGS_DELIMITER)) | ||
.map(tag -> tag.trim().replaceAll(HYPHEN, "")) | ||
.filter(tag -> tag.equalsIgnoreCase(VIRTUAL_SERVICE.replaceAll(HYPHEN, "")) | ||
|| tag.equalsIgnoreCase(DESTINATION_RULE.replaceAll(HYPHEN, ""))) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.