Skip to content

Commit

Permalink
Merge branch 'main' into feat-grafana-map
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Jan 29, 2025
2 parents 391b851 + 8ecd2b3 commit 63de0b2
Show file tree
Hide file tree
Showing 30 changed files with 2,004 additions and 218 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:

- name: Run unit tests and report coverage
env:
LOG_LEVEL: DEBUG
# LOG_LEVEL: DEBUG
SQLALCHEMY_WARN_20: 1
run: |
poetry run coverage run --branch -m pytest --timeout 20 -n auto --non-integration --ignore=tests/e2e_tests/
Expand All @@ -108,8 +108,8 @@ jobs:
poetry run coverage run --branch -m pytest --integration --ignore=tests/e2e_tests/
- name: Convert coverage results to JSON (for CodeCov support)
env:
LOG_LEVEL: DEBUG
# env:
# LOG_LEVEL: DEBUG
run: poetry run coverage json --omit="keep/providers/*"

- name: Upload coverage reports to Codecov
Expand Down
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,57 @@
> Missing a provider? [Submit a new provider request](https://github.com/keephq/keep/issues/new?assignees=&labels=provider&projects=&template=new_provider_request.md&title=) and we'll add it quickly!
### AI Backends for Enrichments, Correlations and Incident Context Gathering

<table>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/anthropic-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/anthropic-icon.png" alt="Anthropic"/><br/>
Anthropic
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/openai-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/openai-icon.png" alt="OpenAI"/><br/>
OpenAI
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/deepseek-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/deepseek-icon.png" alt="DeepSeek"/><br/>
DeepSeek
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/ollama-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/ollama-icon.png" alt="Ollama"/><br/>
Ollama
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/llamacpp-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/llamacpp-icon.png" alt="LlamaCPP"/><br/>
LlamaCPP
</a>
</td>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/grok-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/grok-icon.png" alt="Grok"/><br/>
Grok
</a>
</td>
</tr>
<tr>
<td align="center" width="150">
<a href="https://docs.keephq.dev/providers/documentation/gemini-provider" target="_blank">
<img width="40" src="keep-ui/public/icons/gemini-icon.png" alt="Gemini"/><br/>
Gemini
</a>
</td>
</tr>
</table>

### Observability Tools

<table>
Expand Down
2 changes: 2 additions & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@
"providers/documentation/console-provider",
"providers/documentation/coralogix-provider",
"providers/documentation/datadog-provider",
"providers/documentation/deepseek-provider",
"providers/documentation/discord-provider",
"providers/documentation/dynatrace-provider",
"providers/documentation/eks-provider",
"providers/documentation/elastic-provider",
"providers/documentation/gcpmonitoring-provider",
"providers/documentation/gemini-provider",
Expand Down
39 changes: 39 additions & 0 deletions docs/providers/documentation/deepseek-provider.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "DeepSeek Provider"
description: "The DeepSeek Provider enables integration of DeepSeek's language models into Keep."
---

<Tip>
The DeepSeek Provider supports querying DeepSeek language models for prompt-based
interactions.
</Tip>

## Inputs

The DeepSeek Provider supports the following functions:

- `prompt`: Interact with DeepSeek's models by sending prompts and receiving responses
- `model`: The model to be used, defaults to `deepseek-reasoner`
- `max_tokens`: Limit amount of tokens returned by the model, default 1024
- `system_prompt`: Optional system prompt to guide the model's behavior
- `structured_output_format`: Optional JSON format for the structured output (check examples at the GitHub)

## Outputs

Currently, the DeepSeek Provider outputs the response from the model based on the prompt provided.

## Authentication Parameters

To use the DeepSeek Provider, you'll need an API Key from DeepSeek. The required parameters for authentication are:

- **api_key** (required): Your DeepSeek API Key.

## Connecting with the Provider

To connect to DeepSeek, you'll need to obtain an API Key:

1. Sign up for an account at [DeepSeek](https://platform.deepseek.com)
2. Navigate to your account settings
3. Generate an API key for Keep

Use the generated API key in the `authentication` section of your DeepSeek Provider configuration.
132 changes: 132 additions & 0 deletions docs/providers/documentation/eks-provider.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
title: "EKS Provider"
description: "EKS provider integrates with AWS EKS and let you interatct with kubernetes clusters hosted on EKS."
---

## Inputs
- **command_type** (required): The command type to operate on the k8s cluster:
- `get_pods`: List all pods across namespaces or in a specific namespace
- `get_pvc`: List all persistent volume claims
- `get_node_pressure`: Get node pressure metrics
- `get_deployment`: Get deployment information
- `scale_deployment`: Scale a deployment's replicas
- `exec_command`: Execute a command in a pod
- `restart_pod`: Restart a specific pod
- `get_pod_logs`: Get logs from a pod

### Command-specific Parameters

#### For get_pods, get_pvc
- **namespace** (optional): Target specific namespace. If not provided, queries all namespaces

#### For get_deployment, scale_deployment
- **namespace** (optional): Target namespace (defaults to "default")
- **deployment_name** (required): Name of the deployment
- **replicas** (required for scale_deployment): Number of desired replicas

#### For exec_command
- **namespace** (required): Pod's namespace
- **pod_name** (required): Name of the pod
- **command** (required): Command to execute (string or array)
- **container** (optional): Container name (defaults to first container)
- **use_shell** (optional): Whether to wrap command in shell (defaults to true)

#### For restart_pod
- **namespace** (required): Pod's namespace
- **pod_name** (required): Name of the pod

#### For get_pod_logs
- **namespace** (required): Pod's namespace
- **pod_name** (required): Name of the pod
- **container** (optional): Container name (defaults to first container)
- **tail_lines** (optional): Number of lines to get from the end (defaults to 100)

## Outputs
The Amazon EKS Provider supports the `query` function with different outputs based on command type:
- `get_pods`: Returns list of pod details
- `get_pvc`: Returns list of PVC details
- `get_node_pressure`: Returns node pressure metrics
- `get_deployment`: Returns deployment details
- `scale_deployment`: Returns scaling operation result
- `exec_command`: Returns command output as string
- `restart_pod`: Returns restart operation status
- `get_pod_logs`: Returns pod logs as string

## Authentication Parameters
The Amazon EKS Provider uses AWS credentials to allow you to query your cluster resources. You need to provide the following authentication parameters:

- **access_key** (required): AWS access key ID with EKS permissions
- **secret_access_key** (required): AWS secret access key
- **region** (required): AWS region where the EKS cluster is located (e.g., us-east-1)
- **cluster_name** (required): The name of your EKS cluster

## Connecting with the Provider
To connect to Amazon EKS, follow these steps:

1. Log in to your [AWS Console](https://aws.amazon.com/)

2. Create an IAM user with EKS permissions:
```bash
aws iam create-user --user-name eks-user
```

3. Attach required policies:

```bash
aws iam attach-user-policy --user-name eks-user --policy-arn arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
aws iam attach-user-policy --user-name eks-user --policy-arn arn:aws:iam::aws:policy/AmazonEKSServicePolicy
```

4. Create access keys

```bash
aws iam create-access-key --user-name eks-user
```

You should get:

```
{
"AccessKey": {
"AccessKeyId": "AKIAXXXXXXXXXXXXXXXX",
"SecretAccessKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Status": "Active"
}
}
```

The `AccessKeyId` is your `access_key` and `SecretAccessKey` is your `secret_access_key`.

5. Note your cluster name and region from the EKS console or using:

```bash
aws eks list-clusters --region <your-region>
```

## Required Permissions
The AWS IAM user needs these permissions:

1. eks:DescribeCluster
2. eks:ListClusters

Additional permissions for specific operations:

3. eks:AccessKubernetesApi for pod/deployment operations
4. eks:UpdateCluster for scaling operations

| Command | AWS IAM Permissions |
|---------|-------------------|
| `get_pods` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `get_pvc` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `get_node_pressure` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `get_deployment` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `scale_deployment` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `exec_command` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `restart_pod` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |
| `get_pod_logs` | `eks:DescribeCluster` <br/> `eks:AccessKubernetesApi` |


## Usage Examples

1. Basic - https://github.com/keephq/keep/blob/main/examples/workflows/eks_basic.yml
2. Advanced - https://github.com/keephq/keep/blob/main/examples/workflows/aks_advanced.yml
15 changes: 14 additions & 1 deletion docs/providers/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ By leveraging Keep Providers, users are able to deeply integrate Keep with the t
icon={ <img src="https://img.logo.dev/datadoghq.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>

<Card
title="DeepSeek"
href="/providers/documentation/deepseek-provider"
icon={ <img src="https://img.logo.dev/deepseek.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>

<Card
title="Discord"
href="/providers/documentation/discord-provider"
Expand All @@ -138,6 +144,13 @@ By leveraging Keep Providers, users are able to deeply integrate Keep with the t
icon={ <img src="https://img.logo.dev/dynatrace.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>

<Card
title="EKS"
href="/providers/documentation/eks-provider"
icon={ <img src="https://img.logo.dev/amazon.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>


<Card
title="Elastic"
href="/providers/documentation/elastic-provider"
Expand Down Expand Up @@ -617,4 +630,4 @@ By leveraging Keep Providers, users are able to deeply integrate Keep with the t
href="/providers/documentation/zenduty-provider"
icon={ <img src="https://img.logo.dev/zenduty.com?token=pk_dfXfZBoKQMGDTIgqu7LvYg" /> }
></Card>
</CardGroup>
</CardGroup>
64 changes: 64 additions & 0 deletions examples/workflows/eks_advanced.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
workflow:
id: eks-example-advanced
description: eks-example-advanced
triggers:
- type: manual
steps:
# get all pods
- name: get-pods
provider:
type: eks
config: "{{ providers.eks }}"
with:
command_type: get_pods

# get specific deployment info
- name: get-deployment-info
provider:
type: eks
config: "{{ providers.eks }}"
with:
command_type: get_deployment
namespace: default
deployment_name: nginx-test

# scale up deployment
- name: scale-up
provider:
type: eks
config: "{{ providers.eks }}"
with:
command_type: scale_deployment
namespace: default
deployment_name: nginx-test
replicas: 4

# get pods after scaling
- name: get-pods-after-scale
provider:
type: eks
config: "{{ providers.eks }}"
with:
command_type: get_pods
namespace: default

actions:
- name: echo-all-pods
foreach: "{{ steps.get-pods.results }}"
provider:
type: console
with:
message: "Pod name: {{ foreach.value.metadata.name }} || Namespace: {{ foreach.value.metadata.namespace }} || Status: {{ foreach.value.status.phase }}"

- name: echo-deployment-info
provider:
type: console
with:
message: "Deployment {{ steps.get-deployment-info.results.metadata.name }} has {{ steps.get-deployment-info.results.status.replicas }} replicas"

- name: echo-scaled-pods
foreach: "{{ steps.get-pods-after-scale.results }}"
provider:
type: console
with:
message: "After scaling - Pod name: {{ foreach.value.metadata.name }} || Status: {{ foreach.value.status.phase }}"
20 changes: 20 additions & 0 deletions examples/workflows/eks_basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
workflow:
id: eks-example
description: eks-example
triggers:
- type: manual
steps:
# get all pods
- name: get-pods
provider:
type: eks
config: "{{ providers.eks }}"
with:
command_type: get_pods
actions:
- name: echo-pod-status
foreach: "{{ steps.get-pods.results }}"
provider:
type: console
with:
message: "Pod name: {{ foreach.value.metadata.name }} || Namespace: {{ foreach.value.metadata.namespace }} || Status: {{ foreach.value.status.phase }}"
Loading

0 comments on commit 63de0b2

Please sign in to comment.