{"id":22772690,"url":"https://github.com/akyriako/kvnts","last_synced_at":"2025-04-15T06:49:27.371Z","repository":{"id":167516046,"uuid":"643151274","full_name":"akyriako/kvnts","owner":"akyriako","description":"A Kubernetes custom Controller to watch \u0026 forward Kubernetes Events to Grafana Loki with Promtail, push them and their correlated Logs as alerts to Slack ","archived":false,"fork":false,"pushed_at":"2023-06-15T08:00:27.000Z","size":78,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T06:49:21.092Z","etag":null,"topics":["grafana-loki","kubebuilder","kubernetes","kubernetes-events","kubernetes-events-monitoring","observability","operator-sdk","promtail","slack-bot"],"latest_commit_sha":null,"homepage":"https://medium.com/p/62068cf43ec","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akyriako.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-20T08:58:13.000Z","updated_at":"2024-03-12T14:07:31.000Z","dependencies_parsed_at":"2024-06-21T14:20:00.086Z","dependency_job_id":"9140fb1c-e5bf-498a-b468-f04184221eec","html_url":"https://github.com/akyriako/kvnts","commit_stats":null,"previous_names":["akyriako/kvnts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akyriako%2Fkvnts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akyriako%2Fkvnts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akyriako%2Fkvnts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akyriako%2Fkvnts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akyriako","download_url":"https://codeload.github.com/akyriako/kvnts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023707,"owners_count":21199958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grafana-loki","kubebuilder","kubernetes","kubernetes-events","kubernetes-events-monitoring","observability","operator-sdk","promtail","slack-bot"],"created_at":"2024-12-11T17:09:22.073Z","updated_at":"2025-04-15T06:49:27.351Z","avatar_url":"https://github.com/akyriako.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kvnts\nA Kubernetes custom Controller to watch \u0026 forward Kubernetes Events to Grafana Loki with Promtail, push them and their correlated Logs as alerts to Slack\n\n## Description\nRefer to this [medium article](https://betterprogramming.pub/kubernetes-observability-part-1-events-logs-integration-with-slack-openai-and-grafana-62068cf43ec) for more analytical information \n\n## Getting Started\nYou’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) or [K3S/K3D](https://k3d.io/) to get a local cluster for testing, or run against a remote cluster.\n**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).\n\n### Running on the cluster\n0. Provide enviroment variables\n\nYou are going to need to provide the values of `CLUSTER_NAME`, `LOKI_PUSH_GATEWAY_URL` and `OPENAI_API_KEY` as environment variables (just with source from an .env file if you are running locally) or as a `ConfigMap` if you are installing on a cluster \n\n1. Install Instances of Custom Resources:\n\nFill in samples with the necessary Slack tokens:\n\n```yaml\napiVersion: events.kvnts/v1alpha1\nkind: SinksConfig\nmetadata:\n  labels:\n    app.kubernetes.io/name: sinksconfig\n    app.kubernetes.io/instance: sinksconfig-sample\n    app.kubernetes.io/part-of: kvnts\n    app.kubernetes.io/managed-by: kustomize\n    app.kubernetes.io/created-by: kvnts\n  name: sinksconfig-sample\nspec:\n  slack:\n    botToken: \"xoxb-\"\n    channelID: \"C0\"\n    appLevelToken: \"xapp-1-\"\n    debug: false\n  excludedReasons: [ \"FailedMount\" ]\n```\n\nYou can completely omit `excludedReasons`, this is just an example of how you could in a declarative way to ignore Kubernetes Events for specific set of `Reasons` \n\nand then install them in the cluster:\n\n```sh\nkubectl apply -f config/samples/\n```\n\n2. Build and push your image to the location specified by `IMG`:\n\n```sh\nmake docker-build docker-push IMG=\u003csome-registry\u003e/kvnts:tag\n```\n\n3. Deploy the controller to the cluster with the image specified by `IMG`:\n\n```sh\nmake deploy IMG=\u003csome-registry\u003e/kvnts:tag\n```\n\n### Uninstall CRDs\nTo delete the CRDs from the cluster:\n\n```sh\nmake uninstall\n```\n\n### Undeploy controller\nUnDeploy the controller from the cluster:\n\n```sh\nmake undeploy\n```\n\n## Contributing\n// TODO(user): Add detailed information on how you would like others to contribute to this project\n\n### How it works\nThis project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).\n\nIt uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/),\nwhich provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.\n\n### Test It Out\n1. Install the CRDs into the cluster:\n\n```sh\nmake install\n```\n\n2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):\n\n```sh\nmake run\n```\n\n**NOTE:** You can also run this in one step by running: `make install run`\n\n### Modifying the API definitions\nIf you are editing the API definitions, generate the manifests such as CRs or CRDs using:\n\n```sh\nmake manifests\n```\n\n**NOTE:** Run `make --help` for more information on all potential `make` targets\n\nMore information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)\n\n## License\n\nCopyright 2023.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakyriako%2Fkvnts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakyriako%2Fkvnts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakyriako%2Fkvnts/lists"}