Skip to content

Conversation

@errordeveloper
Copy link
Contributor

This package contains bare minimum configuration required to run e2e tests.

As seen in linuxkit/linuxkit#2668 earlier.

It still needs a little work (e.g. Job config would be plausible to add), but I wanted to open a PR before this gets lost.

@GordonTheTurtle
Copy link
Collaborator

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "master" [email protected]:errordeveloper/linuxkit-kubernetes.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

pkg/e2e/Makefile Outdated
kube_release_artefacts=https://dl.k8s.io/$(kubernetes_version)/bin/linux/amd64

.PHONY: build
build: _cache/kubernetes-test.tar.gz _cache/kubectl
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd really like to avoid adding any more Makefile wrappers for package builds at this point.

Are these things large enough to be worth caching or can we just get away with fetching them in the Dockerfile.

If they are big and we think caching is worth while then we should look into enhancing the linuxkit tool to express this in the build.yml, perhaps with a new subsection of depends alongside the docker image cache one I added to get rid of the last Makefiles here? If we are going down this path then probably it would be best to have a design in an issue on the linuxkit/linuxkit repo first.

Note that my preference would be to simply avoid the cache (i.e. just fetch in the Dockerfile) unless the artefacts are really so large as to be problematic.

org: linuxkit
image: kube-e2e-test
network: true
disable-content-trust: true
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets setup trust for this repo before we merge this PR. I think everything in the linuxkit org really ought to be signed these days.

@ijc
Copy link
Contributor

ijc commented Dec 18, 2017

I think you'll need to add a new job to the .circleci/config.yml, hopefully the pattern will be obvious, ask if not. (another reason to avoid Makefile wrappers is it avoids special cases here...)

@errordeveloper
Copy link
Contributor Author

errordeveloper commented Dec 18, 2017 via email

@ijc
Copy link
Contributor

ijc commented Dec 19, 2017

It should be a relatively simply change to this PR to move the curl invocations into the Dockerfile nowm then we can get this merged (assuming the downloads are 10s to asmall hundred MB should be tolerable given we ought to be building this package reasonably infrequently) and consider whether we want to build from scratch or not (kubelet went through a similar trajectory with getting binaries first and switching to building later on).

WRT building, what is the source repo for this stuff?

@ijc
Copy link
Contributor

ijc commented Dec 19, 2017

I missed replying to your final paragraph, #2587 has a bullet point for using buildkit but AFAIK noone is actively working on that so there is no timeline for when it might become possible.

ijc pushed a commit to ijc/linuxkit-kubernetes that referenced this pull request Dec 19, 2017
Remind the reader about the other place to update. Structured as a list because
I'm anticipating linuxkit#35 adding another.

Make the variable name consistent too by updating scripts/mk-image-cache-lst.

Signed-off-by: Ian Campbell <[email protected]>
@ijc ijc mentioned this pull request Dec 19, 2017
ijc pushed a commit to ijc/linuxkit-kubernetes that referenced this pull request Dec 19, 2017
Remind the reader about the other place to update. Structured as a list because
I'm anticipating linuxkit#35 adding another.

Make the variable name consistent too by updating scripts/mk-image-cache-lst.

Signed-off-by: Ian Campbell <[email protected]>
@errordeveloper
Copy link
Contributor Author

WRT building, what is the source repo for this stuff?

kubernetes/kubernetes

ijc pushed a commit to ijc/linuxkit-kubernetes that referenced this pull request Dec 19, 2017
Remind the reader about the other place to update. Structured as a list because
I'm anticipating linuxkit#35 adding another.

Make the variable name consistent too by updating scripts/mk-image-cache-lst.

Signed-off-by: Ian Campbell <[email protected]>
@errordeveloper
Copy link
Contributor Author

This now builds all binaries that are needed from source.

@@ -0,0 +1 @@
_cache
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this exists in the current version so this whole file is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed

RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
#coreutils needed for du -B for disk image checks made by kubelet
# example: $ du -s -B 1 /var/lib/kubelet/pods/...
# du: unrecognized option: B
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this relevant in the context of building the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No

