This is an automated email from the ASF dual-hosted git repository.

xianjin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 7dd93b8d [#564] test(operator): add end-to-end test (#581)
7dd93b8d is described below

commit 7dd93b8db95aebeda2f90f3e49f4a3d1df089143
Author: jasonawang <[email protected]>
AuthorDate: Tue Mar 14 10:09:15 2023 +0800

    [#564] test(operator): add end-to-end test (#581)
    
    ### What changes were proposed in this pull request?
    Add a script to start the e2e test environment.
    
    ### Why are the changes needed?
    This address #564
    Add a script to start the e2e test environment to support more e2e tests in 
the future.
    
    ### Does this PR introduce _any_ user-facing change?
    For developers, they can quickly build a Kubernetes environment and run rss 
services and operators by docker and kind.
    
    ### How was this patch tested?
    In /deploy/kubernetes/integration-test/e2e directory, run `start-e2e.sh` 
script.
---
 .gitignore                                         |   3 +
 deploy/kubernetes/docker/build.sh                  |   4 +-
 deploy/kubernetes/integration-test/e2e/README.md   |  40 +++++
 deploy/kubernetes/integration-test/e2e/kind-config |  24 +++
 .../integration-test/e2e/set-up-local-cluster.sh   | 184 +++++++++++++++++++++
 .../kubernetes/integration-test/e2e/start-e2e.sh   |  35 ++++
 .../e2e/template/rss-controller-template.yaml      | 128 ++++++++++++++
 .../e2e/template/rss-template.yaml                 |  92 +++++++++++
 .../e2e/template/rss-webhook-template.yaml         | 148 +++++++++++++++++
 9 files changed, 657 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 2496b9ec..b6901d7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,6 @@ common/build/
 integration-test/common/build/
 storage/build/
 build/
+deploy/kubernetes/integration-test/e2e/rss.yaml
+deploy/kubernetes/integration-test/e2e/rss-controller.yaml
+deploy/kubernetes/integration-test/e2e/rss-webhook.yaml
diff --git a/deploy/kubernetes/docker/build.sh 
b/deploy/kubernetes/docker/build.sh
index aca37dd5..bdc27d67 100755
--- a/deploy/kubernetes/docker/build.sh
+++ b/deploy/kubernetes/docker/build.sh
@@ -110,6 +110,8 @@ RSS_DIR=../../..
 cd $RSS_DIR || exit
 RSS_VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | 
grep -v "INFO" | grep -v "WARNING" | tail -n 1)
 RSS_FILE=rss-${RSS_VERSION}.tgz
+echo "RSS_VERSION: $RSS_VERSION"
+echo "RSS_FILE: $RSS_FILE"
 if [ ! -e "$RSS_FILE" ]; \
   then bash ./build_distribution.sh; \
   else echo "$RSS_FILE has been built"; \
@@ -122,7 +124,7 @@ GIT_COMMIT=$(git describe --dirty --always --tags | sed 
's/-/./g')
 echo "image version: ${IMAGE_VERSION:=$RSS_VERSION-$GIT_COMMIT}"
 IMAGE=$REGISTRY/rss-server:$IMAGE_VERSION
 echo "building image: $IMAGE"
-docker build -t "$IMAGE" \
+docker build --network=host -t "$IMAGE" \
              --build-arg RSS_VERSION="$RSS_VERSION" \
              --build-arg HADOOP_VERSION="$HADOOP_VERSION" \
              --build-arg AUTHOR="$AUTHOR" \
diff --git a/deploy/kubernetes/integration-test/e2e/README.md 
b/deploy/kubernetes/integration-test/e2e/README.md
new file mode 100644
index 00000000..a2305cdf
--- /dev/null
+++ b/deploy/kubernetes/integration-test/e2e/README.md
@@ -0,0 +1,40 @@
+<!--
+  ~ 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.
+  -->
+
+# End-to-end Test
+
+Currently, we can quickly pull up an e2e test environment locally by executing 
local-up-cluster.sh.
+
+The kubernetes environment for local testing is built with 
[kind](https://github.com/kubernetes-sigs/kind).
+
+The script reads parameters from the following environment variables, which 
are:
+
++ "TEST_REGISTRY": represents the url of the registry where the test image 
resides
++ "BUILD_NEW_CLUSTER": indicates whether a new kubernetes cluster needs to be 
built
++ "BUILD_RSS_IMAGE": indicates whether a new rss image needs to be built
++ "BUILD_RSS_OPERATOR": indicates whether a new operator image needs to be 
built
+
+We can quickly build the environment by executing the following command:
+
+```
+$ TEST_REGISTRY=${users-registry-url} sh start-e2e.sh
+```
+
+## Dependence
+
+We need to install [golang 1.17+](https://go.dev/doc/install), 
[docker](https://www.docker.com/get-started/) and 
+[kind](https://github.com/kubernetes-sigs/kind) first.
\ No newline at end of file
diff --git a/deploy/kubernetes/integration-test/e2e/kind-config 
b/deploy/kubernetes/integration-test/e2e/kind-config
new file mode 100644
index 00000000..7d196481
--- /dev/null
+++ b/deploy/kubernetes/integration-test/e2e/kind-config
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+- role: control-plane
+- role: worker
+- role: worker
+- role: worker
diff --git a/deploy/kubernetes/integration-test/e2e/set-up-local-cluster.sh 
b/deploy/kubernetes/integration-test/e2e/set-up-local-cluster.sh
new file mode 100644
index 00000000..d7693f04
--- /dev/null
+++ b/deploy/kubernetes/integration-test/e2e/set-up-local-cluster.sh
@@ -0,0 +1,184 @@
+#!/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.
+#
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+STEP_BUILD_KIND_CLUSTER="true"
+STEP_BUILD_NEW_RSS_IMAGE="true"
+STEP_BUILD_NEW_OPERATOR="true"
+
+KIND_K8S_IMAGE=kindest/node:v1.22.15@sha256:7d9708c4b0873f0fe2e171e2b1b7f45ae89482617778c1c875f1053d4cef2e41
+KIND_CLUSTER_NAME=rss-test
+TEST_REGISTRY="docker.io/library"
+TEST_VERSION=$KIND_CLUSTER_NAME
+
+RSS_BUILD_DIR=../../docker
+OPERATOR_BUILD_DIR=../../operator
+
+function pre_check() {
+  docker -v
+  res=$?
+  if [ $res -eq 0 ]; then
+    echo "--->>>docker has been installed"
+  else
+    echo "--->>>please install docker"
+    exit
+  fi
+
+  kind --version
+  res=$?
+  if [ $res -eq 0 ]; then
+    echo "--->>>kind has been installed"
+  else
+    echo "--->>>please install kind"
+    exit
+  fi
+}
+
+function prepare_local_k8s_cluster() {
+  # delete old cluster with the same name
+  kind delete cluster --name ${KIND_CLUSTER_NAME}
+  sleep 5
+  # create new cluster
+  kind create cluster --name ${KIND_CLUSTER_NAME} --image ${KIND_K8S_IMAGE} 
--config kind-config
+  # change context of kubeConfig
+  kubectl cluster-info --context kind-${KIND_CLUSTER_NAME}
+}
+
+function build_rss_image() {
+  cd $RSS_BUILD_DIR
+  export IMAGE_VERSION=$TEST_VERSION
+  sh ./build.sh --registry $TEST_REGISTRY
+  cd "$OLDPWD"
+}
+
+function build_operator_image() {
+  cd $OPERATOR_BUILD_DIR
+  export REGISTRY=$TEST_REGISTRY
+  export VERSION=$TEST_VERSION
+  make docker-push
+  cd "$OLDPWD"
+}
+
+pre_check
+
+while (("$#")); do
+  case $1 in
+  --registry)
+    if [ -n "$2" ]; then
+      TEST_REGISTRY=$2
+    fi
+    shift
+    ;;
+  --build-kind-cluster)
+    STEP_BUILD_KIND_CLUSTER="$2"
+    shift
+    ;;
+  --build-rss-image)
+    STEP_BUILD_NEW_RSS_IMAGE="$2"
+    shift
+    ;;
+  --build-operator)
+    STEP_BUILD_NEW_OPERATOR="$2"
+    shift
+    ;;
+  --*)
+    echo "Error: $1 is not supported"
+    exit_with_usage
+    ;;
+  -*)
+    break
+    ;;
+  *)
+    echo "Error: $1 is not supported"
+    exit_with_usage
+    ;;
+  esac
+  shift
+done
+
+# build k8s environment
+if [ "$STEP_BUILD_KIND_CLUSTER" == "true" ]; then
+  echo "--->>>try to delete the old cluster and create a new cluster"
+  prepare_local_k8s_cluster
+  sleep 60
+fi
+
+# create rss-operator in environment
+if [ "$STEP_BUILD_NEW_OPERATOR" == "true" ]; then
+  # build crd object
+  echo "--->>>create rss crd in cluster"
+  kubectl create -f 
../../operator/config/crd/bases/uniffle.apache.org_remoteshuffleservices.yaml
+  sleep 5
+  # build operator image
+  echo "--->>>try to build test image of rss-operator"
+  build_operator_image
+  # generate operator yaml
+  echo "--->>>try to generate operator yaml from template"
+  export RSS_WEBHOOK_IMAGE=$TEST_REGISTRY/rss-webhook:$TEST_VERSION
+  export RSS_CONTROLLER_IMAGE=$TEST_REGISTRY/rss-controller:$TEST_VERSION
+  envsubst <template/rss-controller-template.yaml >rss-controller.yaml
+  envsubst <template/rss-webhook-template.yaml >rss-webhook.yaml
+  # build rss-operator
+  echo "--->>>try to apply rss-operator in cluster"
+  kubectl apply -f rss-controller.yaml
+  kubectl apply -f rss-webhook.yaml
+  echo "--->>>wait some time for rss-operator to be ready"
+  sleep 60
+fi
+
+# generate rss object yaml
+if [ "$STEP_BUILD_NEW_RSS_IMAGE" == "true" ]; then
+  echo "--->>>try to build test image of rss"
+  build_rss_image
+fi
+
+echo "--->>>try to load image of rss"
+export RSS_SERVER_IMAGE=$TEST_REGISTRY/rss-server:$TEST_VERSION
+kind load docker-image --name ${KIND_CLUSTER_NAME} "${RSS_SERVER_IMAGE}"
+
+echo "--->>>try to generate rss object yaml from template"
+envsubst <template/rss-template.yaml >rss.yaml
+
+# build rss object
+echo "--->>>try to apply a rss object in cluster"
+kubectl apply -f rss.yaml
+echo "--->>>wait some time for the rss cluster to be ready"
+sleep 30
+
+target_cnt=3
+target_times=5
+times=0
+for ((i = 1; i <= 15; i = i + 1)); do
+  running_cnt=$(kubectl get pod -nkube-system | grep -E 
"rss-coordinator|rss-shuffle-server" | grep -v "NAME" | grep -c "Running")
+  echo "--->>>running count: $running_cnt currently"
+  if [ "$running_cnt" -eq $target_cnt ]; then
+    times=$((times + 1))
+    if [ $times -eq $target_times ]; then
+      echo "rss running normally!"
+      exit
+    fi
+  else
+    echo "invalid running count"
+    times=0
+  fi
+  sleep 60
+done
diff --git a/deploy/kubernetes/integration-test/e2e/start-e2e.sh 
b/deploy/kubernetes/integration-test/e2e/start-e2e.sh
new file mode 100755
index 00000000..5f2fdaa4
--- /dev/null
+++ b/deploy/kubernetes/integration-test/e2e/start-e2e.sh
@@ -0,0 +1,35 @@
+#!/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.
+#
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+TEST_REGISTRY=${TEST_REGISTRY-"docker.io/library"}
+BUILD_NEW_CLUSTER=${BUILD_NEW_CLUSTER-"true"}
+BUILD_RSS_IMAGE=${BUILD_RSS_IMAGE-"true"}
+BUILD_RSS_OPERATOR=${BUILD_RSS_OPERATOR-"true"}
+
+echo "TEST_REGISTRY: $TEST_REGISTRY"
+echo "BUILD_NEW_CLUSTER: $BUILD_NEW_CLUSTER"
+echo "BUILD_RSS_IMAGE: $BUILD_RSS_IMAGE"
+echo "BUILD_RSS_OPERATOR: $BUILD_RSS_OPERATOR"
+
+sh set-up-local-cluster.sh --registry "$TEST_REGISTRY" --build-kind-cluster 
"$BUILD_NEW_CLUSTER" \
+          --build-rss-image "$BUILD_RSS_IMAGE" --build-operator 
"$BUILD_RSS_OPERATOR"
diff --git 
a/deploy/kubernetes/integration-test/e2e/template/rss-controller-template.yaml 
b/deploy/kubernetes/integration-test/e2e/template/rss-controller-template.yaml
new file mode 100644
index 00000000..103d50d2
--- /dev/null
+++ 
b/deploy/kubernetes/integration-test/e2e/template/rss-controller-template.yaml
@@ -0,0 +1,128 @@
+#
+# 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.
+#
+
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: rss-controller
+  namespace: kube-system
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rss-controller-role
+rules:
+  - apiGroups: [ "" ]
+    resources: [ "pods" ]
+    verbs: [ "get", "list", "watch", "delete" ]
+  - apiGroups: [ "uniffle.apache.org" ]
+    resources: [ "remoteshuffleservices", "remoteshuffleservices/status" ]
+    verbs: [ "get", "list", "watch", "update" ]
+  - apiGroups: [ "admissionregistration.k8s.io" ]
+    resources: [ "validatingwebhookconfigurations", 
"mutatingwebhookconfigurations" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete" ]
+  - apiGroups: [ "" ]
+    resources: [ "configmaps", "secrets", "services", "serviceaccounts" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete", "patch" ]
+  - apiGroups: [ "apps" ]
+    resources: [ "deployments", "statefulsets" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete", "patch" ]
+  - apiGroups: [ "coordination.k8s.io" ]
+    resources: [ "leases" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete" ]
+  - apiGroups: [ "" ]
+    resources: [ "events" ]
+    verbs: [ "list", "watch", "create", "update", "patch" ]
+---
+kind: ClusterRoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rss-controller-role-binding
+subjects:
+  - kind: ServiceAccount
+    name: rss-controller
+    namespace: kube-system
+roleRef:
+  kind: ClusterRole
+  name: rss-controller-role
+  apiGroup: rbac.authorization.k8s.io
+---
+kind: Deployment
+apiVersion: apps/v1
+metadata:
+  name: rss-controller
+  namespace: kube-system
+spec:
+  strategy:
+    rollingUpdate:
+      maxSurge: 1
+      maxUnavailable: 2
+    type: RollingUpdate
+  selector:
+    matchLabels:
+      app: rss-controller
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: rss-controller
+    spec:
+      serviceAccountName: rss-controller
+      containers:
+        - name: rss-controller
+          image: ${RSS_CONTROLLER_IMAGE}
+          command:
+            - "./controller"
+          args:
+            - "--v=5"
+          ports:
+            - containerPort: 9876
+              protocol: TCP
+          imagePullPolicy: "Always"
+          env:
+            - name: POD_NAME
+              valueFrom:
+                fieldRef:
+                  apiVersion: v1
+                  fieldPath: metadata.name
+            - name: POD_NAMESPACE
+              valueFrom:
+                fieldRef:
+                  apiVersion: v1
+                  fieldPath: metadata.namespace
+            - name: NODE_NAME
+              valueFrom:
+                fieldRef:
+                  fieldPath: spec.nodeName
+          resources:
+            requests:
+              cpu: 500m
+              memory: 1024Mi
+      tolerations:
+        - effect: NoSchedule
+          key: node-role.kubernetes.io/master
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            - labelSelector:
+                matchExpressions:
+                  - key: app
+                    operator: In
+                    values:
+                      - rss-controller
+              topologyKey: kubernetes.io/hostname
diff --git a/deploy/kubernetes/integration-test/e2e/template/rss-template.yaml 
b/deploy/kubernetes/integration-test/e2e/template/rss-template.yaml
new file mode 100644
index 00000000..49927c26
--- /dev/null
+++ b/deploy/kubernetes/integration-test/e2e/template/rss-template.yaml
@@ -0,0 +1,92 @@
+#
+# 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.
+#
+
+---
+apiVersion: uniffle.apache.org/v1alpha1
+kind: RemoteShuffleService
+metadata:
+  name: rss-test
+  namespace: kube-system
+spec:
+  configMapName: "rss-configuration"
+  coordinator:
+    image: "${RSS_SERVER_IMAGE}"
+    initContainerImage: "busybox:latest"
+    rpcNodePort:
+      - 30001
+      - 30011
+    httpNodePort:
+      - 30002
+      - 30012
+    xmxSize: "800M"
+    configDir: "/data/rssadmin/rss/conf"
+    replicas: 1
+    excludeNodesFilePath: "/data/rssadmin/rss/coo/exclude_nodes"
+    securityContext:
+      runAsUser: 1000
+      fsGroup: 1000
+    logHostPath: "/data/logs/rss/coordinator"
+    hostPathMounts:
+      /data/logs/rss/coordinator: /data/rssadmin/rss/logs
+  shuffleServer:
+    sync: true
+    replicas: 1
+    image: "${RSS_SERVER_IMAGE}"
+    initContainerImage: "busybox:latest"
+    upgradeStrategy:
+      type: "FullUpgrade"
+    xmxSize: "800M"
+    configDir: "/data/rssadmin/rss/conf"
+    securityContext:
+      runAsUser: 1000
+      fsGroup: 1000
+    logHostPath: "/data/logs/rss/shuffle-server"
+    hostPathMounts:
+      /data/logs/rss/shuffle-server: /data/rssadmin/rss/logs
+      /data/rssdata1: /data1
+---
+kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: rss-configuration
+  namespace: kube-system
+data:
+  coordinator.conf: |-
+    rss.coordinator.app.expired 60000
+    rss.coordinator.exclude.nodes.file.path /data/rssadmin/rss/coo
+    rss.coordinator.server.heartbeat.timeout 30000
+    rss.jetty.http.port 19996
+    rss.rpc.server.port 19997
+  log4j.properties: |-
+    log4j.rootCategory=INFO, RollingAppender
+    log4j.appender.console=org.apache.log4j.ConsoleAppender
+    log4j.appender.console.Threshold=INFO
+    log4j.appender.console.target=System.err
+    log4j.appender.console.layout=org.apache.log4j.PatternLayout
+    log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p 
%c{1}: %m%n
+    log4j.appender.RollingAppender=org.apache.log4j.RollingFileAppender
+    log4j.appender.RollingAppender.File=./logs/rss.log
+    log4j.appender.RollingAppender.MaxFileSize=50MB
+    log4j.appender.RollingAppender.MaxBackupIndex=10
+    log4j.appender.RollingAppender.layout=org.apache.log4j.PatternLayout
+    log4j.appender.RollingAppender.layout.ConversionPattern=[%p] %d %t %c{1} 
%M - %m%n
+  server.conf: |-
+    rss.coordinator.quorum 
rss-coordinator-rss-demo-0:19997,rss-coordinator-rss-demo-1:19997
+    rss.jetty.http.port 19996
+    rss.server.buffer.capacity 335544320
+    rss.server.read.buffer.capacity 167772160
+    rss.storage.type MEMORY_LOCALFILE
diff --git 
a/deploy/kubernetes/integration-test/e2e/template/rss-webhook-template.yaml 
b/deploy/kubernetes/integration-test/e2e/template/rss-webhook-template.yaml
new file mode 100644
index 00000000..e2182052
--- /dev/null
+++ b/deploy/kubernetes/integration-test/e2e/template/rss-webhook-template.yaml
@@ -0,0 +1,148 @@
+#
+# 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.
+#
+
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: rss-webhook
+  namespace: kube-system
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rss-webhook-role
+rules:
+  - apiGroups: [ "" ]
+    resources: [ "pods" ]
+    verbs: [ "get", "list", "watch", "delete" ]
+  - apiGroups: [ "node.k8s.io" ]
+    resources: [ "runtimeclasses" ]
+    verbs: [ "get", "list", "watch" ]
+  - apiGroups: [ "uniffle.apache.org" ]
+    resources: [ "remoteshuffleservices", "remoteshuffleservices/status" ]
+    verbs: [ "get", "list", "watch", "update" ]
+  - apiGroups: [ "admissionregistration.k8s.io" ]
+    resources: [ "validatingwebhookconfigurations", 
"mutatingwebhookconfigurations" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete" ]
+  - apiGroups: [ "" ]
+    resources: [ "configmaps", "secrets" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete" ]
+  - apiGroups: [ "coordination.k8s.io" ]
+    resources: [ "leases" ]
+    verbs: [ "get", "list", "watch", "update", "create", "delete" ]
+  - apiGroups: [ "" ]
+    resources: [ "events" ]
+    verbs: [ "list", "watch", "create", "update", "patch" ]
+  - apiGroups: [ "node.k8s.io"]
+    resources: [ "runtimeclasses" ]
+    verbs: [ "get", "list", "watch" ]
+---
+kind: ClusterRoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: rss-webhook-role-binding
+subjects:
+  - kind: ServiceAccount
+    name: rss-webhook
+    namespace: kube-system
+roleRef:
+  kind: ClusterRole
+  name: rss-webhook-role
+  apiGroup: rbac.authorization.k8s.io
+---
+kind: Service
+apiVersion: v1
+metadata:
+  name: rss-webhook
+  namespace: kube-system
+spec:
+  type: NodePort
+  selector:
+    service: rss-webhook
+  ports:
+    - protocol: TCP
+      port: 443
+      targetPort: 9876
+      nodePort: 31777
+---
+kind: Deployment
+apiVersion: apps/v1
+metadata:
+  name: rss-webhook
+  namespace: kube-system
+spec:
+  strategy:
+    rollingUpdate:
+      maxSurge: 1
+      maxUnavailable: 2
+    type: RollingUpdate
+  selector:
+    matchLabels:
+      app: rss-webhook
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: rss-webhook
+        service: rss-webhook
+    spec:
+      serviceAccountName: rss-webhook
+      containers:
+        - name: rss-webhook
+          image: ${RSS_WEBHOOK_IMAGE}
+          command:
+            - "./webhook"
+          args:
+           - "--ignore-rss=false"
+           - "--v=4"
+          ports:
+            - containerPort: 9876
+              protocol: TCP
+          imagePullPolicy: "Always"
+          env:
+            - name: POD_NAME
+              valueFrom:
+                fieldRef:
+                  apiVersion: v1
+                  fieldPath: metadata.name
+            - name: POD_NAMESPACE
+              valueFrom:
+                fieldRef:
+                  apiVersion: v1
+                  fieldPath: metadata.namespace
+            - name: NODE_NAME
+              valueFrom:
+                fieldRef:
+                  fieldPath: spec.nodeName
+          resources:
+            requests:
+              cpu: 500m
+              memory: 1024Mi
+      tolerations:
+        - effect: NoSchedule
+          key: node-role.kubernetes.io/master
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            - labelSelector:
+                matchExpressions:
+                  - key: app
+                    operator: In
+                    values:
+                      - rss-webhook
+              topologyKey: kubernetes.io/hostname

Reply via email to