-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial commit for handling multiple secrets #241
Initial commit for handling multiple secrets #241
Conversation
Oops... my last couple of commits broke the |
823f03a
to
e0796a7
Compare
Fixed simulated vsphere.conf which corrected the |
44a8311
to
fabb1af
Compare
manifests/controller-manager/vsphere-cloud-controller-manager-ds.yaml
Outdated
Show resolved
Hide resolved
5b513ac
to
44b759e
Compare
So the ServiceAccounts are to ensure the CCM can't accidentally modify a VM belonging to another VC but only if the secrets are stored in separate namespaces? |
That really depends on how you set everything up. I could see a few different ways of how you architect everything. The CPI's vCenter accounts should only need to be read-only (need to think about that a little more 🤔to be sure). CSI, on the other hand, is probably where the real benefit sits because it needs to have create/modify access for datastores, volumes and VMs. The service accounts are a method to restrict access to k8s secrets. The VC credentials within those secrets are what actually prevents modification of VMs by reducing scope and access/permissions of what that VC user cred can see/modify/delete on a given vCenter Server. Hope that makes sense. Still... even the reduced scope for the CPI even using read-only vCenter Server user creds will have significant security benefits. Viewing inventory you shouldn't see is still no bueno. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added comments where I felt like I saw something. :) But I don't really know enough about this code to use "Request Changes" and feel like you have to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So maybe I'm missing something still. I’m confused because the default ClusterRole we use for CPI can read secrets from all namespaces, so specifying the SA doesn’t really add additional isolation but it does make the install/configure steps more complicated. Is the intention to remove access to secrets in the cloud-controller-manager
role and require SAs (w/ Role + RoleBinding) per VC?
Yup, that's the exact intention. I just added a note that the default |
61fcc6c
to
654b2d5
Compare
Updated based feedback from @andrewsykim and updated the description (comment #1) of the PR for consistency. The good news is by changing how we enable ConnectionLabels from what was first implemented, it's made the code much simpler. The short version of this change is you enable the ConnectionLabel by defining the Thanks @andrewsykim !! |
/hold |
/hold cancel |
Yup, we are good to go! |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, left a few more minor comments
4474859
to
eb639aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/hold
LGTM, remaining comments non-blocking, holding in-case you want to address them
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewsykim The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
2585a90
to
f98e4bc
Compare
Improvement to use ConnectionLabels Update with bug fixes Fix bug with global lister Fix for ConnectionLabel in config Fix lint, vet, and etc Fix the rename of the variable Fix go test Remove klog InitFlags from go test Removed commented out code Revert YAML to remove arg0 Updates based on the Travis' feedback Updated test Update validate func Remove because no longer needed Made global lock a member variable Remove service account logic Update based on AK feedback Update based on AK feedback Update based on feedback Fix go test Update go test for TestConnectionLabels Rename ConnectionLabel to TenantRef
a351a04
to
3c937e4
Compare
/lgtm |
/hold cancel |
What this PR does / why we need it:
This PR implements the following issue (#233) and a bonus feature! 😀
This allows each
[VirtualCenter]
to have their own dedicated Secret containing VC credentials (username/password). By having a dedicated Secret, each[VirtualCenter]
will be isolated from accessing each other's Secret when said Secret is placed into their own namespace. Maybe an example vsphere.conf might be helpful...The "bonus" feature is something I am calling TenantRefs. Prior to this PR, a single
[VirtualCenter]
was constrained to have either all or a subset of Datacenters contribute to the k8s cluster. Those DCs that weren't contributing to the cluster, couldn't have a different configuration because the[VirtualCenter]
"key" was the ip/fqdn of that vCenter Server. A TenantRefs is set by defining theserver
field under the[VirtualCenter]
section. If thatserver
field is set, it is assumed that thevalue
in[VirtualCenter "value"]
is the TenantRef. By implementing TenantRefs, this allows the potential for each VC/DC to have its own unique configuration based on the access controls of a given set of creds. So what does this feature translate into in English? Think of this as possibly enabling multi-tenancy. Maybe an example configuration might help...Some things to note based on the example configuration above:
TenantRef
s starting from the top of the config file to the bottom are:us-west-tenant1
,us-east-tenant2
,us-east-tenant3
, andus-east-tenant4
. TenantRefs must be unique!Here is an example vsphere.conf based on what I actually tested:
Other minor changes along for the ride in this PR:
Which issue this PR fixes: #233
Special notes for your reviewer:
Tested on vSphere 6.7u2
Test cases included:
TenantRef
s with each their own dedicated Secret. In my test configuration, that's 3 Datacenters mapping to 3[VirtualCenter]
with 3 secrets.[VirtualCenter]
has their ownTenantRef
, 2 of the 3[VirtualCenter]
had their own dedicated Secret, and the 3rd[VirtualCenter]
used the "global" Secret. This is a complicated use case which I am sure no one will use... the point in testing this just means I have confidence everything is working fine. 🙂Since this feature is a pretty significant change and because the default/current/backward-compatible vsphere.conf file format still works, I am going to do the documentation in a separate PR. This is mainly due to the fact that this will impact CSI and I would like to start the integration of this feature into CSI before the new CNS based implementation PR start making their way over and I lose the ability to accurately test this feature on CSI.
Release note:
Default/current/backward-compatible vsphere.conf still works!