Skip to content

Commit

Permalink
rename to metal-bmc (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Jul 1, 2022
1 parent 781843e commit 2a59bf9
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 144 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Docker Build Action
on:
pull_request:
branches:
- master
release:
types:
- published
push:
branches:
- master

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Docker Build
runs-on: ubuntu-latest

steps:
- name: Log in to the container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}

- name: Checkout
uses: actions/checkout@v2

- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: '1.18.x'

- name: Lint
uses: golangci/golangci-lint-action@v2
with:
args: --build-tags integration -p bugs -p unused --timeout=3m

- name: Make tag
run: |
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "tag=${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'release' ] && echo "tag=${GITHUB_REF##*/}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
- name: Build and push image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.tag }}
29 changes: 0 additions & 29 deletions .github/workflows/master.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/pull_request.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Release Drafter Action

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 0 additions & 29 deletions .github/workflows/release.yaml

This file was deleted.

9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM metalstack/builder:latest as builder
FROM golang:1.18 as builder
WORKDIR /work
COPY . .
RUN make

FROM r.metal-stack.io/metal/supermicro:2.8.1 as sum

Expand All @@ -12,7 +15,7 @@ RUN apt update \
# /usr/bin/sum is provided by busybox
&& rm /usr/bin/sum

COPY --from=builder /work/bin/bmc-catcher /
COPY --from=builder /work/bin/metal-bmc /
COPY --from=sum /usr/bin/sum /usr/bin/sum

CMD ["/bmc-catcher"]
CMD ["/metal-bmc"]
38 changes: 21 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
BINARY := bmc-catcher
MAINMODULE := github.com/metal-stack/bmc-catcher
COMMONDIR := $(or ${COMMONDIR},../builder)
DOCKER_TAG := $(or ${GITHUB_TAG_NAME}, latest)
.ONESHELL:
SHA := $(shell git rev-parse --short=8 HEAD)
GITVERSION := $(shell git describe --long --all)
BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},devel)

include $(COMMONDIR)/Makefile.inc
all: test metal-bmc

release:: test all;
.PHONY: test
test:
go test -v ./...

.PHONY: fmt
fmt:
GO111MODULE=off go fmt ./...

.PHONY: dockerimage
dockerimage:
docker build -t metalstack/bmc-catcher:${DOCKER_TAG} .

.PHONY: dockerpush
dockerpush:
docker push metalstack/bmc-catcher:${DOCKER_TAG}
.PHONY: metal-bmc
metal-bmc:
go build \
-trimpath \
-tags netgo \
-ldflags "-X 'github.com/metal-stack/v.Version=$(VERSION)' \
-X 'github.com/metal-stack/v.Revision=$(GITVERSION)' \
-X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \
-X 'github.com/metal-stack/v.BuildDate=$(BUILDDATE)'" \
-o bin/metal-bmc \
main.go
strip bin/metal-bmc
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# bmc-catcher
# metal-bmc

Reports the ip addresses that are leased to ipmi devices together with their machine uuids to the `metal-api`.
`metal-bmc` is responsible to gather data from machines via the out of band interfaces and report them back to the metal-api.
It also passes commands to the machines like power on/off, led on/off, firmware update etc.
Access to the console of a machine is also terminated here in conjunction with the `metal-console` running in the control-plane.

More details per package as follows:

## Reporter

Reporter reports the ip addresses that are leased to ipmi devices together with their machine uuids to the `metal-api`.
Therewith it is possible to have knowledge about new machines very early in the `metal-api` and also get knowledge about possibly changing ipmi ip addresses.
`metal-bmc` parses the DHCPD lease file and reports the mapping of machine uuids to ipmi ip address to the `metal-api`.

## BMC

The `bmc` package serves the following:

### Commands

Commands from the metal-api are passed via nsq and executed either through redfish or ipmi against the out-of-band interface of a machine.

### Firmware

Firmware updates the firmware of the BIOS and the BMC of a machine.

### Console

`bmc-catcher` parses the DHCPD lease file and reports the mapping of machine uuids to ipmi ip address to the `metal-api`.
Console forwards the the serial console access terminated in `metal-console` to the machine.
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
version: '3.7'

services:
bmc-catcher:
metal-bmc:
build:
context: .
image: metalstack/bmc-catcher:latest
image: metalstack/metal-bmc:latest
network_mode: host
volumes:
- ${PWD}/dhcpd.leases:/dhcpd.leases
Expand Down
15 changes: 0 additions & 15 deletions docker-make.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/metal-stack/bmc-catcher
module github.com/metal-stack/metal-bmc

go 1.18

Expand Down
4 changes: 2 additions & 2 deletions internal/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"syscall"
"time"

"github.com/metal-stack/bmc-catcher/domain"
"github.com/metal-stack/bmc-catcher/internal/leases"
"github.com/metal-stack/metal-bmc/domain"
"github.com/metal-stack/metal-bmc/internal/leases"
metalgo "github.com/metal-stack/metal-go"
"github.com/metal-stack/metal-go/api/client/machine"
"github.com/metal-stack/metal-go/api/models"
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"fmt"

"github.com/metal-stack/bmc-catcher/domain"
"github.com/metal-stack/bmc-catcher/internal/bmc"
"github.com/metal-stack/metal-bmc/domain"
"github.com/metal-stack/metal-bmc/internal/bmc"
metalgo "github.com/metal-stack/metal-go"

"github.com/metal-stack/bmc-catcher/internal/reporter"
"github.com/metal-stack/metal-bmc/internal/reporter"
"github.com/metal-stack/v"

"github.com/kelseyhightower/envconfig"
Expand Down

0 comments on commit 2a59bf9

Please sign in to comment.