Compare commits

...

66 Commits

Author SHA1 Message Date
AlexsJones
3cc397efe7 updated contribution guide
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-23 16:30:51 +00:00
Alex Jones
866ee9f15e Merge pull request #44 from k8sgpt-ai/chore/logo-update
chore: adjusted logo to change based on background
2023-03-23 14:50:56 +00:00
AlexsJones
bb5c9fc2de adjusted logo to change based on background
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-23 14:49:04 +00:00
AlexsJones
b7f06ff0a8 adjusted logo to change based on background
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-23 14:48:36 +00:00
AlexsJones
e29f0df68f adjusted logo to change based on background
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-23 14:44:11 +00:00
Thomas Schuetz
52769b4198 Merge pull request #41 from k8sgpt-ai/renovate/pin-dependencies 2023-03-23 14:01:23 +01:00
Thomas Schuetz
e42cc42ded Merge pull request #40 from k8sgpt-ai/release-please--branches--main 2023-03-23 13:31:55 +01:00
renovate[bot]
f6072f56cb chore(deps): pin dependencies 2023-03-23 12:31:05 +00:00
github-actions[bot]
53c994725e chore(main): release 0.0.3 2023-03-23 12:30:42 +00:00
Thomas Schuetz
4840aa081e chore: release 0.0.3
Release-As: 0.0.3
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-23 13:30:07 +01:00
Thomas Schuetz
c9962a98a6 Merge pull request #39 from k8sgpt-ai/release-please--branches--main 2023-03-23 13:27:08 +01:00
github-actions[bot]
f5d86092f4 chore(main): release 0.0.3 2023-03-23 12:26:43 +00:00
Thomas Schuetz
de027955ea chore: release 0.0.3
Release-As: 0.0.3
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-23 13:25:55 +01:00
Thomas Schuetz
a927c32def chore: release 0.0.3
Release-As: 0.0.3
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-23 13:21:32 +01:00
Thomas Schuetz
0c05e4d934 Merge pull request #37 from k8sgpt-ai/fix/container_build
ci: fix permissions, add container to release
2023-03-23 13:18:22 +01:00
Thomas Schuetz
ca60841a2d ci: fix permissions, add container to release
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-23 13:17:09 +01:00
Thomas Schuetz
0ea7c52d72 Merge pull request #31 from k8sgpt-ai/release-please--branches--main 2023-03-23 12:56:55 +01:00
github-actions[bot]
22873a6716 chore(main): release 0.0.3 2023-03-23 11:31:47 +00:00
Thomas Schuetz
e05b90eba9 Merge pull request #32 from k8sgpt-ai/feat/rs_fail
feat: detect replicaset errors
2023-03-23 12:31:24 +01:00
Thomas Schuetz
b2007b8b14 Merge pull request #36 from k8sgpt-ai/fix/container_build
fix: add permissions to read repository
2023-03-23 12:04:55 +01:00
Thomas Schuetz
d6cc4cfcbf fix: add permissions to read repository
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-23 12:04:19 +01:00
Thomas Schuetz
8e6b9886ea Merge branch 'main' of github.com:k8sgpt-ai/k8sgpt into feat/rs_fail 2023-03-23 11:56:26 +01:00
Thomas Schuetz
950be6aef3 Merge pull request #34 from k8sgpt-ai/chore/copy-readme 2023-03-23 11:19:22 +01:00
AlexsJones
10b290e4e3 updated readme copy
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-23 09:27:06 +00:00
Thomas Schuetz
e029678cbe Merge pull request #28 from k8sgpt-ai/feature/oomkill 2023-03-23 09:39:55 +01:00
Thomas Schuetz
8ac56e062b feat: find replicaset errors
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 19:05:04 +01:00
Thomas Schuetz
2452b0d506 Merge pull request #30 from k8sgpt-ai/renovate/pin-dependencies
chore(deps): pin dependencies
2023-03-22 16:55:24 +01:00
renovate[bot]
5b360de2ae chore(deps): pin dependencies 2023-03-22 15:47:28 +00:00
Thomas Schuetz
c7d81bfdb8 Merge pull request #29 from k8sgpt-ai/chore/container_build
feat: build container
2023-03-22 16:47:07 +01:00
Thomas Schuetz
ef17b845ba fix: minor adaptions
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 16:36:24 +01:00
Thomas Schuetz
115276e01a fix: container naming
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 16:31:16 +01:00
Thomas Schuetz
1fbed3e44f fix: build
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 16:29:38 +01:00
Thomas Schuetz
260640f865 feat: build container
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 16:24:46 +01:00
AlexsJones
ca534b337a updated the guard on the event
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 15:17:59 +00:00
AlexsJones
f873cf317f reads the event stream to correlate against OOMKill events
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 15:13:34 +00:00
Thomas Schuetz
a05b570a59 Merge pull request #26 from k8sgpt-ai/chore/release_please
fix: release please config
2023-03-22 16:05:00 +01:00
Thomas Schuetz
c402c7bab7 fix: release please config
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 15:46:25 +01:00
Alex Jones
bbc3f00ca0 Merge pull request #25 from k8sgpt-ai/chore/release_please
chore: add release-please
2023-03-22 14:44:14 +00:00
Thomas Schuetz
6f18959e88 Merge pull request #24 from k8sgpt-ai/renovate/github.com-sashabaranov-go-openai-1.x
fix(deps): update module github.com/sashabaranov/go-openai to v1.5.6
2023-03-22 15:43:29 +01:00
Thomas Schuetz
da7b40978d chore: add release-please
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 15:38:40 +01:00
renovate[bot]
37a1d3f47e fix(deps): update module github.com/sashabaranov/go-openai to v1.5.6 2023-03-22 14:21:30 +00:00
Alex Jones
35c8deee8b Merge pull request #23 from k8sgpt-ai/feature/optimisation-caching
feat: adding performance optimisation through local caching
2023-03-22 11:53:12 +00:00
Alex Jones
05d2aef48a Merge pull request #19 from k8sgpt-ai/chore/pr_template
chore: add pull request template
2023-03-22 11:24:47 +00:00
AlexsJones
e4f138dc00 adding performance optimisation through local caching
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 11:19:26 +00:00
Alex Jones
917380435f Merge pull request #21 from k8sgpt-ai/chore/copy-readme
chore: updated copy
2023-03-22 10:40:58 +00:00
AlexsJones
5d956e209f updated copy
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 10:40:38 +00:00
Alex Jones
f62a944941 Merge pull request #20 from k8sgpt-ai/chore/readme-copy
chore:updated readme
2023-03-22 10:27:09 +00:00
AlexsJones
935c4d2c15 updated readme copy
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 10:26:30 +00:00
Thomas Schuetz
a6d5132b8c chore: add pull request template
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 10:58:17 +01:00
Alex Jones
b68895a7f1 Merge pull request #8 from k8sgpt-ai/renovate/github.com-sashabaranov-go-openai-1.x
fix(deps): update module github.com/sashabaranov/go-openai to v1.5.5
2023-03-22 09:40:31 +00:00
Alex Jones
3bd226fc3d Merge pull request #7 from k8sgpt-ai/renovate/pin-dependencies
chore(deps): pin dependencies
2023-03-22 09:40:09 +00:00
Alex Jones
0c8cbbbf1d Merge pull request #6 from k8sgpt-ai/doc/add_slack_info
doc: add slack information
2023-03-22 09:39:44 +00:00
Alex Jones
d08831278e Merge pull request #17 from k8sgpt-ai/chore/tidying
chore: tidying up packages
2023-03-22 09:39:21 +00:00
AlexsJones
9409998884 merged main
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 09:38:45 +00:00
renovate[bot]
105fe44680 fix(deps): update module github.com/sashabaranov/go-openai to v1.5.5 2023-03-22 07:26:55 +00:00
renovate[bot]
7fea7d14a5 chore(deps): pin dependencies 2023-03-22 07:26:36 +00:00
Thomas Schuetz
7c0bdab60e doc: add slack information
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 08:19:07 +01:00
Alex Jones
6d8b2fe39d Merge pull request #4 from k8sgpt-ai/chore/renaming
chore: change module repository references
2023-03-22 06:52:51 +00:00
Alex Jones
6934e9c5fa Merge pull request #5 from k8sgpt-ai/chore/renovate
chore: add initial renovate config
2023-03-22 06:52:27 +00:00
Thomas Schuetz
e37dbc7909 chore: add initial renovate config
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 07:44:38 +01:00
Thomas Schuetz
a307c132b3 chore: change module repo
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 07:40:21 +01:00
Alex Jones
54d8d1cea1 Update README.md 2023-03-21 22:05:34 +00:00
Alex Jones
dce276e509 Rename CONTRIBUTING to CONTRIBUTING.md 2023-03-21 22:05:01 +00:00
Alex Jones
7532fd26c2 Create CONTRIBUTING 2023-03-21 22:04:45 +00:00
Alex Jones
6733680a94 Update LICENSE 2023-03-21 22:01:53 +00:00
AlexsJones
8be2ba763e updated workflows
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-21 21:47:20 +00:00
27 changed files with 783 additions and 135 deletions