```

This will result in `linuxkit/kube-e2e-test:current` image that
you can use. See `e2e.sh` for supported environment variables.
Copy link
Contributor

Choose a reason for hiding this comment

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

The section is out of date I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

@errordeveloper
Copy link
Contributor Author

@ijc I've updated this, and included YAML in the top-level directory, as I didn't know where it maybe be better to put it. Inside the package it would affect the hash and that doesn't seem right.
I've also cleaned-up a few things, please take a look and let me know what you think.

Running the e2e tests in CI would be a long job (I think it took 40min on my laptop last time I tried it), what do you think?
I certainly should add package build job to the CI, as discussed earlier.

@errordeveloper errordeveloper force-pushed the master branch 2 times, most recently from 09067af to bd2dafb Compare January 5, 2018 01:25
@ijc
Copy link
Contributor

ijc commented Jan 5, 2018

About to take a look, but came here to ask you to rebase onto #36 and to update the two comments I added and add a similar comment to the place you've added another Kube version definition.

Running the e2e tests in CI would be a long job (I think it took 40min on my laptop last time I tried it), what do you think?
I certainly should add package build job to the CI, as discussed earlier.

40 mins is certainly too long, the current set of tests takes ~20 mins in the worst case (all packages needing to be rebuilt) and can be much faster if packages don't need building.

We could consider adding a daily/nightly job which ran on master and ran these tests, but lets defer that until these basics are in.

@ijc
Copy link
Contributor

ijc commented Jan 5, 2018

included YAML in the top-level directory, as I didn't know where it maybe be better to put it. Inside the package it would affect the hash and that doesn't seem right.

Do you mean test/kube-e2e-test-job.yaml? Since it includes linuxkit/kube-e2e-test:260c4467ab0a752b5369e73d4f2da13eb2da7bbf I think it can't go in pkg/e2e-test even if you wanted to (since updating the hash would change the hash, rinse and repeat).

Actually that does highlight that this is not actually a "linuxkit package" (i.e. something you would feed to linuxkit build via a yml), it's an image intended to be run as a pod. It's not too bad to reuse linuxkit pkg to rebuild such a thing but perhaps it should be in test/pkg rather than pkg and then having test/foo-job.yaml which consumes it seems entirely reasonable.

Wherever it ends up you should include it in the update-hashes rune in the top-level Makefile.

What about also adding yml/e2e-test.yml similar to yml/weave.yml to pull in kube-e2e-test-job.yaml into /etc/kubeadm/kube-system.init/99-e2e-test.yaml so one can easily build an image which runs the tests automatically. Or are there issues like needing to wait after kubeadm init for things to stabilise before running the tests in order to get useful results?

@ijc
Copy link
Contributor

ijc commented Jan 5, 2018

I think your CI issues are down to the thing which will be fixed by #39. Once we have the code in shape I can bash the retry button till it passes (or maybe #39 will get merged in time for you to rebase onto it)

@errordeveloper
Copy link
Contributor Author

We could consider adding a daily/nightly job which ran on master and ran these tests, but lets defer that until these basics are in.

💯 👍

@errordeveloper errordeveloper force-pushed the master branch 6 times, most recently from 3b7ee1e to 0297ffa Compare January 5, 2018 14:48
- lint
- pkg-kubelet
- pkg-cri-containerd
- pkg-kube-e2e-test
Copy link
Contributor

Choose a reason for hiding this comment

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

You are missing a linuxkit pkg push --nobuild for this new package in the push-pkgs-to-hub step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well spotted!

org: linuxkit
image: kube-e2e-test
network: true
disable-content-trust: true
Copy link
Contributor

Choose a reason for hiding this comment

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

I setup content trust for this repo so you can now drop this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

#!/bin/sh

set -o errexit
set -o pipefail
Copy link
Contributor

Choose a reason for hiding this comment

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

pipefail (at least) is a bash-ism so you need #! /bin/bash shebang. Not sure about errexit or nounset, the short names (-e and -u) are portable I think.

Given how awful it is to replicate pipefail in pure POSIX shell I think just using /bin/bash for the shebang is the right answer in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I didn't realise this... It's okay, we aren't relying on pipefail here. I'll switch to /bin/sh and use set -eu, same goes for pkg/kube-e2e-test/e2e.sh (which currently has an explicit set +o pipefail).

@errordeveloper errordeveloper force-pushed the master branch 2 times, most recently from beae7cd to 349b23a Compare January 5, 2018 15:22
echo "$0: log save in ${PWD}/e2e.log, cleaning up the resources..."
cleanup 2> /dev/null || true
grep -q '^Test Suite Passed$' e2e.log && exit 0
grep -q '^Test Suite Failed$' e2e.log && exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

If the log contains neither the pass nor fail messages that is a failure IMHO (perhaps the file is empty because pod logging is b0rked), I think you can just drop the grep from this last line and exit 1 unconditionally.

@errordeveloper
Copy link
Contributor Author

I found an issue with the script, testing a fix right now.

@errordeveloper errordeveloper force-pushed the master branch 5 times, most recently from 8e4c750 to 7bd6c72 Compare January 5, 2018 16:54
@errordeveloper errordeveloper force-pushed the master branch 2 times, most recently from 0edd1f3 to 3d2fad9 Compare January 8, 2018 08:29
@errordeveloper
Copy link
Contributor Author

@ijc I'm quite happy with the runner script now, PTAL.

Signed-off-by: Ilya Dmitrichenko <[email protected]>
linuxkit pkg push --nobuild pkg/cri-containerd
linuxkit pkg push --nobuild pkg/kubelet
linuxkit pkg push --nobuild pkg/cri-containerd
linuxkit pkg push --nobuild pkg/kube-e2e-test
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you move cri-containerd below kubelet? They were alphabetic before. Suppose it isn't a big deal.

Copy link
Contributor Author

@errordeveloper errordeveloper Jan 8, 2018

Choose a reason for hiding this comment

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

They were in different order in some places, so I was trying to list them in the same order everywhere...

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it was the other places which were buggy then ;-)

Lets not worry about it, if someone enthusiastic soul decides they want to sort them later (and add comments to keep them sorted) then they can.

Copy link
Contributor

@ijc ijc left a comment

Choose a reason for hiding this comment

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

LGTM

@ijc ijc merged commit 4e6f520 into linuxkit:master Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants