Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

feat: add rbac support #29

Merged
merged 4 commits into from
Oct 18, 2018
Merged

feat: add rbac support #29

merged 4 commits into from
Oct 18, 2018

Conversation

tomwganem
Copy link
Contributor

closes #20

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for working on this and especially for adding unit tests!

It might be preferable to actually create a dedicated service account for the catalog sync service, and bind to that, rather than adding the sync role to all service accounts. That is the approach we took with #37.

Would that be okay? We can make the changes if necessary but want to inquire why you didn't go with that approach since you might have reasons.

values.yaml Outdated
# Enabling rbac will create cluster roles and cluster role bindings to allow the
# syncCatalog service to communicate with the kubernetes api to get/create services
rbac:
enabled: false
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should probably go under the syncCatalog section. I can see the easiest way would be:

syncCatalog:
  rbac:
    enabled: false/true

@tomwganem
Copy link
Contributor Author

I've been deploying this helm chart to a dedicated namespace, hence why I didn't think to add a service account. I agree with that approach however, and will integrate it with this PR.

@tomwganem
Copy link
Contributor Author

PR updated to include the creation of a service account

@jipperinbham
Copy link

I tested this out and the use of : in the API object names will not work. Once I changed it to -, the helm install worked as expected.

@tomwganem
Copy link
Contributor Author

Fixed

- watch
- update
- patch
- delete

Choose a reason for hiding this comment

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

Suggested change
- delete
- delete
- create

I was getting error="services is forbidden: User "system:serviceaccount:platform:consul-sync-catalog" cannot create services in the namespace "platform"" without this. Once added, the consul service was synced to k8s.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Yep.

It seems possible that we should create two roles here. One for k8s => Consul and one for Consul => k8s, since either one-way can be disabled/enabled and k8s => Consul only requires read-only privileges which is a nice to have.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually decided to just add -create for now and keep the simple thing, we can split it out later if its useful.

@mitchellh mitchellh merged commit 973cc2e into hashicorp:master Oct 18, 2018
@mitchellh
Copy link
Contributor

Thank you very much @tomwganem! I just ran it and it worked great. I added the change @jipperinbham recommended as well. Merged!

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

Successfully merging this pull request may close these issues.

Add support for RBAC for consul-k8s in chart
3 participants