Skip to content

Commit

Permalink
Add istio bug report on failure (#9458)
Browse files Browse the repository at this point in the history
* add istioctl bug report

* add debug, clean up istio commands

* bump curl, add check httpbin is ready

* use hashFiles exists

* add resource req limits

* pr feedback

* trigger failure to get resource limits in oss

* set istio version

* set istio version in github workflow

* use GeneratedFiles.TempDir

* use FailureDir

* remove fail() to test artifact upload

* switch istioctl back to testInstallation

* remove increased timeout

---------

Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
npolshakova and soloio-bulldozer[bot] authored May 9, 2024
1 parent a4e8834 commit f55d646
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 169 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/pr-kubernetes-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
env:
VERSION: '1.0.0-ci1'
GITHUB_TOKEN: ${{ github.token }}
# The istio version to use for the e2e tests
# TODO(npolshak): Test across multiple versions of Istio
# https://istio.io/latest/docs/releases/supported-releases/#support-status-of-istio-releases
ISTIO_VERSION: "1.19.9"

jobs:
prepare_env:
Expand Down Expand Up @@ -95,4 +99,9 @@ jobs:
cluster-name: kind
test-args: ${{ matrix.test.go-test-args }}
run-regex: ${{ matrix.test.go-test-run-regex }}

- name: Archive bug report directory on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: bug-report
path: ./_test/bug_report
6 changes: 6 additions & 0 deletions changelog/v1.17.0-beta26/add-istio-bug-report-on-failure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: NON_USER_FACING
issueLink: https://github.com/solo-io/solo-projects/issues/6048
resolvesIssue: false
description: >-
Add istioctl bug-report to the end-to-end tests on failure.
6 changes: 6 additions & 0 deletions test/kubernetes/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ This package holds the entry point for each of our `TestInstallation`.

See [Load balancing tests](./load_balancing_tests.md) for more information about how these tests are run in CI.

## Environment Variables

Some tests may require environment variables to be set. Some required env vars are:

- Istio features: Require `ISTIO_VERSION` to be set. The tests running in CI use `ISTIO_VERSION="${ISTIO_VERSION:-1.19.9}"` to default to a specific version of Istio.

## Debugging

Refer to the [Debugging guide](./debugging.md) for more information on how to debug tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ spec:
command:
- "tail"
- "-f"
- "/dev/null"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
7 changes: 6 additions & 1 deletion test/kubernetes/e2e/features/istio/auto_mtls_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package istio
import (
"context"

"github.com/onsi/gomega"
"github.com/stretchr/testify/suite"

"github.com/solo-io/gloo/pkg/utils/kubeutils"
Expand Down Expand Up @@ -31,6 +32,8 @@ func NewIstioAutoMtlsSuite(ctx context.Context, testInst *e2e.TestInstallation)
func (s *istioAutoMtlsTestingSuite) SetupSuite() {
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
s.NoError(err, "can apply setup manifest")
// Check that istio injection is successful and httpbin is running
s.testInstallation.Assertions.EventuallyRunningReplicas(s.ctx, httpbinDeployment.ObjectMeta, gomega.Equal(1))

// Ensure that the proxy service and deployment are created
err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, k8sRoutingManifest)
Expand All @@ -45,6 +48,7 @@ func (s *istioAutoMtlsTestingSuite) TearDownSuite() {

err = s.testInstallation.Actions.Kubectl().DeleteFile(s.ctx, setupManifest)
s.NoError(err, "can delete setup manifest")
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, httpbinDeployment)
}

func (s *istioAutoMtlsTestingSuite) TestMtlsStrictPeerAuth() {
Expand All @@ -64,7 +68,8 @@ func (s *istioAutoMtlsTestingSuite) TestMtlsStrictPeerAuth() {
curl.WithHostHeader("httpbin"),
curl.WithPath("/headers"),
},
expectedMtlsResponse)
expectedMtlsResponse,
)
}

