Skip to content

Commit

Permalink
Modify styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
wukong121 committed Oct 7, 2023
1 parent b3e8e9e commit ed7c1df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
import java.io.FileReader;
import java.io.IOException;

/**
* The ApiClient factory.
*
* @author wangyixing
*/
public class ApiClientFactory {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,16 @@
import io.kubernetes.client.informer.SharedIndexInformer;
import io.kubernetes.client.informer.SharedInformerFactory;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1ConfigMap;
import io.kubernetes.client.openapi.models.V1ConfigMapList;
import io.kubernetes.client.util.CallGeneratorParams;
import io.kubernetes.client.util.ClientBuilder;
import io.kubernetes.client.util.KubeConfig;
import okhttp3.OkHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -237,7 +233,7 @@ public ConfigInfo configMapToNacosConfigInfo(V1ConfigMap configMap) {
String group = ConfigMapSyncConfig.K8S_GROUP;
String tenant = configMap.getMetadata().getNamespace();
// 将 ConfigMap 的数据转换为 Nacos 的配置内容
Map<String, String> dataMap = configMap.getData() != null ? configMap.getData() : new HashMap<>();
Map<String, String> dataMap = configMap.getData() != null ? configMap.getData() : new HashMap<>(10);
String content = getContent(dataMap);
return new ConfigInfo(dataId, group, tenant, null, content);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ public void checkAndSyncConfigMaps() {
* @return whether contents are equal.
*/
private Boolean compareContent(String configMapContent, String nacosContent) {
if (configMapContent == null && nacosContent != null || configMapContent != null && nacosContent == null) {
if (configMapContent == null && nacosContent != null) {
return false;
}
if (configMapContent != null && nacosContent == null) {
return false;
}
assert configMapContent != null;
Expand Down

0 comments on commit ed7c1df

Please sign in to comment.