{"id":13987788,"url":"https://github.com/jacksgt/alert-operator","last_synced_at":"2025-04-11T13:44:17.214Z","repository":{"id":248488060,"uuid":"828572343","full_name":"jacksgt/alert-operator","owner":"jacksgt","description":"The missing piece for the kube-prometheus stack: manage Alerts and Silences from Kubernetes","archived":false,"fork":false,"pushed_at":"2024-07-19T18:09:21.000Z","size":88,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T10:02:54.430Z","etag":null,"topics":["alertmanager","controller","kubernetes","monitoring","observability","operator","prometheus"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacksgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-07-14T14:54:00.000Z","updated_at":"2024-12-21T12:00:20.000Z","dependencies_parsed_at":"2024-07-19T20:59:47.398Z","dependency_job_id":null,"html_url":"https://github.com/jacksgt/alert-operator","commit_stats":null,"previous_names":["jacksgt/alert-operator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacksgt%2Falert-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacksgt%2Falert-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacksgt%2Falert-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacksgt%2Falert-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacksgt","download_url":"https://codeload.github.com/jacksgt/alert-operator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248410886,"owners_count":21098790,"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":["alertmanager","controller","kubernetes","monitoring","observability","operator","prometheus"],"created_at":"2024-08-09T12:01:05.225Z","updated_at":"2025-04-11T13:44:17.179Z","avatar_url":"https://github.com/jacksgt.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# alert-operator\n\nThe Alert-Operator is the missing component of the [kube-prometheus stack](https://github.com/prometheus-operator/kube-prometheus/) for observability on Kubernetes:\nit allows you to view active **Alerts** from the comfort of your `kubectl` CLI and lets you manage associated **Silences** declaratively, for example with GitOps.\n\n```sh\n$ kubectl get alerts\nNAME                 STATE   VALUE  SINCE  LABELS\nContainerOOM-asxi    firing  1      3h17m  pod=prometheus-k8s-db-prometheus-k8s-0,severity=warning\nKubeJobFailed-kp2md  firing  3      42m    alertname=KubeJobFailed,job_name=image-pruner-28679172,namespace=openshift-image-registry\n\n$ kubectl get alert ContainerOOM-asxi -o yaml\napiVersion: alertmanager.prometheus.io/v1alpha1\nkind: Alert\nmetadata:\n  name: ContainerOOM-asxi\nspec: {}\nstatus:\n  since: 2018-07-04 20:27:12.60602144 +0200 CEST\n  state: firing\n  value: \"1e+00\"\n  labels:\n    alertname: ContainerOOM\n    endpoint: https-metrics\n    instance: 1.2.3.4:10250\n    job: kubelet\n    metrics_path: /metrics\n    namespace: openshift-monitoring\n    node: infra-avz-a-5phgg\n    pod: prometheus-k8s-db-prometheus-k8s-0\n    service: kubelet\n    severity: warning\n  annotations:\n    summary: The container 'prometheus' of pod 'prometheus-k8s-db-prometheus-k8s-0' has been restarted multiple times due to running out of memory.\n```\n\n```sh\n$ kubectl get silences\nNAME                   STATE    CREATOR  COMMENT\nout-of-memory-issues   active   foobar   Currently scaling up the cluster and waiting for new nodes\n```\n\n## Development\n\n### Prerequisites\n- go version v1.22.0+\n- docker version 17.03+.\n- kubectl version v1.11.3+.\n- Access to a Kubernetes v1.11.3+ cluster.\n\n### To Deploy on the cluster\n**Build and push your image to the location specified by `IMG`:**\n\n```sh\nmake docker-build docker-push IMG=\u003csome-registry\u003e/alert-operator:tag\n```\n\n**NOTE:** This image ought to be published in the personal registry you specified.\nAnd it is required to have access to pull the image from the working environment.\nMake sure you have the proper permission to the registry if the above commands don’t work.\n\n**Install the CRDs into the cluster:**\n\n```sh\nmake install\n\n# to uninstall (delete CRDs from the cluster):\nmake uninstall\n```\n\n**Deploy the Manager to the cluster with the image specified by `IMG`:**\n\n```sh\nmake deploy IMG=\u003csome-registry\u003e/alert-operator:tag\n\n# to uninstall (remove controller from the cluster):\nmake undeploy\n```\n\n\u003e **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin\nprivileges or be logged in as admin.\n\n**Create instances of your solution**\nYou can apply the samples (examples) from the config/sample:\n\n```sh\nkubectl apply -k config/samples/\n\n# to uninstall:\nkubectl delete -k config/samples/\n```\n\n\u003e **NOTE**: Ensure that the samples has default values to test it out.\n\n\u003e **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### Generate Alertmanger API client\n\nwe use [OpenAPI Generator](https://openapi-generator.tech/docs/usage/) that generates the Go code based on the OpenAPI spec (*\"Swagger\"*).\nThis generated code might need to be updated from time to time to get access to new endpoints in the API.\n\n```sh\n# fetch API schema (commit it to Git so we can track changes)\ncurl -sSL https://raw.githubusercontent.com/prometheus/alertmanager/main/api/v2/openapi.yaml -o alertmanager-openapi.yaml\n\n# generate Go client and models (see details in the config file)\nrm -rf pkg/alertmanagerapi/\npodman run --rm -v \"${PWD}:/local\" docker.io/openapitools/openapi-generator-cli:v7.6.0 generate \\\n    --input-spec /local/alertmanager-openapi.yaml \\\n    --generator-name go \\\n    --output /local/pkg/alertmanagerapi \\\n    --config /local/openapi-generator-config.yaml\n# fetch dependencies\ngo get -u ./pkg/alertmanagerapi/...\ngo mod tidy\ngo mod vendor\n```\n\n## Project Distribution\n\nFollowing are the steps to build the installer and distribute this project to users.\n\n1. Build the installer for the image built and published in the registry:\n\n```sh\nmake build-installer IMG=\u003csome-registry\u003e/alert-operator:tag\n```\n\nNOTE: The makefile target mentioned above generates an 'install.yaml'\nfile in the dist directory. This file contains all the resources built\nwith Kustomize, which are necessary to install this project without\nits dependencies.\n\n2. Using the installer\n\nUsers can just run kubectl apply -f \u003cURL for YAML BUNDLE\u003e to install the project, i.e.:\n\n```sh\nkubectl apply -f https://raw.githubusercontent.com/\u003corg\u003e/alert-operator/\u003ctag or branch\u003e/dist/install.yaml\n```\n\n## Contributing\n\nContributions are welcome! Feel free to submit feedback and ideas by opening [GitHub issues](https://github.com/jacksgt/alert-operator/issues).\nIt is recommended to discuss your feature in an issue before opening a pull request.\n\n## License\n\nCopyright 2024.\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%2Fjacksgt%2Falert-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacksgt%2Falert-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacksgt%2Falert-operator/lists"}