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
Fix allowed resources checks on GKE #6657
Conversation
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
6c31d85
to
92d41b6
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
15d3957
to
cf105dd
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1a34fef
to
8916ce1
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
e75c3de
to
d426ed8
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
- Make injectable phases more explicit for renderer Signed-off-by: Sebastian Malton <sebastian@malton.name>
4e1ec5e
to
c7ead83
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
const k8sRequest = di.inject(k8SRequestInjectable); | ||
const logger = di.inject(loggerInjectable); | ||
|
||
return async (cluster) => { |
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.
Code as seen here could probably benefit from reducing its nesting. Eg. instead of mutating resourceListGroups
and kubeApiResources
inside for-loops inside async-IIFEs inside concurrency protected decorator, inside Promise.all, it could use some functional patterns to get something like. const resourceListGroups = await pipeline(clusters, map(toK8ApiRequestPromise), awaitAll, flatMap(toResourceListGroup));
and const kubeApiResources = await pipeline(resourceListGroups, map(toGeneralK8RequestCall), map(withApiLimit), map(toCalledFunction), awaitAll, flatMap(toKubeApiResources));
.
Probably made an error somewhere there, but the point is there :)
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.
That would be a conversation-starter :)
console.warn("Setting KubeObjectStore.context is no longer supported"); | ||
void ctx; | ||
}, | ||
get: () => asLegacyGlobalForExtensionApi(clusterFrameContextForNamespacedResourcesInjectable), |
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.
One day we'll get rid of these.
}, | ||
nodes: { | ||
kind: "Node", | ||
group: "v1", |
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.
@Nokel81 Should the group be an empty string? It seems only v1 stuff is not showing up for me.
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.
Actually this probably isn't the place that you need to fix but instead the uses of shouldShowResourceInjectionToken
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.
But yes they probably should be empty here too
Signed-off-by: Sebastian Malton sebastian@malton.name
NOTE: This is a rather large PR that fixes the GKE issue but also does some much need refactoring with fixing some circular dependencies.
The first commit fixes the bug on GKE and the rest of the commits work to do the following refactorings:
Cluster
type so that theshouldShowResource
method is more correct. Namely, just theapiName
of a resource is not enough to uniquely specify it. Furthermore, this updated naming better describes how the information should be used (it is also what the Kube docs say to use for it).ClusterContext
type to include some helpful functions that are used in several places (more DRY)NamespaceStore
KubeObjectStore.context
static to the legacy extension API type and instead passes the context in as a dependency. This removed some more global shared state and permitted the removal of the circular dependency.isMac
, etc...