From 4d39e3eaaddfd501abfa7a9235048930f44158ec Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Thu, 9 May 2024 19:04:25 -0700 Subject: [PATCH] Enable K8sGPT deployment --- README.md | 1 + _chart_installers.sh | 6 ++++++ _uninstallers.sh | 6 ++++++ ci/update_versions.sh | 3 +++ resources/k8sgpt-local.yml | 23 +++++++++++++++++++++++ tests/resources/broken-pod.yaml | 24 ++++++++++++++++++++++++ 6 files changed, 63 insertions(+) create mode 100644 resources/k8sgpt-local.yml create mode 100644 tests/resources/broken-pod.yaml diff --git a/README.md b/README.md index 50a3e180..fa5f5fb3 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ different scenarios. There are different setups located in the | kube-monkey | Netflix's Chaos Monkey for Kubernetes clusters | | Implemented | | Nephio | Management platform to on-board NFs at scale | | Implemented | | LocalAI | Allows to run LLMs locally | | Implemented | +| K8SGPT | Scans K8s clusters for diagnosing issues | | Implemented | ## Quick Deployment diff --git a/_chart_installers.sh b/_chart_installers.sh index 64995359..48d25586 100755 --- a/_chart_installers.sh +++ b/_chart_installers.sh @@ -257,3 +257,9 @@ function install_local-ai { _add_helm_repo go-skynet https://go-skynet.github.io/helm-charts/ KRD_CHART_FILE="helm/local-ai/values.yaml" _install_chart local-ai go-skynet/local-ai } + +# install_k8sgpt() - Install K8sGPT operator +function install_k8sgpt { + _add_helm_repo k8sgpt https://charts.k8sgpt.ai/ + _install_chart k8sgpt-operator k8sgpt/k8sgpt-operator +} diff --git a/_uninstallers.sh b/_uninstallers.sh index 396255d2..761946b6 100755 --- a/_uninstallers.sh +++ b/_uninstallers.sh @@ -177,3 +177,9 @@ function uninstall_local-ai { _uninstall_helm local-ai _delete_namespace local-ai-system } + +# uninstall_k8sgpt() - Uninstall K8sGPT operator +function uninstall_k8sgpt { + _uninstall_helm k8sgpt-operator + _delete_namespace k8sgpt-operator-system +} diff --git a/ci/update_versions.sh b/ci/update_versions.sh index a287b511..48a77349 100755 --- a/ci/update_versions.sh +++ b/ci/update_versions.sh @@ -176,3 +176,6 @@ sed -i "s|image.tag=.*|image.tag=v$(get_version docker_tag rancher/metrics-serve # Update Rook test resources wget -q -O ./tests/resources/rook/toolbox.yaml https://raw.githubusercontent.com/rook/rook/master/deploy/examples/toolbox.yaml wget -q -O ./tests/resources/rook/cluster-test.yaml https://raw.githubusercontent.com/rook/rook/master/deploy/examples/cluster-test.yaml + +# Update K8sGPT resources +sed -i "s/version: .*/version: v$(get_version github_release k8sgpt-ai/k8sgpt)/g" resources/k8sgpt-local.yml diff --git a/resources/k8sgpt-local.yml b/resources/k8sgpt-local.yml new file mode 100644 index 00000000..c5d4d4a5 --- /dev/null +++ b/resources/k8sgpt-local.yml @@ -0,0 +1,23 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2024 +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +apiVersion: core.k8sgpt.ai/v1alpha1 +kind: K8sGPT +metadata: + name: k8sgpt-local + namespace: k8sgpt-operator-system +spec: + ai: + model: gpt-4 + backend: localai + baseUrl: http://local-ai.local-ai-system.svc.cluster.local:8080/v1 + enabled: true + version: v0.3.30 + noCache: false + targetNamespace: default diff --git a/tests/resources/broken-pod.yaml b/tests/resources/broken-pod.yaml new file mode 100644 index 00000000..980332a4 --- /dev/null +++ b/tests/resources/broken-pod.yaml @@ -0,0 +1,24 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2024 +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +apiVersion: v1 +kind: Pod +metadata: + name: broken-pod + namespace: default +spec: + containers: + - name: broken-pod + image: nginx:1.a.b.c + livenessProbe: + httpGet: + path: / + port: 90 + initialDelaySeconds: 3 + periodSeconds: 3