-
Notifications
You must be signed in to change notification settings - Fork 35
[WIP] Add Cluster API plugin #273
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
base: main
Are you sure you want to change the base?
Conversation
/cc @willie-yao |
cadd210
to
b39983e
Compare
@mboersma , I am happy to have it as an official plugin. We may also be able to early-merge it into a capi-plugin branch, so it continues being worked on without depending just on your branch. WDYT? |
@joaquimrocha thanks for the info and the icon! If it's ok to leave this as a work-in-progress for a few days, I think we can fix most of the known issues and then see if a capi-plugin branch would help with collaboration. |
73d6515
to
87f84f5
Compare
4e8c517
to
f349a61
Compare
For stories there's a problem with the current headlamp-plugin. We have storybooks working in a headlamp-plugin alpha release, but there's still some bugs. cd cluster-api
npx @kinvolk/headlamp-plugin upgrade --headlamp-plugin-version=0.13.0-alpha.5 diff --git a/cluster-api/src/index.tsx b/cluster-api/src/index.tsx
index a36d967..7eada7f 100644
--- a/cluster-api/src/index.tsx
+++ b/cluster-api/src/index.tsx
@@ -70,7 +70,7 @@ function registerClusterApiResource(config: ResourceRegistrationConfig) {
path: `/cluster-api/${path}/${hasNamespace ? ':namespace/:name' : ':name'}`,
sidebar: name,
name: name.slice(0, -1), // Remove 's' from plural form
- component: DetailComponent,
+ component: () => <DetailComponent />,
});
// Register list route
@@ -78,7 +78,7 @@ function registerClusterApiResource(config: ResourceRegistrationConfig) {
path: `/cluster-api/${path}`,
sidebar: name,
name,
- component: ListComponent,
+ component: () => <ListComponent />,
});
// Register icon for the resource kind One issue with the headlamp-plugin alpha is that it has issues with this import path when running the storybook. diff --git a/cluster-api/src/resources/kubeadmcontrolplane.ts b/cluster-api/src/resources/kubeadmcontrolplane.ts
index 867af16..59ef79b 100644
--- a/cluster-api/src/resources/kubeadmcontrolplane.ts
+++ b/cluster-api/src/resources/kubeadmcontrolplane.ts
@@ -1,4 +1,4 @@
-import { KubeObject, KubeObjectInterface, Time } from '@kinvolk/headlamp-plugin/lib/k8s/cluster';
+import { KubeObject, KubeObjectInterface, Time } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster';
import { Condition, ObjectMeta, ReadinessGate } from './common';
import { KubeadmConfigSpec } from './kubeadmconfig'; Autogenerated a storybook story: import { Meta, StoryObj } from '@storybook/react';
import { KubeadmControlPlane } from '../../resources/kubeadmcontrolplane';
import { KubeadmControlPlaneGlance } from './Glance';
const meta: Meta<typeof KubeadmControlPlaneGlance> = {
title: 'Components/KubeadmControlPlanes/Glance',
component: KubeadmControlPlaneGlance,
parameters: {
layout: 'centered',
},
};
export default meta;
type Story = StoryObj<typeof KubeadmControlPlaneGlance>;
export const Default: Story = {
args: {
node: {
kubeObject: {
kind: KubeadmControlPlane.kind,
spec: {
replicas: 3,
},
status: {
readyReplicas: 2,
},
},
},
},
};
export const AllReplicasReady: Story = {
args: {
node: {
kubeObject: {
kind: KubeadmControlPlane.kind,
spec: {
replicas: 3,
},
status: {
readyReplicas: 3,
},
},
},
},
};
export const NoReplicasReady: Story = {
args: {
node: {
kubeObject: {
kind: KubeadmControlPlane.kind,
spec: {
replicas: 3,
},
status: {
readyReplicas: 0,
},
},
},
},
};
export const InvalidNodeKind: Story = {
args: {
node: {
kubeObject: {
kind: 'SomeOtherKind',
},
},
},
}; Then you can see the storybook in here: Note, I didn't run the plugin with the headlamp-plugin alpha release. The |
Sorry, I had the wrong line here:
Should have been:
|
Thanks @illume! I made the changes you suggested. Two problems:
|
Ok, thanks for those notes. I’ll work on fixing them tomorrow. |
0ef7866
to
f054590
Compare
Signed-off-by: Matt Boersma <[email protected]>
NOTE: This is still a work in progress. There are a few issues to address before it should merge.
Adds a headlamp plugin for rendering Cluster API objects in the Sidebar and Map.
Fixes kubernetes-sigs/cluster-api#12305
TODO:
The Cluster detail view should have a "Get kubeconfig" action button, and the downloaded kubeconfig should show up in Headlamp's "Clusters" list (see Headlamp.setCluster())The MachinePool spec needs the template fields to be added.The typescript defs for CAPI resources are not all complete and need reviewing.The ClusterDetail view causes an error when its route is registered.Time fields in List views should be formatted askubectl -o table
does, e.g. "2d5h".The Sidebar needs a black-and-white "turtles" icon for CAPI.All CAPI types are using the "turtles" icon, but they should have their own icons."Controlled by" field in Detail views should be a link to the owning object (see Pods for example)Wishlist:
v1beta2
version of Cluster API resources.ScaleButton
and act like k8s Deployment/ReplicaSet (see Allow plugins to register as scalable resources kubernetes-sigs/headlamp#3536)Questions:
I don't know if this should be an official plugin or live in a separate repo. Any advice here is welcome.