diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 810f4a80b4..4170651799 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -25,16 +25,6 @@ jobs: username: ${{ secrets.username }} password: ${{ secrets.password }} - - name: Build and push kepler latest (bcc) - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64 - push: true - tags: quay.io/sustainable_computing_io/kepler:latest-bcc - labels: latest-bcc - file: build/Dockerfile - - name: Build and push kepler latest (libbpf) uses: docker/build-push-action@v5 with: @@ -43,4 +33,4 @@ jobs: push: true tags: quay.io/sustainable_computing_io/kepler:latest labels: latest - file: build/Dockerfile.libbpf.kepler + file: build/Dockerfile diff --git a/.github/workflows/image_base.yml b/.github/workflows/image_base.yml index 05c20c722c..61b637181f 100644 --- a/.github/workflows/image_base.yml +++ b/.github/workflows/image_base.yml @@ -21,30 +21,6 @@ jobs: registry: quay.io/sustainable_computing_io username: ${{ secrets.BOT_NAME }} password: ${{ secrets.BOT_TOKEN }} - - name: Build and push bcc-amd64 - uses: docker/build-push-action@v5 - with: - context: . - file: ./build/Dockerfile.bcc.base - platforms: linux/amd64 - push: true - tags: quay.io/sustainable_computing_io/kepler_base:latest-bcc-amd64 - - name: Build and push bcc-s390x - uses: docker/build-push-action@v5 - with: - context: . - file: ./build/Dockerfile.bcc.base.s390x - platforms: linux/s390x - push: true - tags: quay.io/sustainable_computing_io/kepler_base:latest-bcc-s390x - - name: Build and push bcc-arm64 - uses: docker/build-push-action@v5 - with: - context: . - file: ./build/Dockerfile.bcc.base.arm64 - platforms: linux/arm64 - push: true - tags: quay.io/sustainable_computing_io/kepler_base:latest-bcc-arm64 - name: Build and push libbpf-amd64 uses: docker/build-push-action@v5 with: diff --git a/.github/workflows/integration_test_bcc.yml b/.github/workflows/integration_test_bcc.yml deleted file mode 100644 index a6ac27d3c4..0000000000 --- a/.github/workflows/integration_test_bcc.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Integration test with bcc - -on: - workflow_call: - -env: - OUTPUT_DIR: "_output/" - FILE_NAME: "kepler-bcc.tar.gz" - ARTIFACT_DIR: "/tmp/artifacts" - -jobs: - build-kepler-with-bcc: - runs-on: ubuntu-latest - steps: - # checkout source code - - name: checkout source - uses: actions/checkout@v4.1.1 - # set up golang - - name: install Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - # set up ebpf - - name: install bcc - uses: sustainable-computing-io/kepler-action@v0.0.4 - with: - ebpfprovider: bcc - # build kepler image - - name: build and export Kepler image - run: | - make build_containerized - make save-image - env: - IMAGE_REPO: "localhost:5001" - IMAGE_TAG: "devel" - IMAGE_NAME: "kepler" - CTR_CMD: docker - IMAGE_OUTPUT_PATH: ${{env.OUTPUT_DIR}}${{env.FILE_NAME}} - # save kepler image - - name: save Kepler image as artifact - uses: actions/upload-artifact@v3 - with: - name: kepler - path: ${{env.OUTPUT_DIR}}${{env.FILE_NAME}} - retention-days: 1 - # ref https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts - # as PR or Push event, we don't keep artifact in 90 days hence use 1 day here to save resources. - - integration_test: - needs: [build-kepler-with-bcc] - runs-on: ubuntu-latest - strategy: - matrix: - cluster_provider: [kind,microshift] - steps: - - name: checkout source - uses: actions/checkout@v4.1.1 - - - name: download Kepler image artifact - uses: actions/download-artifact@v3 - with: - name: kepler - - - name: build manifest - run: make build-manifest OPTS="CI_DEPLOY" - env: - CLUSTER_PROVIDER: ${{matrix.cluster_provider}} - IMAGE_REPO: "localhost:5001" - IMAGE_TAG: "devel" - CTR_CMD: docker - - - name: import Kepler image - run: make load-image - env: - IMAGE_REPO: "localhost:5001" - IMAGE_NAME: "kepler" - IMAGE_TAG: "devel" - CTR_CMD: docker - INPUT_PATH: ${{env.FILE_NAME}} - # set up k8s cluster with ebpf - - name: use Kepler action to deploy cluster - uses: sustainable-computing-io/kepler-action@v0.0.4 - with: - ebpfprovider: bcc - cluster_provider: ${{matrix.cluster_provider}} - local_dev_cluster_version: v0.0.3 - - - name: push Kepler image to local registry - run: | - make push-image - make image-prune - env: - IMAGE_REPO: "localhost:5001" - IMAGE_NAME: "kepler" - IMAGE_TAG: "devel" - CTR_CMD: docker - - - name: deploy Kepler on cluster - run: make cluster-deploy - env: - CLUSTER_PROVIDER: ${{matrix.cluster_provider}} - NO_BUILDS: true - - - name: Save artifacts - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: artifacts - path: ${{env.ARTIFACT_DIR}} - retention-days: 10 - - - name: run e2e tests - run: make e2e - env: - CLUSTER_PROVIDER: ${{matrix.cluster_provider}} - kepler_address: localhost:9102 - - - name: undeploy Kepler and cleanup the cluster - run: | - make cluster-clean - make cluster-down - env: - CLUSTER_PROVIDER: ${{matrix.cluster_provider}} diff --git a/.github/workflows/platform-validation.yml b/.github/workflows/platform-validation.yml index 5642ff5955..5beccfffe5 100644 --- a/.github/workflows/platform-validation.yml +++ b/.github/workflows/platform-validation.yml @@ -136,7 +136,7 @@ jobs: uses: sustainable-computing-io/kepler-action@v0.0.4 with: cluster_provider: ${{matrix.cluster_provider}} - ebpfprovider: bcc + ebpfprovider: libbpf local_dev_cluster_version: v0.0.3 prometheus_enable: true grafana_enable: true diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 975b7acd0c..aa41d399c2 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,9 +18,6 @@ jobs: # for each PR ensure for local developer usage developer_local: uses: ./.github/workflows/developer_local.yml - # for each PR run integration test - integration_test_bcc: - uses: ./.github/workflows/integration_test_bcc.yml # for each PR run integration test integration_test: uses: ./.github/workflows/integration_test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e91c711f2..5140afdbc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -124,16 +124,6 @@ jobs: username: ${{ secrets.BOT_NAME }} password: ${{ secrets.BOT_TOKEN }} - - name: Build and push kepler latest bcc image - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64 - push: true - tags: quay.io/sustainable_computing_io/kepler:latest, quay.io/sustainable_computing_io/kepler:${{ github.event.inputs.release }}-bcc - labels: latest, ${{ github.event.inputs.release }}, bcc - file: build/Dockerfile - - name: Build and push kepler latest libbpf image uses: docker/build-push-action@v5 with: @@ -142,7 +132,7 @@ jobs: push: true tags: quay.io/sustainable_computing_io/kepler:latest, quay.io/sustainable_computing_io/kepler:${{ github.event.inputs.release }} labels: latest, ${{ github.event.inputs.release }}, libbpf - file: build/Dockerfile.libbpf.kepler + file: build/Dockerfile - name: Generate SBOM uses: anchore/sbom-action@v0.15.1 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9ae060f4fb..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM quay.io/sustainable_computing_io/kepler_builder:ubi-9-libbpf-1.2.0 as builder - -WORKDIR /workspace - -COPY . . - -RUN ATTACHER_TAG=libbpf make build - -FROM registry.access.redhat.com/ubi9-minimal:9.2 -RUN microdnf -y update - -ENV NVIDIA_VISIBLE_DEVICES=all - -RUN INSTALL_PKGS=" \ - libbpf \ - " && \ - microdnf install -y $INSTALL_PKGS && \ - microdnf clean all - -COPY --from=builder /workspace/_output/bin/kepler /usr/bin/kepler -COPY --from=builder /libbpf-source/linux-5.14.0-333.el9/tools/bpf/bpftool/bpftool /usr/bin/bpftool -COPY --from=builder /usr/bin/cpuid /usr/bin/cpuid - -RUN mkdir -p /var/lib/kepler/data -RUN mkdir -p /var/lib/kepler/bpfassets -COPY --from=builder /workspace/data/cpus.yaml /var/lib/kepler/data/cpus.yaml -COPY --from=builder /workspace/bpfassets/libbpf/bpf.o /var/lib/kepler/bpfassets - -# copy model weight -COPY --from=builder /workspace/data/model_weight/acpi_AbsPowerModel.json /var/lib/kepler/data/acpi_AbsPowerModel.json -COPY --from=builder /workspace/data/model_weight/acpi_DynPowerModel.json /var/lib/kepler/data/acpi_DynPowerModel.json -COPY --from=builder /workspace/data/model_weight/rapl_AbsPowerModel.json /var/lib/kepler/data/rapl_AbsPowerModel.json -COPY --from=builder /workspace/data/model_weight/rapl_DynPowerModel.json /var/lib/kepler/data/rapl_DynPowerModel.json -ENTRYPOINT ["/usr/bin/kepler"] diff --git a/build/Dockerfile b/build/Dockerfile index 85f49ad7b2..9ae060f4fb 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,45 +1,34 @@ -# -# This Dockerfile is used for building the kepler default image: Dockerfile.bcc.kepler -# FROM quay.io/sustainable_computing_io/kepler_builder:ubi-9-libbpf-1.2.0 as builder -ARG BIN_TIMESTAMP -ARG SOURCE_GIT_TAG +WORKDIR /workspace -LABEL name=kepler-builder - -ENV GOPATH=/opt/app-root GO111MODULE=off GOROOT=/usr/local/go - -ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH +COPY . . -WORKDIR $GOPATH/src/github.com/sustainable-computing-io/kepler +RUN ATTACHER_TAG=libbpf make build +FROM registry.access.redhat.com/ubi9-minimal:9.2 +RUN microdnf -y update -COPY . . -RUN mkdir -p data -# Build kepler -RUN make build SOURCE_GIT_TAG=$SOURCE_GIT_TAG BIN_TIMESTAMP=$BIN_TIMESTAMP -RUN ls ./_output/bin -# RUN make test +ENV NVIDIA_VISIBLE_DEVICES=all -# build image -FROM quay.io/sustainable_computing_io/kepler_base:ubi-9-bcc-0.26 +RUN INSTALL_PKGS=" \ + libbpf \ + " && \ + microdnf install -y $INSTALL_PKGS && \ + microdnf clean all -COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/_output/bin/kepler /usr/bin/kepler +COPY --from=builder /workspace/_output/bin/kepler /usr/bin/kepler +COPY --from=builder /libbpf-source/linux-5.14.0-333.el9/tools/bpf/bpftool/bpftool /usr/bin/bpftool +COPY --from=builder /usr/bin/cpuid /usr/bin/cpuid RUN mkdir -p /var/lib/kepler/data -COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/cpus.yaml /var/lib/kepler/data/cpus.yaml - +RUN mkdir -p /var/lib/kepler/bpfassets +COPY --from=builder /workspace/data/cpus.yaml /var/lib/kepler/data/cpus.yaml +COPY --from=builder /workspace/bpfassets/libbpf/bpf.o /var/lib/kepler/bpfassets # copy model weight -COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/model_weight/acpi_AbsPowerModel.json /var/lib/kepler/data/acpi_AbsPowerModel.json -COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/model_weight/acpi_DynPowerModel.json /var/lib/kepler/data/acpi_DynPowerModel.json -COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/model_weight/rapl_AbsPowerModel.json /var/lib/kepler/data/rapl_AbsPowerModel.json -COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/model_weight/rapl_DynPowerModel.json /var/lib/kepler/data/rapl_DynPowerModel.json - -# pre install kernel sources -RUN mkdir -p /usr/share/kepler/kernel_sources - -COPY --from=quay.io/sustainable_computing_io/kepler_kernel_source_images:ubi9 /usr/src/kernels /usr/share/kepler/kernel_sources - +COPY --from=builder /workspace/data/model_weight/acpi_AbsPowerModel.json /var/lib/kepler/data/acpi_AbsPowerModel.json +COPY --from=builder /workspace/data/model_weight/acpi_DynPowerModel.json /var/lib/kepler/data/acpi_DynPowerModel.json +COPY --from=builder /workspace/data/model_weight/rapl_AbsPowerModel.json /var/lib/kepler/data/rapl_AbsPowerModel.json +COPY --from=builder /workspace/data/model_weight/rapl_DynPowerModel.json /var/lib/kepler/data/rapl_DynPowerModel.json ENTRYPOINT ["/usr/bin/kepler"]