-
Notifications
You must be signed in to change notification settings - Fork 16
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
WIP: KEDA Plugin for Headlamp #181
base: main
Are you sure you want to change the base?
WIP: KEDA Plugin for Headlamp #181
Conversation
ebc2f3b
to
a333dd9
Compare
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.
Good work. Have dropped few comments. Please add steps to test both in readme and the PR description.
{ | ||
id: 'authentications', | ||
label: 'Authentications', | ||
getValue: null, | ||
render: item => { | ||
const triggerAuthenticationRefs = item.spec.triggers | ||
.map(trigger => trigger.authenticationRef) | ||
.filter(Boolean); | ||
|
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.
{ | |
id: 'authentications', | |
label: 'Authentications', | |
getValue: null, | |
render: item => { | |
const triggerAuthenticationRefs = item.spec.triggers | |
.map(trigger => trigger.authenticationRef) | |
.filter(Boolean); | |
{ | |
id: 'authentications', | |
label: 'Authentications', | |
render: item => { | |
const triggerAuthenticationRefs = item.spec.triggers | |
.map(trigger => trigger.authenticationRef) | |
.filter(Boolean); | |
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.
@yolossn, earlier I did try doing this but it gives the below error
No overload matches this call.
Overload 1 of 2, '(props: ResourceListViewWithResourceClassProps<typeof ScaledObject>): ReactElement<any, string | JSXElementConstructor<any>>', gave the following error.
Type '(item: ScaledObject) => Element' is not assignable to type 'never'.
Overload 2 of 2, '(props: ResourceListViewProps<KubeObject<any>>): ReactElement<any, string | JSXElementConstructor<any>>', gave the following error.
Type '(item: ScaledObject) => Element' is not assignable to type 'never'.ts(2769)
(property) render: (item: ScaledObject) => JSX.Element
so I had to do getValue: null
{ | ||
id: 'authentications', | ||
label: 'Authentications', | ||
getValue: null, | ||
render: item => { | ||
const triggerAuthenticationRefs = item.spec.triggers | ||
.map(trigger => trigger.authenticationRef) | ||
.filter(Boolean); |
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.
{ | |
id: 'authentications', | |
label: 'Authentications', | |
getValue: null, | |
render: item => { | |
const triggerAuthenticationRefs = item.spec.triggers | |
.map(trigger => trigger.authenticationRef) | |
.filter(Boolean); | |
{ | |
id: 'authentications', | |
label: 'Authentications', | |
render: item => { | |
const triggerAuthenticationRefs = item.spec.triggers | |
.map(trigger => trigger.authenticationRef) | |
.filter(Boolean); |
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.
same reason as in this comment
493bc71
to
a6d8d30
Compare
Signed-off-by: adwait-godbole <[email protected]>
a6d8d30
to
8f51232
Compare
Upstream Issue: headlamp-k8s/headlamp/#2791
Testing the plugin
Prerequisites
Steps to Test
Clone the plugins repository:
Switch to the keda branch:
Navigate to the keda plugin directory:
cd keda
Install the required dependencies:
Start the plugin in development mode:
Launch Headlamp. You should now see "KEDA" in the sidebar.
Generate KEDA Resources for Testing
1. Build the RabbitMQ Client Image
Before deploying the examples, build the RabbitMQ client Docker image using the provided Dockerfile:
Take a note of your image name as you'll need to update it in the deployment YAML files.
2. Update the YAML files with your image
Update the image reference in these files:
For example:
Replace
with
3. Create a RabbitMQ Queue
Install RabbitMQ via Helm
Since the Helm stable repository was migrated to the Bitnami Repository, add the Bitnami repo and use it during the installation:
Helm 3
RabbitMQ Helm Chart version 7.0.0 or later
Notes:
If you are running the rabbitMQ image on KinD, you will run into permission issues unless you set
volumePermissions.enabled=true
. Use the following command if you are using KinD:With RabbitMQ Helm Chart version 6.x.x or earlier, username and password should be specified with rabbitmq.username and rabbitmq.password parameters https://hub.helm.sh/charts/bitnami/rabbitmq
Helm 2
RabbitMQ Helm Chart version 7.0.0 or later
Wait for RabbitMQ to Deploy
4. Deploy a KEDA TriggerAuthentication for RabbitMQ
This TriggerAuthentication resource provides the necessary credentials for KEDA to connect to RabbitMQ and monitor the queue.
5. Testing KEDA ScaledObject
Deploy a RabbitMQ Consumer
Validate the consumer has been deployed
You should see
rabbitmq-consumer
deployment with 1 running pod but after deploying the ScaledObject, it will display 0 running pods as we haven't yet published any messages to RabbitMQ and hence KEDA will scale down the pods to 0 since we have not mentioned anyminReplicaCount
in the spec.This consumer is set to consume one message per instance, sleep for 1 second, and then acknowledge completion of the message. This is used to simulate work.
Deploy ScaledObject
This ScaledObject configures autoscaling for the
rabbitmq-consumer
deployment. It is set to scale to a minimum of 0 replicas when there are no messages in the queue, and up to a maximum of 30 replicas when the queue is heavily loaded. The scaling is optimized for maintaining a queue length of 5 messages per replica. After 30 seconds of no events, the replicas will be scaled down (cooldown period). These settings can be adjusted in the YAML Specification as needed.Trigger the Publisher Job to Generate Messages
Now that all components are set up, trigger the publisher job to send messages to the RabbitMQ queue:
This job will publish 300 messages to the RabbitMQ queue, which will trigger scaling of the consumer deployment (via ScaledObject).
Observe Autoscaling in Action
Monitor the scaling activities:
You should see the number of replicas for the
rabbitmq-consumer
deployment increase as messages are added to the queue, and decrease as messages are processed.Clean Up Resources
When you're done testing, you can clean up the deployed resources:
6. Testing KEDA ScaledJob
Deploy ScaledJob
This ScaledJob creates Kubernetes Jobs to process messages in the RabbitMQ queue in batch mode. It is set to scale to a minimum of 0 jobs when there are no messages in the queue, and up to a maximum of 30 jobs when the queue is heavily loaded. Unlike the ScaledObject which scales a Deployment, ScaledJob creates separate Job instances that process a batch of messages and then terminate. This ScaledJob is configured to process 10 messages per job with a 30-second timeout. These settings can be adjusted in the YAML Specification as needed.
Trigger the Publisher Job to Generate Messages
Now that all components are set up, trigger the publisher job to send messages to the RabbitMQ queue:
This job will publish 300 messages to the RabbitMQ queue, which will trigger the creation of batch processing jobs (via ScaledJob).
Observe Autoscaling in Action
Monitor the scaling activities:
You will see jobs created to process batches of messages based on the ScaledJob configuration.
Clean Up
When you're done testing, you can clean up the deployed resources:
7. Clean Up All The Resources You Deployed
When you're done testing, you can clean up all the deployed resources via:
Phase 1 Implementation Demo:
Screencast.from.2025-03-07.23-02-03.mp4
Screencast.from.2025-03-07.22-54-07.mp4
Screencast.from.2025-03-07.23-03-41.mp4
Screencast.from.2025-03-07.23-04-47.mp4