21
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,21 @@
<!--
Thanks for creating this pull request 🤗
Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one.
-->
<!-- If this pull request closes an issue, please mention the issue number below -->
Closes # <!-- Issue # here -->
## 📑 Description
<!-- Add a brief description of the pr -->
## ✅ Checks
<!-- Make sure your pr passes the CI checks and do check the following fields as needed - -->
- [ ] My pull request adheres to the code style of this project
- [ ] My code requires changes to the documentation
- [ ] I have updated the documentation as required
- [ ] All the tests have passed
## Additional Information
<!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behavior, etc. -->

147
.github/workflows/build_container.yaml vendored Normal file
View File

@@ -0,0 +1,147 @@
name: Build container
on:
push:
branches:
- 'main'
- '[0-9]+.[1-9][0-9]*.x'
pull_request:
branches:
- 'main'
- '[0-9]+.[1-9][0-9]*.x'
paths-ignore:
- "**.md"
env:
GO_VERSION: "~1.20"
IMAGE_NAME: "k8sgpt"
defaults:
run:
shell: bash
jobs:
prepare_ci_run:
name: Prepare CI Run
runs-on: ubuntu-22.04
outputs:
GIT_SHA: ${{ steps.extract_branch.outputs.GIT_SHA }}
BRANCH: ${{ steps.extract_branch.outputs.BRANCH }}
BRANCH_SLUG: ${{ steps.extract_branch.outputs.BRANCH_SLUG }}
DATETIME: ${{ steps.get_datetime.outputs.DATETIME }}
BUILD_TIME: ${{ steps.get_datetime.outputs.BUILD_TIME }}
NON_FORKED_AND_NON_ROBOT_RUN: ${{ steps.get_run_type.outputs.NON_FORKED_AND_NON_ROBOT_RUN }}
steps:
- name: Check out code
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: Extract branch name
id: extract_branch
uses: keptn/gh-action-extract-branch-name@main
- name: Get current date and time
id: get_datetime
run: |
DATETIME=$(date +'%Y%m%d%H%M')
BUILD_TIME=$(date -u "+%F_%T")
echo "DATETIME=$DATETIME" >> "$GITHUB_OUTPUT"
echo "BUILD_TIME=$BUILD_TIME" >> "$GITHUB_OUTPUT"
- name: Get workflow run type
id: get_run_type
run: |
NON_FORKED_AND_NON_ROBOT_RUN=${{ ( github.actor != 'renovate[bot]' && github.actor != 'dependabot[bot]' ) && ( github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository ) }}
echo "github.actor != 'renovate[bot]' = ${{ github.actor != 'renovate[bot]' }}"
echo "github.actor != 'dependabot[bot]' = ${{ github.actor != 'dependabot[bot]' }}"
echo "github.event_name == 'push' = ${{ github.event_name == 'push' }}"
echo "github.event.pull_request.head.repo.full_name == github.repository = ${{ github.event.pull_request.head.repo.full_name == github.repository }}"
echo "NON_FORKED_AND_NON_ROBOT_RUN = $NON_FORKED_AND_NON_ROBOT_RUN"
echo "NON_FORKED_AND_NON_ROBOT_RUN=$NON_FORKED_AND_NON_ROBOT_RUN" >> "$GITHUB_OUTPUT"
build_image:
name: Build Container Image
needs: prepare_ci_run
runs-on: ubuntu-22.04
env:
BRANCH: ${{ needs.prepare_ci_run.outputs.BRANCH }}
DATETIME: ${{ needs.prepare_ci_run.outputs.DATETIME }}
BUILD_TIME: ${{ needs.prepare_ci_run.outputs.BUILD_TIME }}
GIT_SHA: ${{ needs.prepare_ci_run.outputs.GIT_SHA }}
RELEASE_REGISTRY: "localhost:5000/k8sgpt"
steps:
- name: Check out code
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2
- name: Build Docker Image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4
with:
context: .
platforms: linux/amd64
file: ./container/Dockerfile
target: production
tags: |
${{ env.RELEASE_REGISTRY }}/${{ env.IMAGE_NAME }}:dev-${{ env.DATETIME }}
build-args: |
GIT_HASH=${{ env.GIT_SHA }}
RELEASE_VERSION=dev-${{ env.DATETIME }}
BUILD_TIME=${{ env.BUILD_TIME }}
builder: ${{ steps.buildx.outputs.name }}
push: false
cache-from: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
outputs: type=docker,dest=/tmp/${{ env.IMAGE_NAME }}-image.tar
- name: Upload image as artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3
with:
name: ${{ env.IMAGE_NAME }}-image.tar
path: /tmp/${{ env.IMAGE_NAME }}-image.tar
upload_images:
name: Upload images to ghcr registry
needs: [ prepare_ci_run, build_image ]
if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true' # only run on push to main/maintenance branches
runs-on: ubuntu-22.04
env:
DATETIME: ${{ needs.prepare_ci_run.outputs.DATETIME }}
BUILD_TIME: ${{ needs.prepare_ci_run.outputs.BUILD_TIME }}
GIT_SHA: ${{ needs.prepare_ci_run.outputs.GIT_SHA }}
permissions:
packages: write # Needed for pushing images to the registry
contents: read # Needed for checking out the repository
steps:
- name: Check out code
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2
- name: Build Docker Image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4
with:
context: .
file: ./container/Dockerfile
platforms: linux/amd64,linux/arm64
target: production
tags: |
ghcr.io/k8sgpt-ai/${{ env.IMAGE_NAME }}:dev-${{ env.DATETIME }}
build-args: |
GIT_HASH=${{ env.GIT_SHA }}
RELEASE_VERSION=dev-${{ env.DATETIME }}
BUILD_TIME=${{ env.BUILD_TIME }}
builder: ${{ steps.buildx.outputs.name }}
push: true
cache-from: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}

