Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update kubebuilder scaffold to v4.4.0 #218

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7b13c5c
feat: update kubebuilder scaffold to v4.4.0
pl4nty Jan 20, 2025
993f86f
fix: readd gateway roles, finalizer func
pl4nty Jan 20, 2025
918c609
linting
pl4nty Jan 20, 2025
e321130
fix: gateway and e2e tests
pl4nty Jan 21, 2025
0746762
refactor: update workflow triggers and improve project version handling
pl4nty Jan 21, 2025
a9a8c41
install prom for ServiceMonitor CRD
pl4nty Jan 21, 2025
279d091
test: add setup for Cloudflare Secret and GatewayClass in suite tests
pl4nty Jan 21, 2025
a3f8414
test: rename Cloudflare Secret in suite tests
pl4nty Jan 21, 2025
b5275b4
more logging
pl4nty Jan 21, 2025
e557344
fix: gateway log
pl4nty Jan 21, 2025
1c19f9c
fix: make install
pl4nty Jan 21, 2025
833d8df
fix: gateway status
pl4nty Jan 21, 2025
9a6f900
fix: gateway status
pl4nty Jan 21, 2025
a5319ee
fix: e2e consts
pl4nty Jan 21, 2025
2b33652
fix: bump e2e timeout
pl4nty Jan 21, 2025
8c0167e
e2e manager logs
pl4nty Jan 21, 2025
11aa480
fix logging
pl4nty Jan 21, 2025
1d04947
Update manager.yaml
pl4nty Jan 21, 2025
ac8eb10
fix: don't clean up after e2e test
pl4nty Jan 21, 2025
c4ef58b
fix: e2e metrics test
pl4nty Jan 21, 2025
cd17620
fix: e2e push
pl4nty Jan 23, 2025
53ce7d2
feat: update kubebuilder scaffod to v4.5.0
pl4nty Jan 26, 2025
0404618
fix: don't renovate scaffolded deps
pl4nty Jan 26, 2025
82f48bb
fix: manager.yaml
pl4nty Jan 26, 2025
cea0499
fix: cloudflared metrics
pl4nty Jan 26, 2025
3013dae
fix: deployment spec
pl4nty Jan 26, 2025
a4fb2b7
fix: cloudflared version
pl4nty Jan 26, 2025
059e72f
fix: status/ratelimit logging and filter predicate
pl4nty Jan 26, 2025
1fe5ba1
fix: predicate dep
pl4nty Jan 26, 2025
efd4ce2
fix: more status logging
pl4nty Jan 26, 2025
9911a85
fix: patch status instead of update
pl4nty Jan 26, 2025
3d0f54b
fix: revert to Status.Update
pl4nty Jan 26, 2025
2f3425a
fix: revert some gateway changes
pl4nty Jan 26, 2025
6d0a715
fix: restore status and eventfilter
pl4nty Jan 26, 2025
c504cf6
fix: revert again and test in cluster
pl4nty Jan 27, 2025
6b660c6
fix: e2e push
pl4nty Jan 27, 2025
89614f4
fix: readd some of gateway
pl4nty Jan 27, 2025
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
44 changes: 20 additions & 24 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "cloudflare-kubernetes-gateway",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1.23",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
"ghcr.io/audacioustux/devcontainers/kubebuilder:1": {},
"ghcr.io/devcontainers-contrib/features/act:1": {},
"ghcr.io/mpriscella/features/kind:1": {}
}
"name": "Kubebuilder DevContainer",
"image": "docker.io/golang:1.23",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/git:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
"runArgs": ["--network=host"],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ms-azuretools.vscode-docker"
]
}
},

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"onCreateCommand": "bash .devcontainer/post-install.sh"
}

23 changes: 23 additions & 0 deletions .devcontainer/post-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -x

curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/kind

curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/linux/amd64
chmod +x kubebuilder
mv kubebuilder /usr/local/bin/

KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
curl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/kubectl

docker network create -d=bridge --subnet=172.19.0.0/24 kind

kind version
kubebuilder version
docker --version
go version
kubectl version --client
11 changes: 11 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
"postUpdateOptions": [
"gomodTidy"
],
"packageRules": [
{
"matchPackageNames": [
"go",
"k8s.io/**",
"sigs.k8s.io/controller-runtime",
"github.com/onsi/**"
],
"enabled": false
}
],
"regexManagers": [
{
"description": "Process custom dependencies",
Expand Down
74 changes: 7 additions & 67 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,73 +1,13 @@
name: CI
on: [push]
name: Release
on:
push:
branches:
- main
tags:
- 'v*'

jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/[email protected]
- uses: securego/[email protected]
with:
args: "-no-fail -fmt sarif -out results.sarif ./..."
- uses: github/codeql-action/[email protected]
with:
sarif_file: results.sarif

test:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version: stable

- run: make lint test

e2e:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
packages: write
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
go-version: stable

- name: Create kind cluster
uses: helm/[email protected]
with:
cluster_name: kind
- run: make test-e2e
continue-on-error: true
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Get manager logs
run: kubectl logs -n cloudflare-gateway deployment/cloudflare-controller-manager

- name: Upload conformance report
uses: actions/[email protected]
with:
name: conformance-report
path: '*-report.yaml'

- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- run: make docker-push IMG=ghcr.io/pl4nty/cloudflare-kubernetes-gateway:$(git describe --tag --always --match 'v[0-9]*')

release-please:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint

on:
pull_request:

jobs:
lint:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.63.4

scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/[email protected]
- uses: securego/[email protected]
with:
args: "-no-fail -fmt sarif -out results.sarif ./..."
- uses: github/codeql-action/[email protected]
with:
sarif_file: results.sarif
60 changes: 60 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: E2E Tests

on:
pull_request:

jobs:
test-e2e:
name: Run on Ubuntu
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install the latest version of kind
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

- name: Verify kind installation
run: kind version

- name: Create kind cluster
run: kind create cluster

- name: Running Test e2e
run: |
go mod tidy
make test-e2e
continue-on-error: true
env:
CERT_MANAGER_INSTALL_SKIP: true
E2E_TIMEOUT: 15m
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

- name: Get manager logs
run: kubectl logs -n cloudflare-gateway deployment/cloudflare-controller-manager

- name: Upload conformance report
uses: actions/[email protected]
with:
name: conformance-report
path: '*-report.yaml'

- uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- run: make docker-push IMG=ghcr.io/pl4nty/cloudflare-kubernetes-gateway:$(git describe --tag --always --dirty --match 'v[0-9]*')
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

on:
pull_request:

jobs:
test:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Running Tests
run: |
go mod tidy
make test
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ go.work
*.swp
*.swo
*~

config/crd
8 changes: 7 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ linters:
enable:
- dupl
- errcheck
- exportloopref
- copyloopvar
- ginkgolinter
- goconst
- gocyclo
Expand All @@ -34,8 +34,14 @@ linters:
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- typecheck
- unconvert
- unparam
- unused

linters-settings:
revive:
rules:
- name: comment-spacings
Loading
Loading