Skip to content

Commit b51eb01

Browse files
authored
feat: refactor to argocd-agent addon with GitOpsCluster CRD (#109)
BREAKING CHANGE: Complete redesign from basic pull to argocd-agent model - Add GitOpsCluster CRD for declarative agent management - Implement OCM addon deployment (internal/addon, internal/controller) - Remove old controllers/application (basic pull model) - Rename chart to argocd-agent-addon - Move main.go to cmd/ directory - Add automated certificate, RBAC, and server discovery - Enable managed and autonomous deployment modes Basic pull model now in OCM repository. See README for migration. Signed-off-by: Mike Ng <[email protected]>
1 parent efbcbd7 commit b51eb01

File tree

136 files changed

+68076
-13360
lines changed

Some content is hidden

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

136 files changed

+68076
-13360
lines changed

.dockerignore

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2-
# Ignore build and test binaries.
3-
bin/
4-
testbin/
2+
# Ignore everything by default and re-include only needed files
3+
**
4+
5+
# Re-include Go source files (but not *_test.go)
6+
!**/*.go
7+
**/*_test.go
8+
9+
# Re-include Go module files
10+
!go.mod
11+
!go.sum
12+
13+
# Re-include charts directory for addon embedding
14+
!charts/
15+
!internal/addon/charts/

.github/workflows/chart-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
types: [published]
99

1010
env:
11-
CHART_NAME: argocd-pull-integration
11+
CHART_NAME: argocd-agent-addon
1212

1313
jobs:
1414
env:

.github/workflows/e2e.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: E2E
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
branches:
7+
- main
8+
9+
env:
10+
# Common versions
11+
GO_VERSION: '1.24'
12+
GO_REQUIRED_MIN_VERSION: ''
13+
GOPATH: '/home/runner/work/argocd-pull-integration/argocd-pull-integration/go'
14+
15+
defaults:
16+
run:
17+
working-directory: go/src/open-cluster-management.io/argocd-pull-integration
18+
19+
jobs:
20+
e2e:
21+
name: e2e
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 1
28+
path: go/src/open-cluster-management.io/argocd-pull-integration
29+
30+
- name: install Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: ${{ env.GO_VERSION }}
34+
35+
- name: Add GOPATH/bin to PATH
36+
run: echo "$GOPATH/bin" >> "$GITHUB_PATH"
37+
38+
- name: install imagebuilder
39+
run: go install github.com/openshift/imagebuilder/cmd/[email protected]
40+
41+
# Install Helm so make test-e2e can run helm commands
42+
- name: Set up Helm
43+
uses: azure/setup-helm@v4
44+
with:
45+
version: v3.15.2 # pin for reproducibility; omit to get latest v3
46+
47+
# Optional: pin kubectl to match your kind/k8s version
48+
- name: Set up kubectl
49+
uses: azure/setup-kubectl@v4
50+
with:
51+
version: v1.29.0
52+
53+
- name: build-images
54+
run: make build-images
55+
56+
- name: setup kind (cluster1)
57+
uses: engineerd/[email protected]
58+
with:
59+
version: v0.14.0
60+
name: cluster1
61+
62+
- name: setup kind (hub)
63+
uses: engineerd/[email protected]
64+
with:
65+
version: v0.14.0
66+
name: hub
67+
68+
- name: Load image on the nodes of the hub
69+
run: |
70+
kind load docker-image --name=hub quay.io/open-cluster-management/argocd-pull-integration:latest
71+
72+
- name: Load image on the nodes of the cluster1
73+
run: |
74+
kind load docker-image --name=cluster1 quay.io/open-cluster-management/argocd-pull-integration:latest
75+
76+
- name: Run e2e test
77+
env:
78+
KUBECONFIG: /home/runner/.kube/config
79+
run: make test-e2e

.github/workflows/go-postsubmit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ jobs:
2424
arch: [ amd64 ]
2525
steps:
2626
- name: checkout code
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 1
3030
path: go/src/open-cluster-management.io/argocd-pull-integration
3131
- name: install Go
32-
uses: actions/setup-go@v3
32+
uses: actions/setup-go@v5
3333
with:
3434
go-version: ${{ env.GO_VERSION }}
3535
- name: install imagebuilder
3636
run: go install github.com/openshift/imagebuilder/cmd/[email protected]
3737
- name: pull base image
38-
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
38+
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
3939
- name: images
4040
run: make docker-build
4141
- name: push

.github/workflows/go-presubmit.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: checkout code
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525
with:
2626
fetch-depth: 1
2727
path: go/src/open-cluster-management.io/argocd-pull-integration
2828
- name: install Go
29-
uses: actions/setup-go@v3
29+
uses: actions/setup-go@v5
3030
with:
3131
go-version: ${{ env.GO_VERSION }}
3232
- name: build
@@ -39,31 +39,31 @@ jobs:
3939
arch: [ amd64 ]
4040
steps:
4141
- name: checkout code
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343
with:
4444
fetch-depth: 1
4545
path: go/src/open-cluster-management.io/argocd-pull-integration
4646
- name: install Go
47-
uses: actions/setup-go@v3
47+
uses: actions/setup-go@v5
4848
with:
4949
go-version: ${{ env.GO_VERSION }}
5050
- name: install imagebuilder
5151
run: go install github.com/openshift/imagebuilder/cmd/[email protected]
5252
- name: pull base image
53-
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
53+
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
5454
- name: images
5555
run: make docker-build
5656
test:
5757
name: test
5858
runs-on: ubuntu-latest
5959
steps:
6060
- name: checkout code
61-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
6262
with:
6363
fetch-depth: 1
6464
path: go/src/open-cluster-management.io/argocd-pull-integration
6565
- name: install Go
66-
uses: actions/setup-go@v3
66+
uses: actions/setup-go@v5
6767
with:
6868
go-version: ${{ env.GO_VERSION }}
6969
- name: test

.github/workflows/go-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
GO_VERSION: '1.24'
1010
GO_REQUIRED_MIN_VERSION: ''
1111
GITHUB_REF: ${{ github.ref }}
12-
CHART_NAME: argocd-pull-integration
12+
CHART_NAME: argocd-agent-addon
1313

1414
jobs:
1515
env:

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
21
# Binaries for programs and plugins
32
*.exe
43
*.exe~
54
*.dll
65
*.so
76
*.dylib
8-
bin
9-
testbin/*
7+
bin/*
108
Dockerfile.cross
119

12-
# Test binary, build with `go test -c`
10+
# Test binary, built with `go test -c`
1311
*.test
1412

1513
# Output of the go coverage tool, specifically when used with LiteIDE
1614
*.out
1715

18-
# Kubernetes Generated files - skip generated files, except for vendored files
16+
# Go workspace file
17+
go.work
1918

19+
# Kubernetes Generated files - skip generated files, except for vendored files
2020
!vendor/**/zz_generated.*
2121

2222
# editor and IDE paraphernalia
2323
.idea
24+
.vscode
2425
*.swp
2526
*.swo
2627
*~

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ COPY go.sum go.sum
1111
# and so that source changes don't invalidate our downloaded layer
1212
RUN go mod download
1313

14-
# Copy the go source
15-
COPY main.go main.go
16-
COPY controllers/ controllers/
14+
# Copy the Go source (relies on .dockerignore to filter)
15+
COPY . .
1716

1817
# Build
19-
# the GOARCH has not a default value to allow the binary be built according to the host where the command
18+
# the GOARCH has no default value to allow the binary to be built according to the host where the command
2019
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
2120
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
2221
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
23-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go
22+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
2423

2524
# Use distroless as minimal base image to package the manager binary
2625
# Refer to https://github.com/GoogleContainerTools/distroless for more details

0 commit comments

Comments
 (0)