Skip to content

Commit d545536

Browse files
authored
Merge pull request #1 from rebel-mskim/refactor/rust-to-go
refactor: replace rust implementation with go
2 parents ef4e65b + e994874 commit d545536

File tree

1,051 files changed

+470043
-2701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,051 files changed

+470043
-2701
lines changed

.github/ISSUE_TEMPLATE/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: true
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: Feature Suggestion
3+
description: Suggest a new functionality or enhancement for rbln-metrics-exporter
4+
title: "[Feature]: "
5+
labels: enhancement
6+
assignees: []
7+
8+
body:
9+
- type: markdown
10+
attributes:
11+
value: |
12+
Thank you for taking the time to suggest a new feature for **rbln-metrics-exporter**!
13+
Please fill in the details and help us understand your idea, why it matters and how it could be implemented.
14+
15+
- type: textarea
16+
attributes:
17+
label: Problem Statement
18+
description: Describe the current issue or limitation that this feature would address.
19+
placeholder: |
20+
* What are you trying to accomplish?
21+
* What is preventing you from accomplishing it today?
22+
validations:
23+
required: true
24+
25+
- type: textarea
26+
attributes:
27+
label: Suggestion Description
28+
description: Describe your idea or enhancement in detail.
29+
placeholder: |
30+
* What is the feature you’d like to see?
31+
* Why would it be useful?
32+
* How does it relate to existing functionality?
33+
validations:
34+
required: true
35+
36+
- type: input
37+
attributes:
38+
label: Operating System / Platform
39+
description: (Optional) If this feature is specific to a certain OS or platform.
40+
placeholder: "e.g. Ubuntu 22.04, RHEL 9"
41+
42+
- type: input
43+
attributes:
44+
label: Kubernetes Environment
45+
description: (Optional) Specify the Kubernetes distribution or environment you are using.
46+
placeholder: "e.g. Vanilla Kubernetes, OpenShift 4.15"
47+
48+
- type: input
49+
attributes:
50+
label: Kubernetes Version
51+
description: (Optional) Provide the version of Kubernetes in your environment.
52+
placeholder: "e.g. v1.28.3"
53+
54+
- type: textarea
55+
attributes:
56+
label: Additional Context
57+
description: Add any further context, screenshots, logs, links to proposals or references.
58+
validations:
59+
required: false
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: Bug Report
3+
description: Report a bug or unexpected behavior in rbln-metrics-exporter.
4+
title: "[Bug]: "
5+
labels: bug
6+
assignees: []
7+
8+
body:
9+
- type: markdown
10+
attributes:
11+
value: |
12+
Thank you for taking the time to report a bug in **rbln-metrics-exporter**!
13+
Please provide as much detail as possible so we can reproduce and fix the issue efficiently.
14+
15+
- type: textarea
16+
attributes:
17+
label: Problem Description
18+
description: Describe the unexpected behavior or issue in detail.
19+
placeholder: |
20+
* What went wrong?
21+
* What did you expect to happen instead?
22+
* When did the issue start occurring?
23+
validations:
24+
required: true
25+
26+
- type: input
27+
attributes:
28+
label: Kubernetes Environment
29+
description: Specify the Kubernetes distribution or platform.
30+
placeholder: "e.g. Vanilla Kubernetes, OpenShift 4.15"
31+
32+
- type: input
33+
attributes:
34+
label: Kubernetes Version
35+
description: Provide the Kubernetes version in your environment.
36+
placeholder: "e.g. v1.28.3"
37+
38+
- type: input
39+
attributes:
40+
label: Operating System / Platform
41+
description: Mention the OS and version used on the nodes.
42+
placeholder: "e.g. Ubuntu 22.04, RHEL 9"
43+
44+
- type: input
45+
attributes:
46+
label: Metrics Exporter Version
47+
description: Specify the rbln-metrics-exporter version or image tag.
48+
placeholder: "e.g. v0.1.3 or rebellions/rbln-metrics-exporter:v0.1.3"
49+
50+
- type: textarea
51+
attributes:
52+
label: Logs or Error Output
53+
description: Include any relevant logs, error messages, or stack traces.
54+
placeholder: |
55+
* Pod logs:
56+
```
57+
kubectl logs ds/rbln-metrics-exporter -n rbln-system
58+
```

