Repository: iter8-tools/iter8
Pull request #1235 (2022-04-26 21:42:28)

Fix k8s further
Date time deserialization issues


Patch:
diff --git a/.github/workflows/assets.yaml b/.github/workflows/assets.yaml
index a6039ae8..a3ae5c96 100644
--- a/.github/workflows/assets.yaml
+++ b/.github/workflows/assets.yaml
@@ -99,9 +99,10 @@ jobs:
     needs: build-and-push
     steps:
     - uses: iter8-tools/iter8@v0.10
-    - uses: engineerd/setup-kind@v0.5.0
+    - name: Start kind cluster
+      uses: helm/kind-action@v1.2.0
       with:
-        version: "v0.12.0"    
+        wait: 300s
     - name: create app
       run: |
         kubectl create deployment httpbin --image=kennethreitz/httpbin
@@ -130,9 +131,10 @@ jobs:
         wget https://github.com/iter8-tools/iter8/releases/download/$tagref/iter8-linux-amd64.tar.gz
         tar -xvf iter8-linux-amd64.tar.gz
         mv linux-amd64/iter8 /usr/local/bin
-    - uses: engineerd/setup-kind@v0.5.0
+    - name: Start kind cluster
+      uses: helm/kind-action@v1.2.0
       with:
-        version: "v0.12.0"    
+        wait: 300s
     - name: create app
       run: |
         kubectl create deploy hello --image=docker.io/grpc/java-example-hostname:latest --port=50051
diff --git a/base/experiment.go b/base/experiment.go
index ca224a15..1d98f0a7 100644
--- a/base/experiment.go
+++ b/base/experiment.go
@@ -8,11 +8,11 @@ import (
 	"regexp"
 	"strconv"
 	"strings"
-	"time"
 
 	"github.com/antonmedv/expr"
 	log "github.com/iter8-tools/iter8/base/log"
 	"github.com/montanaflynn/stats"
+	"helm.sh/helm/v3/pkg/time"
 )
 
 // Task is the building block of an experiment spec
diff --git a/charts/iter8lib/templates/_k-result-secret.tpl b/charts/iter8lib/templates/_k-result-secret.tpl
index 2dc0ec02..a531da49 100644
--- a/charts/iter8lib/templates/_k-result-secret.tpl
+++ b/charts/iter8lib/templates/_k-result-secret.tpl
@@ -7,7 +7,7 @@ metadata:
     iter8.tools/revision: {{ .Release.Revision | quote }}
 stringData:
   result.yaml: |
-    startTime:         {{ now | toString }}
+    startTime:         {{ now }}
     numCompletedTasks: 0
     failure:           false
     iter8Version:      {{ .Values.iter8lib.majorMinor }}
diff --git a/driver/kubedriver.go b/driver/kubedriver.go
index fbb4bd5f..b35ddf85 100644
--- a/driver/kubedriver.go
+++ b/driver/kubedriver.go
@@ -265,12 +265,6 @@ func (driver *KubeDriver) formResultSecret(r *base.ExperimentResult) (*corev1.Se
 	sec := corev1.Secret{
 		ObjectMeta: metav1.ObjectMeta{
 			Name: driver.getResultSecretName(),
-			OwnerReferences: []metav1.OwnerReference{{
-				APIVersion: "v1",
-				Kind:       "secret",
-				Name:       spec.Name,
-				UID:        spec.UID,
-			}},
 		},
 		StringData: map[string]string{ExperimentResultPath: string(byteArray)},
 	}


Test patch:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index 02c5b965..a431232f 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -61,7 +61,7 @@ jobs:
     - name: launch load-test-http with percentiles, duration, and SLOs
       run: |
         iter8 launch -c load-test-http --noDownload \
-        --set url="https://httpbin.org/post" \
+        --set url="http://$HOST_IP/post" \
         --set payloadURL="https://httpbin.org/stream/1" \
         --set duration="3s" \
         --set percentiles[0]=45.6 \
@@ -153,7 +153,7 @@ jobs:
         iter8 assert -c completed -c nofailure
 
   kubernetes-http-experiment:
-    name: http load test inside Kubernetes
+    name: http load test at the edge of Kubernetes
     runs-on: ubuntu-latest
     steps:
     - name: Install Go
@@ -164,21 +164,35 @@ jobs:
       uses: actions/checkout@v2
     - name: Build and install Iter8
       run: make install
-    - uses: engineerd/setup-kind@v0.5.0
+    - name: run httpbin
+      run: |
+        set -e
+        docker pull kennethreitz/httpbin
+        docker run -p 80:80 kennethreitz/httpbin &
+        HOST_IP=$(ip -f inet addr show docker0 | grep -Po 'inet \K[\d.]+')
+        echo "HOST_IP=$HOST_IP" >> $GITHUB_ENV
+        while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://$HOST_IP/get)" != "200" ]]; do
+          sleep 5; 
+        done;
+    - name: Start kind cluster
+      uses: helm/kind-action@v1.2.0
       with:
-        version: "v0.12.0"    
+        wait: 300s
     - name: k launch load-test-http
       run: |
         iter8 k launch -c load-test-http --noDownload \
-        --set url="https://httpbin.org/post" \
-        --set payloadURL="https://httpbin.org/stream/1" \
-        --set iter8lib.disable.job=true
+        --set url="http://$HOST_IP/get" \
+        --set iter8lib.disable.job=true \
+        --set duration="3s" \
+        --set SLOs.http/latency-p50=200 \
+        --set SLOs.http/latency-p90=500 \
+        --set SLOs.http/error-count=0
     - name: k run
       run: |
         iter8 k run --namespace default --group default
-    - name: assert experiment completed without failures
+    - name: assert experiment completed without failures and SLOs are satisfied
       run: |
-        iter8 k assert -c completed -c nofailure --timeout 300s
+        iter8 k assert -c completed -c nofailure -c slos --timeout 300s
         iter8 k report
         iter8 k delete
 
@@ -200,7 +214,7 @@ jobs:
       run: |
         iter8 launch -c load-test-http --noDownload \
         --set ready.deploy="test-deployment" \
-        --set url="https://httpbin.org/get"
+        --set url="https://example.com"
     - name: assert experiment completed without failures
       run: |
         iter8 assert -c completed -c nofailure
diff --git a/action/run_test.go b/action/run_test.go
index c2f894a6..ec47fc2a 100644
--- a/action/run_test.go
+++ b/action/run_test.go
@@ -4,17 +4,16 @@ import (
 	"context"
 	"io/ioutil"
 	"testing"
-	"time"
-
-	corev1 "k8s.io/api/core/v1"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"sigs.k8s.io/yaml"
 
 	"github.com/iter8-tools/iter8/base"
 	"github.com/iter8-tools/iter8/base/log"
 	"github.com/iter8-tools/iter8/driver"
 	"github.com/stretchr/testify/assert"
 	"helm.sh/helm/v3/pkg/cli"
+	"helm.sh/helm/v3/pkg/time"
+	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"sigs.k8s.io/yaml"
 )
 
 func TestLocalRun(t *testing.T) {
diff --git a/cmd/kassert_test.go b/cmd/kassert_test.go
index d5985c4b..7d96d55e 100644
--- a/cmd/kassert_test.go
+++ b/cmd/kassert_test.go
@@ -5,15 +5,14 @@ import (
 	"fmt"
 	"io/ioutil"
 	"testing"
-	"time"
 
+	"github.com/iter8-tools/iter8/base"
 	id "github.com/iter8-tools/iter8/driver"
+	"helm.sh/helm/v3/pkg/time"
 	batchv1 "k8s.io/api/batch/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"sigs.k8s.io/yaml"
-
-	"github.com/iter8-tools/iter8/base"
 )
 
 func TestKAssert(t *testing.T) {
diff --git a/cmd/krun_test.go b/cmd/krun_test.go
index d9198bf3..bdc2cecb 100644
--- a/cmd/krun_test.go
+++ b/cmd/krun_test.go
@@ -4,15 +4,13 @@ import (
 	"context"
 	"io/ioutil"
 	"testing"
-	"time"
 
+	"github.com/iter8-tools/iter8/base"
+	id "github.com/iter8-tools/iter8/driver"
+	"helm.sh/helm/v3/pkg/time"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"sigs.k8s.io/yaml"
-
-	id "github.com/iter8-tools/iter8/driver"
-
-	"github.com/iter8-tools/iter8/base"
 )
 
 func TestKRun(t *testing.T) {
diff --git a/driver/kubedriver_test.go b/driver/kubedriver_test.go
index 2b10df6b..7834fc56 100644
--- a/driver/kubedriver_test.go
+++ b/driver/kubedriver_test.go
@@ -4,12 +4,12 @@ import (
 	"context"
 	"io/ioutil"
 	"testing"
-	"time"
 
 	"github.com/iter8-tools/iter8/base"
 	"github.com/stretchr/testify/assert"
 	"helm.sh/helm/v3/pkg/cli"
 	"helm.sh/helm/v3/pkg/cli/values"
+	"helm.sh/helm/v3/pkg/time"
 	batchv1 "k8s.io/api/batch/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"