Skip to content

Commit

Permalink
Merge pull request #305 from chrisdoherty4/v0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdoherty4 authored Oct 13, 2023
2 parents bbf9e13 + b37f996 commit 1354917
Show file tree
Hide file tree
Showing 16 changed files with 284 additions and 355 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
Expand All @@ -31,7 +31,7 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
Expand All @@ -48,7 +48,7 @@ jobs:
name: Test - Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
Expand All @@ -68,7 +68,7 @@ jobs:
platform: [amd64, arm64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
Expand All @@ -89,7 +89,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test, integration]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
Expand All @@ -107,7 +107,7 @@ jobs:
runs-on: ubuntu-latest
needs: [lint, build, test, e2e]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# We need to specify a name for the download action else artifacts are downloaded with
# whatever name they were uploaded with. Its required because the Dockerfile expects
Expand All @@ -122,7 +122,7 @@ jobs:
run: chmod +x hegel-linux-*

- name: Generate image tags
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
id: meta
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -132,17 +132,17 @@ jobs:
type=sha
- name: Login to quay.io
uses: docker/login-action@v2
uses: docker/login-action@v3
if: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v3

- name: Build images and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: ./
cache-from: type=registry,ref=${{ env.IMAGE }}:latest
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,29 @@
# an associated docker image.
name: Latest
on:
workflow_dispatch: {}
release:
types: [published, edited]

env:
REGISTRY: quay.io
IMAGE: quay.io/${{ github.repository }}

jobs:
latest:
name: Update latest image tag
runs-on: ubuntu-latest
steps:
- run: |
LATEST=$(curl -H "Accept: application/json" https://api.github.com/repos/tinkerbell/hegel/releases/latest | jq .name -r)
docker pull {{ env.IMAGE }}:$LATEST
docker tag {{ env.IMAGE }}:$LATEST {{ env.IMAGE }}:latest
docker push {{ env.IMAGE }}:latest
- name: Login to quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- uses: docker/setup-buildx-action@v3

- name: Tag and push
run: |
LATEST_RELEASE=$(curl -H "Accept: application/json" https://api.github.com/repos/tinkerbell/hegel/releases/latest | jq .name -r)
docker buildx imagetools create --tag ${{ env.IMAGE }}:latest ${{ env.IMAGE }}:$LATEST_RELEASE
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Login to quay.io
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
Expand All @@ -26,7 +26,7 @@ jobs:
# ci.yaml workflow.
- name: Generate source image name
id: src
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: ${{ env.IMAGE }}
Expand All @@ -35,7 +35,7 @@ jobs:

- name: Generate image release tags
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: ${{ env.IMAGE }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.17.3
FROM alpine:3.18.4

# Define args for the target platform so we can identify the binary in the Docker context.
# These args are populated by Docker. The values should match Go's GOOS and GOARCH values for
Expand Down
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ do not hesitate to raise an issue.

## Quick Start

**Pre-requisits**
- Make
- Go
- Docker with BuildKit

```sh
# Build a Docker image for the host platform.
$ make image

# See the "How to impersonate an instance?" FAQ to launch Hegel. Ensure you use `hegel:latest`
# as the image name to use the newly built image.
# To test the image see the "How to impersonate an instance?" FAQ to launch Hegel. Ensure you use
# hegel:latest as the image name to use the newly built image.
```

See ["How do I Impersonate an Instance?"](#how-do-i-impersonate-an-instance) to launch Hegel and
Expand Down Expand Up @@ -74,16 +79,15 @@ submit requests with the `X-Forwarded-For` header set to the IP they wish to imp
```sh
# Launch Hegel trusting the Docker default gateway so we can impersonate machines.
#
# 172.17.0.1 is the addressed used by Docker for NAT when exposing ports. This includes Docker
# Desktop setups where the address won't be visible in `ip` output on the host. If you customize
# the container network subnet this address may be different.
# The trusted proxy 0.0.0.0/0 causes Hegel to trust all requesters. The sample flatfile.yml is
# configured to output success messages on when the API calls are successful.
#
# If the container doesn't launch and there's no `docker run` logging remove the --rm flag
# so the container remains on disk and can be inspected with `docker logs`.
docker run --rm -d --name=hegel \
-p 50061:50061 \
-v $PWD/samples/flatfile.yml:/flatfile.yml \
-e HEGEL_TRUSTED_PROXIES="172.17.0.1" \
-e HEGEL_TRUSTED_PROXIES="0.0.0.0/0" \
-e HEGEL_BACKEND="flatfile" \
-e HEGEL_FLATFILE_PATH="/flatfile.yml" \
quay.io/tinkerbell/hegel:latest
Expand Down
98 changes: 47 additions & 51 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,110 +3,106 @@ module github.com/tinkerbell/hegel
go 1.19

require (
github.com/equinix-labs/otel-init-go v0.0.7
github.com/gin-gonic/gin v1.9.0
github.com/equinix-labs/otel-init-go v0.0.9
github.com/gin-gonic/gin v1.9.1
github.com/go-logr/logr v1.2.4
github.com/go-logr/zerologr v1.2.3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/packethost/pkg v0.0.0-20211110202003-387414657e83
github.com/google/go-cmp v0.6.0
github.com/packethost/xff v0.0.0-20190305172552-d3e9190c41b3
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.15.1
github.com/rollbar/rollbar-go/errors v0.0.0-20211129211054-6380fe0f262a // indirect
github.com/prometheus/client_golang v1.17.0
github.com/rs/zerolog v1.31.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.15.0
github.com/spf13/viper v1.16.0
github.com/tinkerbell/tink v0.8.0
google.golang.org/grpc v1.52.0 // indirect
gopkg.in/yaml.v2 v2.4.0
k8s.io/apimachinery v0.27.1
k8s.io/apimachinery v0.27.4
k8s.io/client-go v0.26.3
sigs.k8s.io/controller-runtime v0.14.6
)

require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/bytedance/sonic v1.9.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/go-playground/validator/v10 v10.14.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rollbar/rollbar-go v1.4.2 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
go.opentelemetry.io/otel v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect
go.opentelemetry.io/otel/sdk v1.11.2 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
go.opentelemetry.io/otel v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.18.0 // indirect
go.opentelemetry.io/otel/metric v1.18.0 // indirect
go.opentelemetry.io/otel/sdk v1.18.0 // indirect
go.opentelemetry.io/otel/trace v1.18.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230911183012-2d3300fd4832 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832 // indirect
google.golang.org/grpc v1.58.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.26.3 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230308215209-15aac26d736a // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand Down
Loading

0 comments on commit 1354917

Please sign in to comment.