Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Project Refactoring #191

Merged
merged 24 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 63 additions & 63 deletions .github/workflows/test_and_publish.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Test and publish

on:
on:
push:
branches:
- main
- release-*
- main
- release-*
tags:
- 'v*'
- 'v*'
pull_request:
branches:
- main
- release-*
- main
- release-*

jobs:
test:
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.18'
go-version: '1.21.3'

- name: Check out the repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -50,67 +50,67 @@ jobs:
strategy:
matrix:
image:
- nodecontribution
- nodelabeler
- selectivedeployment
- subnamespace
- tenant
- tenantrequest
- rolerequest
- tenantresourcequota
- vpnpeer
- clusterrolerequest
- sliceclaim
- slice
- notifier
- admissioncontrol
- cluster
- clusterlabeler
- fedlet
- fedscheduler
- managercache
- selectivedeploymentanchor
- nodecontribution
- nodelabeler
- selectivedeployment
- subnamespace
- tenant
- tenantrequest
- rolerequest
- tenantresourcequota
- vpnpeer
- clusterrolerequest
- sliceclaim
- slice
- notifier
- admissioncontrol
- cluster
- clusterlabeler
- fedlet
- fedscheduler
- managercache
- selectivedeploymentanchor
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.18'
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.21.3'

- name: Install dependencies
run: |
go mod download
go mod vendor
- name: Install dependencies
run: |
go mod download
go mod vendor

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# See https://github.com/docker/metadata-action for the generated tags
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: edgenetio/${{ matrix.image }}
# See https://github.com/docker/metadata-action for the generated tags
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: edgenetio/${{ matrix.image }}

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push ${{ matrix.image }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./build/images/${{ matrix.image }}/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=edgenetio/${{ matrix.image }}:buildcache
cache-to: type=registry,ref=edgenetio/${{ matrix.image }}:buildcache,mode=max
- name: Build and push ${{ matrix.image }}
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./build/images/${{ matrix.image }}/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=edgenetio/${{ matrix.image }}:buildcache
cache-to: type=registry,ref=edgenetio/${{ matrix.image }}:buildcache,mode=max
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ examples/selective-deployment/object/error-handling
examples/*.txt
examples/*/*.txt
code-generator
hack

cmd/dnsrecords

Expand Down
44 changes: 24 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# When initially cloned the project, run make sync to download the libraries.
# Then run the
GOCMD=go
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
Expand All @@ -12,46 +14,48 @@ GIT_VERSION:=$(or \
)
.PHONY: build

sync:
$(GOCLEAN) --modcache
$(GOMOD)

all:
GO111MODULE=on GOBIN=${GOPATH}/bin go install -mod=vendor \
-gcflags="all=-trimpath=$GOPATH" \
-asmflags="all=-trimpath=$GOPATH" \
-ldflags="-X github.com/EdgeNet-Project/edgenet.CurrentVersion=$(GIT_VERSION)" \
./cmd/...

# DO NOT MAUALLY RUN
# This is for github actions.
bootstrap:
mkdir -p ${HOME}/.kube
cp ./configs/public.cfg ${HOME}/.kube/config
cp ./configs/smtp_test_template.yaml ./configs/smtp_test.yaml
cp ./configs/headnode_template.yaml ./configs/headnode.yaml
cp ./configs/namecheap_template.yaml ./configs/namecheap.yaml

fedmanctl:
$(GOCMD) install ./cmd/fedmanctl/fedmanctl.go

gen:
./hack/update-codegen.sh

sync:
$(GOCLEAN) --modcache
$(GOMOD)

test:
$(GOCLEAN) -testcache ./...
$(GOTEST) -covermode atomic ./... -v
find ./assets/certs ! -name 'README.md' -type f -exec rm -f {} +
find ./assets/kubeconfigs ! -name 'README.md' -type f -exec rm -f {} +
cp ./configs/smtp_test_template.yaml ./configs/smtp_test.yaml
cp ./configs/headnode_template.yaml ./configs/headnode.yaml
cp ./configs/namecheap_template.yaml ./configs/namecheap.yaml
$(GOCLEAN) -testcache
$(GOTEST) -covermode atomic ./...

build:
docker-compose -f ./build/yamls/docker-compose.yml build
docker-compose -f ./build/yamls/docker-compose.yaml build

rebuild: stop clean build start

start: build
docker-compose -f ./build/yamls/docker-compose.yml up -d
docker-compose -f ./build/yamls/docker-compose.yaml up -d

run:
docker-compose -f ./build/yamls/docker-compose.yml up -d
docker-compose -f ./build/yamls/docker-compose.yaml up -d

stop:
docker-compose -f ./build/yamls/docker-compose.yml down
docker-compose -f ./build/yamls/docker-compose.yaml down

clean:
docker-compose -f ./build/yamls/docker-compose.yml down --rmi all
docker-compose -f ./build/yamls/docker-compose.yaml down --rmi all
$(GOCLEAN)

lint:
Expand Down
4 changes: 2 additions & 2 deletions build/images/admissioncontrol/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o admissioncontrol ./cmd/admissioncontrol/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/cluster/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o cluster ./cmd/cluster/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/clusterlabeler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o clusterlabeler ./cmd/clusterlabeler/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/clusterrolerequest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o clusterrolerequest ./cmd/clusterrolerequest/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/fedlet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o fedlet ./cmd/fedlet/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/fedscheduler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o fedscheduler ./cmd/fedscheduler/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/managercache/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o managercache ./cmd/managercache/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/nodecontribution/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o nodecontribution ./cmd/nodecontribution/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/nodelabeler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o nodelabeler ./cmd/nodelabeler/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
4 changes: 2 additions & 2 deletions build/images/notifier/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18.3-alpine AS build
FROM golang:1.21.3-alpine AS build

WORKDIR /edgenet

Expand All @@ -9,7 +9,7 @@ COPY . ./
ENV CGO_ENABLED=0
RUN go build -o notifier ./cmd/notifier/

FROM alpine:3.16.2
FROM alpine:3.18.4

RUN adduser -D -u 8118 edgenet
USER edgenet:edgenet
Expand Down
Loading
Loading