[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 0a62e2bd767075e27dd46ff4efe9a041c342a99d
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 220 +
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 .../skywalking/e2e/retryable/RetryableTest.java|   4 +-
 .../org/apache/skywalking/e2e/mesh/ALSE2E.java |  18 +-
 .../als/{services.yml => instances-reviews.yml}|  16 +-
 .../src/test/resources/expected/als/services.yml   |  12 +-
 .../src/test/resources/expected/als/topo.yml   |  56 ++---
 12 files changed, 359 insertions(+), 283 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..afb3d49
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,220 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceE

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit f747de2d85fa87d1858bed29a46ee1ce9bf0dd2f
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 220 +
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 .../skywalking/e2e/retryable/RetryableTest.java|   4 +-
 .../org/apache/skywalking/e2e/mesh/ALSE2E.java |   2 +-
 .../src/test/resources/expected/als/services.yml   |  12 +-
 .../src/test/resources/expected/als/topo.yml   |  56 ++---
 11 files changed, 344 insertions(+), 266 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..afb3d49
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,220 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInfo

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 19b60d887a56f305bb307dcb12b15e3dcfe5d1c8
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 220 +
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 .../skywalking/e2e/retryable/RetryableTest.java|   4 +-
 .../org/apache/skywalking/e2e/mesh/ALSE2E.java |   2 +-
 .../src/test/resources/expected/als/services.yml   |  12 +-
 10 files changed, 329 insertions(+), 225 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..afb3d49
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,220 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+im

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 23642178c802773707c9e16ab4b2a92197f1a7df
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 220 +
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 .../skywalking/e2e/retryable/RetryableTest.java|   4 +-
 8 files changed, 324 insertions(+), 216 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..afb3d49
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,220 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kuber

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 9d82b69dea40bd26a3afae2c1c8701c68c0d3d2e
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 218 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 .../skywalking/e2e/retryable/RetryableTest.java|   4 +-
 8 files changed, 322 insertions(+), 216 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..fd9d0c6
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,218 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubern

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit aae36dfc315f8c61d4103f8394dc78394d226538
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 217 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 319 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..9e2a0ba
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,217 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubern

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 77257b5af86e7f1d498ce04cb23a8b94300dd1fe
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 221 +
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 323 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..fadfaa1 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,6 +29,7 @@
 
 
 
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..99e578a
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,221 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kuber

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 819bf8b0c811dd678f82ec627babe0b2bb5506e3
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 213 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 314 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..8c2321e
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,213 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 4a05652abe5e7e0bf143230e1536d2d42f22f9c6
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 213 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 314 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..eb6b2cb
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,213 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 0eca7e47ea33f2a6cbfc8c053f2b56d1bed3c38d
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 213 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 314 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..b83944e
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,213 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 8546b9eb042ae4298cbde8e5ba3cfca5eeb570a4
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 312 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 4086b482490d54ed93a6618e7ffa94a13b083ec3
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 313 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..4450f70 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard e29fa9c7dc16409af2cfb9c982c9840d8932c86a
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 401d0254e61e3cfb6f31975f4b87e032c930b5d7
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  13 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 313 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..fc8b388 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,22 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard 80a18d1d475c82ccaace87f2dbe1c0bf22f2dedf
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
+   --set elasticsearch.imageTag=7.5.1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 8b137dc67bc2812bc03d192b2ec635f689f7
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  12 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 312 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..32d6e9c 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,21 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard 80a18d1d475c82ccaace87f2dbe1c0bf22f2dedf
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch7
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+impo

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 62017449515dc6b1318a098485b56e9e34d46f84
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  12 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 312 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..67d0b85 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,21 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard 80a18d1d475c82ccaace87f2dbe1c0bf22f2dedf
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.repository=skywalking/ui \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+impor

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 5710e9c6154ec230082192fab34b6921bbb1f2e7
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  11 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 311 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..89cf382 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,20 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git reset --hard 80a18d1d475c82ccaace87f2dbe1c0bf22f2dedf
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.ku

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 3d433e9189af601ab4cd8fa090e4ca4b8a47a2c8
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |  11 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 311 insertions(+), 215 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..d505044 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,17 +64,20 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git checkout cluster-role
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
--set fullnameOverride=skywalking \
--set elasticsearch.replicas=1 \
+   --set elasticsearch.minimumMasterNodes=1 \
--set oap.env.SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS=k8s-mesh \
--set oap.envoy.als.enabled=true \
--set oap.replicas=1 \
+   --set ui.image.tag=$TAG \
--set oap.image.tag=$TAG \
-   --set oap.image.repository=skywalking/oap
+   --set oap.image.repository=skywalking/oap \
+   --set oap.storageType=elasticsearch
   kubectl -n istio-system get pods
 
   sleep 3
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-24 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 9a1858819f7e9e236bbfe9d267409b8e5ff734ff
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   6 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 307 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..a5518b1 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
@@ -62,7 +64,7 @@ jobs:
 run: |
   git clone https://github.com/apache/skywalking-kubernetes.git
   cd skywalking-kubernetes
-  git reset --hard 419cd1aed8bb4ad972208e5a031527a25d2ae690
+  git checkout cluster-role
   cd chart
   helm dep up skywalking
   helm -n istio-system install skywalking skywalking \
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SService

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 2c92a748cdbb403a4e4592a270ddee524e7540d8
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   4 +-
 docker/oap/log4j2.xml  |   2 +-
 oap-server/pom.xml |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 8 files changed, 307 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..e25b624 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:8-jdk
 
 jobs:
   als:
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git a/oap-server/pom.xml b/oap-server/pom.xml
index 70440f1..b6a0cac 100755
--- a/oap-server/pom.xml
+++ b/oap-server/pom.xml
@@ -68,7 +68,7 @@
 2.6
 6.3.2
 2.10.5
-8.0.0
+9.0.0
 3.1.0
 2.9.1
 2.6.2
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new Co

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 85f8a713f3d5ccb5410b6b5d87193cbf87bb716f
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   4 +-
 docker/oap/log4j2.xml  |   2 +-
 oap-server/pom.xml |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 8 files changed, 307 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..206bea2 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git a/oap-server/pom.xml b/oap-server/pom.xml
index 70440f1..b6a0cac 100755
--- a/oap-server/pom.xml
+++ b/oap-server/pom.xml
@@ -68,7 +68,7 @@
 2.6
 6.3.2
 2.10.5
-8.0.0
+9.0.0
 3.1.0
 2.9.1
 2.6.2
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new C

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit a6a1364a7888de3174f225184ab2194a02cda0c5
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   4 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 306 insertions(+), 213 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..206bea2 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Conf

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit a6a1364a7888de3174f225184ab2194a02cda0c5
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   4 +-
 docker/oap/log4j2.xml  |   2 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 7 files changed, 306 insertions(+), 213 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..206bea2 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
diff --git a/docker/oap/log4j2.xml b/docker/oap/log4j2.xml
index eb69a89..a119e1e 100644
--- a/docker/oap/log4j2.xml
+++ b/docker/oap/log4j2.xml
@@ -29,7 +29,7 @@
 
 
 
-
+
 
 
 
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Conf

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 89400527c0ca4057202f7de381fc4debdc238d4c
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   4 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 305 insertions(+), 212 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..206bea2 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,14 +21,16 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
   ES_VERSION: es7
   ISTIO_VERSION: 1.7.1
+  K8S_VER: 1.17.0
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Config.defaultClient();
+apiClient.setHttpClient(apiClient.getHttpClient()
+ .newBuilder()
+ .readTimeout(0, TimeUnit.SECONDS)
+ .build());
+
+final CoreV1Api coreV1Api = n

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit d8044367d92ba78dffae8cbea954fe36cdfb4452
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   3 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 304 insertions(+), 212 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..39a3ef1 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,6 +21,7 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
@@ -28,7 +29,7 @@ env:
   ISTIO_VERSION: 1.7.1
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:11-jdk
 
 jobs:
   als:
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..97c233c
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Config.defaultClient();
+apiClient.setHttpClient(apiClient.getHttpClient()
+ .newBuilder()
+ .readTimeout(0, TimeUnit.SECONDS)
+ .build());
+
+final CoreV1Api coreV1Api = new CoreV1Api(apiC

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-23 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit e183d74f8ed1c0315176fde9729e32dd8eaa
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   3 +-
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 304 insertions(+), 212 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..7f9bfc6 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,6 +21,7 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
@@ -28,7 +29,7 @@ env:
   ISTIO_VERSION: 1.7.1
   TAG: ${{ github.sha }}
   SCRIPTS_DIR: test/e2e-mesh/e2e-istio/scripts
-  SW_OAP_BASE_IMAGE: openjdk:8-jre-alpine
+  SW_OAP_BASE_IMAGE: openjdk:8-jdk-alpine
 
 jobs:
   als:
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..b735641
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Config.defaultClient();
+apiClient.setHttpClient(apiClient.getHttpClient()
+ .newBuilder()
+ .readTimeout(0, TimeUnit.SECONDS)
+ .build());
+
+final CoreV1Api coreV1Api = new CoreV1Ap

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-22 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 7c60e32fb8110879e5c5c3ad70b762298c276fb8
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 test/e2e-mesh/e2e-istio/scripts/istio.sh   |   3 +-
 6 files changed, 303 insertions(+), 211 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..c139711 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,6 +21,7 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..b735641
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Config.defaultClient();
+apiClient.setHttpClient(apiClient.getHttpClient()
+ .newBuilder()
+ .readTimeout(0, TimeUnit.SECONDS)
+ .build());
+
+final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
+final SharedInformerFactory factory = new SharedInformerFactory();
+
+listenEndpointsEvents(coreV1Api, factory);
+listenPodEvents(coreV1Api, factory);
+
+factory.startAllRegister

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-22 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit e721f379e78e1897cbd36acc5e02330c6cd039d7
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 210 
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 273 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 5 files changed, 301 insertions(+), 209 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..c139711 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,6 +21,7 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..df2b323
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,210 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Config.defaultClient();
+apiClient.setHttpClient(apiClient.getHttpClient()
+ .newBuilder()
+ .readTimeout(0, TimeUnit.SECONDS)
+ .build());
+
+final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
+final SharedInformerFactory factory = new SharedInformerFactory();
+
+listenEndpointsEvents(coreV1Api, factory);
+listenPodEvents(coreV1Api, factory);
+
+factory.startAllRegisteredInformers();
+}
+
+private void listenEndpointsEven

[skywalking] 01/01: Improve K8S ALS analysis

2020-10-22 Thread kezhenxu94
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch k8s/service-registry
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit fc14bedc33085f52a59a7da42bb5c375001645e7
Author: kezhenxu94 
AuthorDate: Fri Oct 23 12:06:38 2020 +0800

Improve K8S ALS analysis

The current implementation of envoy ALS K8S analysis is based on the 
hierarchy, pod -> StatefulSet -> deployment, StatefulSet, or others. It's 
freaky and different from the Istio Kubernetes registry.

The new path is pod -> endpoint -> service, and we should leverage Informer 
API instead of raw Kubernetes API.
---
 .github/workflows/e2e.istio.yaml   |   1 +
 .../receiver/envoy/als/K8SServiceRegistry.java | 211 ++
 .../envoy/als/K8sALSServiceMeshHTTPAnalysis.java   | 241 ++---
 .../server/receiver/envoy/als/ServiceMetaInfo.java |   9 +
 .../receiver/envoy/als/K8sHTTPAnalysisTest.java|  17 +-
 5 files changed, 292 insertions(+), 187 deletions(-)

diff --git a/.github/workflows/e2e.istio.yaml b/.github/workflows/e2e.istio.yaml
index 28db870..c139711 100644
--- a/.github/workflows/e2e.istio.yaml
+++ b/.github/workflows/e2e.istio.yaml
@@ -21,6 +21,7 @@ on:
   push:
 branches:
   - master
+  - k8s/service-registry
 
 env:
   SKIP_TEST: true
diff --git 
a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
new file mode 100644
index 000..4618a94
--- /dev/null
+++ 
b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/K8SServiceRegistry.java
@@ -0,0 +1,211 @@
+/*
+ * 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.receiver.envoy.als;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.kubernetes.client.informer.ResourceEventHandler;
+import io.kubernetes.client.informer.SharedInformerFactory;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.apis.CoreV1Api;
+import io.kubernetes.client.openapi.models.V1Endpoints;
+import io.kubernetes.client.openapi.models.V1EndpointsList;
+import io.kubernetes.client.openapi.models.V1ObjectMeta;
+import io.kubernetes.client.openapi.models.V1Pod;
+import io.kubernetes.client.openapi.models.V1PodList;
+import io.kubernetes.client.util.Config;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static java.util.Objects.requireNonNull;
+
+@Slf4j
+class K8SServiceRegistry {
+final Map ipServiceMap;
+
+final ExecutorService executor;
+
+K8SServiceRegistry() {
+ipServiceMap = new ConcurrentHashMap<>();
+executor = Executors.newCachedThreadPool(
+new ThreadFactoryBuilder()
+.setNameFormat("K8SServiceRegistry-%d")
+.setDaemon(true)
+.build()
+);
+}
+
+void start() throws IOException {
+final ApiClient apiClient = Config.defaultClient();
+apiClient.setHttpClient(apiClient.getHttpClient()
+ .newBuilder()
+ .readTimeout(0, TimeUnit.SECONDS)
+ .build());
+
+final CoreV1Api coreV1Api = new CoreV1Api(apiClient);
+final SharedInformerFactory factory = new SharedInformerFactory();
+
+listenEndpointsEvents(coreV1Api, factory);
+listenPodEvents(coreV1Api, factory);
+
+factory.startAllRegisteredInformers();
+}
+
+private void listenEndpointsEv