-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
6efa850
commit a947d56
Showing
13 changed files
with
522 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: docker | ||
directory: . | ||
schedule: | ||
interval: daily | ||
|
||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Add To GitHub Projects | ||
|
||
on: | ||
issues: | ||
types: | ||
- opened | ||
pull_request: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
add-to-osinfra-project: | ||
name: Open Source Infrastructure (as Code) | ||
uses: osinfra-io/github-misc-called-workflows/.github/workflows/[email protected] | ||
with: | ||
project_id: 1 | ||
secrets: | ||
add_to_project_pat: ${{ secrets.ADD_TO_PROJECT_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Docker Build and Push | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-and-push: | ||
name: Build and Push GKE Info Go | ||
runs-on: ubuntu-latest | ||
env: | ||
VERSION: ${{ github.event.release.tag_name }} | ||
|
||
steps: | ||
# Checkout | ||
# https://github.com/marketplace/actions/checkout | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Docker Buildx | ||
# https://github.com/marketplace/actions/docker-setup-buildx | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
# Docker Login | ||
# https://github.com/marketplace/actions/docker-login | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build and Push Docker to GitHub Container Registry | ||
# https://github.com/marketplace/actions/build-and-push-docker-images | ||
|
||
- name: Build and Push GitHub Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
tags: | | ||
ghcr.io/osinfra-io/gke-info-go:${{ env.VERSION }} | ||
ghcr.io/osinfra-io/gke-info-go:latest | ||
cache-from: type=registry,ref=ghcr.io/osinfra-io/gke-info-go:latest | ||
cache-to: type=inline | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Docker Build and Test | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build and Test | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout | ||
# https://github.com/marketplace/actions/checkout | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Docker Buildx | ||
# https://github.com/marketplace/actions/docker-setup-buildx | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
|
||
# Docker Login | ||
# https://github.com/marketplace/actions/docker-login | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build and Test Docker images | ||
# https://github.com/marketplace/actions/build-and-push-docker-images | ||
|
||
- name: Build | ||
uses: docker/[email protected] | ||
with: | ||
tags: | | ||
ghcr.io/osinfra-io/gke-info-go:test | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
load: true | ||
|
||
- name: Test | ||
run: | | ||
docker run --rm ghcr.io/osinfra-io/gke-info-go:test go version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Dependabot Approve and Merge | ||
|
||
on: pull_request_target | ||
|
||
jobs: | ||
dependabot: | ||
name: Dependabot | ||
uses: osinfra-io/github-misc-called-workflows/.github/workflows/[email protected] | ||
secrets: | ||
pr_approve_and_merge_pat: ${{ secrets.PR_APPROVE_AND_MERGE_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# .gitignore | ||
# https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files | ||
|
||
# Datadog Static Analysis | ||
static-analysis.datadog.yml | ||
|
||
|
||
# Other Files | ||
*.log | ||
*.bak | ||
*.swp | ||
*.tmp | ||
*.gz | ||
*.tgz | ||
*.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-symlinks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM golang:1.22.3 | ||
|
||
ARG DD_GIT_REPOSITORY_URL | ||
ARG DD_GIT_COMMIT_SHA | ||
ENV DD_GIT_REPOSITORY_URL=${DD_GIT_REPOSITORY_URL} | ||
ENV DD_GIT_COMMIT_SHA=${DD_GIT_COMMIT_SHA} | ||
|
||
WORKDIR /app | ||
|
||
COPY main.go . | ||
|
||
RUN go mod init gke-status | ||
RUN go mod tidy | ||
RUN go build -o main . | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# GKE Info Go | ||
|
||
[![Docker Build and Test](https://github.com/osinfra-io/gke-info-go/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/osinfra-io/gke-info-go/actions/workflows/build-and-test.yml) | ||
|
||
## Usage | ||
|
||
```yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: gke-info-go | ||
namespace: gke-info | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: gke-info-go | ||
version: v1 | ||
template: | ||
metadata: | ||
labels: | ||
app: gke-info-go | ||
version: v1 | ||
spec: | ||
containers: | ||
- image: ghcr.io/osinfra-io/gke-info-go:latest | ||
imagePullPolicy: IfNotPresent | ||
name: gke-info-go | ||
ports: | ||
- containerPort: 8080 | ||
imagePullSecrets: | ||
- name: github-container-registry-key | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: gke-info-go | ||
namespace: gke-info | ||
labels: | ||
app: gke-info-go | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app: gke-info-go | ||
|
||
``` | ||
|
||
After deploying the above, you can check the status of the cluster by running: | ||
|
||
```bash | ||
kubectl port-forward --namespace gke-info $(kubectl get pod --namespace gke-info --selector="app=gke-info-go" --output jsonpath='{.items[0].metadata.name}') 8080:8080 | ||
``` | ||
|
||
Open your browser to <http://localhost:8080/cluster-name> and you should see the name of the cluster. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module gke-status | ||
|
||
go 1.21.1 | ||
|
||
require gopkg.in/DataDog/dd-trace-go.v1 v1.63.1 | ||
|
||
require ( | ||
github.com/DataDog/datadog-go/v5 v5.3.0 // indirect | ||
github.com/DataDog/gostackparse v0.7.0 // indirect | ||
github.com/Microsoft/go-winio v0.6.1 // indirect | ||
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect | ||
github.com/google/uuid v1.5.0 // indirect | ||
github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 // indirect | ||
github.com/spaolacci/murmur3 v1.1.0 // indirect | ||
golang.org/x/mod v0.12.0 // indirect | ||
golang.org/x/sys v0.18.0 // indirect | ||
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect | ||
) |
Oops, something went wrong.