Skip to content

Commit

Permalink
Merge branch 'master' into main-2501-permission-fix-for-prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
itisallgood authored Dec 18, 2024
2 parents 75419a8 + 2cde05c commit c1d7fdf
Show file tree
Hide file tree
Showing 229 changed files with 106,830 additions and 1,795 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ name: Build and test HolmesGPT
on: [push, pull_request, workflow_dispatch]

jobs:
check:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1

build:
needs: check
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/python-poetry/poetry
rev: 1.8.4
hooks:
- id: poetry-check
- id: poetry-lock
pass_filenames: false
args:
- --no-update
132 changes: 132 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
conduct@robusta.dev.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributing

## Before you get started

### Code of Conduct

Please make sure to read and observe our [Code of Conduct](https://github.com/robusta-dev/holmesgpt?tab=coc-ov-file).

### Install requirements
- Python `3.11`
- poetry `1.8.4` & up
- A LLM API key is required to use and test HolmesGPT
- OpenAI's `gpt4-o` is recommended.
- For details see [Getting an API Key](https://github.com/robusta-dev/holmesgpt?tab=readme-ov-file#getting-an-api-key).

## Reporting bugs

We encourage those interested to contribute code and also appreciate when issues are reported.

- Create a new issue and label is as `bug`
- Clearly state how to reproduce the bug:
- Which LLM you've used
- Which steps are required to reproduce
- As LLMs answers may differ between runs - Does it always reproduce, or occasionally?


## Contributing Code

- Fork the repository and clone it locally.
- Create a new branch and make your changes
- Add or update tests to ensure your changes are covered.
- Run `pytest` to verify all tests pass.
- Keep pull requests small and focused. if you have multiple changes, open a PR for each.
- Create a pull request back to the upstream repository.
- Wait for a review and address any comments
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key -o Release.key

# Set the architecture-specific kube lineage URLs
ARG ARM_URL=https://github.com/Avi-Robusta/kube-lineage/releases/download/v2.1/kube-lineage-macos-latest-v2.1
ARG AMD_URL=https://github.com/Avi-Robusta/kube-lineage/releases/download/v2.1/kube-lineage-ubuntu-latest-v2.1
ARG ARM_URL=https://github.com/Avi-Robusta/kube-lineage/releases/download/v2.2.1/kube-lineage-macos-latest-v2.2.1
ARG AMD_URL=https://github.com/Avi-Robusta/kube-lineage/releases/download/v2.2.1/kube-lineage-ubuntu-latest-v2.2.1
# Define a build argument to identify the platform
ARG TARGETPLATFORM
# Conditional download based on the platform
Expand All @@ -41,6 +41,8 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
RUN chmod 777 kube-lineage
RUN ./kube-lineage --version

RUN curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64

# Set up poetry
ARG PRIVATE_PACKAGE_REGISTRY="none"
RUN if [ "${PRIVATE_PACKAGE_REGISTRY}" != "none" ]; then \
Expand Down Expand Up @@ -90,6 +92,10 @@ RUN apt-get install -y kubectl
COPY --from=builder /app/kube-lineage /usr/local/bin
RUN kube-lineage --version

COPY --from=builder /app/argocd-linux-amd64 /usr/local/bin/argocd
RUN chmod 555 /usr/local/bin/argocd
RUN argocd --help

ARG AWS_DEFAULT_PROFILE
ARG AWS_DEFAULT_REGION
ARG AWS_PROFILE
Expand Down
19 changes: 19 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Maintainers

## Current

| Maintainer | GitHub ID |
| --------------------|---------------------------------------------------|
| Natan Yellin | [aantn](https://github.com/aantn) |
| Arik Alon | [arikalon1](https://github.com/arikalon1) |
| Avi Kotlicky | [Avi-Robusta](https://github.com/Avi-Robusta) |
| Dmytro Chievtaiev | [itisallgood](https://github.com/itisallgood) |
| Pavan Gudiwada | [pavangudiwada](https://github.com/pavangudiwada) |
| Nicolas Herment | [nherment](https://github.com/nherment) |
| Tomer Keshet | [Sheeproid](https://github.com/Sheeproid) |
| Roi Glinik | [RoiGlinik](https://github.com/RoiGlinik) |
| Moshe Morad | [moshemorad](https://github.com/moshemorad) |

## Emeritus

N/A
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,15 @@ HolmesGPT can consult webpages containing runbooks or other relevant information
HolmesGPT uses playwright to scrape webpages and requires playwright to be installed and working through `playwright install`.
</details>

<details>
<summary>
ArgoCD
</summary>

Holmes can use the `argocd` CLI to get details about the ArgoCD setup like the apps configuration and status, clusters and projects within ArgoCD.
To enable ArgoCD, set the `ARGOCD_AUTH_TOKEN` environment variable as described in the [argocd documentation](https://argo-cd.readthedocs.io/en/latest/user-guide/commands/argocd_account_generate-token/).
</details>

## More Use Cases

HolmesGPT was designed for incident response, but it is a general DevOps assistant too. Here are some examples:
Expand Down
16 changes: 14 additions & 2 deletions examples/custom_toolset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
toolsets:
# Name of the toolset (for example "mycompany/internal-tools")
# Used for informational purposes only (e.g. to print the name of the toolset if it can't be loaded)
- name: "switch_clusters"

switch_clusters:
# Description of the toolset. Used for display in the UI
description: "Set of tools for switching between kubernetes clusters"
# Documentation URL. Used for display in the UI
docs_url: "https://kubernetes.io/docs/home/"
# Icon URL. Used for display in the UI
icon_url: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRPKA-U9m5BxYQDF1O7atMfj9EMMXEoGu4t0Q&s"
# Tags for categorizing toolsets, 'core' will be used for all Holmes features (both cli's commands and chats in UI).
# The 'cluster' tag is used for UI functionality, while 'cli' is for for command-line specific tools
tags:
- core
# Prerequisites is a list of conditions checked by Holmes before using the toolset
prerequisites:
- command: "kubectl version --client"
# List of tools the LLM can use - this is the important part
tools:
# Name is a unique identifier for the tool
Expand Down
2 changes: 0 additions & 2 deletions helm/holmes/templates/holmes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ spec:
env:
- name: LOG_LEVEL
value: {{ .Values.logLevel }}
- name: ALLOWED_TOOLSETS
value: {{ .Values.allowedToolsets }}
{{ if .Values.certificate -}}
- name: CERTIFICATE
value: {{ .Values.certificate }}
Expand Down
11 changes: 10 additions & 1 deletion helm/holmes/templates/holmesgpt-service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,16 @@ rules:
verbs:
- get
- list

{{- if .Values.openshift }}
- apiGroups:
- apps.openshift.io
resources:
- deploymentconfigs
verbs:
- get
- list
- watch
{{- end }}
# Prometheus CRDs
- apiGroups:
- monitoring.coreos.com
Expand Down
2 changes: 1 addition & 1 deletion helm/holmes/templates/toolset-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if gt (len .Values.toolsets) 0 }}
{{- if .Values.toolsets | not | empty }}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
15 changes: 12 additions & 3 deletions helm/holmes/values.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
certificate: "" # base64 encoded
logLevel: INFO


additionalEnvVars: []
additional_env_vars: []
imagePullSecrets: []

allowedToolsets: "kubernetes/core,findings,internet"

image: holmes:0.0.0
registry: us-central1-docker.pkg.dev/genuine-flight-317411/devel

Expand All @@ -19,14 +18,24 @@ customClusterRoleRules: []

enablePostProcessing: false
postProcessingPrompt: "builtin://generic_post_processing.jinja2"
openshift: false

tolerations: []

serviceAccount:
imagePullSecrets: []
annotations: {}

toolsets: []
toolsets:
kubernetes/core:
enabled: true
kubernetes/logs:
enabled: true
robusta:
enabled: true
internet:
enabled: true


resources:
requests:
Expand Down
4 changes: 2 additions & 2 deletions holmes/common/env_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def load_bool(env_var, default: bool):
return json.loads(s.lower())


ALLOWED_TOOLSETS = os.environ.get('ALLOWED_TOOLSETS', '*')
ENABLED_BY_DEFAULT_TOOLSETS = os.environ.get('ENABLED_BY_DEFAULT_TOOLSETS', 'kubernetes/core,kubernetes/logs,robusta,internet')
HOLMES_HOST = os.environ.get('HOLMES_HOST', '0.0.0.0')
HOLMES_PORT = int(os.environ.get('HOLMES_PORT', 5050))
ROBUSTA_CONFIG_PATH = os.environ.get('ROBUSTA_CONFIG_PATH', "/etc/robusta/config/active_playbooks.yaml")
Expand All @@ -19,4 +19,4 @@ def load_bool(env_var, default: bool):
STORE_PASSWORD = os.environ.get("STORE_PASSWORD", "")
HOLMES_POST_PROCESSING_PROMPT = os.environ.get("HOLMES_POST_PROCESSING_PROMPT", "")
ROBUSTA_AI = load_bool("ROBUSTA_AI", False)
ROBUSTA_API_ENDPOINT = os.environ.get("ROBUSTA_API_ENDPOINT", "https://api.robusta.dev")
ROBUSTA_API_ENDPOINT = os.environ.get("ROBUSTA_API_ENDPOINT", "https://api.robusta.dev")
Loading

0 comments on commit c1d7fdf

Please sign in to comment.