View File

@@ -3,33 +3,113 @@ name: release
on:
push:
branches:
- feature/gh-actions
tags:
- '*'
permissions:
contents: write
- main
- '[0-9]+.[0-9]+.x'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
release-please:
permissions:
contents: write # for google-github-actions/release-please-action to create release commit
pull-requests: write # for google-github-actions/release-please-action to create release PR
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
# Release-please creates a PR that tracks all changes
steps:
- name: Checkout
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- uses: google-github-actions/release-please-action@e0b9d1885d92e9a93d5ce8656de60e3b806e542c # v3
id: release
with:
command: manifest
token: ${{secrets.GITHUB_TOKEN}}
default-branch: main
goreleaser:
if: needs.release-please.outputs.releases_created == 'true'
permissions:
contents: write
needs:
- release-please
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4
with:
go-version: '1.20'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --snapshot
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-container:
if: needs.release-please.outputs.releases_created == 'true'
needs:
- release-please
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
id-token: write
env:
IMAGE_TAG: ghcr.io/k8sgpt-ai/k8sgpt:${{ needs.release-please.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
with:
submodules: recursive
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2
- name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4
with:
context: .
file: ./container/Dockerfile
platforms: linux/amd64,linux/arm64
target: production
tags: |
${{ env.IMAGE_TAG }}
builder: ${{ steps.buildx.outputs.name }}
push: true
cache-from: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
cache-to: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_NAME }}
- name: Generate SBOM
uses: anchore/sbom-action@448520c4f19577ffce70a8317e619089054687e3 # v0.13.4
with:
image: ${{ env.IMAGE_TAG }}
artifact-name: sbom-${{ env.IMAGE_NAME }}
output-file: ./sbom-${{ env.IMAGE_NAME }}.spdx.json
- name: Attach SBOM to release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
files: ./sbom-${{ env.IMAGE_NAME }}.spdx.json

