deis / controller

Deis Workflow Controller (API)
https://deis.com
MIT License
41 stars 53 forks source link

Cannot create applications with Kubernetes 1.5 #1175

Closed mhulscher closed 7 years ago

mhulscher commented 7 years ago

Creating an application w/ latest Deis and Kubernetes 1.5.0.

clusters/usvc-dev1 [ kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.0", GitCommit:"58b7c16a52c03e4a849874602be42ee71afdcab1", GitTreeState:"clean", BuildDate:"2016-12-12T23:35:54Z", GoVersion:"go1.7.4",Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.0", GitCommit:"58b7c16a52c03e4a849874602be42ee71afdcab1", GitTreeState:"clean", BuildDate:"2016-12-12T23:31:15Z", GoVersion:"go1.7.4",Compiler:"gc", Platform:"linux/amd64"}

clusters/usvc-dev1 [ mkdir beerz
clusters/usvc-dev1 [ deis create beerz --no-remote
Creating Application... done, created beerz
If you want to add a git remote for this app later, use `deis git:remote -a beerz`

clusters/usvc-dev1 [ cd beerz

usvc-dev1/beerz [ deis config:set PORT=80
Creating config... done

=== beerz Config
PORT      80

usvc-dev1/beerz [ deis pull tutum/hello-world
Creating build... Error: Unknown Error (400): {"detail":"'NoneType' object is not iterable"}

usvc-dev1/beerz [ deis info
=== beerz Application
updated:  2016-12-13T13:19:51Z
uuid:     a06728d5-7d56-4aaf-a872-bfcdfd050065
created:  2016-12-13T13:19:34Z
url:      beerz.dev1.****
owner:    mitch.hulscher
id:       beerz

Error: Unknown Error (503): {"detail":"(list pods): 'NoneType' object is not iterable"}

usvc-dev1/beerz [ deis destroy
 !    WARNING: Potentially Destructive Action
 !    This command will destroy the application: beerz
 !    To proceed, type "beerz" or re-run this command with --confirm=beerz

> beerz
Destroying beerz...
done in 0s
Error: Could not find remote matching app in 'git remote -v'

deis-controller logs (collected w/ stern)

+ deis-controller-3623075965-kl9bv › deis-controller
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: config beerz-e63575a updated
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: mitch.hulscher created initial release
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: appsettings beerz-24a41e9 updated
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: domain beerz added
deis-controller-3623075965-kl9bv deis-controller 10.19.128.0 "POST /v2/apps/ HTTP/1.1" 201 166 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller 10.19.32.0 "POST /v2/apps/usvc-dev1/config/ HTTP/1.1" 404 33 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: config beerz-977e95b updated
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: mitch.hulscher added PORT
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: No build associated with this release to publish
deis-controller-3623075965-kl9bv deis-controller 10.19.128.0 "POST /v2/apps/beerz/config/ HTTP/1.1" 201 237 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller 10.19.32.0 "GET /v2/apps/beerz/config/ HTTP/1.1" 200 237 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: build beerz-1fa3bf4 created
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: mitch.hulscher deployed tutum/hello-world
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: tutum/hello-world exists in the target registry. Using image for release 3 of app beerz
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: adding 5s on to the original 120s timeout to account for the initial delay specified in the liveness / readiness probe
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: This deployments overall timeout is 125s - batch timout is 125s and there are 1 batches to deploy with a total of 1 pods
deis-controller-3623075965-kl9bv deis-controller WARNING [beerz]: Router was not ready to serve traffic to process type cmd in time, waited 10 seconds
deis-controller-3623075965-kl9bv deis-controller ERROR:root:'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller Traceback (most recent call last):
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/models/build.py", line 65, in create
deis-controller-3623075965-kl9bv deis-controller     self.app.deploy(new_release)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/models/app.py", line 545, in deploy
deis-controller-3623075965-kl9bv deis-controller     release.cleanup_old()
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/models/release.py", line 267, in cleanup_old
deis-controller-3623075965-kl9bv deis-controller     for controller in controllers['items']:
deis-controller-3623075965-kl9bv deis-controller TypeError: 'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller
deis-controller-3623075965-kl9bv deis-controller The above exception was the direct cause of the following exception:
deis-controller-3623075965-kl9bv deis-controller
deis-controller-3623075965-kl9bv deis-controller Traceback (most recent call last):
deis-controller-3623075965-kl9bv deis-controller   File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 474, in dispatch
deis-controller-3623075965-kl9bv deis-controller     response = handler(request, *args, **kwargs)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/views.py", line 185, in create
deis-controller-3623075965-kl9bv deis-controller     return super(AppResourceViewSet, self).create(request, **kwargs)
deis-controller-3623075965-kl9bv deis-controller   File "/usr/local/lib/python3.5/dist-packages/rest_framework/mixins.py", line 21, in create
deis-controller-3623075965-kl9bv deis-controller     self.perform_create(serializer)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/viewsets.py", line 21, in perform_create
deis-controller-3623075965-kl9bv deis-controller     self.post_save(obj)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/views.py", line 268, in post_save
deis-controller-3623075965-kl9bv deis-controller     self.release = build.create(self.request.user)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/models/build.py", line 79, in create
deis-controller-3623075965-kl9bv deis-controller     raise DeisException(str(e)) from e
deis-controller-3623075965-kl9bv deis-controller api.exceptions.DeisException: 'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller 10.19.128.0 "POST /v2/apps/beerz/builds/ HTTP/1.1" 400 46 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller 10.19.32.0 "GET /v2/apps/beerz/ HTTP/1.1" 200 173 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller 10.19.128.0 "GET /v2/apps/beerz/domains/?limit=1 HTTP/1.1" 200 175 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller ERROR [beerz]: (list pods): 'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller ERROR:root:'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller Traceback (most recent call last):
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/models/app.py", line 742, in list_pods
deis-controller-3623075965-kl9bv deis-controller     for p in pods:
deis-controller-3623075965-kl9bv deis-controller TypeError: 'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller
deis-controller-3623075965-kl9bv deis-controller The above exception was the direct cause of the following exception:
deis-controller-3623075965-kl9bv deis-controller
deis-controller-3623075965-kl9bv deis-controller Traceback (most recent call last):
deis-controller-3623075965-kl9bv deis-controller   File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 474, in dispatch
deis-controller-3623075965-kl9bv deis-controller     response = handler(request, *args, **kwargs)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/views.py", line 305, in list
deis-controller-3623075965-kl9bv deis-controller     pods = self.get_app().list_pods(*args, **kwargs)
deis-controller-3623075965-kl9bv deis-controller   File "/app/api/models/app.py", line 779, in list_pods
deis-controller-3623075965-kl9bv deis-controller     raise ServiceUnavailable(err) from e
deis-controller-3623075965-kl9bv deis-controller api.exceptions.ServiceUnavailable: (list pods): 'NoneType' object is not iterable
deis-controller-3623075965-kl9bv deis-controller 10.19.32.0 "GET /v2/apps/beerz/pods/?limit=100 HTTP/1.1" 503 59 "Deis Client v2.9.1"
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: deleting environment
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: domain beerz removed
deis-controller-3623075965-kl9bv deis-controller INFO [beerz]: tls beerz-25c3a62 removed
deis-controller-3623075965-kl9bv deis-controller 10.19.128.0 "DELETE /v2/apps/beerz/ HTTP/1.1" 204 - "Deis Client v2.9.1"

Rolling back the control-plane to 1.4.7 fixed the issue. I am available if more information is required.

bacongobbler commented 7 years ago

I know the helm team is still working on compatibility with v1.5.0 so installing through conventional means is not even a possibility at this time. I'm assuming you installed using helm-classic?

Bregor commented 7 years ago
$ helm version
Client: &version.Version{SemVer:"v2.0.2", GitCommit:"afcab3bb4f45478772a853e0d98306fda0a7af34", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.0.2", GitCommit:"afcab3bb4f45478772a853e0d98306fda0a7af34", GitTreeState:"clean"}
bacongobbler commented 7 years ago

I tried that and hit https://github.com/kubernetes/helm/issues/1591#issuecomment-266842591.

Bregor commented 7 years ago

In my particular case tiller-deploy is already installed since k8s-1.4. Problem is not in helm install ... but in git push deis master

Bregor commented 7 years ago

Also operations like deis config:set, deis create ... and so on fails constantly with

deis[controller]: ERROR (list pods): 'NoneType' object is not iterable
mhulscher commented 7 years ago

Just like @Bregor I installed Deis using Helm 2.0.0 when the K8s-cluster was still 1.4.6. This morning I tried upgrading K8s to 1.5.0. This is an on-premise sandbox cluster bootstrapped with kubeadm.

mboersma commented 7 years ago

It's possible that this is due to API access being denied in k8s v1.5.0, as described here: https://marc.ttias.be/kubernetes-announce/2016-12/msg00004.php

tl:dr we should re-test this with v1.5.1.

bacongobbler commented 7 years ago

I have re-tested this with v1.5.1 and helm v2.1.0. I can install workflow again, but it still seems like deis ps still fails with the following:

><> deis ps -a go
Error: Unknown Error (503): {"detail":"(list pods): 'NoneType' object is not iterable"}

controller logs:

10.246.74.20 "GET /v2/apps/go/pods/?limit=100 HTTP/1.1" 503 59 "Deis Client dev-eb21ef2"
ERROR [go]: (list pods): 'NoneType' object is not iterable
ERROR:root:'NoneType' object is not iterable
Traceback (most recent call last):
  File "/app/api/models/app.py", line 742, in list_pods
    for p in pods:
TypeError: 'NoneType' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 474, in dispatch
    response = handler(request, *args, **kwargs)
  File "/app/api/views.py", line 305, in list
    pods = self.get_app().list_pods(*args, **kwargs)
  File "/app/api/models/app.py", line 779, in list_pods
    raise ServiceUnavailable(err) from e
api.exceptions.ServiceUnavailable: (list pods): 'NoneType' object is not iterable
bacongobbler commented 7 years ago

Going to sleep but will retry testing in the morning.

bacongobbler commented 7 years ago

So it looks like they changed the response in 1.5.0 when fetching pods when none exist:

2016-12-14T18:07:51+00:00 deis[controller]: INFO {'items': None, 'kind': 'PodList', 'metadata': {'resourceVersion': '5350', 'selfLink': '/api/v1/namespaces/go/pods'}, 'apiVersion': 'v1'}

notice that the items field is None. In v1.4.7 that would be an empty list, so we will need to account for that.

bacongobbler commented 7 years ago

this has now been merged into master. Up to @mboersma whether we want to cut a v2.9.1 with this fix or wait until v2.10 for k8s 1.5 compatibility. :)

Bregor commented 7 years ago

v2.9.1, please