Generate RBAC will guess unknown mappings
If we have an unknown resource mapping, rather than just fail take an unsafe guess at what the name should be. This would be necessary for CRD types since we wouldn't know them up front (i.e. in our scheme).
@@ -183,7 +183,9 @@ func findRules(experiment *redskyv1alpha1.Experiment, mapper meta.RESTMapper) ([
gvk := ref.GroupVersionKind()
m, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
- return nil, err
+ // TODO If this is guessing wrong too often we may need to allow additional mappings in the configuration
+ m = &meta.RESTMapping{GroupVersionKind: gvk, Scope: meta.RESTScopeRoot}
+ m.Resource, _ = meta.UnsafeGuessKindToResource(gvk)
}
var names []string
