Skip to content

Commit

Permalink
chore: Add pre-commit
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Tucker <[email protected]>
  • Loading branch information
dave-tucker committed Jun 10, 2024
1 parent 235493a commit df240a3
Show file tree
Hide file tree
Showing 124 changed files with 433 additions and 395 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ body:
</details>
validations:
required: true

- type: textarea
id: kubeVersion
attributes:
Expand Down Expand Up @@ -111,11 +111,11 @@ body:
$ KEPLER_NAMESPACE=kepler
# provide kepler configmap
$ kubectl get configmap kepler-cfm -n ${KEPLER_NAMESPACE}
$ kubectl get configmap kepler-cfm -n ${KEPLER_NAMESPACE}
# paste output here
# provide kepler deployment description
$ kubectl describe deployment kepler-exporter -n ${KEPLER_NAMESPACE}
$ kubectl describe deployment kepler-exporter -n ${KEPLER_NAMESPACE}
```
For standalone:
Expand All @@ -141,4 +141,4 @@ body:
value: |
<details>
</details>
</details>
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ body:
attributes:
label: Why is this needed?
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
interval: daily
2 changes: 1 addition & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ changelog:
- '^fix.*'
- title: 👒 Chores
labels:
- '^chore.*'
- '^chore.*'
2 changes: 1 addition & 1 deletion .github/workflows/baseimage_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
pushImage: true
secrets:
username: ${{ secrets.BOT_NAME }}
password: ${{ secrets.BOT_TOKEN }}
password: ${{ secrets.BOT_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/developer_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Prepare environment
- name: Prepare environment
run: |
brew install cpuid
cd doc/ && sudo ./dev/prepare_dev_env.sh && cd -
cd doc/ && sudo ./dev/prepare_dev_env.sh && cd -
git config --global --add safe.directory /kepler
- name: Run
- name: Run
run: make test-mac-verbose

local_env:
Expand All @@ -32,4 +32,4 @@ jobs:
- name: local cluster set up
run: make cluster-up
- name: local container test
run: make container_test
run: make container_test
10 changes: 5 additions & 5 deletions .github/workflows/equinix_metal_flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ jobs:
sudo systemctl daemon-reload
sudo systemctl enable --now container-kepler
# curl kepler port 8888 with 10 seconds timeout and retry 5 times; if it fails, exit with error
for i in {1..5}; do
for i in {1..5}; do
echo "Attempt $i"
# curl and get http code
ret=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8888/metrics --max-time 10 --connect-timeout 10 || true)
if [ ${ret} -eq 200 ]; then
break
if [ ${ret} -eq 200 ]; then
break
fi
sleep 5
done
if [ ${ret} -ne 200 ]; then
if [ ${ret} -ne 200 ]; then
echo "Kepler did not start in time"
# exit 1
fi
Expand Down Expand Up @@ -146,4 +146,4 @@ jobs:
with:
authToken: ${{ secrets.EQUINIX_API_TOKEN }}
projectID: ${{ secrets.EQUINIX_PROJECT_ID }}
runnerName: ${{ needs.Install.outputs.runner-name }}
runnerName: ${{ needs.Install.outputs.runner-name }}
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
# for each PR ensure for local developer usage
developer_local:
uses: ./.github/workflows/developer_local.yml
# for each PR run integration test
# for each PR run integration test
integration_test:
uses: ./.github/workflows/integration_test.yml

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
make containerized_build_container_rpm
cd _output/rpmbuild/
sudo tar czvf /tmp/kepler.rpm.tar.gz RPMS/
- name: release rpm
uses: actions/upload-release-asset@v1
env:
Expand All @@ -85,21 +85,21 @@ jobs:
asset_path: /tmp/kepler.rpm.tar.gz
asset_name: kepler.rpm.tar.gz
asset_content_type: application/gzip

create-release-branch:
name: Create release branch
needs: [build]
runs-on: ubuntu-latest
steps:
steps:
- name: Create release branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: ${{ github.event.inputs.release }}
sha: '${{ github.event.pull_request.head.sha }}'


push-image:
name: Push image to the registry
needs: [build]
Expand All @@ -114,7 +114,7 @@ jobs:
name: download Kepler image SBOM
needs: [push-image]
runs-on: ubuntu-latest
steps:
steps:
- name: download from artifact
uses: actions/download-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/review_bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
github.event_name == 'pull_request' ||
github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.fork ||
(contains(github.event.comment.body, '@SeineSailor') && (
github.event_name == 'issue_comment' ||
github.event_name == 'issue_comment' ||
github.event_name == 'pull_request_review_comment' ||
github.event_name == 'discussion_comment')) ||
(github.event_name == 'issues' && contains(github.event.issue.body, '@SeineSailor')) ||
Expand All @@ -59,7 +59,7 @@ jobs:
in_code_block=true
fi
fi
# Process lines that are not in a code block or quoted
if [[ "$in_code_block" = false && ! "$line" =~ ^\> ]]; then
if echo "$line" | grep -q '@SeineSailor'; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
with:
name: kepler_rpm_${{ steps.git_version.outputs.git_version }}
path: /tmp/kepler.rpm.tar.gz
retention-days: 1
retention-days: 1
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: Scorecard supply-chain security
on:
workflow_call:

# Declare default permissions as read only.
permissions: read-all

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Prepare environment
run: |
sudo apt-get install -y cpuid clang
cd doc/ && sudo ./dev/prepare_dev_env.sh && cd -
cd doc/ && sudo ./dev/prepare_dev_env.sh && cd -
git config --global --add safe.directory /kepler
- name: install libbpf
uses: sustainable-computing-io/[email protected]
Expand Down
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
# Need to fix YAML first
# - id: check-yaml
- id: check-added-large-files
# Requires fixing and adding a configuration file
# - repo: https://github.com/adrienverge/yamllint
# rev: v1.35.1
# hooks:
# - id: yamllint
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
types_or: [c]
- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
hooks:
- id: golangci-lint
exclude: "^vendor/.*|^_output/.*|^bpfassets/libbpf/include/.*"
2 changes: 1 addition & 1 deletion ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

The list of organisations who are using Kepler can be found at <https://sustainable-computing.io/project/adopters/>.

To join the adopters list, please follow [these instructions](https://sustainable-computing.io/project/contributing/).
To join the adopters list, please follow [these instructions](https://sustainable-computing.io/project/contributing/).
2 changes: 1 addition & 1 deletion ADVISORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
|---|---|---|
| Sandro Mazziotta | Red Hat | [email protected] |
| Eun K Lee | IBM | [email protected] |
| Cathy Zhang | Intel | [email protected] |
| Cathy Zhang | Intel | [email protected] |
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ in kepler 0.7 release
- add initial NVIDIA DCGM support, this help monitor power consumption by NVIDIA GPU especially MIG instances.
- add new curvefit regressors to predict component power consumption
- add workload pipeline to build container base images on demand
- add ARM64 container image and RPM build support
- add ARM64 container image and RPM build support
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Based on different k8s cluster, for example, [kind](https://kind.sigs.k8s.io/):
Back to common checking process:
- Deploy Kepler to a local kind cluster with image stored at local image registry.
- Use kubectl to check that the change was applied as intended.

## Benchmark
steps:
```
Expand Down
10 changes: 5 additions & 5 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Leadership Election

