Add RBAC support for 1.7 clusters

Signed-off-by: Nolan Brubaker <nolan@heptio.com>
This commit is contained in:
Nolan Brubaker
2018-07-20 17:03:11 -04:00
parent 5329a4d67d
commit dd1e150511
6 changed files with 584 additions and 47 deletions

View File

@@ -45,6 +45,10 @@ type Helper interface {
// Refresh pulls an updated set of Ark-backuppable resources from the
// discovery API.
Refresh() error
// APIGroups gets the current set of supported APIGroups
// in the cluster.
APIGroups() []metav1.APIGroup
}
type helper struct {
@@ -56,6 +60,7 @@ type helper struct {
mapper meta.RESTMapper
resources []*metav1.APIResourceList
resourcesMap map[schema.GroupVersionResource]metav1.APIResource
apiGroups []metav1.APIGroup
}
var _ Helper = &helper{}
@@ -127,6 +132,12 @@ func (h *helper) Refresh() error {
}
}
apiGroupList, err := h.discoveryClient.ServerGroups()
if err != nil {
return errors.WithStack(err)
}
h.apiGroups = apiGroupList.Groups
return nil
}
@@ -165,3 +176,9 @@ func (h *helper) Resources() []*metav1.APIResourceList {
defer h.lock.RUnlock()
return h.resources
}
func (h *helper) APIGroups() []metav1.APIGroup {
h.lock.RLock()
defer h.lock.RUnlock()
return h.apiGroups
}