Skip to content

Commit

Permalink
refactor: migrate kubebuilder, k8s dependencies and go version (#216)
Browse files Browse the repository at this point in the history
* rename dir `apis` to `api`

* move main.go and Dockerfile to cmd/manager/

* move controllers from controllers/ to internal/controller/ dir

* update PROJECT

* update suite_test.go

* update go and dependencies

* update github workflows

* simplifies Makefile

* fix manifests target in Makefile

* ignoring doc dirs when adding license header

* generate manifests

* fix worker Dockerfile

* update config/ files

* move status.go from pkg/apis/ to api/zora/v1alpha1/

* annotate package discovery to generate deepcopy implementation

* removing TODOs

* moving saas payloads to saas package

* update .gitignore

* merge packages plugins/errparse and plugins/cronjobs

* move saas package to internal

* delete worker/run/ package

* add template target in Makefile

* update rbac-proxy version

* 0.5.2-rc1

* fix Makefile

* fix manager Dockerfile

* add kustomize labels in config/ manifests

* rename config/rbac/ files
  • Loading branch information
matheusfm authored May 16, 2023
1 parent 3111726 commit dacf3d7
Show file tree
Hide file tree
Showing 161 changed files with 953 additions and 2,235 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/build.yaml

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish Docker images
name: docker
on:
workflow_dispatch:
workflow_call:
Expand All @@ -9,7 +9,7 @@ env:

jobs:
docker:
name: Build and push Docker image (${{ matrix.image }})
name: build and push '${{ matrix.image }}'
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -18,28 +18,28 @@ jobs:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile
- dockerfile: cmd/manager/Dockerfile
image: operator
- dockerfile: cmd/worker/Dockerfile
image: worker
steps:
- name: Checkout repository
- name: checkout
uses: actions/checkout@v3

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

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

- name: Log in to the Container registry
- name: login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
- name: metadata
id: meta
uses: docker/metadata-action@v4
with:
Expand All @@ -51,12 +51,12 @@ jobs:
type=ref,event=pr,prefix=pr-
type=sha,prefix=,format=long
- name: Create Dockerfile for cross-platform support
- name: create dockerfile.cross
run: |
sed -e '1 s/\(^FROM\)/FROM --platform=\$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$\{BUILDPLATFORM\}/' ${{ matrix.dockerfile }} > ${{ matrix.dockerfile }}.cross
cat ${{ matrix.dockerfile }}.cross
- name: Build and push Docker image
- name: build and push
uses: docker/build-push-action@v3
with:
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update docs
name: docs
on:
workflow_dispatch:
inputs:
Expand All @@ -12,49 +12,51 @@ on:
dev:
description: 'dev'
type: boolean

env:
GIT_USER: "github-actions"
GIT_EMAIL: "github-actions@github.com"

jobs:
docs:
name: Update docs ${{ inputs.version }}
name: update docs ${{ inputs.version }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: checkout
uses: actions/checkout@v3

- name: Set up Python
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Set up Go
- name: setup go
uses: actions/setup-go@v3

- name: Install MkDocs and Mike
- name: install mkdocs and mike
run: pip install mkdocs-material mike

- name: Set 'latest' alias
- name: set 'latest' alias
if: inputs.latest
run: echo 'alias=latest' >> $GITHUB_ENV

- name: Set 'dev' alias
- name: set 'dev' alias
if: inputs.dev
run: echo 'alias=dev' >> $GITHUB_ENV

- name: Fetch gh-pages branch
- name: fetch gh-pages branch
run: |
git config --global user.email "$GIT_EMAIL"
git config --global user.name "$GIT_USER"
git fetch origin gh-pages --depth=1
- name: Mike deploy
- name: mike deploy
run: |
cp -f charts/zora/README.md docs/helm-chart.md
cp -f charts/zora/values.yaml docs/values.yaml
mike deploy --update-aliases ${{ inputs.version }} ${{ env.alias }}
- name: Update titles and push
- name: update titles and push
run: |
git checkout gh-pages
go run update_titles.go
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/license.yaml

This file was deleted.

21 changes: 10 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Docker images and Helm chart
name: release
on:
workflow_dispatch:
push:
Expand All @@ -22,24 +22,24 @@ jobs:
secrets: inherit

goreleaser:
name: Create GitHub release
runs-on: ubuntu-latest
needs: [docker]
steps:
- name: Checkout repository
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch tags
- name: fetch tags
run: git fetch --force --tags

- name: Set up Go
- name: setup go
uses: actions/setup-go@v4
with:
go-version: stable
cache: true

- name: Release
- name: release
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
Expand All @@ -49,16 +49,15 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

helm:
name: Update Helm repository
runs-on: ubuntu-latest
needs: [goreleaser]
steps:
- name: Checkout repository
- name: checkout
uses: actions/checkout@v3
with:
path: main

- name: Checkout charts repository
- name: checkout charts
uses: actions/checkout@v3
with:
repository: undistro/charts.undistro.io
Expand All @@ -67,10 +66,10 @@ jobs:
token: ${{ secrets.BOT_TOKEN }} # GITHUB_TOKEN is scoped to the current repository, so we need a PAT to checkout a different repository and commit on it.
path: ${{ env.CHARTS_REPOSITORY_PATH }}

- name: Sync charts
- name: sync
run: rsync -avh --delete main/$CHART_PATH/ ${{ env.CHARTS_REPOSITORY_PATH }}/$CHART_PATH

- name: Commit and push
- name: commit and push
working-directory: ${{ env.CHARTS_REPOSITORY_PATH }}
run: |
git config --global user.email "$GIT_EMAIL"
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup go
uses: actions/setup-go@v3
with:
go-version: "1.19"
cache: true

- name: test
run: make test

- name: check license headers
run: make check-license

- name: build
run: make build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.dylib
bin
testbin/*
Dockerfile.cross

# Test binary, build with `go test -c`
*.test
Expand Down
Loading

0 comments on commit dacf3d7

Please sign in to comment.