Qualified new maintainers are approved via consensus by the group of existing maintainers.
Qualified new maintainers are approved via consensus by the group of existing maintainers.

## Technical Committee

Expand All @@ -18,7 +18,7 @@ The current list of technical committee members is published and updated in [Con

### Becoming a Technical Committee Member

Proficient in one or more of the following areas:
Proficient in one or more of the following areas:
* Developing and maintaining Kepler core
* Developing and maintaining Kepler deployment and integration (including Operator)
* Developing and maintaining Kepler model server and models
Expand All @@ -37,7 +37,7 @@ Responsibilities include:
* Contribute non-trivial pull requests
* Actively attend the community meetings
* Perform code reviews on other's pull requests
* Regularly triage GitHub issues.
* Regularly triage GitHub issues.
* Make sure that ongoing PRs are moving forward at the right pace or closing them
* Monitor Kepler Slack (delayed response is perfectly acceptable), particularly for the area of your expertise

Expand All @@ -46,7 +46,7 @@ Responsibilities include:
Responsibilities include:

* Perform code reviews on other's pull requests
* Regularly triage GitHub issues.
* Regularly triage GitHub issues.
* Make sure that ongoing PRs are moving forward at the right pace or closing them
* Monitor Kepler Slack (delayed response is perfectly acceptable), particularly for the area of your expertise

Expand All @@ -60,4 +60,4 @@ Advisory committee provides guidance for the overall direction of the Kepler pro

Members of the advisory committee are expected to be active in the Kepler community and attend the advisory committee meetings.
Members are expected to serve for a term of one year, with the option to renew for additional terms.
Members are invited and approved by the Kepler maintainers.
Members are invited and approved by the Kepler maintainers.
6 changes: 3 additions & 3 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Maintainers
# Maintainers
(as of May, 22nd, 2023)

| Name | Company | Github ID | Email |
Expand All @@ -15,8 +15,8 @@
| Marcelo Amaral | IBM | marceloamaral | [email protected] |
| Niki Manoledaki | Weaveworks | nikimanoledaki | [email protected] |
| Brad McCoy | Basiq | bradmccoydev | [email protected] |
| Sunyanan Choochotkaew | IBM | sunya-ch | [email protected] |
| Ruomeng Hao | Intel | ruomengh | [email protected] |
| Sunyanan Choochotkaew | IBM | sunya-ch | [email protected] |
| Ruomeng Hao | Intel | ruomengh | [email protected] |
| Chen Wang | IBM | wangchen615 | [email protected] |
| Sunil Thaha | Red Hat | sthaha | [email protected] |
| Jie Ren | Intel | jiere | [email protected] |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Kepler (Kubernetes Efficient Power Level Exporter) uses eBPF to probe energy-rel

As a CNCF Sandbox project, Kepler uses [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md)
## Architecture
Kepler Exporter exposes a variety of [metrics](https://sustainable-computing.io/design/metrics/) about the energy consumption of Kubernetes components such as Pods and Nodes.
Kepler Exporter exposes a variety of [metrics](https://sustainable-computing.io/design/metrics/) about the energy consumption of Kubernetes components such as Pods and Nodes.

![Architecture](doc/kepler-arch.png)

Expand Down
2 changes: 1 addition & 1 deletion automation/presubmit-tests/gofmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ if [ ! -z "$unformatted" ]; then
exit 1
fi

exit 0
exit 0
2 changes: 1 addition & 1 deletion data/legacy/power_model.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Architecture,cpu_instruction,cpu_cycle,intercept_core,cache_misses,memory_usage,intercept_dram
Cascade Lake,0.0000005268224465,0.0000005484982329,152121.0472,0.000004112383656,0,-23.70284983
Cascade Lake,0.0000005268224465,0.0000005484982329,152121.0472,0.000004112383656,0,-23.70284983
2 changes: 1 addition & 1 deletion data/model_weight/acpi_AbsPowerModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"platform": {"All_Weights": {"Bias_Weight": 220.9079278650894, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 29.028228361462897}}}}}
{"platform": {"All_Weights": {"Bias_Weight": 220.9079278650894, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 29.028228361462897}}}}}
2 changes: 1 addition & 1 deletion data/model_weight/acpi_DynPowerModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"platform": {"All_Weights": {"Bias_Weight": 49.56491877218095, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 28.501356366108837}}}}}
{"platform": {"All_Weights": {"Bias_Weight": 49.56491877218095, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 28.501356366108837}}}}}
2 changes: 1 addition & 1 deletion data/model_weight/intel_rapl_AbsPowerModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"package": {"All_Weights": {"Bias_Weight": 69.91739430907396, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 22.16772409328642}}}}, "core": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "uncore": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "dram": {"All_Weights": {"Bias_Weight": 47.142633336743344, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 3.57348245077466}}}}}
{"package": {"All_Weights": {"Bias_Weight": 69.91739430907396, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 22.16772409328642}}}}, "core": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "uncore": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "dram": {"All_Weights": {"Bias_Weight": 47.142633336743344, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 3.57348245077466}}}}}
2 changes: 1 addition & 1 deletion data/model_weight/intel_rapl_DynPowerModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"package": {"All_Weights": {"Bias_Weight": 38.856412561925055, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 22.258830113477515}}}}, "core": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "uncore": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "dram": {"All_Weights": {"Bias_Weight": 9.080889901856153, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 3.0358946796490924}}}}}
{"package": {"All_Weights": {"Bias_Weight": 38.856412561925055, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 22.258830113477515}}}}, "core": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "uncore": {"All_Weights": {"Bias_Weight": 0.0, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 0.0}}}}, "dram": {"All_Weights": {"Bias_Weight": 9.080889901856153, "Categorical_Variables": {}, "Numerical_Variables": {"bpf_cpu_time_ms": {"scale": 5911.969193263386, "mean": 0, "variance": 0, "weight": 3.0358946796490924}}}}}
27 changes: 26 additions & 1 deletion doc/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<!--toc:start-->
- [Getting Started](#getting-started)
- [Pre-requisites](#pre-requisites)
- [Create a new ephemeral local kubernetes cluster](#create-a-new-ephemeral-local-kubernetes-cluster)
- [Build and run kepler on your cluster](#build-and-run-kepler-on-your-cluster)
- [To run kepler externally to the cluster](#to-run-kepler-externally-to-the-cluster)
Expand All @@ -11,7 +12,31 @@
- [Build kepler and base multi-arch images](#build-kepler-and-base-multi-arch-images)
<!--toc:end-->

A quick start guide to get Kepler up and running inside your container-based development cluster.
A quick start guide to get Kepler up and running.

## Pre-requisites

This guide assumes you have the following installed:

- [Docker](https://docs.docker.com/get-docker/) or [Podman](https://podman.io/getting-started/installation)
- [Go](https://golang.org/doc/install)
- [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/)

In order to make contributions to Kepler, you need to have the following installed:

- [Pre-commit](https://pre-commit.com/#install)

You can install pre-commit by running the following command:

```bash
pip install pre-commit
```

After installing pre-commit, you need to install the pre-commit hooks by running the following command:

```bash
pre-commit install
```

## Create a new ephemeral local kubernetes cluster

Expand Down
Loading

0 comments on commit df240a3

Please sign in to comment.