.github/pull_request_template.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- Title should follow Conventional Commits: feat: , fix: , docs: , chore: , refactor: , perf: , test: -->
2+
# Pull Request Title: [type(scope?): subject]
3+
<!-- e.g. feat(metrics): add power status metrics -->
4+
5+
## Motivation
6+
<!-- Why are we making this change? What problem does it solve or feature does it add? -->
7+
8+
## Summary of Changes
9+
<!-- A high-level summary of what this PR does. Reference any related issues: “Closes #123” -->
10+
-
11+
-
12+
13+
## Technical Details
14+
<!-- Describe the implementation details. Include links to commits, issues, design docs if applicable. -->
15+
-
16+
-

.github/workflows/go-build.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Golang Code build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
go-build:
8+
name: golang build metrics exporter
9+
runs-on: ubuntu-latest-rbln
10+
steps:
11+
- uses: actions/checkout@v4
12+
name: Checkout code
13+
- name: Read tool versions and setup Go
14+
id: versions
15+
run: |
16+
GOLANG_VERSION=$(grep '^GOLANG_VERSION' versions.mk | cut -d'=' -f2 | tr -d ' ?')
17+
echo "golang-version=${GOLANG_VERSION}" >> $GITHUB_OUTPUT
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ steps.versions.outputs.golang-version }}
22+
cache: true
23+
- name: Build metrics exporter
24+
run: make build

.github/workflows/go-checks.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Golang Code Checks
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
code-check:
8+
name: golang code checks
9+
runs-on: ubuntu-latest-rbln
10+
steps:
11+
- uses: actions/checkout@v4
12+
name: Checkout code
13+
- name: Read tool versions and setup Go
14+
id: versions
15+
run: |
16+
GOLANG_VERSION=$(grep '^GOLANG_VERSION' versions.mk | cut -d'=' -f2 | tr -d ' ?')
17+
echo "golang-version=${GOLANG_VERSION}" >> $GITHUB_OUTPUT
18+
- name: Setup Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ steps.versions.outputs.golang-version }}
22+
cache: true
23+
- name: Run code-check
24+
run: make code-check