func (s *istioAutoMtlsTestingSuite) TestMtlsPermissivePeerAuth() {
Expand Down
14 changes: 6 additions & 8 deletions test/kubernetes/e2e/features/istio/inputs/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,11 @@ spec:
- "600s" # override default 10s
ports:
- containerPort: 8080
- name: curl
image: curlimages/curl:7.83.1
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
imagePullPolicy: IfNotPresent
command:
- "tail"
- "-f"
- "/dev/null"
---
apiVersion: v1
kind: Namespace
Expand All @@ -93,4 +86,9 @@ spec:
command:
- "tail"
- "-f"
- "/dev/null"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
8 changes: 7 additions & 1 deletion test/kubernetes/e2e/features/istio/no_mtls_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package istio
import (
"context"

"github.com/onsi/gomega"
"github.com/solo-io/gloo/pkg/utils/kubeutils"
"github.com/solo-io/gloo/pkg/utils/requestutils/curl"
"github.com/solo-io/gloo/test/kubernetes/e2e"
Expand Down Expand Up @@ -31,6 +32,8 @@ func NewTestingSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.
func (s *istioTestingSuite) SetupSuite() {
err := s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, setupManifest)
s.NoError(err, "can apply setup manifest")
// Check that istio injection is successful and httpbin is running
s.testInstallation.Assertions.EventuallyRunningReplicas(s.ctx, httpbinDeployment.ObjectMeta, gomega.Equal(1))

// Ensure that the proxy service and deployment are created
err = s.testInstallation.Actions.Kubectl().ApplyFile(s.ctx, k8sRoutingManifest)
Expand All @@ -45,6 +48,8 @@ func (s *istioTestingSuite) TearDownSuite() {

err = s.testInstallation.Actions.Kubectl().DeleteFile(s.ctx, setupManifest)
s.NoError(err, "can delete setup manifest")
s.testInstallation.Assertions.EventuallyObjectsNotExist(s.ctx, httpbinDeployment)

}

func (s *istioTestingSuite) TestStrictPeerAuth() {
Expand All @@ -65,7 +70,8 @@ func (s *istioTestingSuite) TestStrictPeerAuth() {
curl.WithHostHeader("httpbin"),
curl.WithPath("/headers"),
},
expectedServiceUnavailableResponse)
expectedServiceUnavailableResponse,
)
}

func (s *istioTestingSuite) TestPermissivePeerAuth() {
Expand Down
8 changes: 8 additions & 0 deletions test/kubernetes/e2e/features/istio/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ var (
proxyDeployment = &appsv1.Deployment{ObjectMeta: glooProxyObjectMeta}
proxyService = &corev1.Service{ObjectMeta: glooProxyObjectMeta}

// httpbinDeployment is the Deployment that is in the Istio mesh
httpbinDeployment = &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "httpbin",
Namespace: "httpbin",
},
}

// curlPod is the Pod that will be used to execute curl requests, and is defined in the fault injection manifest files
curlPodExecOpt = kubectl.PodExecOptions{
Name: "curl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ spec:
command:
- "tail"
- "-f"
- "/dev/null"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ spec:
command:
- "tail"
- "-f"
- "/dev/null"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,9 @@ spec:
command:
- "tail"
- "-f"
- "/dev/null"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ spec:
command:
- "tail"
- "-f"
- "/dev/null"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,8 @@ spec:
- "tail"
- "-f"
- "/dev/null"
resources:
requests:
cpu: "100m"
limits:
cpu: "200m"
3 changes: 3 additions & 0 deletions test/kubernetes/e2e/k8sgateway/automtls_istio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func TestK8sGatewayIstioAutoMtls(t *testing.T) {
t.Cleanup(func() {
if t.Failed() {
testInstallation.PreFailHandler(ctx)

// Generate istioctl bug report
testInstallation.CreateIstioBugReport(ctx)
}

testInstallation.UninstallGlooGateway(ctx, func(ctx context.Context) error {
Expand Down
3 changes: 3 additions & 0 deletions test/kubernetes/e2e/k8sgateway/istio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func TestK8sGatewayIstio(t *testing.T) {
t.Cleanup(func() {
if t.Failed() {
testInstallation.PreFailHandler(ctx)

// Generate istioctl bug report
testInstallation.CreateIstioBugReport(ctx)
}

testInstallation.UninstallGlooGateway(ctx, func(ctx context.Context) error {
Expand Down
Loading

0 comments on commit f55d646

Please sign in to comment.