View File

@@ -28,16 +28,15 @@ archives:
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
skip: true
# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.

View File

@@ -0,0 +1 @@
{".":"0.0.3"}

67
CHANGELOG.md Normal file
View File

@@ -0,0 +1,67 @@
# Changelog
## [0.0.3](https://github.com/k8sgpt-ai/k8sgpt/compare/v0.0.3...v0.0.3) (2023-03-23)
### Features
* build container ([260640f](https://github.com/k8sgpt-ai/k8sgpt/commit/260640f865baefba8ac256f800d4992f25ca15fd))
* find replicaset errors ([8ac56e0](https://github.com/k8sgpt-ai/k8sgpt/commit/8ac56e062baef2a0cf7c7ce2b4c97753f079f157))
### Bug Fixes
* add permissions to read repository ([d6cc4cf](https://github.com/k8sgpt-ai/k8sgpt/commit/d6cc4cfcbffbf84f27c7e4e4159da1e42dd5d689))
* build ([1fbed3e](https://github.com/k8sgpt-ai/k8sgpt/commit/1fbed3e44ff790fccfef502ddafae92e34629c21))
* container naming ([115276e](https://github.com/k8sgpt-ai/k8sgpt/commit/115276e01a38fc1692d6b66ab56a33f1e1793974))
* **deps:** update module github.com/sashabaranov/go-openai to v1.5.5 ([105fe44](https://github.com/k8sgpt-ai/k8sgpt/commit/105fe44680e5a987d4a65ff9c58b5b2211808c5e))
* **deps:** update module github.com/sashabaranov/go-openai to v1.5.6 ([37a1d3f](https://github.com/k8sgpt-ai/k8sgpt/commit/37a1d3f47e07caddb168f228627973870a9d867e))
* minor adaptions ([ef17b84](https://github.com/k8sgpt-ai/k8sgpt/commit/ef17b845ba3c65c16ed5dcc417e3e3d3d40dd04e))
* release please config ([c402c7b](https://github.com/k8sgpt-ai/k8sgpt/commit/c402c7bab7baababbbc7c82965d8337de7d50d35))
### Other
* add initial renovate config ([e37dbc7](https://github.com/k8sgpt-ai/k8sgpt/commit/e37dbc7909f1c520c4c6660c25b45de5847ea581))
* add pull request template ([a6d5132](https://github.com/k8sgpt-ai/k8sgpt/commit/a6d5132b8c2ff077680e2edfd8361a93008197fd))
* add release-please ([da7b409](https://github.com/k8sgpt-ai/k8sgpt/commit/da7b40978d55a6afed4c3a1ca83a756238feaca8))
* change module repo ([a307c13](https://github.com/k8sgpt-ai/k8sgpt/commit/a307c132b3464ff2e949c8a5588e01d344de91a0))
* **deps:** pin dependencies ([5b360de](https://github.com/k8sgpt-ai/k8sgpt/commit/5b360de2ae6094cf850a4ae973a22855c21a9040))
* **deps:** pin dependencies ([7fea7d1](https://github.com/k8sgpt-ai/k8sgpt/commit/7fea7d14a572fe0fd05f5f241b98e93655fb1965))
* **main:** release 0.0.3 ([f5d8609](https://github.com/k8sgpt-ai/k8sgpt/commit/f5d86092f49faef8d71cb950986d76c3f92daf46))
* **main:** release 0.0.3 ([22873a6](https://github.com/k8sgpt-ai/k8sgpt/commit/22873a67163e58484d2a0ad343b4ba3c83e51d8f))
* release 0.0.3 ([4840aa0](https://github.com/k8sgpt-ai/k8sgpt/commit/4840aa081e3aa4a7a01fd3fd5f837fa6f0c3c02c))
* release 0.0.3 ([de02795](https://github.com/k8sgpt-ai/k8sgpt/commit/de027955ea18a751c5f991e7ff0f60b90ae704b0))
* release 0.0.3 ([a927c32](https://github.com/k8sgpt-ai/k8sgpt/commit/a927c32def806bb8b99e1cfcd4ee3dcdeca6ae5d))
## [0.0.3](https://github.com/k8sgpt-ai/k8sgpt/compare/v0.0.3...v0.0.3) (2023-03-23)
### Other
* release 0.0.3 ([de02795](https://github.com/k8sgpt-ai/k8sgpt/commit/de027955ea18a751c5f991e7ff0f60b90ae704b0))
* release 0.0.3 ([a927c32](https://github.com/k8sgpt-ai/k8sgpt/commit/a927c32def806bb8b99e1cfcd4ee3dcdeca6ae5d))
## [0.0.3](https://github.com/k8sgpt-ai/k8sgpt/compare/v0.0.2...v0.0.3) (2023-03-23)
### Features
* build container ([260640f](https://github.com/k8sgpt-ai/k8sgpt/commit/260640f865baefba8ac256f800d4992f25ca15fd))
* find replicaset errors ([8ac56e0](https://github.com/k8sgpt-ai/k8sgpt/commit/8ac56e062baef2a0cf7c7ce2b4c97753f079f157))
### Bug Fixes
* add permissions to read repository ([d6cc4cf](https://github.com/k8sgpt-ai/k8sgpt/commit/d6cc4cfcbffbf84f27c7e4e4159da1e42dd5d689))
* build ([1fbed3e](https://github.com/k8sgpt-ai/k8sgpt/commit/1fbed3e44ff790fccfef502ddafae92e34629c21))
* container naming ([115276e](https://github.com/k8sgpt-ai/k8sgpt/commit/115276e01a38fc1692d6b66ab56a33f1e1793974))
* **deps:** update module github.com/sashabaranov/go-openai to v1.5.6 ([37a1d3f](https://github.com/k8sgpt-ai/k8sgpt/commit/37a1d3f47e07caddb168f228627973870a9d867e))
* minor adaptions ([ef17b84](https://github.com/k8sgpt-ai/k8sgpt/commit/ef17b845ba3c65c16ed5dcc417e3e3d3d40dd04e))
* release please config ([c402c7b](https://github.com/k8sgpt-ai/k8sgpt/commit/c402c7bab7baababbbc7c82965d8337de7d50d35))
### Other
* add release-please ([da7b409](https://github.com/k8sgpt-ai/k8sgpt/commit/da7b40978d55a6afed4c3a1ca83a756238feaca8))
* **deps:** pin dependencies ([5b360de](https://github.com/k8sgpt-ai/k8sgpt/commit/5b360de2ae6094cf850a4ae973a22855c21a9040))

21
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,21 @@
# Contributing
## Getting Started
If you would like to contribute you to the project, please follow the steps below.
1. Introduce yourself on slack or open an issue to let us know you are interested in contributing.
2. Fork the project and clone it locally.
3. Create a branch and follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines for work undertaken.
4. Pull request your changes back to the upstream repository and follow follow the [pull request template](.github/pull_request_template.md) guidelines.
## Release process with release-please
This project uses [release-please](https://github.com/googleapis/release-please) to automate the release process. The release process is triggered by a GitHub Action that runs on a schedule. The schedule is defined in the [release-please.yml](.github/workflows/release.yml) file.
The release process will create a new release and tag on the repository. It will also create a pull request to update the [CHANGELOG.md](CHANGELOG.md) file. The pull request will need to be merged before the next release is created.
## Requirements
- Golang `1.20`

21
LICENSE
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Alex Jones
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,56 +1,34 @@
<img src="images/logo.png" width="100px;" />
# k8sgpt
<br />
AI Powered Kubernetes debugging for SRE, Platform and DevOps teams.
<br />
<img src="images/demo.gif" width=800px; />
## What is k8sgpt?
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./images/logo-white.png" width="100px;">
<img alt="Text changing depending on mode. Light: 'So light!' Dark: 'So dark!'" src="./images/logo-black.png" width="100px;">
</picture>
`k8sgpt` is a tool for scanning your kubernetes clusters, diagnosing and triaging issues in simple english.
It reduces the mystery of kubernetes and makes it easy to understand what is going on in your cluster.
It has SRE experience codified into it's analyzers and helps to pull out the most relevent information to enrich it with AI.
<img src="images/demo2.gif" width=650px; />
## Usage
```
# Ensure KUBECONFIG env is set to an active Kubernetes cluster
k8sgpt auth key <Your OpenAI key>
k8sgpt find problems --explain
```
### What about kubectl-ai?
The the kubectl-ai [project](https://github.com/sozercan/kubectl-ai) uses AI to create manifests and apply them to the cluster. It is not what we are trying to do here, it is focusing on writing YAML manifests.
K8sgpt is focused on triaging and diagnosing issues in your cluster. It is a tool for SRE, Platform & DevOps engineers to help them understand what is going on in their cluster. Cutting through the noise of logs and multiple tools to find the root cause of an issue.
### Configuration
`k8sgpt` stores config data in `~/.k8sgpt` the data is stored in plain text, including your OpenAI key.
### Example
```
k8sgpt find problems --explain
default/deathstar-5b559d699b-d4jm7: Back-off pulling image "docker.io/cilium/starwaraaes"
The Kubernetes error message: Back-off pulling image "docker.io/cilium/starwaraaes" means that the Kubernetes cluster is having trouble pulling the specified container image from the Docker registry.
To solve this issue, you can try the following:
1. Check if the specified image exists in the Docker registry by running the following command:
`docker pull docker.io/cilium/starwaraaes`
2. If the image exists, try pulling the image manually on the node where the container is trying to run. This can be done by running the following command:
`docker pull docker.io/cilium/starwaraaes`
3. If the image is not found in the Docker registry, check if the image name and tag are correct.
4. If the issue persists, check the Docker engine logs for any error messages that might provide more context on the issue.
placed-application-demo/placed-application-demo-58469d688c-7wdps: 0/5 nodes are available: 5 node(s) were unschedulable. preemption: 0/5 nodes are available: 5 Preemption is not helpful for scheduling..
```
### Community
* Find us on [Slack](https://cloud-native.slack.com/channels/k8sgpt-ai)

View File

@@ -7,10 +7,10 @@ import (
"context"
"os"
"github.com/cloud-native-skunkworks/k8sgpt/pkg/analyzer"
"github.com/cloud-native-skunkworks/k8sgpt/pkg/client"
"github.com/cloud-native-skunkworks/k8sgpt/pkg/openai"
"github.com/fatih/color"
"github.com/k8sgpt-ai/k8sgpt/pkg/ai"
"github.com/k8sgpt-ai/k8sgpt/pkg/analyzer"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@@ -26,7 +26,7 @@ var problemsCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// Initialise the openAI client
openAIClient, err := openai.NewClient()
openAIClient, err := ai.NewClient()
if err != nil {
color.Red("Error: %v", err)
os.Exit(1)
@@ -34,9 +34,12 @@ var problemsCmd = &cobra.Command{
ctx := context.Background()
// Get kubernetes client from viper
client := viper.Get("kubernetesClient").(*client.Client)
client := viper.Get("kubernetesClient").(*kubernetes.Client)
analyzer.RunAnalysis(ctx, client, openAIClient, explain)
if err := analyzer.RunAnalysis(ctx, client, openAIClient, explain); err != nil {
color.Red("Error: %v", err)
os.Exit(1)
}
},
}

View File

@@ -6,10 +6,10 @@ package cmd
import (
"os"
"github.com/cloud-native-skunkworks/k8sgpt/cmd/auth"
"github.com/cloud-native-skunkworks/k8sgpt/cmd/find"
"github.com/cloud-native-skunkworks/k8sgpt/pkg/client"
"github.com/fatih/color"
"github.com/k8sgpt-ai/k8sgpt/cmd/auth"
"github.com/k8sgpt-ai/k8sgpt/cmd/find"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@@ -56,7 +56,7 @@ func init() {
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
//Initialise the kubeconfig
kubernetesClient, err := client.NewClient(masterURL, kubeconfig)
kubernetesClient, err := kubernetes.NewClient(masterURL, kubeconfig)
if err != nil {
color.Red("Error initialising kubernetes client: %v", err)
}

26
container/Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
FROM golang:1.20.2-alpine3.16 AS builder
ENV CGO_ENABLED=0
WORKDIR /workspace
COPY go.mod go.sum ./
RUN go mod download
COPY ./ ./
RUN go build -o /workspace/k8sgpt ./
FROM gcr.io/distroless/static AS production
LABEL org.opencontainers.image.source="https://github.com/k8sgpt-ai/k8sgpt" \
org.opencontainers.image.url="https://k8sgpt.ai" \
org.opencontainers.image.title="k8sgpt" \
org.opencontainers.image.vendor="the k8sgpt-ai maintainers" \
org.opencontainers.image.licenses="MIT"
WORKDIR /
COPY --from=builder /workspace/k8sgpt .
USER 65532:65532
ENTRYPOINT ["/k8sgpt"]

4
go.mod
View File

@@ -1,11 +1,11 @@
module github.com/cloud-native-skunkworks/k8sgpt
module github.com/k8sgpt-ai/k8sgpt
go 1.20
require (
github.com/briandowns/spinner v1.23.0
github.com/fatih/color v1.15.0
github.com/sashabaranov/go-openai v1.5.4
github.com/sashabaranov/go-openai v1.5.6
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.15.0
golang.org/x/term v0.6.0

4
go.sum
View File

@@ -210,6 +210,10 @@ github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBO
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sashabaranov/go-openai v1.5.4 h1:I2K7JMIx/EC/mwT2fbypBzJ3OtwKNxaFg4jf3KOvXuc=
github.com/sashabaranov/go-openai v1.5.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sashabaranov/go-openai v1.5.5 h1:VYdzEGVk4zV04ZNqNb1DT8w7JCzWM77h3h6pBH27B1k=
github.com/sashabaranov/go-openai v1.5.5/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sashabaranov/go-openai v1.5.6 h1:i/DI9y1kzlPqKA0KeTYezJJSy01sqpOdUIm2BV7vgtA=
github.com/sashabaranov/go-openai v1.5.6/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=

BIN
images/demo2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

BIN
images/logo-black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

BIN
images/logo-white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 KiB

View File

@@ -3,7 +3,7 @@ Copyright © 2023 NAME HERE <EMAIL ADDRESS>
*/
package main
import "github.com/cloud-native-skunkworks/k8sgpt/cmd"
import "github.com/k8sgpt-ai/k8sgpt/cmd"
func main() {
cmd.Execute()

View File

@@ -1,4 +1,4 @@
package openai
package ai
import (
"context"

View File

@@ -2,71 +2,19 @@ package analyzer
import (
"context"
"fmt"
"os"
"strings"
"time"
"github.com/briandowns/spinner"
"github.com/cloud-native-skunkworks/k8sgpt/pkg/client"
ai "github.com/cloud-native-skunkworks/k8sgpt/pkg/openai"
"github.com/fatih/color"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/k8sgpt-ai/k8sgpt/pkg/ai"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
)
func RunAnalysis(ctx context.Context, client *client.Client, openAIClient *ai.Client, explain bool) {
// search all namespaces for pods that are not running
list, err := client.GetClient().CoreV1().Pods("").List(ctx, metav1.ListOptions{})
func RunAnalysis(ctx context.Context, client *kubernetes.Client, aiClient *ai.Client, explain bool) error {
err := AnalyzePod(ctx, client, aiClient, explain)
if err != nil {
color.Red("Error: %v", err)
os.Exit(1)
return err
}
var brokenPods = map[string][]string{}
for _, pod := range list.Items {
// Check for pending pods
if pod.Status.Phase == "Pending" {
// Check through container status to check for crashes
for _, containerStatus := range pod.Status.Conditions {
if containerStatus.Type == "PodScheduled" && containerStatus.Reason == "Unschedulable" {
brokenPods[fmt.Sprintf("%s/%s", pod.Namespace, pod.Name)] = []string{containerStatus.Message}
}
}
}
// Check through container status to check for crashes
var failureDetails = []string{}
for _, containerStatus := range pod.Status.ContainerStatuses {
if containerStatus.State.Waiting != nil {
if containerStatus.State.Waiting.Reason == "CrashLoopBackOff" || containerStatus.State.Waiting.Reason == "ImagePullBackOff" {
failureDetails = append(failureDetails, containerStatus.State.Waiting.Message)
brokenPods[fmt.Sprintf("%s/%s", pod.Namespace, pod.Name)] = failureDetails
}
}
}
}
for key, value := range brokenPods {
fmt.Printf("%s: %s\n", color.YellowString(key), color.RedString(value[0]))
if explain {
s := spinner.New(spinner.CharSets[35], 100*time.Millisecond) // Build our new spinner
s.Start()
response, err := openAIClient.GetCompletion(ctx, strings.Join(value, " "))
s.Stop()
if err != nil {
color.Red("Error: %v", err)
return
}
fmt.Printf("%s\n", color.GreenString(response))
}
err = AnalyzeReplicaSet(ctx, client, aiClient, explain)
if err != nil {
return err
}
return nil
}

33
pkg/analyzer/events.go Normal file
View File

@@ -0,0 +1,33 @@
package analyzer
import (
"context"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func FetchLatestPodEvent(ctx context.Context, kubernetesClient *kubernetes.Client, pod *v1.Pod) (*v1.Event, error) {
// get the list of events
events, err := kubernetesClient.GetClient().CoreV1().Events(pod.Namespace).List(ctx,
metav1.ListOptions{
FieldSelector: "involvedObject.name=" + pod.Name,
})
if err != nil {
return nil, err
}
// find most recent event
var latestEvent *v1.Event
for _, event := range events.Items {
if latestEvent == nil {
latestEvent = &event
}
if event.LastTimestamp.After(latestEvent.LastTimestamp.Time) {
latestEvent = &event
}
}
return latestEvent, nil
}

118
pkg/analyzer/podAnalyzer.go Normal file
View File

@@ -0,0 +1,118 @@
package analyzer
import (
"context"
"encoding/base64"
"fmt"
"github.com/briandowns/spinner"
"github.com/fatih/color"
"github.com/k8sgpt-ai/k8sgpt/pkg/ai"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
"github.com/spf13/viper"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strings"
"time"
)
func AnalyzePod(ctx context.Context, client *kubernetes.Client, aiClient *ai.Client, explain bool) error {
// search all namespaces for pods that are not running
list, err := client.GetClient().CoreV1().Pods("").List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
var brokenPods = map[string][]string{}
for _, pod := range list.Items {
// Check for pending pods
if pod.Status.Phase == "Pending" {
// Check through container status to check for crashes
for _, containerStatus := range pod.Status.Conditions {
if containerStatus.Type == "PodScheduled" && containerStatus.Reason == "Unschedulable" {
brokenPods[fmt.Sprintf("%s/%s", pod.Namespace, pod.Name)] = []string{containerStatus.Message}
}
}
}
// Check through container status to check for crashes
var failureDetails = []string{}
for _, containerStatus := range pod.Status.ContainerStatuses {
if containerStatus.State.Waiting != nil {
if containerStatus.State.Waiting.Reason == "CrashLoopBackOff" || containerStatus.State.Waiting.Reason == "ImagePullBackOff" {
failureDetails = append(failureDetails, containerStatus.State.Waiting.Message)
brokenPods[fmt.Sprintf("%s/%s", pod.Namespace, pod.Name)] = failureDetails
}
// This represents a container that is still being created or blocked due to conditions such as OOMKilled
if containerStatus.State.Waiting.Reason == "ContainerCreating" && pod.Status.Phase == "Pending" {
// parse the event log and append details
evt, err := FetchLatestPodEvent(ctx, client, &pod)
if err != nil {
continue
}
if evt.Reason == "FailedCreatePodSandBox" {
failureDetails = append(failureDetails, evt.Message)
brokenPods[fmt.Sprintf("%s/%s", pod.Namespace, pod.Name)] = failureDetails
}
}
}
}
}
count := 0
for key, value := range brokenPods {
fmt.Printf("%s: %s: %s\n", color.CyanString("%d", count), color.YellowString(key), color.RedString(value[0]))
count++
if explain {
s := spinner.New(spinner.CharSets[35], 100*time.Millisecond) // Build our new spinner
s.Start()
inputValue := strings.Join(value, " ")
// Check for cached data
sEnc := base64.StdEncoding.EncodeToString([]byte(inputValue))
// find in viper cache
if viper.IsSet(sEnc) {
s.Stop()
// retrieve data from cache
response := viper.GetString(sEnc)
if response == "" {
color.Red("error retrieving cached data")
continue
}
output, err := base64.StdEncoding.DecodeString(response)
if err != nil {
color.Red("error decoding cached data: %v", err)
continue
}
color.Green(string(output))
continue
}
response, err := aiClient.GetCompletion(ctx, inputValue)
s.Stop()
if err != nil {
color.Red("error getting completion: %v", err)
continue
}
if !viper.IsSet(sEnc) {
viper.Set(sEnc, base64.StdEncoding.EncodeToString([]byte(response)))
if err := viper.WriteConfig(); err != nil {
return err
}
}
color.Green(response)
}
}
return nil
}

View File

@@ -0,0 +1,89 @@
package analyzer
import (
"context"
"encoding/base64"
"fmt"
"github.com/briandowns/spinner"
"github.com/fatih/color"
"github.com/k8sgpt-ai/k8sgpt/pkg/ai"
"github.com/k8sgpt-ai/k8sgpt/pkg/kubernetes"
"github.com/spf13/viper"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"strings"
"time"
)
func AnalyzeReplicaSet(ctx context.Context, client *kubernetes.Client, aiClient *ai.Client, explain bool) error {
// search all namespaces for pods that are not running
list, err := client.GetClient().AppsV1().ReplicaSets("").List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
var brokenRS = map[string][]string{}
for _, rs := range list.Items {
// Check for empty rs
if rs.Status.Replicas == 0 {
// Check through container status to check for crashes
for _, rsStatus := range rs.Status.Conditions {
if rsStatus.Type == "ReplicaFailure" && rsStatus.Reason == "FailedCreate" {
brokenRS[fmt.Sprintf("%s/%s", rs.Namespace, rs.Name)] = []string{rsStatus.Message}
}
}
}
}
count := 0
for key, value := range brokenRS {
fmt.Printf("%s: %s: %s\n", color.CyanString("%d", count), color.YellowString(key), color.RedString(value[0]))
count++
if explain {
s := spinner.New(spinner.CharSets[35], 100*time.Millisecond) // Build our new spinner
s.Start()
inputValue := strings.Join(value, " ")
// Check for cached data
sEnc := base64.StdEncoding.EncodeToString([]byte(inputValue))
// find in viper cache
if viper.IsSet(sEnc) {
s.Stop()
// retrieve data from cache
response := viper.GetString(sEnc)
if response == "" {
color.Red("error retrieving cached data")
continue
}
output, err := base64.StdEncoding.DecodeString(response)
if err != nil {
color.Red("error decoding cached data: %v", err)
continue
}
color.Green(string(output))
continue
}
response, err := aiClient.GetCompletion(ctx, inputValue)
s.Stop()
if err != nil {
color.Red("error getting completion: %v", err)
continue
}
if !viper.IsSet(sEnc) {
viper.Set(sEnc, base64.StdEncoding.EncodeToString([]byte(response)))
if err := viper.WriteConfig(); err != nil {
return err
}
}
}
}
return nil
}

View File

@@ -1,4 +1,4 @@
package client
package kubernetes
import (
"k8s.io/client-go/kubernetes"

View File

@@ -0,0 +1,74 @@
{
"packages": {
".": {
"changelog-path": "CHANGELOG.md",
"release-type": "go",
"prerelease": false,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"draft": false,
"extra-files": [
"README.md",
"deploy/manifest.yaml",
"chart/Chart.yaml",
"chart/values.yaml"
],
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Other"
},
{
"type": "docs",
"section": "Docs"
},
{
"type": "perf",
"section": "Performance"
},
{
"type": "build",
"hidden": true,
"section": "Build"
},
{
"type": "deps",
"section": "Dependency Updates"
},
{
"type": "ci",
"hidden": true,
"section": "CI"
},
{
"type": "refactor",
"section": "Refactoring"
},
{
"type": "revert",
"hidden": true,
"section": "Reverts"
},
{
"type": "style",
"hidden": true,
"section": "Styling"
},
{
"type": "test",
"hidden": true,
"section": "Tests"
}
]
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}

18
renovate.json Normal file
View File

@@ -0,0 +1,18 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"helpers:pinGitHubActionDigests"
],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"automerge": true
},
{
"matchManagers": ["github-actions"],
"automerge": true
}
]
}