[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r456986342 ## File path: docs/en/setup/backend/dynamic-config.md ## @@ -103,3 +103,20 @@ configuration: appId: ${SW_CONFIG_APOLLO_APP_ID:skywalking} period: ${SW_CONFIG_APOLLO_PERIOD:5} ``` + +## Dynamic Configuration Kuberbetes Configmap Implementation + Review comment: ![image](https://user-images.githubusercontent.com/31562192/87890941-fee53600-ca6a-11ea-9050-e7feab079b9e.png) code like before This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r456984069 ## File path: docs/en/setup/backend/dynamic-config.md ## @@ -103,3 +103,20 @@ configuration: appId: ${SW_CONFIG_APOLLO_APP_ID:skywalking} period: ${SW_CONFIG_APOLLO_PERIOD:5} ``` + +## Dynamic Configuration Kuberbetes Configmap Implementation + Review comment: ![image](https://user-images.githubusercontent.com/31562192/87890941-fee53600-ca6a-11ea-9050-e7feab079b9e.png) code like before This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r454208379 ## File path: oap-server/server-configuration/configuration-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigmapConfigurationWatcherRegister.java ## @@ -0,0 +1,55 @@ +/* + * 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.skywalking.oap.server.configuration.configmap; + +import io.kubernetes.client.openapi.models.V1ConfigMap; +import java.util.Optional; +import java.util.Set; +import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.oap.server.configuration.api.ConfigTable; +import org.apache.skywalking.oap.server.configuration.api.ConfigWatcherRegister; + +@Slf4j +public class ConfigmapConfigurationWatcherRegister extends ConfigWatcherRegister { + +private final ConfigurationConfigmapInformer informer; + +public ConfigmapConfigurationWatcherRegister(ConfigmapConfigurationSettings settings, + ConfigurationConfigmapInformer informer) { +super(settings.getPeriod()); +this.informer = informer; +} + +@Override +public Optional readConfig(Set keys) { +final ConfigTable configTable = new ConfigTable(); + +Optional v1ConfigMap = informer.configMap(); + +for (final String name : keys) { + +final String value = v1ConfigMap.map(configMap -> configMap.getData().get(name)).orElse(null); Review comment: ok,thanks for your notice This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r453316526 ## File path: oap-server/server-bootstrap/src/main/resources/application.yml ## @@ -264,6 +264,10 @@ configuration: period: ${SW_CONFIG_CONSUL_PERIOD:1} # Consul aclToken aclToken: ${SW_CONFIG_CONSUL_ACL_TOKEN:""} + configmap: +period: ${SW_CONFIG_CONSUL_PERIOD:60} Review comment: ok This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r451276365 ## File path: oap-server/server-configuration/configuration-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java ## @@ -0,0 +1,108 @@ +/* + * 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.skywalking.oap.server.configuration.configmap; + +import io.kubernetes.client.informer.SharedIndexInformer; +import io.kubernetes.client.informer.SharedInformerFactory; +import io.kubernetes.client.informer.cache.Lister; +import io.kubernetes.client.openapi.ApiClient; +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.Config; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class ConfigurationConfigmapInformer { + +private static ConfigurationConfigmapInformer informer; + +private Lister configMapLister; + +private SharedInformerFactory factory; + +private final ExecutorService executorService = Executors.newSingleThreadExecutor(r -> { +Thread thread = new Thread(r, "SKYWALKING_KUBERNETES_CONFIGURATION_INFORMER"); +thread.setDaemon(true); +return thread; +}); + +public static ConfigurationConfigmapInformer getInstance(ConfigmapConfigurationSettings settings) { +if (informer == null) { +synchronized (ConfigurationConfigmapInformer.class) { +if (informer == null) { +informer = new ConfigurationConfigmapInformer(settings); +} +} +} +return informer; +} + +private ConfigurationConfigmapInformer(ConfigmapConfigurationSettings settings) { + +try { +doStartConfigMapInformer(settings); +doAddShowdownHook(); +} catch (IOException e) { +log.error("cannot connect with api server in kubernetes", e); +} + +} + +private void doAddShowdownHook() { Review comment: fixed This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r451234306 ## File path: oap-server/server-configuration/configuration-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java ## @@ -0,0 +1,99 @@ +/* + * 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.skywalking.oap.server.configuration.configmap; + +import io.kubernetes.client.informer.SharedIndexInformer; +import io.kubernetes.client.informer.SharedInformerFactory; +import io.kubernetes.client.informer.cache.Lister; +import io.kubernetes.client.openapi.ApiClient; +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.Config; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public enum ConfigurationConfigmapInformer { Review comment: yes, i agree with u ,thx for review again This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r451227086 ## File path: oap-server/server-configuration/configuration-configmap/src/main/java/org/apache/skywalking/oap/server/configuration/configmap/ConfigurationConfigmapInformer.java ## @@ -0,0 +1,99 @@ +/* + * 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.skywalking.oap.server.configuration.configmap; + +import io.kubernetes.client.informer.SharedIndexInformer; +import io.kubernetes.client.informer.SharedInformerFactory; +import io.kubernetes.client.informer.cache.Lister; +import io.kubernetes.client.openapi.ApiClient; +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.Config; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public enum ConfigurationConfigmapInformer { Review comment: It is supposed to be singleton and initialized once, but there are some problems, I will fix it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r451227147 ## File path: docs/en/setup/backend/dynamic-config.md ## @@ -102,3 +102,16 @@ configuration: appId: ${SW_CONFIG_APOLLO_APP_ID:skywalking} period: ${SW_CONFIG_APOLLO_PERIOD:5} ``` + +## Dynamic Configuration Kuberbetes Configmap Implementation + +[configmap](https://kubernetes.io/docs/concepts/configuration/configmap/) is also supported as DCC(Dynamic Configuration Center), to use it, just configured as follows: + +```yaml +configuration: + selector: ${SW_CONFIGURATION:configmap} + configmap: + period: ${SW_CONFIG_CONSUL_PERIOD:60} + namespace: ${SW_CLUSTER_K8S_NAMESPACE:default} + labelSelector: ${SW_CLUSTER_K8S_LABEL:app=collector,release=skywalking} +``` Review comment: no problem This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [skywalking] EvanLjp commented on a change in pull request #4959: Configmap configuration
EvanLjp commented on a change in pull request #4959: URL: https://github.com/apache/skywalking/pull/4959#discussion_r443522852 ## File path: oap-server/server-configuration/configuration-configmap/pom.xml ## @@ -0,0 +1,31 @@ + Review comment: sorry, i would be fix later This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org