https://github.com/ajsalemo/keda-goclient
A REST API that creates KEDA resources and invokes Kubernetes webhooks
https://github.com/ajsalemo/keda-goclient
client-go docker-desktop fiber go go-fiber golang keda kubernetes kubernetes-webhook webhook
Last synced: 19 days ago
JSON representation
A REST API that creates KEDA resources and invokes Kubernetes webhooks
- Host: GitHub
- URL: https://github.com/ajsalemo/keda-goclient
- Owner: Ajsalemo
- Created: 2025-02-16T18:49:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-03T18:11:45.000Z (about 1 year ago)
- Last Synced: 2025-05-03T19:23:25.533Z (about 1 year ago)
- Topics: client-go, docker-desktop, fiber, go, go-fiber, golang, keda, kubernetes, kubernetes-webhook, webhook
- Language: Go
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# keda-goclient
An application functioning as a REST API that does the following:
- Uses `client-go` to interface with Kubernetes. This has been developed in `wsl2` with a local Docker enabled Kubernetes single node cluster
- Acts as a client to create KEDA `ScaledJobs` and `ScaledObjects`. In this repo, it was specifically for creating GitHub Action runners.
- `scaler-kubernetes-webhook` `.yamls` can be deployed to set up both Mutating and Admission Webhooks that will be invoked during KEDA resource creation. The logic currently is that a `metadata.label` of either `scaledjob` or `scaledobject` will be adding during resource creation by the Mutating webhook
----------
Below is the request body structure that some of these endpoints accept. `POST` bodies should follow the same general structure that a Kubernetes or KEDA `.yaml` expects
`POST /api/secret/create`
```json
{
"name": "yoursecret",
"parameter": "personalAccessToken",
"value": "yourPatValue"
}
```
`POST /api/scaledjob/create`
```json
{
"name": "test-keda-scaledjob",
"containers": [
{
"name": "github-runner",
"image": "self-hosted-github-action-runner:local",
"imagePullPolicy": "IfNotPresent",
"env": [
{
"name": "GITHUB_PAT",
"value": "github_pat_xxx"
},
{
"name": "REPO_OWNER",
"value": "YourUser"
},
{
"name": "REPO_NAME",
"value": "yourrepo"
},
{
"name": "REPO_URL",
"value": "https://github.com/YourUser/yourrepo"
},
{
"name": "REGISTRATION_TOKEN_API_URL",
"value": "https://api.github.com/repos/YourUser/yourrepo/actions/runners/registration-token"
}
]
}
],
"triggers": [
{
"type": "github-runner",
"metadata": {
"ownerFromEnv": "REPO_OWNER",
"runnerScope": "repo",
"repoFromEnv": "REPO_NAME",
"targetWorkflowQueueLength": "1"
},
"authenticationRef": {
"name": "yoursecret"
}
}
]
}
```
`POST /api/scaledobject/create`
```json
{
"name": "yourdeployment",
"triggers": [
{
"type": "github-runner",
"metadata": {
"ownerFromEnv": "REPO_OWNER",
"runnerScope": "repo",
"repoFromEnv": "REPO_NAME",
"targetWorkflowQueueLength": "1"
},
"authenticationRef": {
"name": "yoursecret"
}
}
]
}
```
`POST /api/deployment/create`
```json
{
"name": "githubrunner-deployment",
"replicas": 1,
"containers": [
{
"name": "github-runner",
"image": "self-hosted-github-action-runner:local",
"imagePullPolicy": "IfNotPresent",
"env": [
{
"name": "GITHUB_PAT",
"value": "github_pat_xxx"
},
{
"name": "REPO_OWNER",
"value": "YourUser"
},
{
"name": "REPO_NAME",
"value": "self-hosted-github-action-runner"
},
{
"name": "REPO_URL",
"value": "https://github.com/YourUser/yourrepo"
},
{
"name": "REGISTRATION_TOKEN_API_URL",
"value": "https://api.github.com/repos/YourUser/yourrepo/actions/runners/registration-token"
}
]
}
]
}
```
`DELETE /api/scaledjob/delete/:scaledJobName`
```json
DELETE https://localhost:31323/api/scaledjob/delete/yourscaledjob
```
`DELETE /api/scaledjob/delete/:scaledJobName`
```json
DELETE https://localhost:31323/api/scaledobject/delete/yourscaledobject
```