Skip to content

Commit

Permalink
Initial rock definition (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrutlucian94 authored Aug 2, 2024
1 parent bf43f47 commit aa9ec7d
Show file tree
Hide file tree
Showing 20 changed files with 606 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Bug Report
description: Something is not working

body:
- type: markdown
attributes:
value: |
Thank you for submitting an issue. Please fill in the template below
information about the bug you encountered.
- type: textarea
id: summary
attributes:
label: Summary
description: Please explain the bug in a few short sentences.
placeholder: Detail the bug here...
validations:
required: true

- type: textarea
id: what-should-happen
attributes:
label: What Should Happen Instead?
description: Please explain what the expected behavior is.
placeholder: Explain the expected outcome...
validations:
required: true

- type: textarea
id: reproduction-steps
attributes:
label: Reproduction Steps
description: Are you able to consistently reproduce the issue? Please add a list of steps that lead to the bug.
placeholder: "1.\n2.\n"
validations:
required: true

- type: textarea
id: suggest-fix
attributes:
label: Can you suggest a fix?
description: How do you propose that the issue be fixed?
placeholder: Suggest a fix if you have one...

- type: textarea
id: contribute-fix
attributes:
label: Are you interested in contributing with a fix?
description: yes/no, or @mention maintainers. Community contributions are welcome.
placeholder: Are you willing to contribute a fix?

- type: markdown
attributes:
value: Thank you for making the rocks better
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature Request
about: Suggest a new feature
---

<!--
Thank you for submitting a feature request. Please fill the template below
with more details.
-->

#### Summary
<!-- Please explain the feature request in a few short sentences. -->

#### Why is this important?
<!-- Please explain the motivation, how it will be used, etc. -->

#### Are you interested in contributing to this feature?
<!-- yes/no, or @mention maintainers. -->


<!-- Thank you for making Canonical Kubernetes better -->
9 changes: 9 additions & 0 deletions .github/workflows/cla-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: cla-check
on: [pull_request_target]

jobs:
cla-check:
runs-on: ubuntu-latest
steps:
- name: Check if CLA signed
uses: canonical/has-signed-canonical-cla@v1
41 changes: 41 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Push Multiarch Images
on:
pull_request:
push:
branches:
- main

jobs:
build-and-push-arch-specifics:
name: Build Rocks and Push Arch Specific Images
uses: canonical/k8s-workflows/.github/workflows/build_rocks.yaml@main
with:
owner: ${{ github.repository_owner }}
trivy-image-config: "trivy.yaml"
multiarch-awareness: true
cache-action: ${{ (github.event_name == 'push') && 'save' || 'restore' }}
# pinning to use rockcraft 1.3.0 feature `entrypoint-service`
rockcraft-revisions: '{"amd64": "1783", "arm64": "1784"}'
arch-skipping-maximize-build-space: '["arm64"]'
platform-labels: '{"arm64": ["self-hosted", "Linux", "ARM64", "jammy"]}'
run-tests:
uses: canonical/k8s-workflows/.github/workflows/run_tests.yaml@main
needs: [build-and-push-arch-specifics]
secrets: inherit
with:
rock-metas: ${{ needs.build-and-push-arch-specifics.outputs.rock-metas }}
scan-images:
uses: canonical/k8s-workflows/.github/workflows/scan_images.yaml@main
needs: [build-and-push-arch-specifics]
secrets: inherit
with:
upload-result: ${{ github.event_name == 'push' }}
images: ${{ needs.build-and-push-arch-specifics.outputs.images }}
trivy-image-config: ./trivy.yaml
build-and-push-multiarch-manifest:
name: Combine Rocks and Push Multiarch Manifest
uses: canonical/k8s-workflows/.github/workflows/assemble_multiarch_image.yaml@main
needs: [build-and-push-arch-specifics]
with:
rock-metas: ${{ needs.build-and-push-arch-specifics.outputs.rock-metas }}
dry-run: ${{ github.event_name != 'push' }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.rock
**/__pycache__
.pytest_cache
.venv
.tox
88 changes: 88 additions & 0 deletions 0.7.8/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: kepler
summary: Kepler ROCK image.
description: >
This rock is a drop in replacement for the
quay.io/sustainable_computing_io/kepler:release-0.7.8 image.
version: 0.7.8
license: Apache-2.0

base: ubuntu@24.04
build-base: ubuntu@24.04
platforms:
amd64:

entrypoint-service: kepler
services:
kepler:
command: /usr/bin/kepler [ -h ]
override: replace
startup: enabled

parts:
build-deps:
plugin: nil
build-snaps:
- go/1.22/stable
build-packages:
- elfutils
- libbpf-dev
- libbpf-tools
- llvm
- clang
- gcc
- binutils-dev
- libcap-dev

kepler:
after: [build-deps]
plugin: go
source-type: git
source: https://github.com/sustainable-computing-io/kepler
source-tag: v0.7.8
source-depth: 1
override-build: |
export NVIDIA_VISIBLE_DEVICES=all
export NVIDIA_DRIVER_CAPABILITIES=utility
export NVIDIA_MIG_CONFIG_DEVICES=all
export NVIDIA_MIG_MONITOR_DEVICES=all
# The libbpf.a path is hard-coded in the kepler makefile, we'll
# copy it at the expected location.
cp /usr/lib/*-linux-gnu/libbpf.a /usr/lib64/libbpf.a
ATTACHER_TAG=libbpf make build
mkdir -p $CRAFT_PART_INSTALL/usr/bin
cp _output/bin/kepler $CRAFT_PART_INSTALL/usr/bin/kepler
mkdir -p $CRAFT_PART_INSTALL/var/lib/kepler/data
mkdir -p $CRAFT_PART_INSTALL/var/lib/kepler/bpf
cp data/cpus.yaml $CRAFT_PART_INSTALL/var/lib/kepler/data/cpus.yaml
cp -r bpfassets/libbpf/bpf.o $CRAFT_PART_INSTALL/var/lib/kepler/bpfassets
cp data/model_weight/acpi_AbsPowerModel.json $CRAFT_PART_INSTALL/var/lib/kepler/data/acpi_AbsPowerModel.json
cp data/model_weight/acpi_DynPowerModel.json $CRAFT_PART_INSTALL/var/lib/kepler/data/acpi_DynPowerModel.json
cp data/model_weight/intel_rapl_AbsPowerModel.json $CRAFT_PART_INSTALL/var/lib/kepler/data/intel_rapl_AbsPowerModel.json
cp data/model_weight/intel_rapl_DynPowerModel.json $CRAFT_PART_INSTALL/var/lib/kepler/data/intel_rapl_DynPowerModel.json
bpftool:
after: [build-deps]
plugin: nil
source-type: git
source: https://github.com/libbpf/bpftool.git
source-tag: v7.4.0
source-submodules:
- libbpf
source-depth: 1
override-build: |
cd src
make
mkdir -p $CRAFT_PART_INSTALL/usr/bin
cp bpftool $CRAFT_PART_INSTALL/usr/bin/bpftool
runtime-deps:
plugin: nil
stage-packages:
- libbpf1
- cpuid
Loading

0 comments on commit aa9ec7d

Please sign in to comment.