Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Switch to prow for e2e testing. Fix intermittent test failures. #122

Merged
merged 16 commits into from
Nov 13, 2017

Conversation

munnerz
Copy link
Contributor

@munnerz munnerz commented Nov 9, 2017

What this PR does / why we need it:

Attempts to fix requestheader & RBAC related issues with e2e tests

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

TBC

Special notes for your reviewer:

This may not pass due to issues with kubernetes actually starting still

Release note:

NONE

/assign
/cc @wallrj

@jetstack-bot
Copy link
Collaborator

@munnerz PR needs rebase

@munnerz
Copy link
Contributor Author

munnerz commented Nov 10, 2017

/test e2e

Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

Thanks @munnerz

The tests are failing, as you say, because minikube start is failing.

And I expect the tests to fail 1.7 anyway, because we're passing exactly the same --requestheader- arguments to Navigator API server as in #116 (comment), where we saw RBAC access control failures such as

Error from server (Forbidden): elasticsearchclusters.navigator.jetstack.io is forbidden: User "system:anonymous" cannot list elasticsearchclusters.navigator.jetstack.io in the namespace "default"

Even for a user with cluster-admin role binding.

Unless kubeadm bootstrapper does something differently.
And if so, can you add a comment or two explaining what's different.

@@ -87,7 +87,7 @@ items:
name: "{{ template "fullname" . }}:controller"
rules:
- apiGroups: ["navigator.jetstack.io"]
resources: ["elasticsearchclusters", "pilots"]
resources: ["elasticsearchclusters", "pilots", "elasticsearchclusters/status", "pilots/status"]
Copy link
Member

Choose a reason for hiding this comment

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

❓ Does a controller ever need to modify pilots/status ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs to delegate permission to modify/update pilots/status to each Pilot.

Copy link
Member

Choose a reason for hiding this comment

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

Got it.

--extra-config=apiserver.Authorization.Mode=RBAC
--extra-config=apiserver.Authorization.Mode=RBAC \
--bootstrapper=kubeadm; then
sudo journalctl -xu kubelet.service
Copy link
Member

Choose a reason for hiding this comment

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

This is failing on Travis because the VM doesn't have journalctl.
Use minikube logs instead?
Or does kubeadm put the logs somewhere where minikube logs can't find them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is still WIP - we can't use the kubeadm bootstrapper with vm-driver=none as kubeadm requires systemctl, but travis don't support anything newer than ubuntu 14.04.

I'm working on getting rid of Travis in favour of minikube-in-go on our own test-infra at the moment.

resources:
requests:
cpu: 50m
memory: 64Mi
Copy link
Member

Choose a reason for hiding this comment

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

helm install says -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) so perhaps we could put only the apiserver.extraArgs in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep we could - I'm inclined to keep this nice and explicit though, so it's easy to understand what's being deployed in the e2e tests.

@munnerz
Copy link
Contributor Author

munnerz commented Nov 10, 2017

Still TODO:

  • Get kubernetes/test-infra PR merged: Add support for ProwJob lifecycle hooks kubernetes/test-infra#5443
  • Update minikube_in_go job to run virsh destroy and clean up minikube data dir in preStop hook
  • Build Kubernetes 1.7.0 test image (or adjust the existing one to support arbitrary k8s versions)
  • Rename navigator-e2e context to navigator-e2e-v1.8.0, v1.7.0 etc
  • Update Prow required contexts to include navigator-e2e and navigator-quick-verify
  • Resolve SELinux issues
  • Enable RBAC

@munnerz munnerz closed this Nov 10, 2017
@munnerz munnerz reopened this Nov 10, 2017
@munnerz munnerz changed the title Fixes for e2e test requestheader failures Switch to prow for e2e testing. Fix intermittent test failures. Nov 11, 2017
@munnerz
Copy link
Contributor Author

munnerz commented Nov 11, 2017

RBAC is enabled by default with the kubeadm bootstrapper on both 1.7 and 1.8.

@munnerz
Copy link
Contributor Author

munnerz commented Nov 11, 2017

/test e2e

@munnerz
Copy link
Contributor Author

munnerz commented Nov 11, 2017

