You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2021/12/01 19:09:25 UTC
[submarine] branch master updated: SUBMARINE-1103. Add operator e2e test and verify-codegen.sh to github actions
This is an automated email from the ASF dual-hosted git repository.
pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 1133f2b SUBMARINE-1103. Add operator e2e test and verify-codegen.sh to github actions
1133f2b is described below
commit 1133f2bb47b7eda81fbd181e51d474dc323f16df
Author: MortalHappiness <b0...@ntu.edu.tw>
AuthorDate: Mon Nov 29 17:40:30 2021 +0800
SUBMARINE-1103. Add operator e2e test and verify-codegen.sh to github actions
### What is this PR for?
Add operator e2e test and `verify-codegen.sh` to github actions
### What type of PR is it?
[Improvement]
### Todos
### What is the Jira issue?
https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-1103
### How should this be tested?
https://github.com/MortalHappiness/submarine/actions/runs/1515457356
### Screenshots (if appropriate)
### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No
Author: MortalHappiness <b0...@ntu.edu.tw>
Signed-off-by: Kevin <pi...@apache.org>
Closes #814 from MortalHappiness/SUBMARINE-1103 and squashes the following commits:
37b6a4d0 [MortalHappiness] SUBMARINE-1103. Add operator e2e test to github actions
48ee7303 [MortalHappiness] SUBMARINE-1103. Add verify-codegen.sh to github actions
---
.github/workflows/master.yml | 478 ++++++++++++---------
submarine-cloud-v2/README.md | 2 +
submarine-cloud-v2/docs/developer-guide.md | 9 +-
.../test/e2e/framework/cluster_role.go | 102 -----
.../test/e2e/framework/cluster_role_binding.go | 104 -----
submarine-cloud-v2/test/e2e/framework/framework.go | 32 --
.../test/e2e/framework/service_account.go | 90 ----
.../test/e2e/framework/storageclass.go | 50 ---
submarine-cloud-v2/test/e2e/main_test.go | 6 +-
9 files changed, 294 insertions(+), 579 deletions(-)
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 808f9a2..767d2ae 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -24,6 +24,95 @@ env:
TEST_FLAG: "test -DskipRat -ntp"
jobs:
+ submarine-operator-verify-codegen:
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ env:
+ working-directory: "github.com/apache/submarine"
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ path: ${{ env.working-directory }}
+ - name: Setup Golang 1.16.2
+ uses: actions/setup-go@v2
+ with:
+ go-version: "1.16.2"
+ - name: Check golang version
+ working-directory: ${{ env.working-directory }}/submarine-cloud-v2
+ run: go version
+ - name: Install Dependencies
+ working-directory: ${{ env.working-directory }}/submarine-cloud-v2
+ run: go mod vendor
+ - name: Verify Codegen
+ working-directory: ${{ env.working-directory }}/submarine-cloud-v2
+ run: ./hack/verify-codegen.sh
+ submarine-operator-e2e-test:
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: "1.8"
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Setup Golang 1.16.2
+ uses: actions/setup-go@v2
+ with:
+ go-version: "1.16.2"
+ - uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - name: Check version
+ run: |
+ mvn --version
+ java -version
+ go version
+ helm version
+ kind version
+ - name: Create kind cluster
+ run: kind create cluster --config ./.github/config/kind-config-kind.yaml --wait 3m --image kindest/node:v1.15.12
+ - name: Show K8s cluster information
+ run: |
+ kubectl cluster-info
+ kubectl version
+ kubectl get pods -n kube-system
+ echo "current-context:" $(kubectl config current-context)
+ echo "environment-kubeconfig:" ${KUBECONFIG}
+ - name: Build Image locally
+ run: .github/scripts/build-image-locally.sh
+ - name: Install Golang Dependencies
+ working-directory: submarine-cloud-v2
+ run: go mod vendor
+ - name: Install Helm Dependencies
+ run: |
+ sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
+ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
+ helm install --wait --set dev=true --set storageClass.provisioner=rancher.io/local-path --set storageClass.volumeBindingMode=WaitForFirstConsumer submarine ./helm-charts/submarine
+ - name: Run end-to-end test
+ working-directory: submarine-cloud-v2
+ run: go test -v -timeout 30m ./test/e2e
+ - name: Failure status
+ run: |
+ kubectl describe nodes
+ kubectl get all -A
+ kubectl get events -A --sort-by='{.lastTimestamp}'
+ kubectl describe submarine -A
+ if: ${{ failure() }}
+ - name: Delete temporary build artifacts before caching
+ run: |
+ #Never cache local artifacts
+ rm -rf ~/.m2/repository/org/apache/submarine
+ if: always()
submarine-e2e:
runs-on: ubuntu-latest
timeout-minutes: 60
@@ -145,110 +234,110 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - name: Cache jacoco.exec
- uses: actions/cache@v2
- with:
- path: ./submarine-commons/commons-cluster/target/jacoco.exec
- key: ${{ runner.os }}-docker-${{ github.sha }}
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: "1.8"
- - name: Set up Maven 3.6.3
- uses: stCarolas/setup-maven@v4
- with:
- maven-version: 3.6.3
- - name: Check version
- run: |
- mvn --version
- java -version
- - name: Build
- env:
- MODULES: "-pl :submarine-commons-cluster"
- run: |
- echo ">>> mvn $BUILD_FLAG $MODULES -B"
- mvn $BUILD_FLAG $MODULES -B
- - name: Test
- env:
- TEST_MODULES: "-pl :submarine-commons-cluster"
- run: |
- echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
- mvn $TEST_FLAG $TEST_MODULES -B
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Cache jacoco.exec
+ uses: actions/cache@v2
+ with:
+ path: ./submarine-commons/commons-cluster/target/jacoco.exec
+ key: ${{ runner.os }}-docker-${{ github.sha }}
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: "1.8"
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Check version
+ run: |
+ mvn --version
+ java -version
+ - name: Build
+ env:
+ MODULES: "-pl :submarine-commons-cluster"
+ run: |
+ echo ">>> mvn $BUILD_FLAG $MODULES -B"
+ mvn $BUILD_FLAG $MODULES -B
+ - name: Test
+ env:
+ TEST_MODULES: "-pl :submarine-commons-cluster"
+ run: |
+ echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
+ mvn $TEST_FLAG $TEST_MODULES -B
submarine-commons-runtime:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - name: Cache jacoco.exec
- uses: actions/cache@v2
- with:
- path: ./submarine-commons/commons-runtime/target/jacoco.exec
- key: ${{ runner.os }}-docker-${{ github.sha }}
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: "1.8"
- - name: Set up Maven 3.6.3
- uses: stCarolas/setup-maven@v4
- with:
- maven-version: 3.6.3
- - name: Check version
- run: |
- mvn --version
- java -version
- - name: Build
- env:
- MODULES: "-pl :submarine-commons-runtime"
- run: |
- echo ">>> mvn $BUILD_FLAG $MODULES -B"
- mvn $BUILD_FLAG $MODULES -B
- - name: Test
- env:
- TEST_MODULES: "-pl :submarine-commons-runtime"
- run: |
- echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
- mvn $TEST_FLAG $TEST_MODULES -B
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Cache jacoco.exec
+ uses: actions/cache@v2
+ with:
+ path: ./submarine-commons/commons-runtime/target/jacoco.exec
+ key: ${{ runner.os }}-docker-${{ github.sha }}
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: "1.8"
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Check version
+ run: |
+ mvn --version
+ java -version
+ - name: Build
+ env:
+ MODULES: "-pl :submarine-commons-runtime"
+ run: |
+ echo ">>> mvn $BUILD_FLAG $MODULES -B"
+ mvn $BUILD_FLAG $MODULES -B
+ - name: Test
+ env:
+ TEST_MODULES: "-pl :submarine-commons-runtime"
+ run: |
+ echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
+ mvn $TEST_FLAG $TEST_MODULES -B
submarine-client:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - name: Cache jacoco.exec
- uses: actions/cache@v2
- with:
- path: ./submarine-client/target/jacoco.exec
- key: ${{ runner.os }}-docker-${{ github.sha }}
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: "1.8"
- - name: Set up Maven 3.6.3
- uses: stCarolas/setup-maven@v4
- with:
- maven-version: 3.6.3
- - name: Check version
- run: |
- mvn --version
- java -version
- - name: Build
- env:
- MODULES: "-pl :submarine-client"
- run: |
- echo ">>> mvn $BUILD_FLAG $MODULES -B"
- mvn $BUILD_FLAG $MODULES -B
- - name: Test
- env:
- TEST_MODULES: "-pl :submarine-client"
- run: |
- echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
- mvn $TEST_FLAG $TEST_MODULES -B
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Cache jacoco.exec
+ uses: actions/cache@v2
+ with:
+ path: ./submarine-client/target/jacoco.exec
+ key: ${{ runner.os }}-docker-${{ github.sha }}
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: "1.8"
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Check version
+ run: |
+ mvn --version
+ java -version
+ - name: Build
+ env:
+ MODULES: "-pl :submarine-client"
+ run: |
+ echo ">>> mvn $BUILD_FLAG $MODULES -B"
+ mvn $BUILD_FLAG $MODULES -B
+ - name: Test
+ env:
+ TEST_MODULES: "-pl :submarine-client"
+ run: |
+ echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
+ mvn $TEST_FLAG $TEST_MODULES -B
submarine-server:
runs-on: ubuntu-latest
timeout-minutes: 30
@@ -258,111 +347,111 @@ jobs:
env:
MYSQL_ROOT_PASSWORD: "password"
ports:
- - 3306:3306
+ - 3306:3306
# wait until mysql is health
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 10s --health-retries 10
steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - name: Cache jacoco.exec
- uses: actions/cache@v2
- with:
- path: |
- ./submarine-server/server-core/target/jacoco.exec
- key: ${{ runner.os }}-docker-${{ github.sha }}
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: "1.8"
- - name: Set up Maven 3.6.3
- uses: stCarolas/setup-maven@v4
- with:
- maven-version: 3.6.3
- - name: Check version
- run: |
- mvn --version
- java -version
- - name: Prepare default mysql-data
- run: |
- python3 -V
- sudo apt-get install python3-mysql.connector
- python3 ./dev-support/database/init-database.py
- - name: Build
- env:
- MODULES: "-pl :submarine-server-core"
- run: |
- echo ">>> mvn $BUILD_FLAG $MODULES -B"
- mvn $BUILD_FLAG $MODULES -B
- - name: Test
- env:
- TEST_MODULES: "-pl :submarine-server-core"
- run: |
- echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
- mvn $TEST_FLAG $TEST_MODULES -B
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Cache jacoco.exec
+ uses: actions/cache@v2
+ with:
+ path: |
+ ./submarine-server/server-core/target/jacoco.exec
+ key: ${{ runner.os }}-docker-${{ github.sha }}
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: "1.8"
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Check version
+ run: |
+ mvn --version
+ java -version
+ - name: Prepare default mysql-data
+ run: |
+ python3 -V
+ sudo apt-get install python3-mysql.connector
+ python3 ./dev-support/database/init-database.py
+ - name: Build
+ env:
+ MODULES: "-pl :submarine-server-core"
+ run: |
+ echo ">>> mvn $BUILD_FLAG $MODULES -B"
+ mvn $BUILD_FLAG $MODULES -B
+ - name: Test
+ env:
+ TEST_MODULES: "-pl :submarine-server-core"
+ run: |
+ echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
+ mvn $TEST_FLAG $TEST_MODULES -B
submarine-workbench:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - name: Set up Maven 3.6.3
- uses: stCarolas/setup-maven@v4
- with:
- maven-version: 3.6.3
- - name: Check version
- run: |
- mvn --version
- - name: Maven Build
- env:
- MODULES: "-pl :submarine-workbench-web"
- run: |
- echo ">>> mvn $BUILD_FLAG $MODULES -B"
- mvn $BUILD_FLAG $MODULES -B
- - name: Test with chrome
- working-directory: ./submarine-workbench/workbench-web
- run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- - name: Test with firefox
- working-directory: ./submarine-workbench/workbench-web
- run: npm run test -- --no-watch --no-progress --browsers=FirefoxHeadless
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Check version
+ run: |
+ mvn --version
+ - name: Maven Build
+ env:
+ MODULES: "-pl :submarine-workbench-web"
+ run: |
+ echo ">>> mvn $BUILD_FLAG $MODULES -B"
+ mvn $BUILD_FLAG $MODULES -B
+ - name: Test with chrome
+ working-directory: ./submarine-workbench/workbench-web
+ run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
+ - name: Test with firefox
+ working-directory: ./submarine-workbench/workbench-web
+ run: npm run test -- --no-watch --no-progress --browsers=FirefoxHeadless
submarine-submitter:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - name: Cache jacoco.exec
- uses: actions/cache@v2
- with:
- path: |
- ./submarine-server/server-submitter/target/jacoco.exec
- key: ${{ runner.os }}-docker-${{ github.sha }}
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: "1.8"
- - name: Set up Maven 3.6.3
- uses: stCarolas/setup-maven@v4
- with:
- maven-version: 3.6.3
- - name: Check version
- run: |
- mvn --version
- java -version
- - name: Build
- env:
- MODULES: "-pl :submarine-server-submitter"
- run: |
- echo ">>> mvn $BUILD_FLAG $MODULES -B"
- mvn $BUILD_FLAG $MODULES -B
- - name: Test
- env:
- TEST_MODULES: "-pl :submarine-server-submitter"
- run: |
- echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
- mvn $TEST_FLAG $TEST_MODULES -B
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 50
+ - name: Cache jacoco.exec
+ uses: actions/cache@v2
+ with:
+ path: |
+ ./submarine-server/server-submitter/target/jacoco.exec
+ key: ${{ runner.os }}-docker-${{ github.sha }}
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: "1.8"
+ - name: Set up Maven 3.6.3
+ uses: stCarolas/setup-maven@v4
+ with:
+ maven-version: 3.6.3
+ - name: Check version
+ run: |
+ mvn --version
+ java -version
+ - name: Build
+ env:
+ MODULES: "-pl :submarine-server-submitter"
+ run: |
+ echo ">>> mvn $BUILD_FLAG $MODULES -B"
+ mvn $BUILD_FLAG $MODULES -B
+ - name: Test
+ env:
+ TEST_MODULES: "-pl :submarine-server-submitter"
+ run: |
+ echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
+ mvn $TEST_FLAG $TEST_MODULES -B
rat:
name: Check License
@@ -371,7 +460,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
- java-version: '1.8'
+ java-version: "1.8"
- run: mvn org.apache.rat:apache-rat-plugin:check
linter:
name: Check Style
@@ -382,7 +471,7 @@ jobs:
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
- java-version: '1.8'
+ java-version: "1.8"
- name: Set up Maven 3.6.3
uses: stCarolas/setup-maven@v4
with:
@@ -418,7 +507,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
- fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache Maven packages
uses: actions/cache@v1
with:
@@ -489,8 +578,7 @@ jobs:
- name: Calculate combined coverage
run: ./dev-support/cicd/coverage.sh
- name: Build and analyze with JDK 11 # sonar-maven-plugin only support JDK 11
- run:
- mvn -B verify -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_submarine
+ run: mvn -B verify -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_submarine
env:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/submarine-cloud-v2/README.md b/submarine-cloud-v2/README.md
index 17fc821..f1a2a7c 100644
--- a/submarine-cloud-v2/README.md
+++ b/submarine-cloud-v2/README.md
@@ -23,6 +23,8 @@
- In this section, we provide two methods, including **out-of-cluter** method and **in-cluster** method, for you to deploy your **submarine-operator**. In addition, the out-of-cluster method is convenient for operator developers. On the other hand, the in-cluster method is suitable for production.
+Golang version: `1.16.2`
+
## Initialization
```bash
diff --git a/submarine-cloud-v2/docs/developer-guide.md b/submarine-cloud-v2/docs/developer-guide.md
index 8ad1c26..96755c6 100644
--- a/submarine-cloud-v2/docs/developer-guide.md
+++ b/submarine-cloud-v2/docs/developer-guide.md
@@ -46,13 +46,16 @@ go mod vendor
Reference: [spark-on-k8s-operator e2e test](https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/tree/master/test/e2e)
```bash
-# Step1: Build image "submarine-operator" to minikube's Docker
+# Step1: Build image "submarine-operator" to minikube's Docker
eval $(minikube docker-env)
make image
-# Step2: Run Tests
+# Step2: Install helm dependencies
+helm install --wait --set dev=true submarine ../helm-charts/submarine
+
+# Step3: Run Tests
## one can add -v to see additional logs
-go test ./test/e2e
+go test -timeout 30m ./test/e2e
```
## Run Frontend End-to-end Tests
diff --git a/submarine-cloud-v2/test/e2e/framework/cluster_role.go b/submarine-cloud-v2/test/e2e/framework/cluster_role.go
deleted file mode 100644
index eae5612..0000000
--- a/submarine-cloud-v2/test/e2e/framework/cluster_role.go
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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 framework
-
-import (
- "context"
- "encoding/json"
- "io"
- "os"
-
- rbacv1 "k8s.io/api/rbac/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/util/yaml"
- "k8s.io/client-go/kubernetes"
-)
-
-func CreateClusterRole(kubeClient kubernetes.Interface, relativePath string) error {
- clusterRole, err := parseClusterRoleYaml(relativePath)
- if err != nil {
- return err
- }
-
- _, err = kubeClient.RbacV1().ClusterRoles().Get(context.TODO(), clusterRole.Name, metav1.GetOptions{})
-
- if err == nil {
- // ClusterRole already exists -> Update
- _, err = kubeClient.RbacV1().ClusterRoles().Update(context.TODO(), clusterRole, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
-
- } else {
- // ClusterRole doesn't exists -> Create
- _, err = kubeClient.RbacV1().ClusterRoles().Create(context.TODO(), clusterRole, metav1.CreateOptions{})
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func DeleteClusterRole(kubeClient kubernetes.Interface, relativePath string) error {
- clusterRole, err := parseClusterRoleYaml(relativePath)
- if err != nil {
- return err
- }
-
- if err := kubeClient.RbacV1().ClusterRoles().Delete(context.TODO(), clusterRole.Name, metav1.DeleteOptions{}); err != nil {
- return err
- }
-
- return nil
-}
-
-func parseClusterRoleYaml(relativePath string) (*rbacv1.ClusterRole, error) {
- var manifest *os.File
- var err error
-
- var clusterRole rbacv1.ClusterRole
- if manifest, err = PathToOSFile(relativePath); err != nil {
- return nil, err
- }
-
- decoder := yaml.NewYAMLOrJSONDecoder(manifest, 100)
- for {
- var out unstructured.Unstructured
- err = decoder.Decode(&out)
- if err != nil {
- // this would indicate it's malformed YAML.
- break
- }
-
- if out.GetKind() == "ClusterRole" {
- var marshaled []byte
- marshaled, err = out.MarshalJSON()
- json.Unmarshal(marshaled, &clusterRole)
- break
- }
- }
-
- if err != io.EOF && err != nil {
- return nil, err
- }
- return &clusterRole, nil
-}
diff --git a/submarine-cloud-v2/test/e2e/framework/cluster_role_binding.go b/submarine-cloud-v2/test/e2e/framework/cluster_role_binding.go
deleted file mode 100644
index cb16ed2..0000000
--- a/submarine-cloud-v2/test/e2e/framework/cluster_role_binding.go
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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 framework
-
-import (
- "context"
- "encoding/json"
- "io"
- "os"
-
- rbacv1 "k8s.io/api/rbac/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/util/yaml"
- "k8s.io/client-go/kubernetes"
-)
-
-func CreateClusterRoleBinding(kubeClient kubernetes.Interface, relativePath string) (finalizerFn, error) {
- finalizerFn := func() error {
- return DeleteClusterRoleBinding(kubeClient, relativePath)
- }
- clusterRoleBinding, err := parseClusterRoleBindingYaml(relativePath)
- if err != nil {
- return finalizerFn, err
- }
-
- _, err = kubeClient.RbacV1().ClusterRoleBindings().Get(context.TODO(), clusterRoleBinding.Name, metav1.GetOptions{})
-
- if err == nil {
- // ClusterRoleBinding already exists -> Update
- _, err = kubeClient.RbacV1().ClusterRoleBindings().Update(context.TODO(), clusterRoleBinding, metav1.UpdateOptions{})
- if err != nil {
- return finalizerFn, err
- }
- } else {
- // ClusterRoleBinding doesn't exists -> Create
- _, err = kubeClient.RbacV1().ClusterRoleBindings().Create(context.TODO(), clusterRoleBinding, metav1.CreateOptions{})
- if err != nil {
- return finalizerFn, err
- }
- }
-
- return finalizerFn, err
-}
-
-func DeleteClusterRoleBinding(kubeClient kubernetes.Interface, relativePath string) error {
- clusterRoleBinding, err := parseClusterRoleYaml(relativePath)
- if err != nil {
- return err
- }
-
- if err := kubeClient.RbacV1().ClusterRoleBindings().Delete(context.TODO(), clusterRoleBinding.Name, metav1.DeleteOptions{}); err != nil {
- return err
- }
-
- return nil
-}
-
-func parseClusterRoleBindingYaml(relativePath string) (*rbacv1.ClusterRoleBinding, error) {
- var manifest *os.File
- var err error
-
- var clusterRoleBinding rbacv1.ClusterRoleBinding
- if manifest, err = PathToOSFile(relativePath); err != nil {
- return nil, err
- }
-
- decoder := yaml.NewYAMLOrJSONDecoder(manifest, 100)
- for {
- var out unstructured.Unstructured
- err = decoder.Decode(&out)
- if err != nil {
- // this would indicate it's malformed YAML.
- break
- }
-
- if out.GetKind() == "ClusterRoleBinding" {
- var marshaled []byte
- marshaled, err = out.MarshalJSON()
- json.Unmarshal(marshaled, &clusterRoleBinding)
- break
- }
- }
-
- if err != io.EOF && err != nil {
- return nil, err
- }
- return &clusterRoleBinding, nil
-}
diff --git a/submarine-cloud-v2/test/e2e/framework/framework.go b/submarine-cloud-v2/test/e2e/framework/framework.go
index 1f1fd8a..e1e20cf 100644
--- a/submarine-cloud-v2/test/e2e/framework/framework.go
+++ b/submarine-cloud-v2/test/e2e/framework/framework.go
@@ -95,24 +95,6 @@ func (f *Framework) Setup(opImage, opImagePullPolicy string) error {
func (f *Framework) setupOperator(opImage, opImagePullPolicy string) error {
- // setup RBAC (ClusterRole, ClusterRoleBinding, and ServiceAccount)
- if _, err := CreateServiceAccount(f.KubeClient, f.Namespace.Name, "../../helm-charts/submarine-operator/templates/rbac.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
- return errors.Wrap(err, "failed to create operator service account")
- }
-
- if err := CreateClusterRole(f.KubeClient, "../../helm-charts/submarine-operator/templates/rbac.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
- return errors.Wrap(err, "failed to create cluster role")
- }
-
- if _, err := CreateClusterRoleBinding(f.KubeClient, "../../helm-charts/submarine-operator/templates/rbac.yaml"); err != nil && !apierrors.IsAlreadyExists(err) {
- return errors.Wrap(err, "failed to create cluster role binding")
- }
-
- // setup storage class
- if _, err := CreateStorageClass(f.KubeClient, "submarine-storageclass"); err != nil && !apierrors.IsAlreadyExists(err) {
- return errors.Wrap(err, "failed to create storageclass submarine-storageclass")
- }
-
// Deploy a submarine-operator
deploy := MakeOperatorDeployment()
@@ -147,20 +129,6 @@ func (f *Framework) setupOperator(opImage, opImagePullPolicy string) error {
// Teardown ters down a previously initialized test environment
func (f *Framework) Teardown() error {
- // delete rbac
- if err := DeleteClusterRole(f.KubeClient, "../../helm-charts/submarine-operator/templates/rbac.yaml"); err != nil {
- return errors.Wrap(err, "failed to delete operator cluster role")
- }
-
- if err := DeleteClusterRoleBinding(f.KubeClient, "../../helm-charts/submarine-operator/templates/rbac.yaml"); err != nil {
- return errors.Wrap(err, "failed to delete operator cluster role binding")
- }
-
- // delete storage class
- if err := DeleteStorageClass(f.KubeClient, "submarine-storageclass"); err != nil {
- return errors.Wrap(err, "failed to delete storageclass submarine-storageclass")
- }
-
if err := f.KubeClient.AppsV1().Deployments(f.Namespace.Name).Delete(context.TODO(), "submarine-operator-demo", metav1.DeleteOptions{}); err != nil {
return errors.Wrap(err, "failed to delete deployment submarine-operator-demo")
}
diff --git a/submarine-cloud-v2/test/e2e/framework/service_account.go b/submarine-cloud-v2/test/e2e/framework/service_account.go
deleted file mode 100644
index c56923b..0000000
--- a/submarine-cloud-v2/test/e2e/framework/service_account.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 framework
-
-import (
- "context"
- "encoding/json"
- "io"
- "os"
-
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
- "k8s.io/apimachinery/pkg/util/yaml"
- "k8s.io/client-go/kubernetes"
-)
-
-func CreateServiceAccount(kubeClient kubernetes.Interface, namespace string, relativePath string) (finalizerFn, error) {
- finalizerFn := func() error {
- return DeleteServiceAccount(kubeClient, namespace, relativePath)
- }
-
- serviceAccount, err := parseServiceAccountYaml(relativePath)
- if err != nil {
- return finalizerFn, err
- }
- serviceAccount.Namespace = namespace
- _, err = kubeClient.CoreV1().ServiceAccounts(namespace).Create(context.TODO(), serviceAccount, metav1.CreateOptions{})
- if err != nil {
- return finalizerFn, err
- }
-
- return finalizerFn, nil
-}
-
-func parseServiceAccountYaml(relativePath string) (*v1.ServiceAccount, error) {
- var manifest *os.File
- var err error
-
- var serviceAccount v1.ServiceAccount
- if manifest, err = PathToOSFile(relativePath); err != nil {
- return nil, err
- }
-
- decoder := yaml.NewYAMLOrJSONDecoder(manifest, 100)
- for {
- var out unstructured.Unstructured
- err = decoder.Decode(&out)
- if err != nil {
- // this would indicate it's malformed YAML.
- break
- }
-
- if out.GetKind() == "ServiceAccount" {
- var marshaled []byte
- marshaled, err = out.MarshalJSON()
- json.Unmarshal(marshaled, &serviceAccount)
- break
- }
- }
-
- if err != io.EOF && err != nil {
- return nil, err
- }
- return &serviceAccount, nil
-}
-
-func DeleteServiceAccount(kubeClient kubernetes.Interface, namespace string, relativePath string) error {
- serviceAccount, err := parseServiceAccountYaml(relativePath)
- if err != nil {
- return err
- }
-
- return kubeClient.CoreV1().ServiceAccounts(namespace).Delete(context.TODO(), serviceAccount.Name, metav1.DeleteOptions{})
-}
diff --git a/submarine-cloud-v2/test/e2e/framework/storageclass.go b/submarine-cloud-v2/test/e2e/framework/storageclass.go
deleted file mode 100644
index 1863c6e..0000000
--- a/submarine-cloud-v2/test/e2e/framework/storageclass.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 framework
-
-import (
- "context"
- "fmt"
-
- "github.com/pkg/errors"
- corev1 "k8s.io/api/core/v1"
- storagev1 "k8s.io/api/storage/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/client-go/kubernetes"
-)
-
-func CreateStorageClass(kubeClient kubernetes.Interface, name string) (*storagev1.StorageClass, error) {
- provisioner := "k8s.io/minikube-hostpath"
- recalimPolicy := corev1.PersistentVolumeReclaimDelete
- storageclass, err := kubeClient.StorageV1().StorageClasses().Create(context.TODO(), &storagev1.StorageClass{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- },
- Provisioner: provisioner,
- ReclaimPolicy: &recalimPolicy,
- }, metav1.CreateOptions{})
-
- if err != nil {
- return nil, errors.Wrap(err, fmt.Sprintf("failed to create namespace with name %v", name))
- }
- return storageclass, nil
-}
-
-func DeleteStorageClass(kubeClient kubernetes.Interface, name string) error {
- return kubeClient.StorageV1().StorageClasses().Delete(context.TODO(), name, metav1.DeleteOptions{})
-}
diff --git a/submarine-cloud-v2/test/e2e/main_test.go b/submarine-cloud-v2/test/e2e/main_test.go
index 72b54e8..13fc775 100644
--- a/submarine-cloud-v2/test/e2e/main_test.go
+++ b/submarine-cloud-v2/test/e2e/main_test.go
@@ -34,9 +34,9 @@ var (
framework *operatorFramework.Framework
)
-// Wait for test job to finish. Poll for updates once a second. Time out after 240 seconds.
-var TIMEOUT = 300 * time.Second
-var INTERVAL = 1 * time.Second
+// Wait for test job to finish.
+var TIMEOUT = 1200 * time.Second
+var INTERVAL = 2 * time.Second
var STATES = [4]string{
"",
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org