mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add check for incomplete SelfSubjectRulesReview to fix GKE
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8b752981a0
commit
51d71f2856
@ -42,7 +42,13 @@ const authorizationNamespaceReview = ({ logger }: Dependencies): AuthorizationNa
|
|||||||
|
|
||||||
const resources = new Set<string>();
|
const resources = new Set<string>();
|
||||||
|
|
||||||
body.status?.resourceRules.forEach(resourceRule => {
|
if (!body.status || body.status.incomplete) {
|
||||||
|
logger.warn(`[AUTHORIZATION-NAMESPACE-REVIEW]: allowing all resources in namespace="${namespace}" due to incomplete SelfSubjectRulesReview: ${body.status?.evaluationError}`);
|
||||||
|
|
||||||
|
return availableResources.map(r => r.apiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
body.status.resourceRules.forEach(resourceRule => {
|
||||||
if (!resourceRule.verbs.some(verb => ["*", "list"].includes(verb)) || !resourceRule.resources) {
|
if (!resourceRule.verbs.some(verb => ["*", "list"].includes(verb)) || !resourceRule.resources) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -62,7 +68,6 @@ const authorizationNamespaceReview = ({ logger }: Dependencies): AuthorizationNa
|
|||||||
} else {
|
} else {
|
||||||
resourceRule.resources.forEach(resource => resources.add(resource));
|
resourceRule.resources.forEach(resource => resources.add(resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return [...resources];
|
return [...resources];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user