@wallrj this appears to be passing pretty consistently now. The only time I've seen failures is when both the k8s 1.7 and 1.8 tests run in parallel sometimes. I think that's because our build server is maxing out (only 2 cores allocated right now) meaning the kubeadm start timeout is being reached.

We'll be increasing the size of our build infrastructure accordingly. I haven't seen the failures very often however.

I've also made the navigator-e2e-v1-7, navigator-e2e-v1-8 and navigator-quick-verify tests mandatory for merge, however e2e tests will not automatically run for every new commit that is pushed. When you are ready to run e2e tests, comment /test e2e or /test e2e v1.7 etc. - you will need to ensure e2e tests are green before the submit queue will merge your PR.

Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

Thanks @munnerz

Looks good. And amazing that you got all this stuff set up in such a short time!

The build logs seem to have disappeared

The Travis build now seems to be running a bare make command which is a bit pointless.

I've left a few additional comments and questions below.

Please address and merge.

@@ -58,6 +64,7 @@ verify: .hack_verify go_verify
DOCKER_BUILD_TARGETS = $(addprefix docker_build_, $(CMDS))
$(DOCKER_BUILD_TARGETS):
$(eval DOCKER_BUILD_CMD := $(subst docker_build_,,$@))
eval $$(minikube docker-env --profile $$HOSTNAME --shell sh); \
Copy link
Member

Choose a reason for hiding this comment

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

❓ Is it necessary to specify a profile here? The default is minikube, which should work on a new e2e VM right?

It means that I have to remember to use $HOSTNAME as the profile, when I launch minikube locally.

@@ -87,7 +87,7 @@ items:
name: "{{ template "fullname" . }}:controller"
rules:
- apiGroups: ["navigator.jetstack.io"]
resources: ["elasticsearchclusters", "pilots"]
resources: ["elasticsearchclusters", "pilots", "elasticsearchclusters/status", "pilots/status"]
Copy link
Member

Choose a reason for hiding this comment

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

Got it.

# - --requestheader-client-ca-file=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
# - --requestheader-username-headers=X-Remote-User
# - --requestheader-group-headers=X-Remote-Group
# - --requestheader-extra-headers-prefix=X-Remote-Extra - --proxy-client-cert-file="${CERT_DIR}/client-auth-proxy.crt"
Copy link
Member

Choose a reason for hiding this comment

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

This line needs to be split. But do it in a followup branch if you like.

chmod +x minikube
sudo mv minikube /usr/local/bin/

docker run -v /usr/local/bin:/hostbin quay.io/jetstack/ubuntu-nsenter cp /nsenter /hostbin/nsenter
Copy link
Member

Choose a reason for hiding this comment

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

❓ I see all this stuff gets installed here: https://github.com/jetstack/test-infra/blob/master/images/minikube-in-go/Dockerfile
Great, that should speed things up and save some network traffic.

  • How easy is it to get launch a KVM VM from inside a Docker container?
  • How do you ensure that we're using the correct version of kubectl, if it is installed there but minikube start --kubernetes-version... is specified here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The KVM VM is launched in a container by passing through the libvirt socket into the container. Anything that works with libvirt should work okay within a container too.

The KUBERNETES_VERSION environment variable is set as part of the minikube-in-go docker image, which helps ensure we use the correct version of kubectl with kubernetes 😄

apiGroup: rbac.authorization.k8s.io
- kind: Group
name: system:unauthenticated
apiGroup: rbac.authorization.k8s.io
Copy link
Member

Choose a reason for hiding this comment

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

👍

@munnerz
Copy link
Contributor Author

munnerz commented Nov 13, 2017

/retest

@munnerz munnerz added the lgtm label Nov 13, 2017
@munnerz
Copy link
Contributor Author

munnerz commented Nov 13, 2017

/approve

@jetstack-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: munnerz

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@jetstack-bot
Copy link
Collaborator

/test all [submit-queue is verifying that this PR is safe to merge]

@munnerz
Copy link
Contributor Author

munnerz commented Nov 13, 2017

/test all

@jetstack-bot
Copy link
Collaborator

Automatic merge from submit-queue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants