kezhenxu94 commented on a change in pull request #14:
URL: https://github.com/apache/skywalking-showcase/pull/14#discussion_r786541049



##########
File path: .github/workflows/go.yml
##########
@@ -0,0 +1,50 @@
+# 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.
+
+name: Continuous Integration
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main

Review comment:
       ```suggestion
   ```

##########
File path: deploy/platform/kubernetes/features.mk
##########
@@ -54,12 +54,12 @@ feature-als:
 
 .PHONY: deploy.feature-als
 deploy.feature-als: prerequisites
-       $(MAKE) deploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true SHOW_TIPS=false
+       $(MAKE) deploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true 
JAVA_AGENT=$(JAVA_AGENT_OPTS_AGENTLESS) SHOW_TIPS=false

Review comment:
       ```suggestion
        $(MAKE) deploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true SHOW_TIPS=false
   ```

##########
File path: deploy/platform/kubernetes/features.mk
##########
@@ -81,3 +81,31 @@ undeploy.feature-kubernetes-monitor:
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/cluster-role-binding.yaml
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/service.yaml
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/deployment.yaml
+
+# @feature: java-agent-injector; use the java agent injector to inject the 
java agent more natively
+.PHONY: feature-java-agent-injector
+feature-java-agent-injector:
+
+# @feature: java-agent-injector; the swck operator depends on the certificate 
management of the cert-manager
+.PHONY: install-cert-manager
+install-cert-manager:
+       @kubectl apply -f 
https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.yaml
+       @sh ../../../scripts/wait-cert-manager-ready.sh
+
+# @feature: java-agent-injector; the java agent injector is a component of the 
swck operator, so we need to deploy the swck operator firstly
+.PHONY: deploy.feature-java-agent-injector
+deploy.feature-java-agent-injector: install-cert-manager
+       @curl -Ls 
https://dlcdn.apache.org/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl apply -f -
+       @kubectl label namespace --overwrite $(NAMESPACE) swck-injection=enabled
+       # @feature: java-agent-injector; we can update the agent's backend 
address in a single-node cluster firstly so that we don't need to add the same 
backend env for every java agent
+       @kubectl get configmap skywalking-swck-java-agent-configmap -n 
skywalking-swck-system -oyaml | sed 
"s/127.0.0.1/$(NAMESPACE)-oap.$(NAMESPACE)/" | kubectl apply -f -
+       $(MAKE) deploy FEATURE_FLAGS=agent AGENTLESS=false SHOW_TIPS=false
+
+# @feature: java-agent-injector; uninstall the swck operator and cert-manager
+.PHONY: undeploy.feature-java-agent-injector
+undeploy.feature-java-agent-injector:
+       @curl -Ls 
https://dlcdn.apache.org/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl delete -f -

Review comment:
       ```suggestion
        @curl -Ls 
https://archive.apache.org/dist/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl delete -f -
   ```

##########
File path: deploy/platform/kubernetes/features.mk
##########
@@ -54,12 +54,12 @@ feature-als:
 
 .PHONY: deploy.feature-als
 deploy.feature-als: prerequisites
-       $(MAKE) deploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true SHOW_TIPS=false
+       $(MAKE) deploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true 
JAVA_AGENT=$(JAVA_AGENT_OPTS_AGENTLESS) SHOW_TIPS=false
 
 .PHONY: undeploy.feature-als
 undeploy.feature-als:
        $(eval TAG := $(TAG)-agentless)
-       $(MAKE) undeploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true
+       $(MAKE) undeploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true 
JAVA_AGENT=$(JAVA_AGENT_OPTS_AGENTLESS)

Review comment:
       ```suggestion
        $(MAKE) undeploy FEATURE_FLAGS=agent TAG=$(TAG)-agentless 
NAMESPACE=$(NAMESPACE)-agentless AGENTLESS=true
   ```

##########
File path: services/load-gen/Makefile
##########
@@ -27,6 +27,7 @@ docker: docker.build
 
 docker.build:
        docker build . -t $(HUB)/load-gen:$(TAG)
+       docker tag $(HUB)/load-gen:$(TAG) $(HUB)/load-gen:$(TAG)-agentless

Review comment:
       ```suggestion
        docker build . -t $(HUB)/load-gen:$(TAG) -t 
$(HUB)/load-gen:$(TAG)-agentless
   ```

##########
File path: deploy/platform/kubernetes/feature-agent/resources.yaml
##########
@@ -44,16 +44,23 @@ spec:
   template:
     metadata:
       labels:
+        # @feature: java-agent-injector; enable the java agent injector
+        swck-java-agent-injected: "true"
         app: gateway
       annotations:
         sidecar.istio.io/inject: "${AGENTLESS}"
+        # @feature: java-agent-injector; set the java agent configuration
+        strategy.skywalking.apache.org/inject.Container: "gateway"
+        strategy.skywalking.apache.org/agent.Overlay: "true"
+        agent.skywalking.apache.org/agent.service_name: "agent::gateway"
     spec:
       containers:
         - name: gateway
           image: ${HUB}/gateway-service:${TAG}
-          imagePullPolicy: Always
+          imagePullPolicy: IfNotPresent
           ports:
             - containerPort: 80
+          # @feature: als; set env to configure java agent, If we use 
injector, we don't need to set env, only to configure java gent through 
annotation

Review comment:
       ```suggestion
             # @feature: agent; set env to configure java agent, If we use 
injector, we don't need to set env, only to configure java gent through 
annotation
   ```

##########
File path: .github/workflows/go.yml
##########
@@ -0,0 +1,50 @@
+# 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.
+
+name: Continuous Integration
+
+on:
+  pull_request:
+  push:
+    branches:
+      - main
+
+env:
+  IMAGE_HUB: ghcr.io/apache/skywalking-showcase
+
+jobs:
+  e2e-tests:
+    name: e2e tests(kubenretes platform)
+    runs-on: ubuntu-latest
+    steps:
+      - name: Install Go
+        uses: actions/setup-go@v2
+        with:
+          go-version: 1.17
+        id: go
+      - name: Check out code into the Go module directory
+        uses: actions/checkout@v2
+      - name: set image_tag to env
+        shell: bash
+        run: |
+          echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

Review comment:
       ```suggestion
   env:
     IMAGE_HUB: ghcr.io/apache/skywalking-showcase
     IMAGE_TAG: ${{ github.sha }}
   
   jobs:
     e2e-tests:
       name: e2e tests(kubenretes platform)
       runs-on: ubuntu-latest
       steps:
         - name: Install Go
           uses: actions/setup-go@v2
           with:
             go-version: 1.17
         - name: Check out source code
           uses: actions/checkout@v2
   ```

##########
File path: deploy/platform/kubernetes/feature-agent/resources.yaml
##########
@@ -88,16 +95,23 @@ spec:
   template:
     metadata:
       labels:
+        # @feature: java-agent-injector; enable the java agent injector
+        swck-java-agent-injected: "true"
         app: songs
       annotations:
         sidecar.istio.io/inject: "${AGENTLESS}"
+        # @feature: java-agent-injector; set the java agent configuration
+        strategy.skywalking.apache.org/inject.Container: "songs"
+        strategy.skywalking.apache.org/agent.Overlay: "true"
+        agent.skywalking.apache.org/agent.service_name: "agent::songs"
     spec:
       containers:
         - name: songs
           image: ${HUB}/songs-service:${TAG}
-          imagePullPolicy: Always
+          imagePullPolicy: IfNotPresent
           ports:
             - containerPort: 80
+          # @feature: als; set env to configure java agent, If we use 
injector, we don't need to set env, only to configure java gent through 
annotation

Review comment:
       ```suggestion
             # @feature: agent; set env to configure java agent, If we use 
injector, we don't need to set env, only to configure java gent through 
annotation
   ```

##########
File path: scripts/prepare-e2e.sh
##########
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+
+OS=$(go env GOOS)
+ARCH=$(go env GOHOSTARCH)
+
+INSTALL_DIR=/usr/local/bin
+
+TEMP_DIR=/tmp/skywalking-infra-e2e
+
+KUBECTL_VERSION=v1.19.1
+ISTIOCTL_VERSION=1.9.1
+SWCTL_VERSION=0.9.0
+
+prepare_ok=true
+# install kubectl
+function install_kubectl()
+{
+    if ! command -v kubectl &> /dev/null; then
+      curl -LO 
https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${OS}/${ARCH}/kubectl && chmod 
+x ./kubectl && mv ./kubectl ${INSTALL_DIR}
+      if [ $? -ne 0 ]; then
+        echo "install kubectl error, please check"
+        $prepare_ok=false
+      fi
+    fi
+}
+# install istioctl
+function install_istioctl()
+{
+    if ! command -v istioctl &> /dev/null; then
+      mkdir -p $TEMP_DIR && cd $TEMP_DIR
+      curl -L https://istio.io/downloadIstio | 
ISTIO_VERSION=${ISTIOCTL_VERSION} TARGET_ARCH=${ARCH} sh -
+      if [ $? -ne 0 ]; then
+        echo "install istioctl error, please check"
+        $prepare_ok=false
+      fi
+      cp istio-${ISTIO_VERSION}/bin/istioctl $INSTALL_DIR
+    fi
+}
+
+# install swctl
+function install_swctl()
+{
+    if ! command -v swctl &> /dev/null; then
+      cd $TEMP_DIR && wget 
https://github.com/apache/skywalking-cli/archive/0.9.0.tar.gz -O - |\
+      tar xz && cd skywalking-cli-${SWCTL_VERSION} && make ${OS} && mv 
bin/swctl-*-${OS}-amd64 ${INSTALL_DIR}/swctl 
+      if [ $? -ne 0 ]; then
+        echo "install swctl error, please check"
+        $prepare_ok=false

Review comment:
       I don't think this is a valid assignment, please also check other places
   
   ```suggestion
           prepare_ok=false
   ```

##########
File path: scripts/wait-cert-manager-ready.sh
##########
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# 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.
+#
+
+TIMEOUT=120
+
+MANIFEST=$(mktemp)
+
+cat << EOF > $MANIFEST
+apiVersion: cert-manager.io/v1
+kind: Issuer
+metadata:
+  name: test-selfsigned
+  namespace: default
+spec:
+  selfSigned: {}
+---
+apiVersion: cert-manager.io/v1
+kind: Certificate
+metadata:
+  name: selfsigned-cert
+  namespace: default
+spec:
+  dnsNames:
+    - example.com
+  secretName: selfsigned-cert-tls
+  issuerRef:
+    name: test-selfsigned
+EOF
+
+timeout $TIMEOUT bash -c -- "\

Review comment:
       `timeout` command is not available in my MacOS, please try to use other 
means that are generally available, I don't want (myself or others) to struggle 
for installing this just for testing.

##########
File path: deploy/platform/kubernetes/features.mk
##########
@@ -81,3 +81,31 @@ undeploy.feature-kubernetes-monitor:
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/cluster-role-binding.yaml
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/service.yaml
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/deployment.yaml
+
+# @feature: java-agent-injector; use the java agent injector to inject the 
java agent more natively
+.PHONY: feature-java-agent-injector
+feature-java-agent-injector:
+
+# @feature: java-agent-injector; the swck operator depends on the certificate 
management of the cert-manager
+.PHONY: install-cert-manager
+install-cert-manager:
+       @kubectl apply -f 
https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.yaml
+       @sh ../../../scripts/wait-cert-manager-ready.sh
+
+# @feature: java-agent-injector; the java agent injector is a component of the 
swck operator, so we need to deploy the swck operator firstly
+.PHONY: deploy.feature-java-agent-injector
+deploy.feature-java-agent-injector: install-cert-manager
+       @curl -Ls 
https://dlcdn.apache.org/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl apply -f -

Review comment:
       ```suggestion
        @curl -Ls 
https://archive.apache.org/dist/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl apply -f -
   ```

##########
File path: deploy/platform/kubernetes/features.mk
##########
@@ -81,3 +81,31 @@ undeploy.feature-kubernetes-monitor:
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/cluster-role-binding.yaml
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/service.yaml
        @kubectl delete --ignore-not-found -f 
https://raw.githubusercontent.com/kubernetes/kube-state-metrics/v2.2.4/examples/standard/deployment.yaml
+
+# @feature: java-agent-injector; use the java agent injector to inject the 
java agent more natively
+.PHONY: feature-java-agent-injector
+feature-java-agent-injector:
+
+# @feature: java-agent-injector; the swck operator depends on the certificate 
management of the cert-manager
+.PHONY: install-cert-manager
+install-cert-manager:
+       @kubectl apply -f 
https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.yaml
+       @sh ../../../scripts/wait-cert-manager-ready.sh
+
+# @feature: java-agent-injector; the java agent injector is a component of the 
swck operator, so we need to deploy the swck operator firstly
+.PHONY: deploy.feature-java-agent-injector
+deploy.feature-java-agent-injector: install-cert-manager
+       @curl -Ls 
https://dlcdn.apache.org/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl apply -f -
+       @kubectl label namespace --overwrite $(NAMESPACE) swck-injection=enabled
+       # @feature: java-agent-injector; we can update the agent's backend 
address in a single-node cluster firstly so that we don't need to add the same 
backend env for every java agent
+       @kubectl get configmap skywalking-swck-java-agent-configmap -n 
skywalking-swck-system -oyaml | sed 
"s/127.0.0.1/$(NAMESPACE)-oap.$(NAMESPACE)/" | kubectl apply -f -
+       $(MAKE) deploy FEATURE_FLAGS=agent AGENTLESS=false SHOW_TIPS=false
+
+# @feature: java-agent-injector; uninstall the swck operator and cert-manager
+.PHONY: undeploy.feature-java-agent-injector
+undeploy.feature-java-agent-injector:
+       @curl -Ls 
https://dlcdn.apache.org/skywalking/swck/${SWCK_OPERATOR_VERSION}/skywalking-swck-${SWCK_OPERATOR_VERSION}-bin.tgz
 | tar -zxf - -O ./config/operator-bundle.yaml | kubectl delete -f -
+       @kubectl delete -f 
https://github.com/jetstack/cert-manager/releases/download/${CERT_MANAGER_VERSION}/cert-manager.yaml
+       $(MAKE) undeploy FEATURE_FLAGS=agent AGENTLESS=false SHOW_TIPS=false
+       
+       

Review comment:
       ```suggestion
   
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to