-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
Thanks for the contribution! Please ensure your commits follow our style guide. This code will be tested once a Deis maintainer reviews it. |
Jenkins, OK to test |
@Bregor thanks for this feature addition! Before I dive into testing on an RBAC-only cluster, I wanted make sure installing charts on non-RBAC clusters (as CI does) still works. As it stands, installation fails either b/c the necessary api version is missing (from ci cluster, looks like
or the cluster otherwise isn't RBAC-ready (the following from my
Therefore, I think the first priority is to wrap the template generation in a feature flag. Perhaps How does that sound? |
Jenkins, add to whitelist |
Looks like we need specific 172.17.0.17 "POST /v2/apps/ HTTP/1.1" 201 170 "Deis Client dev-209c985"
INFO [aerial-yodeling]: deleting environment
ERROR:root:Uncaught Exception
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 480, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/mixins.py", line 93, in destroy
self.perform_destroy(instance)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/mixins.py", line 97, in perform_destroy
instance.delete()
File "/app/api/models/app.py", line 260, in delete
self._scheduler.ns.delete(self.id)
File "/app/scheduler/resources/namespace.py", line 52, in delete
raise KubeHTTPException(response, 'delete Namespace "{}"', namespace)
File "/app/scheduler/exceptions.py", line 10, in __init__
data = response.json()
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 866, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
172.17.0.17 "DELETE /v2/apps/aerial-yodeling/ HTTP/1.1" 500 25 "Deis Client dev-209c985" |
@mboersma added and rebased |
Codecov Report
@@ Coverage Diff @@
## master #1292 +/- ##
=========================================
Coverage ? 87.04%
=========================================
Files ? 45
Lines ? 3929
Branches ? 681
=========================================
Hits ? 3420
Misses ? 338
Partials ? 171 |
@mboersma, quick note about namespace deletion: |
Ah, ok--that makes a lot more sense after your explanation. That's too bad the namespace-delete perm is global. It was a shortcut to have the controller just delete the entire app namespace in the first place. It would probably be a smarter implementation to delete just the objects that controller actually created, and to print a warning if that all succeeds but the namespace deletion fails. But for now this makes RBAC workable for Workflow. @Bregor I'll test more tomorrow. I heard you're vacationing for a week or so--enjoy! We will keep testing this and let you know if we find other issues. There should be plenty of time to get this merged for the next release. Thanks again! |
EDIT: Fixed my case after adding the verb "get" to "pods" resource at deis-controller RBAC ClusterRole. The error code was 403 at URL /api/v1/namespaces/some-namespace/pods/some-pod-13gfabcfg2 I applied the RBAC rules, and all seems be ok, less one thing. Was trying to update a release, doing a second "git push deis some-app", and no matter if it fails or if succeeds, it always prints the next message in the controller logs:
Sometimes does not delete the original pod and creates an extra one, indicating 2 pods running when only 1 is required by the deployment. The output of
So, it tags a good release to a "failed" one: "release h12f1ff1df23 which failed" My RBAC controller rules look like this, maybe something is missing:
|
@kartojal you mean deis-controller needs ability to get pods in all namespaces (clusterrole), not only in workflow's parent namespace? |
Could check that tomorrow morning again, but yes, allowing the controller
to read pods in another namespaces fixed my problem and the 403
(Unauthorized) error at updating a release. Seems like when you update a
release, the controller needs to get the old release pod information, to
check if the old pod have been deleted after the deployment of the new
release, if i'm not wrong. Anyway tomorrow will debug again and report my
findings.
Have fun!
El 19 may. 2017 10:20 a. m., "Maxim Filatov" <[email protected]>
escribió:
… @kartojal <https://github.com/kartojal> you mean deis-controller needs
ability to get pods in all namespaces (clusterrole), not only in workflow's
parent namespace?
And second question: have you access to apiserver's audit.log? If yes,
could you please grep system:serviceaccount:deis:deis-controller
/path/to/audit.log while trying to update a release? This way we can
catch abilities lacks in role/clusterrole. Unfortunately I can't do it
myself till May 23, because I haven't access to my clusters while on
vacation.
Thanks in advance!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1292 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AKqXR88CU_KUwC9vzQqEyP4WpZWTkYdVks5r7VDKgaJpZM4NTHOn>
.
|
@Bregor I believe I've reproduced the same issue mentioned by @kartojal above. grepped
which correlates to the fix mentioned in #1292 (comment), namely adding the edit: here's the full audit.log particular to the |
Sure, thanks for testing, guys! I'll rebase and push ASAP |
With this change deis-controller became available to work in RBAC-only clusters Works with both Kubernetes 1.5 and 1.6 (see templates/_helpers.tmpl for details) Actually tested with 1.5.7 and 1.6.4 ClusterRole allows deis-controller: - namespaces: `get`, `list`, `create` and delete - services: `get`, `list`, `create`, `update` and `delete` - nodes: `get` and `list` - events: `list` and `create` - secrets: `list`, `get`, `create`, `update` and `delete` - replicationcontrollers: `get`, `list`, `create`, `update` and `delete` - replicationcontrollers/scale: `get` and `update` - pods/log: `get` - pods: `get`, `list` and `delete` - resourcequotas: `get` and `create` - apps/deployments: `get`, `list`, `create`, `update` and `delete` - autoscaling/horizontalpodautoscalers: `get`, `list`, `create`, `update` and `delete` - extensions/deployments: `get`, `list`, `create`, `update` and `delete` - extensions/deployments/scale: `get` and `update` - extensions/replicasets: `get`, `list`, `delete` and `update` - extensions/replicasets/scale: `get` and `update` - extensions/horizontalpodautoscalers: `get`, `list`, `create`, `update` and `delete` - extensions/ingresses: `get`, `list`, `watch`, `create`, `update` and `delete`
@vdice, @mboersma I read carefully all the code in https://github.com/deis/controller/tree/master/rootfs/scheduler/resources and updated |
Things look good after an additional round of testing, with specific focus on items relating to updated permissions in latest commits:
Planning on making sure others see the same and hopefully merging this along w/ the rest of the RBAC PRs on Tuesday (US holiday here on Monday). |
Adds RBAC support for Workflow, see also: - deis/builder#513 - deis/controller#1292 - deis/fluentd#96 - deis/monitor#195 - deis/router#344
With this change deis-controller became available to work in RBAC-only clusters
Works with both Kubernetes 1.5 and 1.6 (see templates/_helpers.tmpl for details)
Actually tested with 1.5.7 and 1.6.4
ClusterRole allows deis-controller:
get
,list
,create
and deleteget
,list
,create
,update
anddelete
get
andlist
list
andcreate
list
,get
,create
,update
anddelete
get
,list
,create
,update
anddelete
get
andupdate
get
get
,list
anddelete
get
andcreate
get
,list
,create
,update
anddelete
get
,list
,create
,update
anddelete
get
,list
,create
,update
anddelete
get
andupdate
get
,list
,delete
andupdate
get
andupdate
get
,list
,create
,update
anddelete
get
,list
,watch
,create
,update
anddelete