Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable e2e GHA test #434

Closed
wants to merge 14 commits into from
89 changes: 44 additions & 45 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ env:
# https://github.com/google/go-containerregistry/pull/125 allows insecure registry for
# '*.local' hostnames. This works both for `ko` and our own tag-to-digest resolution logic,
# thus allowing us to test without bypassing tag-to-digest resolution.
KIND_VERSION: 0.14.0
KNATIVE_VERSION: 1.6.0
KIND_VERSION: 0.16.0
KNATIVE_VERSION: 1.10.0

jobs:
build:
Expand All @@ -22,47 +22,46 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: skip test
# see https://github.com/knative-sandbox/kn-plugin-quickstart/issues/392
run: |
echo "github action runner broke this test"

# - name: Set up Go 1.18.x
# uses: actions/setup-go@v3
# with:
# go-version: 1.18.x
#
# - name: Build quickstart plugin
# run: |
# set -x
# ./hack/build.sh
# sudo mv kn-quickstart /usr/local/bin
#
# - name: Install Dependencies
# run: |
# set -x
# echo "::group:: install kind ${KIND_VERSION}"
# curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
# chmod +x ./kind
# sudo mv kind /usr/local/bin
# echo "::endgroup::"
#
# echo "::group:: install kn client ${KNATIVE_VERSION}"
# curl -Lo ./kn https://github.com/knative/client/releases/download/knative-v${KNATIVE_VERSION}/kn-linux-amd64
# chmod +x ./kn
# sudo mv kn /usr/local/bin
# echo "::endgroup::"
#
# - name: Serving e2e Test
# - name: skip test
# # see https://github.com/knative-sandbox/kn-plugin-quickstart/issues/392
# run: |
# kn quickstart kind --install-serving
# source ./vendor/knative.dev/hack/e2e-tests.sh
# ./test/serving-e2e-test.sh || fail_test
#
# - uses: chainguard-dev/actions/kind-diag@main
# # Only upload logs on failure.
# if: ${{ failure() }}
# with:
# cluster-resources: nodes,${{ matrix.cluster-resources || '' }}
# namespace-resources: pods,svc,ksvc,route,configuration,revision,king,${{ matrix.namespace-resources || '' }}
# artifact-name: logs-${{ matrix.k8s-version}}-${{ matrix.ingress }}-${{ matrix.test-suite }}
# echo "github action runner broke this test"

- name: Set up Go 1.20.x
uses: actions/setup-go@v3
with:
go-version: 1.20.x

- name: Build quickstart plugin
run: |
set -x
./hack/build.sh
sudo mv kn-quickstart /usr/local/bin

- name: Install Dependencies
run: |
set -x
echo "::group:: install kind ${KIND_VERSION}"
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
echo "::endgroup::"

echo "::group:: install kn client ${KNATIVE_VERSION}"
curl -Lo ./kn https://github.com/knative/client/releases/download/knative-v${KNATIVE_VERSION}/kn-linux-amd64
chmod +x ./kn
sudo mv kn /usr/local/bin
echo "::endgroup::"

- name: Serving e2e Test
run: |
kn quickstart kind --install-serving --registry
source ./vendor/knative.dev/hack/e2e-tests.sh
./test/serving-e2e-test.sh || fail_test

- uses: chainguard-dev/actions/kind-diag@main
# Only upload logs on failure.
if: ${{ failure() }}
with:
cluster-resources: nodes
namespace-resources: pods,svc,ksvc,route,configuration,revision,king
19 changes: 19 additions & 0 deletions pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ func Serving() error {
return fmt.Errorf("wait: %w", err)
}

if err := reduceResources(); err != nil {
return fmt.Errorf("reduce: %w", err)
}

Comment on lines +129 to +132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also run this for eventing? otherwise, I think this is looking pretty good

if err := waitForPodsReady("knative-serving"); err != nil {
return fmt.Errorf("core: %w", err)
}
Expand Down Expand Up @@ -219,6 +223,21 @@ func retryingApply(path string) error {
return err
}

func reduceResources() error {
var err error
err = runCommand(exec.Command("kubectl", "set", "resources", "deployment", "activator", "--requests=cpu=150m,memory=30Mi", "--limits=cpu=500m,memory=300Mi", "-n", "knative-serving"))
Copy link

@skonto skonto Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind node seems to share the whole host cpu and mem so given that the sum of the Serving deployments cpu requests (including Kourier) are ~=1cpu one thing to explore is limit Kind resource allocation., assuming we want to use one worker node (because of the quickstart). At the Serving side we use kind-worker-count=4 and setup Kind with chainguard-dev/actions/setup-kind@main (which comes with metallb, local registry etc though).
Otherwise I dont see many options other than adjusting our deployment resources.

Copy link
Author

@naveenrajm7 naveenrajm7 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this valuable suggestion. If I can limit resource usage from the kind point of view itself, then I can avoid hard reduction of deployment resources. I will try this.


deployments := []string{"autoscaler", "controller", "webhook"}
for i, deploy := range deployments {
err = runCommand(exec.Command("kubectl", "set", "resources", "deployment", deploy, "--requests=cpu=50m,memory=50Mi", "--limits=cpu=500m,memory=500Mi", "-n", "knative-serving"))
if err != nil {
fmt.Printf("Error %d\n", i)
}
}

return err
}

// waitForCRDsEstablished waits for all CRDs to be established.
func waitForCRDsEstablished() error {
return runCommand(exec.Command("kubectl", "wait", "--for=condition=Established", "--all", "crd"))
Expand Down
Loading