.github/workflows/release.yaml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Release Draft Pipeline
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-push-image:
13+
name: Build and push image
14+
runs-on: ubuntu-latest-rbln
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Login to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
registry: docker.io
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
28+
29+
- name: Build and push RBLN metrics exporter image
30+
env:
31+
VERSION: ${{ github.ref_name }}
32+
REGISTRY: docker.io/rebellions
33+
PUSH_ON_BUILD: "true"
34+
BUILD_MULTI_PLATFORM: "false" # TODO(mskim): revert when dedicated ARM runners become available
35+
run: make build-image
36+
37+
draft-release:
38+
needs:
39+
- build-and-push-image
40+
runs-on: ubuntu-latest-rbln
41+
steps:
42+
- name: Checkout repo
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Get previous tag
48+
id: prev
49+
run: |
50+
PREV_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "")
51+
echo "previous_tag=$PREV_TAG" >> $GITHUB_ENV
52+
echo "Previous tag: $PREV_TAG"
53+
54+
- name: Generate release notes
55+
run: |
56+
CURRENT_TAG=${GITHUB_REF_NAME}
57+
PREV_TAG=${previous_tag:-}
58+
59+
if [ -n "$PREV_TAG" ]; then
60+
RANGE="$PREV_TAG..$CURRENT_TAG"
61+
else
62+
RANGE="$CURRENT_TAG"
63+
fi
64+
65+
git log $RANGE --pretty=format:"%s" > commits.txt
66+
67+
FEATS=$(grep -E "^feat" commits.txt || true)
68+
FIXES=$(grep -E "^fix" commits.txt || true)
69+
DOCS=$(grep -E "^docs" commits.txt || true)
70+
REFACTORS=$(grep -E "^refactor" commits.txt || true)
71+
PERFS=$(grep -E "^perf" commits.txt || true)
72+
STYLES=$(grep -E "^style" commits.txt || true)
73+
BUILDS=$(grep -E "^build" commits.txt || true)
74+
CHORES=$(grep -E "^chore" commits.txt || true)
75+
TESTS=$(grep -E "^test" commits.txt || true)
76+
77+
{
78+
echo "# Release Notes"
79+
echo
80+
echo "## New Features"
81+
if [ -n "$FEATS" ]; then
82+
echo "$FEATS" | sed 's/^/- /'
83+
else
84+
echo "- TBD"
85+
fi
86+
echo
87+
88+
echo "## Improvements"
89+
IMPROVEMENTS=0
90+
91+
for GROUP in "$DOCS" "$REFACTORS" "$PERFS" "$STYLES" "$BUILDS" "$CHORES" "$TESTS"; do
92+
if [ -n "$GROUP" ]; then
93+
IMPROVEMENTS=1
94+
fi
95+
done
96+
97+
if [ $IMPROVEMENTS -eq 1 ]; then
98+
[ -n "$DOCS" ] && echo "$DOCS" | sed 's/^/- /'
99+
[ -n "$REFACTORS" ] && echo "$REFACTORS" | sed 's/^/- /'
100+
[ -n "$PERFS" ] && echo "$PERFS" | sed 's/^/- /'
101+
[ -n "$STYLES" ] && echo "$STYLES" | sed 's/^/- /'
102+
[ -n "$BUILDS" ] && echo "$BUILDS" | sed 's/^/- /'
103+
[ -n "$CHORES" ] && echo "$CHORES" | sed 's/^/- /'
104+
[ -n "$TESTS" ] && echo "$TESTS" | sed 's/^/- /'
105+
else
106+
echo "- TBD"
107+
fi
108+
echo
109+
110+
echo "## Fixed Issues"
111+
if [ -n "$FIXES" ]; then
112+
echo "$FIXES" | sed 's/^/- /'
113+
else
114+
echo "- TBD"
115+
fi
116+
echo
117+
118+
echo "## Known Issues"
119+
echo "- TBD"
120+
echo
121+
echo "_This draft was auto-generated for tag: ${CURRENT_TAG}_"
122+
} > release_notes.md
123+
124+
- name: Create draft release
125+
uses: softprops/action-gh-release@v2
126+
with:
127+
draft: true
128+
tag_name: ${{ github.ref_name }}
129+
name: "RBLN Metrics Exporter ${{ github.ref_name }} Release "
130+
body_path: release_notes.md
131+
env:
132+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/trigger-ci.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
code-check:
14+
uses: ./.github/workflows/go-checks.yaml
15+
go-build:
16+
uses: ./.github/workflows/go-build.yaml
17+
build-and-push-image:
18+
needs: [code-check, go-build]
19+
name: Build and push RBLN metrics exporter image
20+
runs-on: ubuntu-latest-rbln
21+
steps:
22+
- name: Checkout repo
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to Docker Hub
29+
uses: docker/login-action@v3
30+
with:
31+
registry: docker.io
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
34+
35+
- name: Build and push image
36+
env:
37+
VERSION: "latest"
38+
REGISTRY: docker.io/rebellions
39+
PUSH_ON_BUILD: "true"
40+
BUILD_MULTI_PLATFORM: "false" # TODO(mskim): revert when dedicated ARM runners become available
41+
run: make build-image

0 commit comments

Comments
 (0)