Skip to content

Commit e824e04

Browse files
committed
Big revamp to remove kube-rbac-proxyu and uptate to latest operator-sdk. Also improve e2e tests.
1 parent 964cada commit e824e04

102 files changed

Lines changed: 2092 additions & 1805 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ This is a Kubernetes operator that automates external load-balancer configuratio
1111
### Component Structure
1212

1313
```
14+
api/v1 # API Objects
1415
internal/controller/
15-
├── lb.lbconfig.carlosedp.com/ # Main reconciler
16-
│ └── externalloadbalancer_controller.go
17-
├── backend/
16+
├── externalloadbalancer_controller.go # Main reconciler
17+
├── backend/ # Backend management
1818
│ ├── backend_controller/ # Provider interface & orchestration
1919
│ ├── backend_loader/ # Auto-registers all providers via init()
20-
│ ├── f5/ # F5 BigIP implementation
21-
│ ├── netscaler/ # Citrix ADC implementation
22-
│ ├── haproxy/ # HAProxy Dataplane API implementation
23-
│ └── dummy/ # Testing provider
24-
api/lb.lbconfig.carlosedp.com/v1/ # CRD types
20+
│ ├── f5/ # F5 BigIP implementation
21+
│ ├── netscaler/ # Citrix ADC implementation
22+
│ ├── haproxy/ # HAProxy Dataplane API implementation
23+
│ └── dummy/ # Testing provider
24+
api/v1/ # CRD types
2525
```
2626

2727
### Provider Plugin Architecture
@@ -70,7 +70,7 @@ kubectl create secret generic dummy-creds \
7070
--from-literal=username=admin \
7171
--from-literal=password=admin \
7272
-n lbconfig-operator-system
73-
kubectl apply -f config/samples/lb_v1_externalloadbalancer-dummy.yaml
73+
kubectl apply -n lbconfig-operator-system -f examples/lb_v1_externalloadbalancer-dummy.yaml
7474
```
7575

7676
### Testing
@@ -81,6 +81,7 @@ kubectl apply -f config/samples/lb_v1_externalloadbalancer-dummy.yaml
8181
- **Scorecard**: `make scorecard-run` - Validates operator with OLM scorecard tests
8282

8383
**E2E Test Flow**:
84+
8485
1. `e2e-build` - Builds operator binary, Docker image, bundle manifests, and bundle image (local arch only)
8586
- Uses dev version: sets patch to 0 and adds `-dev` suffix (e.g., `0.5.1``v0.5.0-dev`) to distinguish from published releases
8687
- Images tagged as `E2E_IMG` and `E2E_BUNDLE_IMG` variables
@@ -155,10 +156,10 @@ Prometheus metrics:
155156

156157
### Modifying CRD Spec
157158

158-
1. Edit `api/lb.lbconfig.carlosedp.com/v1/externalloadbalancer_types.go`
159+
1. Edit `api/v1/externalloadbalancer_types.go`
159160
2. Add kubebuilder markers for validation/documentation
160161
3. Run `make generate` then `make manifests` then `make bundle`
161-
4. Update samples in `config/samples/`
162+
4. Update samples in `./examples/`
162163

163164
### Debugging Backend Issues
164165

.github/workflows/check-bundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88

99
jobs:
10-
bundle-check-changed:
10+
check-bundle:
1111
permissions:
1212
contents: read
1313
pull-requests: write

.github/workflows/lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
lint:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Run linter
21+
uses: golangci/golangci-lint-action@v8
22+
with:
23+
version: v2.1.0

.github/workflows/test-e2e.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: E2E Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test-e2e:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Running Test e2e
21+
run: |
22+
go mod tidy
23+
make e2e-test
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88

99
jobs:
10-
go-test:
10+
test:
1111
permissions:
1212
contents: read
1313
pull-requests: write
@@ -38,7 +38,9 @@ jobs:
3838
key: Envtest-cache-${{ steps.envtest-info.outputs.envtest-version }}-${{ steps.envtest-info.outputs.goos }}-${{ steps.envtest-info.outputs.goarch }}
3939

4040
- name: Test
41-
run: make test
41+
run: |
42+
go mod tidy
43+
make test
4244
4345
- name: Upload coverage to Codecov
4446
uses: codecov/codecov-action@v5

.golangci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: "2"
2+
run:
3+
allow-parallel-runners: true
4+
linters:
5+
default: none
6+
enable:
7+
- copyloopvar
8+
- dupl
9+
- errcheck
10+
- ginkgolinter
11+
- goconst
12+
- gocyclo
13+
- govet
14+
- ineffassign
15+
- lll
16+
- misspell
17+
- nakedret
18+
- prealloc
19+
- revive
20+
- staticcheck
21+
- unconvert
22+
- unparam
23+
- unused
24+
settings:
25+
revive:
26+
rules:
27+
- name: comment-spacings
28+
- name: import-shadowing
29+
exclusions:
30+
generated: lax
31+
rules:
32+
- linters:
33+
- lll
34+
path: api/*
35+
- linters:
36+
- dupl
37+
- lll
38+
path: internal/*
39+
paths:
40+
- third_party$
41+
- builtin$
42+
- examples$
43+
formatters:
44+
enable:
45+
- gofmt
46+
- goimports
47+
exclusions:
48+
generated: lax
49+
paths:
50+
- third_party$
51+
- builtin$
52+
- examples$

.mergify.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pull_request_rules:
33
conditions:
44
- base=main
55
- label="Please Merge"
6-
- check-success=bundle-check-changed
7-
- check-success=go-test
6+
- check-success=check-bundle
7+
- check-success=test
88
- "#review-requested=0"
99
actions:
1010
merge:
@@ -15,8 +15,8 @@ pull_request_rules:
1515
- base=main
1616
- author=dependabot[bot]
1717
- label="github_actions"
18-
- check-success=bundle-check-changed
19-
- check-success=go-test
18+
- check-success=check-bundle
19+
- check-success=test
2020
- "#review-requested=0"
2121
actions:
2222
merge:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Carlos Eduardo de Paula
3+
Copyright (c) 2025 Carlos Eduardo de Paula
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)