├── .dockerignore ├── .github ├── renovate.json5 └── workflows │ ├── build-edge.yaml │ ├── build-pr.yaml │ └── build-release.yaml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── api └── v1alpha1 │ ├── doc.go │ ├── generated.deepcopy.go │ ├── generated.gatus.go │ ├── info.go │ └── types.go ├── crd └── bases │ └── gatus.io_gatuses.yaml ├── gen.go ├── go.mod ├── go.sum ├── internal └── gatus-operator │ ├── config │ ├── config.go │ └── defaults.go │ ├── controller │ ├── controller.go │ └── gatus.go │ ├── main.go │ └── manager │ └── manager.go ├── rbac.yaml └── resources ├── test.yaml └── test_config.yaml /.dockerignore: -------------------------------------------------------------------------------- 1 | # More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file 2 | # Ignore build and test binaries. 3 | bin/ 4 | charts/ 5 | hack/ 6 | .vscode 7 | -------------------------------------------------------------------------------- /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base", 5 | "docker:enableMajor", 6 | ":disableRateLimiting", 7 | ":dependencyDashboard", 8 | ":semanticCommits", 9 | ":automergeDigest", 10 | ":automergeBranch", 11 | "helpers:pinGitHubActionDigests" 12 | ], 13 | "dependencyDashboard": true, 14 | "dependencyDashboardTitle": "Renovate Dashboard 🤖", 15 | "suppressNotifications": ["prIgnoreNotification"], 16 | "rebaseWhen": "conflicted", 17 | "schedule": ["on saturday"], 18 | // commit message topics 19 | "commitMessageTopic": "{{depName}}", 20 | "commitMessageExtra": "to {{newVersion}}", 21 | "commitMessageSuffix": "", 22 | // package rules 23 | "packageRules": [ 24 | // automerge 25 | { 26 | "description": "Auto merge Github Actions", 27 | "matchManagers": ["github-actions"], 28 | "automerge": true, 29 | "automergeType": "branch", 30 | "ignoreTests": true, 31 | "matchUpdateTypes": ["minor", "patch", "digest"] 32 | }, 33 | { 34 | "matchUpdateTypes": ["major"], 35 | "labels": ["type/major"] 36 | }, 37 | { 38 | "matchUpdateTypes": ["minor"], 39 | "labels": ["type/minor"] 40 | }, 41 | { 42 | "matchUpdateTypes": ["patch"], 43 | "labels": ["type/patch"] 44 | }, 45 | { 46 | "matchDatasources": ["helm"], 47 | "addLabels": ["renovate/helm"] 48 | }, 49 | { 50 | "matchDatasources": ["docker"], 51 | "addLabels": ["renovate/container"] 52 | }, 53 | { 54 | "matchUpdateTypes": ["major"], 55 | "semanticCommitType": "feat", 56 | "commitMessagePrefix": "{{semanticCommitType}}({{semanticCommitScope}})!:" 57 | }, 58 | { 59 | "matchUpdateTypes": ["minor"], 60 | "semanticCommitType": "feat" 61 | }, 62 | { 63 | "matchUpdateTypes": ["patch"], 64 | "semanticCommitType": "fix" 65 | }, 66 | { 67 | "matchManagers": ["github-actions"], 68 | "semanticCommitType": "ci", 69 | "semanticCommitScope": "github-action" 70 | } 71 | ] 72 | } -------------------------------------------------------------------------------- /.github/workflows/build-edge.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Build and push rolling tag 3 | 4 | on: 5 | push: 6 | branches: 7 | - main 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: write 12 | packages: write 13 | 14 | jobs: 15 | build_container: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Check out code 19 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 20 | 21 | - name: Set up QEMU 22 | uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3 23 | 24 | - name: Set up Docker Buildx 25 | uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 26 | 27 | - name: Login to image registry 28 | uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 29 | with: 30 | registry: ghcr.io 31 | username: ${{ github.actor }} 32 | password: ${{ secrets.GITHUB_TOKEN }} 33 | 34 | - name: Docker meta 35 | id: meta 36 | uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5 37 | with: 38 | images: | 39 | ghcr.io/${{ github.repository_owner }}/gatus-operator 40 | tags: | 41 | type=raw,value=rolling 42 | type=ref,event=branch 43 | 44 | - name: Build and push 45 | uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 46 | with: 47 | context: . 48 | file: ./Dockerfile 49 | platforms: linux/amd64,linux/arm64 50 | push: true 51 | tags: ${{ steps.meta.outputs.tags }} 52 | labels: ${{ steps.meta.outputs.labels }} 53 | -------------------------------------------------------------------------------- /.github/workflows/build-pr.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Build and push pr tag 3 | 4 | on: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | permissions: 9 | contents: write 10 | packages: write 11 | 12 | jobs: 13 | build_container: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Check out code 17 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 18 | 19 | - name: Set up QEMU 20 | uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3 21 | 22 | - name: Set up Docker Buildx 23 | uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 24 | 25 | - name: Login to image registry 26 | uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 27 | with: 28 | registry: ghcr.io 29 | username: ${{ github.actor }} 30 | password: ${{ secrets.GITHUB_TOKEN }} 31 | 32 | - name: Docker meta 33 | id: meta 34 | uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5 35 | with: 36 | images: | 37 | ghcr.io/${{ github.repository_owner }}/gatus-operator 38 | tags: | 39 | type=ref,event=branch 40 | type=ref,event=pr 41 | 42 | - name: Build and push 43 | uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 44 | with: 45 | context: . 46 | file: ./Dockerfile 47 | platforms: linux/amd64,linux/arm64 48 | push: true 49 | tags: ${{ steps.meta.outputs.tags }} 50 | labels: ${{ steps.meta.outputs.labels }} 51 | -------------------------------------------------------------------------------- /.github/workflows/build-release.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Build and release 3 | 4 | on: 5 | push: 6 | tags: 7 | - "v*" 8 | workflow_dispatch: 9 | 10 | concurrency: 11 | group: build-and-release-app 12 | cancel-in-progress: false 13 | 14 | permissions: 15 | contents: write 16 | packages: write 17 | 18 | jobs: 19 | build_container: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Check out code 23 | uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 24 | 25 | - name: Set up QEMU 26 | uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3 27 | 28 | - name: Set up Docker Buildx 29 | uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 30 | 31 | - name: Login to image registry 32 | uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 33 | with: 34 | registry: ghcr.io 35 | username: ${{ github.actor }} 36 | password: ${{ secrets.GITHUB_TOKEN }} 37 | 38 | - name: Docker meta 39 | id: meta 40 | uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5 41 | with: 42 | images: | 43 | ghcr.io/${{ github.repository_owner }}/gatus-operator 44 | tags: | 45 | type=semver,pattern={{version}},prefix=v 46 | type=semver,pattern={{major}}.{{minor}},prefix=v 47 | type=semver,pattern={{major}},prefix=v 48 | type=ref,event=tag 49 | 50 | - name: Build and push 51 | uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 52 | with: 53 | context: . 54 | file: ./Dockerfile 55 | platforms: linux/amd64,linux/arm64 56 | push: true 57 | tags: ${{ steps.meta.outputs.tags }} 58 | labels: ${{ steps.meta.outputs.labels }} 59 | 60 | - name: Create GitHub release 61 | if: success() && startsWith(github.ref, 'refs/tags/') 62 | uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1 63 | with: 64 | generateReleaseNotes: true 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | bin/* 8 | Dockerfile.cross 9 | __debug_bin* 10 | 11 | # Test binary, built with `go test -c` 12 | *.test 13 | 14 | # Output of the go coverage tool, specifically when used with LiteIDE 15 | *.out 16 | 17 | # Go workspace file 18 | go.work 19 | 20 | # Kubernetes Generated files - skip generated files, except for vendored files 21 | !vendor/**/zz_generated.* 22 | 23 | # editor and IDE paraphernalia 24 | .idea 25 | .vscode 26 | *.swp 27 | *.swo 28 | *~ 29 | 30 | # Extra 31 | kubeconfig -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Build the manager binary 2 | FROM golang:1.23.4 AS builder 3 | ARG TARGETOS 4 | ARG TARGETARCH 5 | 6 | WORKDIR /build 7 | COPY . . 8 | RUN go mod download 9 | WORKDIR /build/internal/gatus-operator 10 | RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o ../../gatus-operator 11 | 12 | FROM gcr.io/distroless/static:nonroot@sha256:91ca4720011393f4d4cab3a01fa5814ee2714b7d40e6c74f2505f74168398ca9 13 | WORKDIR / 14 | COPY --from=builder /build/gatus-operator . 15 | USER 65532:65532 16 | 17 | EXPOSE 8081/tcp 18 | ENTRYPOINT ["/gatus-operator"] 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gatus Operator 2 | Not affiliated with gatus.io 3 | 4 | **State**: Alpha (in development, use at your own risk) 5 | 6 | ## Install 7 | 1. Install the crds 8 | ```bash 9 | kubectl apply -f crds/bases/gatus.io_gatuses.yaml 10 | ``` 11 | 2. Install RBAC 12 | ```bash 13 | kubectl apply -f rbac.yaml 14 | ``` 15 | 3. Run container as per usual 16 | 17 | ## Usage 18 | Example: resources/test.yaml 19 | ```yaml 20 | --- 21 | apiVersion: gatus.io/v1alpha1 22 | kind: Gatus 23 | metadata: 24 | name: gatus-test 25 | namespace: observability 26 | spec: 27 | endpoint: 28 | enabled: true 29 | name: gatus-test 30 | url: https://example.com 31 | interval: 1m 32 | conditions: ["[STATUS] == 200"] 33 | ``` 34 | 35 | The api is generated from the gatus package as well with some minor tweaks (to make it working). 36 | Most options you use in your normal gatus configs, you should be able to use like this. 37 | 38 | ## API Generation 39 | The operator builds the api and crd based on the Endpoint type struc from Gatus itself, using a very alpha generator which definitely could use a rewrite as it contains many exceptions and other smaller hacks to at least continue my development time on the operator itself. 40 | The API is generated using the following commands: 41 | 42 | ```bash 43 | - go run gen.go 44 | - deepcopy-gen --v=9 ./api/v1alpha1 45 | - controller-gen crd:crdVersions=v1 paths=./api/v1alpha1 output:crd:dir=./crd/bases 46 | ``` 47 | 48 | ### Change in fields 49 | - HttpClient in ClientConfig is ommited (can't deep copy it) 50 | - ProviderOverride is casted to map[string]json.RawMessage 51 | - Any time.Duration is casted to string for the CRD (otherwise it will be an int64) 52 | - Everything is forced to be omitempty so the configmap will only contain the fields that are actually set 53 | -------------------------------------------------------------------------------- /api/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // +k8s:deepcopy-gen=package,register 2 | package v1alpha1 3 | -------------------------------------------------------------------------------- /api/v1alpha1/generated.deepcopy.go: -------------------------------------------------------------------------------- 1 | //go:build !ignore_autogenerated 2 | // +build !ignore_autogenerated 3 | 4 | // Code generated by deepcopy-gen. DO NOT EDIT. 5 | 6 | package v1alpha1 7 | 8 | import ( 9 | json "encoding/json" 10 | 11 | runtime "k8s.io/apimachinery/pkg/runtime" 12 | ) 13 | 14 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 15 | func (in *AlertAlert) DeepCopyInto(out *AlertAlert) { 16 | *out = *in 17 | if in.Enabled != nil { 18 | in, out := &in.Enabled, &out.Enabled 19 | *out = new(bool) 20 | **out = **in 21 | } 22 | if in.Description != nil { 23 | in, out := &in.Description, &out.Description 24 | *out = new(string) 25 | **out = **in 26 | } 27 | if in.SendOnResolved != nil { 28 | in, out := &in.SendOnResolved, &out.SendOnResolved 29 | *out = new(bool) 30 | **out = **in 31 | } 32 | if in.ProviderOverride != nil { 33 | in, out := &in.ProviderOverride, &out.ProviderOverride 34 | *out = make(map[string]json.RawMessage, len(*in)) 35 | for key, val := range *in { 36 | var outVal []byte 37 | if val == nil { 38 | (*out)[key] = nil 39 | } else { 40 | in, out := &val, &outVal 41 | *out = make(json.RawMessage, len(*in)) 42 | copy(*out, *in) 43 | } 44 | (*out)[key] = outVal 45 | } 46 | } 47 | return 48 | } 49 | 50 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertAlert. 51 | func (in *AlertAlert) DeepCopy() *AlertAlert { 52 | if in == nil { 53 | return nil 54 | } 55 | out := new(AlertAlert) 56 | in.DeepCopyInto(out) 57 | return out 58 | } 59 | 60 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 61 | func (in *ClientConfig) DeepCopyInto(out *ClientConfig) { 62 | *out = *in 63 | if in.OAuth2Config != nil { 64 | in, out := &in.OAuth2Config, &out.OAuth2Config 65 | *out = new(ClientOAuth2Config) 66 | (*in).DeepCopyInto(*out) 67 | } 68 | if in.IAPConfig != nil { 69 | in, out := &in.IAPConfig, &out.IAPConfig 70 | *out = new(ClientIAPConfig) 71 | **out = **in 72 | } 73 | if in.TLS != nil { 74 | in, out := &in.TLS, &out.TLS 75 | *out = new(ClientTLSConfig) 76 | **out = **in 77 | } 78 | return 79 | } 80 | 81 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientConfig. 82 | func (in *ClientConfig) DeepCopy() *ClientConfig { 83 | if in == nil { 84 | return nil 85 | } 86 | out := new(ClientConfig) 87 | in.DeepCopyInto(out) 88 | return out 89 | } 90 | 91 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 92 | func (in *ClientIAPConfig) DeepCopyInto(out *ClientIAPConfig) { 93 | *out = *in 94 | return 95 | } 96 | 97 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientIAPConfig. 98 | func (in *ClientIAPConfig) DeepCopy() *ClientIAPConfig { 99 | if in == nil { 100 | return nil 101 | } 102 | out := new(ClientIAPConfig) 103 | in.DeepCopyInto(out) 104 | return out 105 | } 106 | 107 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 108 | func (in *ClientOAuth2Config) DeepCopyInto(out *ClientOAuth2Config) { 109 | *out = *in 110 | if in.Scopes != nil { 111 | in, out := &in.Scopes, &out.Scopes 112 | *out = make([]string, len(*in)) 113 | copy(*out, *in) 114 | } 115 | return 116 | } 117 | 118 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOAuth2Config. 119 | func (in *ClientOAuth2Config) DeepCopy() *ClientOAuth2Config { 120 | if in == nil { 121 | return nil 122 | } 123 | out := new(ClientOAuth2Config) 124 | in.DeepCopyInto(out) 125 | return out 126 | } 127 | 128 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 129 | func (in *ClientTLSConfig) DeepCopyInto(out *ClientTLSConfig) { 130 | *out = *in 131 | return 132 | } 133 | 134 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientTLSConfig. 135 | func (in *ClientTLSConfig) DeepCopy() *ClientTLSConfig { 136 | if in == nil { 137 | return nil 138 | } 139 | out := new(ClientTLSConfig) 140 | in.DeepCopyInto(out) 141 | return out 142 | } 143 | 144 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 145 | func (in *DnsConfig) DeepCopyInto(out *DnsConfig) { 146 | *out = *in 147 | return 148 | } 149 | 150 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DnsConfig. 151 | func (in *DnsConfig) DeepCopy() *DnsConfig { 152 | if in == nil { 153 | return nil 154 | } 155 | out := new(DnsConfig) 156 | in.DeepCopyInto(out) 157 | return out 158 | } 159 | 160 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 161 | func (in *EndpointEndpoint) DeepCopyInto(out *EndpointEndpoint) { 162 | *out = *in 163 | if in.Enabled != nil { 164 | in, out := &in.Enabled, &out.Enabled 165 | *out = new(bool) 166 | **out = **in 167 | } 168 | if in.Headers != nil { 169 | in, out := &in.Headers, &out.Headers 170 | *out = make(map[string]string, len(*in)) 171 | for key, val := range *in { 172 | (*out)[key] = val 173 | } 174 | } 175 | if in.Conditions != nil { 176 | in, out := &in.Conditions, &out.Conditions 177 | *out = make([]string, len(*in)) 178 | copy(*out, *in) 179 | } 180 | if in.Alerts != nil { 181 | in, out := &in.Alerts, &out.Alerts 182 | *out = make([]*AlertAlert, len(*in)) 183 | for i := range *in { 184 | if (*in)[i] != nil { 185 | in, out := &(*in)[i], &(*out)[i] 186 | *out = new(AlertAlert) 187 | (*in).DeepCopyInto(*out) 188 | } 189 | } 190 | } 191 | if in.DNSConfig != nil { 192 | in, out := &in.DNSConfig, &out.DNSConfig 193 | *out = new(DnsConfig) 194 | **out = **in 195 | } 196 | if in.SSHConfig != nil { 197 | in, out := &in.SSHConfig, &out.SSHConfig 198 | *out = new(SshConfig) 199 | **out = **in 200 | } 201 | if in.ClientConfig != nil { 202 | in, out := &in.ClientConfig, &out.ClientConfig 203 | *out = new(ClientConfig) 204 | (*in).DeepCopyInto(*out) 205 | } 206 | if in.UIConfig != nil { 207 | in, out := &in.UIConfig, &out.UIConfig 208 | *out = new(UiConfig) 209 | (*in).DeepCopyInto(*out) 210 | } 211 | return 212 | } 213 | 214 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointEndpoint. 215 | func (in *EndpointEndpoint) DeepCopy() *EndpointEndpoint { 216 | if in == nil { 217 | return nil 218 | } 219 | out := new(EndpointEndpoint) 220 | in.DeepCopyInto(out) 221 | return out 222 | } 223 | 224 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 225 | func (in *Gatus) DeepCopyInto(out *Gatus) { 226 | *out = *in 227 | out.TypeMeta = in.TypeMeta 228 | in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) 229 | in.Spec.DeepCopyInto(&out.Spec) 230 | out.Status = in.Status 231 | return 232 | } 233 | 234 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Gatus. 235 | func (in *Gatus) DeepCopy() *Gatus { 236 | if in == nil { 237 | return nil 238 | } 239 | out := new(Gatus) 240 | in.DeepCopyInto(out) 241 | return out 242 | } 243 | 244 | // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. 245 | func (in *Gatus) DeepCopyObject() runtime.Object { 246 | if c := in.DeepCopy(); c != nil { 247 | return c 248 | } 249 | return nil 250 | } 251 | 252 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 253 | func (in *GatusList) DeepCopyInto(out *GatusList) { 254 | *out = *in 255 | out.TypeMeta = in.TypeMeta 256 | in.ListMeta.DeepCopyInto(&out.ListMeta) 257 | if in.Items != nil { 258 | in, out := &in.Items, &out.Items 259 | *out = make([]Gatus, len(*in)) 260 | for i := range *in { 261 | (*in)[i].DeepCopyInto(&(*out)[i]) 262 | } 263 | } 264 | return 265 | } 266 | 267 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatusList. 268 | func (in *GatusList) DeepCopy() *GatusList { 269 | if in == nil { 270 | return nil 271 | } 272 | out := new(GatusList) 273 | in.DeepCopyInto(out) 274 | return out 275 | } 276 | 277 | // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. 278 | func (in *GatusList) DeepCopyObject() runtime.Object { 279 | if c := in.DeepCopy(); c != nil { 280 | return c 281 | } 282 | return nil 283 | } 284 | 285 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 286 | func (in *GatusSpec) DeepCopyInto(out *GatusSpec) { 287 | *out = *in 288 | in.Endpoint.DeepCopyInto(&out.Endpoint) 289 | return 290 | } 291 | 292 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatusSpec. 293 | func (in *GatusSpec) DeepCopy() *GatusSpec { 294 | if in == nil { 295 | return nil 296 | } 297 | out := new(GatusSpec) 298 | in.DeepCopyInto(out) 299 | return out 300 | } 301 | 302 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 303 | func (in *GatusStatus) DeepCopyInto(out *GatusStatus) { 304 | *out = *in 305 | return 306 | } 307 | 308 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatusStatus. 309 | func (in *GatusStatus) DeepCopy() *GatusStatus { 310 | if in == nil { 311 | return nil 312 | } 313 | out := new(GatusStatus) 314 | in.DeepCopyInto(out) 315 | return out 316 | } 317 | 318 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 319 | func (in *SshConfig) DeepCopyInto(out *SshConfig) { 320 | *out = *in 321 | return 322 | } 323 | 324 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SshConfig. 325 | func (in *SshConfig) DeepCopy() *SshConfig { 326 | if in == nil { 327 | return nil 328 | } 329 | out := new(SshConfig) 330 | in.DeepCopyInto(out) 331 | return out 332 | } 333 | 334 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 335 | func (in *UiBadge) DeepCopyInto(out *UiBadge) { 336 | *out = *in 337 | if in.ResponseTime != nil { 338 | in, out := &in.ResponseTime, &out.ResponseTime 339 | *out = new(UiResponseTime) 340 | (*in).DeepCopyInto(*out) 341 | } 342 | return 343 | } 344 | 345 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UiBadge. 346 | func (in *UiBadge) DeepCopy() *UiBadge { 347 | if in == nil { 348 | return nil 349 | } 350 | out := new(UiBadge) 351 | in.DeepCopyInto(out) 352 | return out 353 | } 354 | 355 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 356 | func (in *UiConfig) DeepCopyInto(out *UiConfig) { 357 | *out = *in 358 | if in.Badge != nil { 359 | in, out := &in.Badge, &out.Badge 360 | *out = new(UiBadge) 361 | (*in).DeepCopyInto(*out) 362 | } 363 | return 364 | } 365 | 366 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UiConfig. 367 | func (in *UiConfig) DeepCopy() *UiConfig { 368 | if in == nil { 369 | return nil 370 | } 371 | out := new(UiConfig) 372 | in.DeepCopyInto(out) 373 | return out 374 | } 375 | 376 | // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. 377 | func (in *UiResponseTime) DeepCopyInto(out *UiResponseTime) { 378 | *out = *in 379 | if in.Thresholds != nil { 380 | in, out := &in.Thresholds, &out.Thresholds 381 | *out = make([]int, len(*in)) 382 | copy(*out, *in) 383 | } 384 | return 385 | } 386 | 387 | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UiResponseTime. 388 | func (in *UiResponseTime) DeepCopy() *UiResponseTime { 389 | if in == nil { 390 | return nil 391 | } 392 | out := new(UiResponseTime) 393 | in.DeepCopyInto(out) 394 | return out 395 | } 396 | -------------------------------------------------------------------------------- /api/v1alpha1/generated.gatus.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "encoding/json" 5 | ) 6 | 7 | // +k8s:deepcopy-gen=true 8 | type DnsConfig struct { 9 | QueryType string `yaml:"query-type" json:"query-type,omitempty"` 10 | QueryName string `yaml:"query-name" json:"query-name,omitempty"` 11 | } 12 | 13 | // +k8s:deepcopy-gen=true 14 | type ClientOAuth2Config struct { 15 | TokenURL string `yaml:"token-url" json:"token-url,omitempty"` 16 | ClientID string `yaml:"client-id" json:"client-id,omitempty"` 17 | ClientSecret string `yaml:"client-secret" json:"client-secret,omitempty"` 18 | Scopes []string `yaml:"scopes" json:"scopes,omitempty"` 19 | } 20 | 21 | // +k8s:deepcopy-gen=true 22 | type ClientConfig struct { 23 | ProxyURL string `yaml:"proxy-url,omitempty" json:"proxy-url,omitempty"` 24 | Insecure bool `yaml:"insecure,omitempty" json:"insecure,omitempty"` 25 | IgnoreRedirect bool `yaml:"ignore-redirect,omitempty" json:"ignore-redirect,omitempty"` 26 | Timeout string `yaml:"timeout" json:"timeout,omitempty"` 27 | DNSResolver string `yaml:"dns-resolver,omitempty" json:"dns-resolver,omitempty"` 28 | OAuth2Config *ClientOAuth2Config `yaml:"oauth2,omitempty" json:"oauth2,omitempty"` 29 | IAPConfig *ClientIAPConfig `yaml:"identity-aware-proxy,omitempty" json:"identity-aware-proxy,omitempty"` 30 | Network string `yaml:"network" json:"network,omitempty"` 31 | TLS *ClientTLSConfig `yaml:"tls,omitempty" json:"tls,omitempty"` 32 | } 33 | 34 | // +k8s:deepcopy-gen=true 35 | type UiResponseTime struct { 36 | Thresholds []int `yaml:"thresholds" json:"thresholds,omitempty"` 37 | } 38 | 39 | // +k8s:deepcopy-gen=true 40 | type AlertAlert struct { 41 | Type string `yaml:"type" json:"type,omitempty"` 42 | Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"` 43 | FailureThreshold int `yaml:"failure-threshold" json:"failure-threshold,omitempty"` 44 | SuccessThreshold int `yaml:"success-threshold" json:"success-threshold,omitempty"` 45 | Description *string `yaml:"description,omitempty" json:"description,omitempty"` 46 | SendOnResolved *bool `yaml:"send-on-resolved,omitempty" json:"send-on-resolved,omitempty"` 47 | ProviderOverride map[string]json.RawMessage `json:"-"` 48 | ResolveKey string `yaml:"-" json:"-"` 49 | Triggered bool `yaml:"-" json:"-"` 50 | } 51 | 52 | // +k8s:deepcopy-gen=true 53 | type SshConfig struct { 54 | Username string `yaml:"username,omitempty" json:"username,omitempty"` 55 | Password string `yaml:"password,omitempty" json:"password,omitempty"` 56 | } 57 | 58 | // +k8s:deepcopy-gen=true 59 | type ClientIAPConfig struct { 60 | Audience string `yaml:"audience" json:"audience,omitempty"` 61 | } 62 | 63 | // +k8s:deepcopy-gen=true 64 | type ClientTLSConfig struct { 65 | CertificateFile string `yaml:"certificate-file,omitempty" json:"certificate-file,omitempty"` 66 | PrivateKeyFile string `yaml:"private-key-file,omitempty" json:"private-key-file,omitempty"` 67 | RenegotiationSupport string `yaml:"renegotiation,omitempty" json:"renegotiation,omitempty"` 68 | } 69 | 70 | // +k8s:deepcopy-gen=true 71 | type UiBadge struct { 72 | ResponseTime *UiResponseTime `yaml:"response-time" json:"response-time,omitempty"` 73 | } 74 | 75 | // +k8s:deepcopy-gen=true 76 | type UiConfig struct { 77 | HideConditions bool `yaml:"hide-conditions" json:"hide-conditions,omitempty"` 78 | HideHostname bool `yaml:"hide-hostname" json:"hide-hostname,omitempty"` 79 | HideURL bool `yaml:"hide-url" json:"hide-url,omitempty"` 80 | DontResolveFailedConditions bool `yaml:"dont-resolve-failed-conditions" json:"dont-resolve-failed-conditions,omitempty"` 81 | Badge *UiBadge `yaml:"badge" json:"badge,omitempty"` 82 | } 83 | 84 | // +k8s:deepcopy-gen=true 85 | type EndpointEndpoint struct { 86 | Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty"` 87 | Name string `yaml:"name" json:"name,omitempty"` 88 | Group string `yaml:"group,omitempty" json:"group,omitempty"` 89 | URL string `yaml:"url" json:"url,omitempty"` 90 | Method string `yaml:"method,omitempty" json:"method,omitempty"` 91 | Body string `yaml:"body,omitempty" json:"body,omitempty"` 92 | GraphQL bool `yaml:"graphql,omitempty" json:"graphql,omitempty"` 93 | Headers map[string]string `json:"-"` 94 | Interval string `yaml:"interval,omitempty" json:"interval,omitempty"` 95 | Conditions []string `yaml:"conditions" json:"conditions,omitempty"` 96 | Alerts []*AlertAlert `yaml:"alerts,omitempty" json:"alerts,omitempty"` 97 | DNSConfig *DnsConfig `yaml:"dns,omitempty" json:"dns,omitempty"` 98 | SSHConfig *SshConfig `yaml:"ssh,omitempty" json:"ssh,omitempty"` 99 | ClientConfig *ClientConfig `yaml:"client,omitempty" json:"client,omitempty"` 100 | UIConfig *UiConfig `yaml:"ui,omitempty" json:"ui,omitempty"` 101 | NumberOfFailuresInARow int `yaml:"-" json:"-"` 102 | NumberOfSuccessesInARow int `yaml:"-" json:"-"` 103 | } 104 | -------------------------------------------------------------------------------- /api/v1alpha1/info.go: -------------------------------------------------------------------------------- 1 | // +kubebuilder:object:generate=true 2 | // +groupName=gatus.io 3 | package v1alpha1 4 | 5 | import ( 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | "sigs.k8s.io/controller-runtime/pkg/scheme" 8 | ) 9 | 10 | var ( 11 | GroupVersion = schema.GroupVersion{Group: "gatus.io", Version: "v1alpha1"} 12 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 13 | AddToScheme = SchemeBuilder.AddToScheme 14 | ) 15 | -------------------------------------------------------------------------------- /api/v1alpha1/types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | // +k8s:deepcopy-gen=true 8 | type GatusSpec struct { 9 | Endpoint EndpointEndpoint `json:"endpoint"` 10 | } 11 | 12 | // +k8s:deepcopy-gen=true 13 | type GatusStatus struct { 14 | } 15 | 16 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 17 | // +kubebuilder:object:root=true 18 | // +kubebuilder:subresource:status 19 | type Gatus struct { 20 | metav1.TypeMeta `json:",inline"` 21 | metav1.ObjectMeta `json:"metadata,omitempty"` 22 | 23 | Spec GatusSpec `json:"spec,omitempty"` 24 | Status GatusStatus `json:"status,omitempty"` 25 | } 26 | 27 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 28 | // +kubebuilder:object:root=true 29 | type GatusList struct { 30 | metav1.TypeMeta `json:",inline"` 31 | metav1.ListMeta `json:"metadata,omitempty"` 32 | Items []Gatus `json:"items"` 33 | } 34 | 35 | func init() { 36 | SchemeBuilder.Register(&Gatus{}, &GatusList{}) 37 | } 38 | -------------------------------------------------------------------------------- /crd/bases/gatus.io_gatuses.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | controller-gen.kubebuilder.io/version: v0.17.1 7 | name: gatuses.gatus.io 8 | spec: 9 | group: gatus.io 10 | names: 11 | kind: Gatus 12 | listKind: GatusList 13 | plural: gatuses 14 | singular: gatus 15 | scope: Namespaced 16 | versions: 17 | - name: v1alpha1 18 | schema: 19 | openAPIV3Schema: 20 | properties: 21 | apiVersion: 22 | description: |- 23 | APIVersion defines the versioned schema of this representation of an object. 24 | Servers should convert recognized schemas to the latest internal value, and 25 | may reject unrecognized values. 26 | More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources 27 | type: string 28 | kind: 29 | description: |- 30 | Kind is a string value representing the REST resource this object represents. 31 | Servers may infer this from the endpoint the client submits requests to. 32 | Cannot be updated. 33 | In CamelCase. 34 | More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 35 | type: string 36 | metadata: 37 | type: object 38 | spec: 39 | properties: 40 | endpoint: 41 | properties: 42 | alerts: 43 | items: 44 | properties: 45 | description: 46 | type: string 47 | enabled: 48 | type: boolean 49 | failure-threshold: 50 | type: integer 51 | send-on-resolved: 52 | type: boolean 53 | success-threshold: 54 | type: integer 55 | type: 56 | type: string 57 | type: object 58 | type: array 59 | body: 60 | type: string 61 | client: 62 | properties: 63 | dns-resolver: 64 | type: string 65 | identity-aware-proxy: 66 | properties: 67 | audience: 68 | type: string 69 | type: object 70 | ignore-redirect: 71 | type: boolean 72 | insecure: 73 | type: boolean 74 | network: 75 | type: string 76 | oauth2: 77 | properties: 78 | client-id: 79 | type: string 80 | client-secret: 81 | type: string 82 | scopes: 83 | items: 84 | type: string 85 | type: array 86 | token-url: 87 | type: string 88 | type: object 89 | proxy-url: 90 | type: string 91 | timeout: 92 | type: string 93 | tls: 94 | properties: 95 | certificate-file: 96 | type: string 97 | private-key-file: 98 | type: string 99 | renegotiation: 100 | type: string 101 | type: object 102 | type: object 103 | conditions: 104 | items: 105 | type: string 106 | type: array 107 | dns: 108 | properties: 109 | query-name: 110 | type: string 111 | query-type: 112 | type: string 113 | type: object 114 | enabled: 115 | type: boolean 116 | graphql: 117 | type: boolean 118 | group: 119 | type: string 120 | interval: 121 | type: string 122 | method: 123 | type: string 124 | name: 125 | type: string 126 | ssh: 127 | properties: 128 | password: 129 | type: string 130 | username: 131 | type: string 132 | type: object 133 | ui: 134 | properties: 135 | badge: 136 | properties: 137 | response-time: 138 | properties: 139 | thresholds: 140 | items: 141 | type: integer 142 | type: array 143 | type: object 144 | type: object 145 | dont-resolve-failed-conditions: 146 | type: boolean 147 | hide-conditions: 148 | type: boolean 149 | hide-hostname: 150 | type: boolean 151 | hide-url: 152 | type: boolean 153 | type: object 154 | url: 155 | type: string 156 | type: object 157 | required: 158 | - endpoint 159 | type: object 160 | status: 161 | type: object 162 | type: object 163 | served: true 164 | storage: true 165 | subresources: 166 | status: {} 167 | -------------------------------------------------------------------------------- /gen.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "reflect" 7 | "regexp" 8 | "strings" 9 | "unicode" 10 | 11 | endpoint "github.com/TwiN/gatus/v5/config/endpoint" 12 | ) 13 | 14 | var ( 15 | apiDir = "api/v1alpha1/" 16 | definitionFile = "generated.gatus.go" 17 | ) 18 | 19 | func main() { 20 | typ := reflect.TypeOf(endpoint.Endpoint{}) 21 | structs := make(map[string]string) 22 | 23 | generateStruct(typ, structs) 24 | 25 | var sb strings.Builder 26 | sb.WriteString("package v1alpha1\n\n") 27 | sb.WriteString("import (\n\t\"encoding/json\"\n)\n\n") 28 | for _, structDef := range structs { 29 | sb.WriteString("// +k8s:deepcopy-gen=true\n" + structDef + "\n") 30 | } 31 | 32 | err := os.WriteFile(apiDir+definitionFile, []byte(sb.String()), 0644) 33 | 34 | if err != nil { 35 | fmt.Println("Error writing to file:", err) 36 | return 37 | } 38 | 39 | fmt.Printf("Go struct definitions written to %s\n", definitionFile) 40 | } 41 | 42 | func generateStruct(typ reflect.Type, structs map[string]string) { 43 | typString := typ.String() 44 | if strings.Contains(typ.String(), ".") { 45 | var re = regexp.MustCompile(`(?m)^[^a-z]*?([a-z]*)\.([a-zA-Z0-9]*)$`) 46 | typString = re.ReplaceAllString(typString, "$1$2") 47 | } 48 | 49 | typString = CapitalizeFirstLetter(typString) 50 | 51 | if _, exists := structs[typString]; exists { 52 | return 53 | } 54 | 55 | if typ.Kind() == reflect.Ptr { 56 | typ = typ.Elem() 57 | } 58 | 59 | var sb strings.Builder 60 | sb.WriteString(fmt.Sprintf("type %s struct {\n", typString)) 61 | 62 | for i := 0; i < typ.NumField(); i++ { 63 | field := typ.Field(i) 64 | fieldName := field.Name 65 | fieldType := field.Type 66 | fieldTag := field.Tag 67 | 68 | fieldTypeString := fieldType.String() 69 | 70 | if field.Type.PkgPath() == "net/http" { 71 | continue 72 | } 73 | 74 | if strings.Contains(fieldTypeString, ".") { 75 | var re = regexp.MustCompile(`(?m)^[^a-z]*?(\*{0,1}[a-z]*)\.([a-zA-Z0-9]*)$`) 76 | fieldTypeString = re.ReplaceAllString(fieldTypeString, "$1$2") 77 | 78 | if fieldType.Kind() != reflect.Func { 79 | fieldTypeString = CapitalizeFirstLetter(fieldTypeString) 80 | } 81 | } 82 | 83 | if yamlTag := fieldTag.Get("yaml"); yamlTag != "" { 84 | newTag := applyJsonTag(fieldTag) 85 | 86 | newTag = applyOmitEmpty(newTag) 87 | 88 | fieldTag = reflect.StructTag(newTag) 89 | } 90 | 91 | if fieldType.Kind() == reflect.Struct { 92 | generateStruct(fieldType, structs) 93 | } else if fieldType.Kind() == reflect.Slice { 94 | elemType := fieldType.Elem() 95 | if elemType.Kind() == reflect.Struct || elemType.Kind() == reflect.Ptr { 96 | generateStruct(elemType, structs) 97 | } 98 | 99 | if !strings.Contains(fieldTypeString, "[]") { 100 | fieldTypeString = fmt.Sprintf("[]%s", fieldTypeString) 101 | } 102 | 103 | if fieldName == "Conditions" { 104 | fieldTypeString = "[]string" 105 | } 106 | 107 | if fieldTag != "" { 108 | sb.WriteString(fmt.Sprintf("\t%s %s `%s`\n", fieldName, fieldTypeString, fieldTag)) 109 | } else { 110 | sb.WriteString(fmt.Sprintf("\t%s %s `yaml: \"-\" json:\"-\"`\n", fieldName, fieldTypeString)) 111 | } 112 | } else if fieldType.Kind() == reflect.Ptr { 113 | elemType := fieldType.Elem() 114 | 115 | if elemType.Kind() == reflect.Struct && fieldName != "httpClient" { 116 | generateStruct(elemType, structs) 117 | } 118 | 119 | if fieldName == "httpClient" { 120 | continue 121 | } 122 | 123 | if fieldTag != "" { 124 | sb.WriteString(fmt.Sprintf("\t%s %s `%s`\n", fieldName, fieldTypeString, fieldTag)) 125 | } else { 126 | sb.WriteString(fmt.Sprintf("\t%s %s `yaml: \"-\" json:\"-\"`\n", fieldName, fieldTypeString)) 127 | } 128 | } else { 129 | if fieldType.Kind() == reflect.Func || fieldType.Kind() == reflect.Interface || fieldType.Kind() == reflect.Map { 130 | if fieldType.Kind() == reflect.Map { 131 | fieldTag = "json:\"-\"" // Ignore maps for now 132 | } 133 | 134 | if fieldTypeString == "map[string]interface {}" { 135 | fieldTypeString = "map[string]json.RawMessage" 136 | } 137 | 138 | if fieldTag != "" { 139 | sb.WriteString(fmt.Sprintf("\t%s %s `%s`\n", fieldName, fieldTypeString, fieldTag)) 140 | } else { 141 | sb.WriteString(fmt.Sprintf("\t%s %s `yaml: \"-\" json:\"-\"`\n", fieldName, fieldTypeString)) 142 | } 143 | } else { 144 | fieldTypeGeneric := fieldType.Kind().String() 145 | if strings.Contains(fieldType.String(), "time.Duration") { 146 | fieldTypeGeneric = "string" 147 | } 148 | 149 | if fieldTag != "" { 150 | sb.WriteString(fmt.Sprintf("\t%s %s `%s`\n", fieldName, fieldTypeGeneric, fieldTag)) 151 | } else { 152 | sb.WriteString(fmt.Sprintf("\t%s %s `yaml: \"-\" json:\"-\"`\n", fieldName, fieldTypeGeneric)) 153 | } 154 | } 155 | } 156 | } 157 | 158 | sb.WriteString("}\n") 159 | 160 | structs[typString] = sb.String() 161 | } 162 | 163 | func applyJsonTag(fieldTag reflect.StructTag) string { 164 | newTag := string(fieldTag) 165 | 166 | yamlTag := string(fieldTag) 167 | jsonTag := strings.Replace(newTag, "yaml", "json", 1) 168 | 169 | return yamlTag + " " + jsonTag 170 | } 171 | 172 | func applyOmitEmpty(newTag string) string { 173 | if strings.Contains(newTag, ",omitempty") { 174 | return newTag 175 | } 176 | 177 | if strings.Contains(newTag, "\"-\"") { 178 | return newTag 179 | } 180 | 181 | lastIndex := strings.LastIndex(newTag, "\"") 182 | if lastIndex == -1 { 183 | return newTag 184 | } 185 | 186 | return newTag[:lastIndex] + ",omitempty\"" 187 | } 188 | 189 | func CapitalizeFirstLetter(s string) string { 190 | if len(s) == 0 { 191 | return s 192 | } 193 | 194 | if s[0] == '*' && len(s) > 1 { 195 | return "*" + string(unicode.ToUpper(rune(s[1]))) + s[2:] 196 | } 197 | 198 | return string(unicode.ToUpper(rune(s[0]))) + s[1:] 199 | } 200 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/aumer-amr/gatus-operator/v2 2 | 3 | go 1.23.4 4 | 5 | require ( 6 | go.uber.org/zap v1.27.0 7 | k8s.io/api v0.32.1 8 | k8s.io/apimachinery v0.32.1 9 | sigs.k8s.io/controller-runtime v0.20.1 10 | ) 11 | 12 | require ( 13 | cloud.google.com/go/auth v0.13.0 // indirect 14 | cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect 15 | cloud.google.com/go/compute/metadata v0.6.0 // indirect 16 | github.com/TwiN/gocache/v2 v2.2.2 // indirect 17 | github.com/TwiN/logr v0.3.1 // indirect 18 | github.com/TwiN/whois v1.1.9 // indirect 19 | github.com/felixge/httpsnoop v1.0.4 // indirect 20 | github.com/go-logr/stdr v1.2.2 // indirect 21 | github.com/google/s2a-go v0.1.8 // indirect 22 | github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect 23 | github.com/googleapis/gax-go/v2 v2.14.0 // indirect 24 | github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2 // indirect 25 | github.com/klauspost/compress v1.17.11 // indirect 26 | github.com/miekg/dns v1.1.62 // indirect 27 | github.com/prometheus-community/pro-bing v0.4.0 // indirect 28 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect 29 | go.opentelemetry.io/otel v1.29.0 // indirect 30 | go.opentelemetry.io/otel/metric v1.29.0 // indirect 31 | go.opentelemetry.io/otel/trace v1.29.0 // indirect 32 | golang.org/x/crypto v0.31.0 // indirect 33 | golang.org/x/mod v0.21.0 // indirect 34 | golang.org/x/tools v0.26.0 // indirect 35 | google.golang.org/api v0.214.0 // indirect 36 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect 37 | google.golang.org/grpc v1.67.1 // indirect 38 | ) 39 | 40 | require ( 41 | github.com/TwiN/gatus/v5 v5.15.0 42 | github.com/beorn7/perks v1.0.1 // indirect 43 | github.com/cespare/xxhash/v2 v2.3.0 // indirect 44 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect 45 | github.com/emicklei/go-restful/v3 v3.11.0 // indirect 46 | github.com/evanphx/json-patch/v5 v5.9.0 // indirect 47 | github.com/fsnotify/fsnotify v1.7.0 // indirect 48 | github.com/fxamacker/cbor/v2 v2.7.0 // indirect 49 | github.com/go-logr/logr v1.4.2 // indirect 50 | github.com/go-logr/zapr v1.3.0 // indirect 51 | github.com/go-openapi/jsonpointer v0.21.0 // indirect 52 | github.com/go-openapi/jsonreference v0.20.2 // indirect 53 | github.com/go-openapi/swag v0.23.0 // indirect 54 | github.com/gogo/protobuf v1.3.2 // indirect 55 | github.com/golang/protobuf v1.5.4 // indirect 56 | github.com/google/btree v1.1.3 // indirect 57 | github.com/google/gnostic-models v0.6.8 // indirect 58 | github.com/google/go-cmp v0.6.0 // indirect 59 | github.com/google/gofuzz v1.2.0 // indirect 60 | github.com/google/uuid v1.6.0 // indirect 61 | github.com/josharian/intern v1.0.0 // indirect 62 | github.com/json-iterator/go v1.1.12 // indirect 63 | github.com/mailru/easyjson v0.7.7 // indirect 64 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 65 | github.com/modern-go/reflect2 v1.0.2 // indirect 66 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 67 | github.com/pkg/errors v0.9.1 // indirect 68 | github.com/prometheus/client_golang v1.20.5 // indirect 69 | github.com/prometheus/client_model v0.6.1 // indirect 70 | github.com/prometheus/common v0.55.0 // indirect 71 | github.com/prometheus/procfs v0.15.1 // indirect 72 | github.com/spf13/pflag v1.0.5 // indirect 73 | github.com/x448/float16 v0.8.4 // indirect 74 | go.uber.org/multierr v1.11.0 // indirect 75 | golang.org/x/net v0.33.0 // indirect 76 | golang.org/x/oauth2 v0.24.0 // indirect 77 | golang.org/x/sync v0.10.0 // indirect 78 | golang.org/x/sys v0.28.0 // indirect 79 | golang.org/x/term v0.27.0 // indirect 80 | golang.org/x/text v0.21.0 // indirect 81 | golang.org/x/time v0.8.0 // indirect 82 | gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect 83 | google.golang.org/protobuf v1.35.2 // indirect 84 | gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect 85 | gopkg.in/inf.v0 v0.9.1 // indirect 86 | gopkg.in/yaml.v3 v3.0.1 // indirect 87 | k8s.io/apiextensions-apiserver v0.32.0 // indirect 88 | k8s.io/client-go v0.32.0 // indirect 89 | k8s.io/klog/v2 v2.130.1 // indirect 90 | k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect 91 | k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect 92 | sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect 93 | sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect 94 | sigs.k8s.io/yaml v1.4.0 // indirect 95 | ) 96 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= 2 | cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= 3 | cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= 4 | cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= 5 | cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= 6 | cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= 7 | github.com/TwiN/gatus/v5 v5.15.0 h1:bhDzIrCCnGgGqZpv7gwgERmIW76N7dwLdIq7g4CDu0k= 8 | github.com/TwiN/gatus/v5 v5.15.0/go.mod h1:QfXBiU6OqCD5r/UYup22LfKPqGgwNQxtBQGH50cQJLY= 9 | github.com/TwiN/gocache/v2 v2.2.2 h1:4HToPfDV8FSbaYO5kkbhLpEllUYse5rAf+hVU/mSsuI= 10 | github.com/TwiN/gocache/v2 v2.2.2/go.mod h1:WfIuwd7GR82/7EfQqEtmLFC3a2vqaKbs4Pe6neB7Gyc= 11 | github.com/TwiN/logr v0.3.1 h1:CfTKA83jUmsAoxqrr3p4JxEkqXOBnEE9/f35L5MODy4= 12 | github.com/TwiN/logr v0.3.1/go.mod h1:BZgZFYq6fQdU3KtR8qYato3zUEw53yQDaIuujHb55Jw= 13 | github.com/TwiN/whois v1.1.9 h1:m20+m1CXnrstie+tW2ZmAJkfcT9zgwpVRUFsKeMw+ng= 14 | github.com/TwiN/whois v1.1.9/go.mod h1:TjipCMpJRAJYKmtz/rXQBU6UGxMh6bk8SHazu7OMnQE= 15 | github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= 16 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= 17 | github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= 18 | github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 19 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 20 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 21 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 22 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= 23 | github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 24 | github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= 25 | github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= 26 | github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= 27 | github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= 28 | github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= 29 | github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= 30 | github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= 31 | github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= 32 | github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= 33 | github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= 34 | github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= 35 | github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= 36 | github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 37 | github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= 38 | github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= 39 | github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= 40 | github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= 41 | github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= 42 | github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= 43 | github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= 44 | github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= 45 | github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= 46 | github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= 47 | github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= 48 | github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= 49 | github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= 50 | github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= 51 | github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= 52 | github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= 53 | github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= 54 | github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= 55 | github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= 56 | github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 57 | github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= 58 | github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= 59 | github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= 60 | github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= 61 | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 62 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 63 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 64 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 65 | github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= 66 | github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 67 | github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= 68 | github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= 69 | github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= 70 | github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= 71 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 72 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 73 | github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= 74 | github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= 75 | github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= 76 | github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= 77 | github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2 h1:i2fYnDurfLlJH8AyyMOnkLHnHeP8Ff/DDpuZA/D3bPo= 78 | github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg= 79 | github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= 80 | github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= 81 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 82 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 83 | github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= 84 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 85 | github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= 86 | github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= 87 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 88 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 89 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 90 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 91 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 92 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 93 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 94 | github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= 95 | github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 96 | github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ= 97 | github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ= 98 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 99 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 100 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 101 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 102 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 103 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= 104 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= 105 | github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= 106 | github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= 107 | github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4= 108 | github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= 109 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 110 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 111 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 112 | github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= 113 | github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 114 | github.com/prometheus-community/pro-bing v0.4.0 h1:YMbv+i08gQz97OZZBwLyvmmQEEzyfyrrjEaAchdy3R4= 115 | github.com/prometheus-community/pro-bing v0.4.0/go.mod h1:b7wRYZtCcPmt4Sz319BykUU241rWLe1VFXyiyWK/dH4= 116 | github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= 117 | github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= 118 | github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= 119 | github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 120 | github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= 121 | github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= 122 | github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= 123 | github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= 124 | github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= 125 | github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= 126 | github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= 127 | github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= 128 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 129 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 130 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 131 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 132 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 133 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 134 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 135 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 136 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 137 | github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= 138 | github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 139 | github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= 140 | github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= 141 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 142 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 143 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= 144 | go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= 145 | go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= 146 | go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= 147 | go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= 148 | go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= 149 | go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= 150 | go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= 151 | go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= 152 | go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= 153 | go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= 154 | go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= 155 | go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= 156 | go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= 157 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 158 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 159 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 160 | golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= 161 | golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= 162 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 163 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 164 | golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= 165 | golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 166 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 167 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 168 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 169 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 170 | golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= 171 | golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 172 | golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= 173 | golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= 174 | golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= 175 | golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 176 | golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= 177 | golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 178 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 179 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 180 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 181 | golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= 182 | golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 183 | golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= 184 | golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 185 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 186 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 187 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 188 | golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= 189 | golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 190 | golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= 191 | golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 192 | golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= 193 | golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= 194 | golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= 195 | golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= 196 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 197 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 198 | golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= 199 | golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 200 | golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= 201 | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= 202 | golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= 203 | golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 204 | golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= 205 | golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= 206 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 207 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 208 | golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 209 | golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= 210 | golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= 211 | golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= 212 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 213 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 214 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 215 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 216 | gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= 217 | gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= 218 | google.golang.org/api v0.214.0 h1:h2Gkq07OYi6kusGOaT/9rnNljuXmqPnaig7WGPmKbwA= 219 | google.golang.org/api v0.214.0/go.mod h1:bYPpLG8AyeMWwDU6NXoB00xC0DFkikVvd5MfwoxjLqE= 220 | google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= 221 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= 222 | google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= 223 | google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= 224 | google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= 225 | google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= 226 | google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 227 | google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= 228 | google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= 229 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 230 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 231 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 232 | gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= 233 | gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= 234 | gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= 235 | gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= 236 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 237 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 238 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 239 | k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= 240 | k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= 241 | k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0= 242 | k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw= 243 | k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= 244 | k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= 245 | k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= 246 | k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= 247 | k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= 248 | k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= 249 | k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= 250 | k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= 251 | k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= 252 | k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= 253 | sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE= 254 | sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= 255 | sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= 256 | sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= 257 | sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= 258 | sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= 259 | sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= 260 | sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= 261 | -------------------------------------------------------------------------------- /internal/gatus-operator/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | type Config struct { 8 | MetricsAddr string 9 | ProbeAddr string 10 | LogLevel string 11 | ConfigPath string 12 | DevMode bool 13 | } 14 | 15 | func Generate() *Config { 16 | config := &Config{ 17 | MetricsAddr: func() string { 18 | if addr := os.Getenv("METRICS_ADDR"); addr != "" { 19 | return addr 20 | } 21 | return ":8080" 22 | }(), 23 | ProbeAddr: func() string { 24 | if addr := os.Getenv("PROBE_ADDR"); addr != "" { 25 | return addr 26 | } 27 | return ":8081" 28 | }(), 29 | LogLevel: func() string { 30 | if level := os.Getenv("LOG_LEVEL"); level != "" { 31 | return level 32 | } 33 | return "info" 34 | }(), 35 | ConfigPath: func() string { 36 | if path := os.Getenv("CONFIG_PATH"); path != "" { 37 | return path 38 | } 39 | return "/config/config.yaml" 40 | }(), 41 | DevMode: func() bool { 42 | if devMode := os.Getenv("DEV_MODE"); devMode != "" { 43 | return devMode == "true" 44 | } 45 | return false 46 | }(), 47 | } 48 | return config 49 | } 50 | -------------------------------------------------------------------------------- /internal/gatus-operator/config/defaults.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "os" 7 | "strings" 8 | 9 | "github.com/aumer-amr/gatus-operator/v2/api/v1alpha1" 10 | "gopkg.in/yaml.v3" 11 | ) 12 | 13 | func getDefaults() (*v1alpha1.EndpointEndpoint, error) { 14 | configuration := Generate() 15 | filePath := configuration.ConfigPath 16 | 17 | file, err := os.Open(filePath) 18 | if err != nil { 19 | return nil, err 20 | } 21 | defer file.Close() 22 | 23 | var defaults = v1alpha1.EndpointEndpoint{} 24 | decoder := yaml.NewDecoder(file) 25 | if err := decoder.Decode(&defaults); err != nil { 26 | return nil, fmt.Errorf("failed to decode YAML: %v", err) 27 | } 28 | 29 | return &defaults, nil 30 | } 31 | 32 | func HasDefaults() bool { 33 | _, err := getDefaults() 34 | return err == nil 35 | } 36 | 37 | func ApplyDefaults(override v1alpha1.EndpointEndpoint) v1alpha1.EndpointEndpoint { 38 | base, err := getDefaults() 39 | if err != nil { 40 | return override 41 | } 42 | 43 | jsonOverride, err := json.Marshal(override) 44 | if err != nil { 45 | return override 46 | } 47 | 48 | err = json.NewDecoder(strings.NewReader(string(jsonOverride))).Decode(&base) 49 | if err != nil { 50 | panic(err) 51 | } 52 | 53 | return *base 54 | } 55 | -------------------------------------------------------------------------------- /internal/gatus-operator/controller/controller.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "context" 5 | 6 | gatusiov1alpha1 "github.com/aumer-amr/gatus-operator/v2/api/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | ctrl "sigs.k8s.io/controller-runtime" 9 | client "sigs.k8s.io/controller-runtime/pkg/client" 10 | ) 11 | 12 | var logger = ctrl.Log.WithName("controller") 13 | 14 | type ReconcileGatus struct { 15 | client.Client 16 | } 17 | 18 | func (r *ReconcileGatus) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { 19 | logger.Info("reconciling", "request", req) 20 | 21 | gatus := &gatusiov1alpha1.Gatus{} 22 | err, cacheMiss := r.checkCache(ctx, req.NamespacedName.String(), gatus) 23 | 24 | if err != nil { 25 | if cacheMiss { 26 | return ctrl.Result{}, nil 27 | } 28 | logger.Error(err, "unable to fetch Gatus") 29 | return ctrl.Result{}, err 30 | } 31 | 32 | err = r.gatusReconcile(ctx, gatus) 33 | if err != nil { 34 | logger.Error(err, "unable to reconcile Gatus") 35 | return ctrl.Result{}, err 36 | } 37 | 38 | return ctrl.Result{}, nil 39 | } 40 | 41 | func (r *ReconcileGatus) checkCache(ctx context.Context, namespacedName string, typed client.Object) (error, bool) { 42 | err := r.Client.Get(ctx, client.ObjectKey{Name: namespacedName}, typed) 43 | if err != nil { 44 | if errors.IsNotFound(err) { 45 | logger.Error(err, "Cache miss", "namespacedName", namespacedName) 46 | return err, true 47 | } 48 | logger.Error(err, "Failed to get object from cache", "namespacedName", namespacedName) 49 | return err, false 50 | } 51 | 52 | return nil, false 53 | } 54 | -------------------------------------------------------------------------------- /internal/gatus-operator/controller/gatus.go: -------------------------------------------------------------------------------- 1 | package controller 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | gatusiov1alpha1 "github.com/aumer-amr/gatus-operator/v2/api/v1alpha1" 8 | config "github.com/aumer-amr/gatus-operator/v2/internal/gatus-operator/config" 9 | corev1 "k8s.io/api/core/v1" 10 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 11 | "sigs.k8s.io/controller-runtime/pkg/client" 12 | "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" 13 | "sigs.k8s.io/yaml" 14 | ) 15 | 16 | const FINALIZER_NAME = "gatus.io/finalizer" 17 | 18 | func (r *ReconcileGatus) gatusReconcile(ctx context.Context, gatus *gatusiov1alpha1.Gatus) error { 19 | logger.Info("reconciling Gatus", "name", gatus.Name, "namespace", gatus.Namespace) 20 | 21 | configMapList := corev1.ConfigMapList{} 22 | err := r.List(ctx, &configMapList, client.MatchingLabels{ 23 | "app.kubernetes.io/managed-by": "gatus-operator", 24 | "gatus.io/parent-uid": string(gatus.ObjectMeta.UID), 25 | }) 26 | if err != nil { 27 | return err 28 | } 29 | 30 | if gatus.ObjectMeta.DeletionTimestamp.IsZero() { 31 | if !controllerutil.ContainsFinalizer(gatus, FINALIZER_NAME) { 32 | controllerutil.AddFinalizer(gatus, FINALIZER_NAME) 33 | r.Update(ctx, gatus) 34 | } 35 | } else { 36 | hasFinalizer := controllerutil.ContainsFinalizer(gatus, FINALIZER_NAME) 37 | 38 | if len(configMapList.Items) == 1 { 39 | configMap := configMapList.Items[0] 40 | err := r.deleteConfigMap(ctx, configMap) 41 | if err != nil { 42 | return err 43 | } 44 | 45 | if hasFinalizer { 46 | controllerutil.RemoveFinalizer(gatus, FINALIZER_NAME) 47 | if err := r.Update(ctx, gatus); err != nil { 48 | return err 49 | } 50 | } 51 | } 52 | 53 | if hasFinalizer { 54 | controllerutil.RemoveFinalizer(gatus, "gatus.io/finalizer") 55 | if err := r.Update(ctx, gatus); err != nil { 56 | return err 57 | } 58 | } 59 | return nil 60 | } 61 | 62 | if len(configMapList.Items) == 0 { 63 | return r.createConfigMap(ctx, gatus) 64 | } 65 | 66 | if len(configMapList.Items) == 1 { 67 | configMap := configMapList.Items[0] 68 | return r.updateConfigMap(ctx, gatus, configMap) 69 | } 70 | 71 | return nil 72 | } 73 | 74 | func (r *ReconcileGatus) createConfigMap(ctx context.Context, gatus *gatusiov1alpha1.Gatus) error { 75 | yamlString, err := r.getEndpointsYaml(gatus) 76 | if err != nil { 77 | return fmt.Errorf("error getting YAML: %w", err) 78 | } 79 | 80 | configMap := &corev1.ConfigMap{ 81 | ObjectMeta: r.generateMetaData(gatus), 82 | Data: map[string]string{ 83 | "gatus.yaml": yamlString, 84 | }, 85 | } 86 | 87 | r.Create(ctx, configMap) 88 | 89 | return nil 90 | } 91 | 92 | func (r *ReconcileGatus) updateConfigMap(ctx context.Context, gatus *gatusiov1alpha1.Gatus, configMap corev1.ConfigMap) error { 93 | yamlString, err := r.getEndpointsYaml(gatus) 94 | if err != nil { 95 | return fmt.Errorf("error getting YAML: %w", err) 96 | } 97 | 98 | configMap.Data["gatus.yaml"] = yamlString 99 | 100 | return r.Update(ctx, &configMap) 101 | } 102 | 103 | func (r *ReconcileGatus) deleteConfigMap(ctx context.Context, configMap corev1.ConfigMap) error { 104 | return r.Delete(ctx, &configMap) 105 | } 106 | 107 | func (r *ReconcileGatus) getEndpointsYaml(gatus *gatusiov1alpha1.Gatus) (string, error) { 108 | type GatusEndpoint struct { 109 | Endpoints []gatusiov1alpha1.EndpointEndpoint `json:"endpoints"` 110 | } 111 | 112 | gatusEndpoint := config.ApplyDefaults(gatus.Spec.Endpoint) 113 | 114 | yamlBytes, err := yaml.Marshal(GatusEndpoint{Endpoints: []gatusiov1alpha1.EndpointEndpoint{gatusEndpoint}}) 115 | if err != nil { 116 | return "", fmt.Errorf("error converting struct to YAML: %v", err) 117 | } 118 | 119 | yamlString := string(yamlBytes) 120 | 121 | return yamlString, nil 122 | } 123 | 124 | func (r *ReconcileGatus) generateMetaData(gatus *gatusiov1alpha1.Gatus) metav1.ObjectMeta { 125 | return metav1.ObjectMeta{ 126 | Name: fmt.Sprintf("%s-%s", gatus.Name, "gatus-config"), 127 | Namespace: gatus.Namespace, 128 | Labels: map[string]string{ 129 | "app.kubernetes.io/managed-by": "gatus-operator", 130 | "gatus.io/enabled": "enabled", 131 | "gatus.io/parent-uid": string(gatus.ObjectMeta.UID), 132 | }, 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /internal/gatus-operator/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/aumer-amr/gatus-operator/v2/internal/gatus-operator/config" 5 | "github.com/aumer-amr/gatus-operator/v2/internal/gatus-operator/manager" 6 | "go.uber.org/zap/zapcore" 7 | ctrl "sigs.k8s.io/controller-runtime" 8 | "sigs.k8s.io/controller-runtime/pkg/log/zap" 9 | ) 10 | 11 | func main() { 12 | config := config.Generate() 13 | 14 | logLevel, err := zapcore.ParseLevel(config.LogLevel) 15 | if err != nil { 16 | logLevel = zapcore.InfoLevel 17 | } 18 | 19 | ctrl.SetLogger(zap.New(zap.Level(logLevel), zap.UseDevMode(true))) 20 | 21 | manager.Run() 22 | } 23 | -------------------------------------------------------------------------------- /internal/gatus-operator/manager/manager.go: -------------------------------------------------------------------------------- 1 | package manager 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | 7 | gatusiov1alpha1 "github.com/aumer-amr/gatus-operator/v2/api/v1alpha1" 8 | config "github.com/aumer-amr/gatus-operator/v2/internal/gatus-operator/config" 9 | "github.com/aumer-amr/gatus-operator/v2/internal/gatus-operator/controller" 10 | corev1 "k8s.io/api/core/v1" 11 | "k8s.io/apimachinery/pkg/runtime" 12 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 13 | clientgoscheme "k8s.io/client-go/kubernetes/scheme" 14 | ctrl "sigs.k8s.io/controller-runtime" 15 | "sigs.k8s.io/controller-runtime/pkg/healthz" 16 | "sigs.k8s.io/controller-runtime/pkg/metrics/server" 17 | ) 18 | 19 | var ( 20 | logger = ctrl.Log.WithName("manager") 21 | scheme = runtime.NewScheme() 22 | ) 23 | 24 | func init() { 25 | utilruntime.Must(clientgoscheme.AddToScheme(scheme)) 26 | utilruntime.Must(gatusiov1alpha1.AddToScheme(scheme)) 27 | } 28 | 29 | func Run() error { 30 | logger.Info("setting up") 31 | 32 | configuration := config.Generate() 33 | 34 | if configuration.DevMode { 35 | logger.Info("running in dev mode, setting up local kubeconfig") 36 | 37 | var kubeConfig string 38 | flagSet := flag.NewFlagSet("kubeconfig", flag.ExitOnError) 39 | flagSet.StringVar(&kubeConfig, "kubeconfig", "../../kubeconfig", "Path to the kubeconfig file to use for CLI requests.") 40 | 41 | ctrl.RegisterFlags(flagSet) 42 | } 43 | 44 | manager, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ 45 | Scheme: scheme, 46 | HealthProbeBindAddress: configuration.ProbeAddr, 47 | LeaderElection: false, 48 | Metrics: server.Options{ 49 | BindAddress: configuration.MetricsAddr, 50 | }, 51 | }) 52 | if err != nil { 53 | logger.Error(err, "unable to start") 54 | return err 55 | } 56 | 57 | if err := manager.AddHealthzCheck("healthz", healthz.Ping); err != nil { 58 | panic(fmt.Errorf("unable to add healthz check: %w", err)) 59 | } 60 | if err := manager.AddReadyzCheck("readyz", healthz.Ping); err != nil { 61 | panic(fmt.Errorf("unable to add readyz check: %w", err)) 62 | } 63 | 64 | logger.Info(fmt.Sprintf("endpoint defaults found: %v", config.HasDefaults())) 65 | 66 | err = ctrl.NewControllerManagedBy(manager). 67 | For(&gatusiov1alpha1.Gatus{}). 68 | Owns(&gatusiov1alpha1.Gatus{}). 69 | Owns(&corev1.ConfigMap{}). 70 | Complete(&controller.ReconcileGatus{ 71 | Client: manager.GetClient(), 72 | }) 73 | if err != nil { 74 | logger.Error(err, "unable to setup controller") 75 | return err 76 | } 77 | 78 | logger.Info("starting") 79 | if err := manager.Start(ctrl.SetupSignalHandler()); err != nil { 80 | logger.Error(err, "problem running") 81 | return err 82 | } 83 | return nil 84 | } 85 | -------------------------------------------------------------------------------- /rbac.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: gatus-operator 7 | name: gatus-manager 8 | namespace: observability 9 | --- 10 | apiVersion: rbac.authorization.k8s.io/v1 11 | kind: ClusterRole 12 | metadata: 13 | labels: 14 | app.kubernetes.io/name: gatus-operator 15 | name: gatus-manager-role 16 | rules: 17 | - apiGroups: [""] 18 | resources: 19 | - "configmaps" 20 | verbs: 21 | - get 22 | - list 23 | - watch 24 | - create 25 | - update 26 | - patch 27 | - delete 28 | - apiGroups: 29 | - gatus.io 30 | resources: 31 | - gatuses 32 | verbs: 33 | - get 34 | - list 35 | - watch 36 | - apiGroups: 37 | - gatus.io 38 | resources: 39 | - gatuses/status 40 | verbs: 41 | - get 42 | --- 43 | apiVersion: rbac.authorization.k8s.io/v1 44 | kind: ClusterRoleBinding 45 | metadata: 46 | labels: 47 | app.kubernetes.io/name: gatus-operator 48 | name: gatus-manager-rolebinding 49 | roleRef: 50 | apiGroup: rbac.authorization.k8s.io 51 | kind: ClusterRole 52 | name: gatus-manager-role 53 | subjects: 54 | - kind: ServiceAccount 55 | name: gatus-manager 56 | namespace: observability 57 | -------------------------------------------------------------------------------- /resources/test.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: gatus.io/v1alpha1 3 | kind: Gatus 4 | metadata: 5 | name: gatus-test 6 | namespace: observability 7 | spec: 8 | endpoint: 9 | name: gatus-test 10 | url: https://example.com -------------------------------------------------------------------------------- /resources/test_config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | enabled: true 3 | interval: 5m 4 | conditions: ["[STATUS] == 200"] 5 | client: 6 | dns-resolver: tcp://1.1.1.1:53 --------------------------------------------------------------------------------