-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cleanup Cluster to remove environment specific details #6951
Conversation
1b2d306
to
fe1a33d
Compare
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
e6b7e70
to
4cdcb66
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. |
9d783fb
to
97e5096
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
@@ -13,18 +13,18 @@ | |||
const isGKE = (version: string) => version.includes("gke"); | |||
const isEKS = (version: string) => version.includes("eks"); | |||
const isIKS = (version: string) => version.includes("IKS"); | |||
const isAKS = (cluster: Cluster) => cluster.apiUrl.includes("azmk8s.io"); | |||
const isAKS = (cluster: Cluster) => cluster.apiUrl.get().includes("azmk8s.io"); |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization
const isMicrok8s = (cluster: Cluster) => cluster.contextName.startsWith("microk8s"); | ||
const isKind = (cluster: Cluster) => cluster.contextName.startsWith("kubernetes-admin@kind-"); | ||
const isDockerDesktop = (cluster: Cluster) => cluster.contextName === "docker-desktop"; | ||
const isDigitalOcean = (cluster: Cluster) => cluster.apiUrl.get().endsWith("k8s.ondigitalocean.com"); |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
665f4c7
to
79b349d
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. |
65fd3f9
to
37389f8
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. |
37389f8
to
9b740b2
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. |
e7987c0
to
f14e229
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
- requestNamespaceListPermissions is infallable so no need to have the extra try/catch - Refactor isMetricHidden method away from Cluster - Refactor shouldShowResource out of Cluster - Refactor isInLocalKubeconfig out of Cluster - Remove depecrated and unused workspace from Cluster - Refactor out kubectl as a dependency of Cluster - Remove from cluster getter used only once - Split out ClusterConnection from Cluster - Also split out KubeAuthProxyServer from ContextHandler - Rename ContextHandler to PrometheusHandler - Cleanup onNetworkOffline/Online impls within ClusterManager - Remove annotations from ClusterConnection - Remove mobx annotations from Cluster - Rename loadConfigFromFileInjectable - Remove all uses of dead createClusterInjectionToken - Fix type errors related to broadcastConnectionUpdate Signed-off-by: Sebastian Malton <sebastian@malton.name>
fd42082
to
a911f08
Compare
@@ -64,7 +62,7 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> { | |||
|
|||
const cluster = clusterOrModel instanceof Cluster | |||
? clusterOrModel | |||
: this.dependencies.createCluster( | |||
: new 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.
It's not good thing to remove the createCluster
since it abstracts the fact that Cluster is even a class. new
keyword should never be used in the implementation code. There should always be a factory function to abstract the constructor arguments. This allows us to change the implementation how ever we want, but using new Cluster
strictly ties us down to Cluster
class with specific arguments.
*/ | ||
@observable accessible = false; // if user is able to access cluster resources | ||
readonly accessible = observable.box(false); |
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.
Isn't Cluster
exposed in the Extension API? This would be breaking change.
This affects all properties that have changed here.
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.
Needs to be said that this PR touches so many places without confidence of unit tests that it is likely to cause some bug somewhere.
Seems like an improvement anyway.
Signed-off-by: Sebastian Malton sebastian@malton.name
Please review this commit by commit.
By the end of this PR, the
Cluster
type will be no more than a shell which contains thestatus
andpreferences
related details. These can be further re-factored in future PRs.Notes:
Cluster
are now on a newClusterConnection
type