Skip to content

Commit 84d2f6d

Browse files
authored
Merge branch 'main' into addPropertyChecker
2 parents 37a9aeb + 4497f8d commit 84d2f6d

File tree

174 files changed

+4970
-23014
lines changed

Some content is hidden

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

174 files changed

+4970
-23014
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ The main idea is that we are creating a multi-cluster application management sol
4949
- `test/apis` - The tests for the CRDs.
5050
- `test/upgrade` - The tests for the upgrade tests to test compatibility between versions.
5151
- `test/e2e` - The end to end tests for the member and hub agent.
52-
- `test/integration` - The integration tests for the v1alpha1 member and hub agent.
5352
- `test/scheduler` - The integration tests for the scheduler.
5453
- `test/utils` - folder contains the utils code which is used to provide common functions for tests
5554
- The `tools/` folder contains client-side tools for helping manage the fleet.

.github/workflows/ci.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Check out code into the Go module directory
4343
uses: actions/checkout@v5
44-
44+
4545
- name: Set up Ginkgo CLI
4646
run: |
4747
go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1
@@ -55,7 +55,7 @@ jobs:
5555
## Repository upload token - get it from codecov.io. Required only for private repositories
5656
token: ${{ secrets.CODECOV_TOKEN }}
5757
## Comma-separated list of files to upload
58-
files: ./it-coverage.xml;./ut-coverage.xml
58+
files: ./ut-coverage.xml
5959

6060
e2e-tests:
6161
strategy:
@@ -84,13 +84,6 @@ jobs:
8484
]
8585
if: needs.detect-noop.outputs.noop != 'true'
8686
steps:
87-
- name: Remove unnecessary files
88-
run: |
89-
sudo rm -rf /usr/share/dotnet
90-
sudo rm -rf /opt/ghc
91-
sudo rm -rf "/usr/local/share/boost"
92-
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
93-
9487
- name: Set up Go
9588
uses: actions/setup-go@v6
9689
with:
@@ -99,6 +92,25 @@ jobs:
9992
- name: Check out code into the Go module directory
10093
uses: actions/checkout@v5
10194

95+
- name: Move Docker data directory to /mnt
96+
# The default storage device on GitHub-hosted runners is running low during e2e tests.
97+
# Moving Docker data directory to /mnt which has more space and is backed by a larger
98+
# storage device.
99+
# Upstream kubefleet repo has a much bigger default storage device and no secondary
100+
# storage device to use.
101+
run: |
102+
echo "=== Moving Docker to /mnt for more disk space ==="
103+
df -h
104+
sudo systemctl stop docker
105+
echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
106+
sudo mkdir -p /mnt/docker
107+
if [ -d "/var/lib/docker" ]; then
108+
sudo mv /var/lib/docker/* /mnt/docker/ || true
109+
fi
110+
sudo systemctl start docker
111+
echo "=== Docker moved to /mnt, verifying ==="
112+
docker info | grep "Docker Root Dir" || true
113+
102114
- name: Install Ginkgo CLI
103115
run: |
104116
go install github.com/onsi/ginkgo/v2/ginkgo@v2.23.4
@@ -134,15 +146,18 @@ jobs:
134146

135147
- name: Collect logs
136148
if: always()
149+
# Wait for a bit before log collection; this gives the agent pods some time to shut down
150+
# gracefully and flush their logs.
137151
run: |
152+
sleep 30
138153
make collect-e2e-logs
139154
env:
140155
KUBECONFIG: '/home/runner/.kube/config'
141156
LOG_DIR: 'logs-${{ matrix.customized-settings }}'
142157

143158
- name: Upload logs
144159
if: always()
145-
uses: actions/upload-artifact@v4
160+
uses: actions/upload-artifact@v5
146161
with:
147162
name: e2e-logs-${{ matrix.customized-settings }}
148163
path: test/e2e/logs-${{ matrix.customized-settings }}/

.github/workflows/upgrade.yml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,26 @@ jobs:
4949
# Fetch the history of all branches and tags.
5050
# This is needed for the test suite to switch between releases.
5151
fetch-depth: 0
52-
52+
53+
- name: Move Docker data directory to /mnt
54+
# The default storage device on GitHub-hosted runners is running low during e2e tests.
55+
# Moving Docker data directory to /mnt which has more space and is backed by a larger
56+
# storage device.
57+
# Upstream kubefleet repo has a much bigger default storage device and no secondary
58+
# storage device to use.
59+
run: |
60+
echo "=== Moving Docker to /mnt for more disk space ==="
61+
df -h
62+
sudo systemctl stop docker
63+
echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
64+
sudo mkdir -p /mnt/docker
65+
if [ -d "/var/lib/docker" ]; then
66+
sudo mv /var/lib/docker/* /mnt/docker/ || true
67+
fi
68+
sudo systemctl start docker
69+
echo "=== Docker moved to /mnt, verifying ==="
70+
docker info | grep "Docker Root Dir" || true
71+
5372
- name: Set up Ginkgo CLI
5473
run: |
5574
go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1
@@ -132,7 +151,26 @@ jobs:
132151
# Fetch the history of all branches and tags.
133152
# This is needed for the test suite to switch between releases.
134153
fetch-depth: 0
135-
154+
155+
- name: Move Docker data directory to /mnt
156+
# The default storage device on GitHub-hosted runners is running low during e2e tests.
157+
# Moving Docker data directory to /mnt which has more space and is backed by a larger
158+
# storage device.
159+
# Upstream kubefleet repo has a much bigger default storage device and no secondary
160+
# storage device to use.
161+
run: |
162+
echo "=== Moving Docker to /mnt for more disk space ==="
163+
df -h
164+
sudo systemctl stop docker
165+
echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
166+
sudo mkdir -p /mnt/docker
167+
if [ -d "/var/lib/docker" ]; then
168+
sudo mv /var/lib/docker/* /mnt/docker/ || true
169+
fi
170+
sudo systemctl start docker
171+
echo "=== Docker moved to /mnt, verifying ==="
172+
docker info | grep "Docker Root Dir" || true
173+
136174
- name: Set up Ginkgo CLI
137175
run: |
138176
go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1
@@ -215,7 +253,26 @@ jobs:
215253
# Fetch the history of all branches and tags.
216254
# This is needed for the test suite to switch between releases.
217255
fetch-depth: 0
218-
256+
257+
- name: Move Docker data directory to /mnt
258+
# The default storage device on GitHub-hosted runners is running low during e2e tests.
259+
# Moving Docker data directory to /mnt which has more space and is backed by a larger
260+
# storage device.
261+
# Upstream kubefleet repo has a much bigger default storage device and no secondary
262+
# storage device to use.
263+
run: |
264+
echo "=== Moving Docker to /mnt for more disk space ==="
265+
df -h
266+
sudo systemctl stop docker
267+
echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
268+
sudo mkdir -p /mnt/docker
269+
if [ -d "/var/lib/docker" ]; then
270+
sudo mv /var/lib/docker/* /mnt/docker/ || true
271+
fi
272+
sudo systemctl start docker
273+
echo "=== Docker moved to /mnt, verifying ==="
274+
docker info | grep "Docker Root Dir" || true
275+
219276
- name: Set up Ginkgo CLI
220277
run: |
221278
go install github.com/onsi/ginkgo/v2/ginkgo@v2.19.1

CLAUDE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ All controllers follow standard Kubernetes controller patterns:
209209
- Custom properties supported for scheduling decisions
210210

211211
### Multi-API Version Support
212-
- v1alpha1 APIs maintained for backward compatibility
213212
- v1beta1 APIs are current stable version
214213
- Feature flags control API version enablement
215214

Makefile

Lines changed: 3 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ MEMBER_CLUSTER_COUNT ?= 3
5555
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
5656
TOOLS_DIR := hack/tools
5757
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
58-
CLUSTER_CONFIG := $(abspath test/e2e/v1alpha1/kind-config.yaml)
5958

6059
# Binaries
6160
# Note: Need to use abspath so we can invoke these from subdirectories
@@ -174,25 +173,6 @@ fmt: $(GOIMPORTS) ## Run go fmt against code.
174173
vet: ## Run go vet against code.
175174
go vet ./...
176175

177-
## --------------------------------------
178-
## Kind
179-
## --------------------------------------
180-
181-
# Note that these targets are only used for E2E tests of the v1alpha1 API.
182-
183-
create-hub-kind-cluster:
184-
kind create cluster --name $(HUB_KIND_CLUSTER_NAME) --image=$(KIND_IMAGE) --config=$(CLUSTER_CONFIG) --kubeconfig=$(KUBECONFIG)
185-
186-
create-member-kind-cluster:
187-
kind create cluster --name $(MEMBER_KIND_CLUSTER_NAME) --image=$(KIND_IMAGE) --config=$(CLUSTER_CONFIG) --kubeconfig=$(KUBECONFIG)
188-
189-
load-hub-docker-image:
190-
kind load docker-image --name $(HUB_KIND_CLUSTER_NAME) $(REGISTRY)/$(HUB_AGENT_IMAGE_NAME):$(HUB_AGENT_IMAGE_VERSION)
191-
192-
load-member-docker-image:
193-
kind load docker-image --name $(MEMBER_KIND_CLUSTER_NAME) $(REGISTRY)/$(REFRESH_TOKEN_IMAGE_NAME):$(REFRESH_TOKEN_IMAGE_VERSION)
194-
kind load docker-image --name $(MEMBER_KIND_CLUSTER_NAME) $(REGISTRY)/$(MEMBER_AGENT_IMAGE_NAME):$(MEMBER_AGENT_IMAGE_VERSION)
195-
196176
## --------------------------------------
197177
## test
198178
## --------------------------------------
@@ -201,87 +181,23 @@ load-member-docker-image:
201181
test: manifests generate fmt vet local-unit-test integration-test ## Run tests.
202182

203183
##
204-
## workaround to bypass the pkg/controllers/workv1alpha1 tests failure
205-
## rollout controller tests need a bit longer to complete, so we increase the timeout
206-
##
207-
# Set up the timeout parameters as some of the test lengths have exceeded the default 10 minute mark.
184+
# Set up the timeout parameters as some of the tests (rollout controller) lengths have exceeded the default 10 minute mark.
208185
# TO-DO (chenyu1): enable parallelization for single package integration tests.
209186
.PHONY: local-unit-test
210187
local-unit-test: $(ENVTEST) ## Run tests.
211188
export CGO_ENABLED=1 && \
212189
export KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" && \
213-
go test ./pkg/controllers/workv1alpha1 -race -coverprofile=ut-coverage.xml -covermode=atomic -v && \
214-
go test `go list ./pkg/... ./cmd/... | grep -v pkg/controllers/workv1alpha1` -race -coverpkg=./... -coverprofile=ut-coverage.xml -covermode=atomic -v -timeout=20m
190+
go test `go list ./pkg/... ./cmd/...` -race -coverpkg=./... -coverprofile=ut-coverage.xml -covermode=atomic -v -timeout=20m
215191

216192
.PHONY: integration-test
217193
integration-test: $(ENVTEST) ## Run tests.
218194
export CGO_ENABLED=1 && \
219195
export KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" && \
220196
ginkgo -v -p --race --cover --coverpkg=./pkg/scheduler/... ./test/scheduler && \
221-
ginkgo -v -p --race --cover --coverpkg=./... ./test/apis/... ./test/crdinstaller && \
222-
go test ./test/integration/... -coverpkg=./... -race -coverprofile=it-coverage.xml -v
197+
ginkgo -v -p --race --cover --coverpkg=./... ./test/apis/...
223198

224199
## local tests & e2e tests
225200

226-
install-hub-agent-helm:
227-
kind export kubeconfig --name $(HUB_KIND_CLUSTER_NAME)
228-
helm install hub-agent ./charts/hub-agent/ \
229-
--set image.pullPolicy=Never \
230-
--set image.repository=$(REGISTRY)/$(HUB_AGENT_IMAGE_NAME) \
231-
--set image.tag=$(HUB_AGENT_IMAGE_VERSION) \
232-
--set logVerbosity=5 \
233-
--set namespace=fleet-system \
234-
--set enableWebhook=true \
235-
--set webhookServiceName=fleetwebhook \
236-
--set webhookClientConnectionType=service \
237-
--set enableV1Alpha1APIs=true \
238-
--set enableV1Beta1APIs=false \
239-
--set enableClusterInventoryAPI=true \
240-
--set logFileMaxSize=1000000
241-
242-
.PHONY: e2e-v1alpha1-hub-kubeconfig-secret
243-
e2e-v1alpha1-hub-kubeconfig-secret:
244-
kind export kubeconfig --name $(HUB_KIND_CLUSTER_NAME)
245-
kubectl apply -f test/e2e/v1alpha1/hub-agent-sa-secret.yaml
246-
TOKEN=$$(kubectl get secret hub-kubeconfig-secret -n fleet-system -o jsonpath='{.data.token}' | base64 -d) ;\
247-
kind export kubeconfig --name $(MEMBER_KIND_CLUSTER_NAME) ;\
248-
kubectl delete secret hub-kubeconfig-secret --ignore-not-found ;\
249-
kubectl create secret generic hub-kubeconfig-secret --from-literal=token=$$TOKEN
250-
251-
install-member-agent-helm: install-hub-agent-helm e2e-v1alpha1-hub-kubeconfig-secret
252-
kind export kubeconfig --name $(HUB_KIND_CLUSTER_NAME)
253-
## Get kind cluster IP that docker uses internally so we can talk to the other cluster. the port is the default one.
254-
HUB_SERVER_URL="https://$$(docker inspect $(HUB_KIND_CLUSTER_NAME)-control-plane --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'):6443" ;\
255-
kind export kubeconfig --name $(MEMBER_KIND_CLUSTER_NAME) ;\
256-
helm install member-agent ./charts/member-agent/ \
257-
--set config.hubURL=$$HUB_SERVER_URL \
258-
--set image.repository=$(REGISTRY)/$(MEMBER_AGENT_IMAGE_NAME) \
259-
--set image.tag=$(MEMBER_AGENT_IMAGE_VERSION) \
260-
--set refreshtoken.repository=$(REGISTRY)/$(REFRESH_TOKEN_IMAGE_NAME) \
261-
--set refreshtoken.tag=$(REFRESH_TOKEN_IMAGE_VERSION) \
262-
--set image.pullPolicy=Never \
263-
--set refreshtoken.pullPolicy=Never \
264-
--set config.memberClusterName="kind-$(MEMBER_KIND_CLUSTER_NAME)" \
265-
--set logVerbosity=5 \
266-
--set namespace=fleet-system
267-
# to make sure member-agent reads the token file.
268-
kubectl delete pod --all -n fleet-system
269-
270-
build-e2e-v1alpha1:
271-
go test -c ./test/e2e/v1alpha1
272-
273-
run-e2e-v1alpha1: build-e2e-v1alpha1
274-
KUBECONFIG=$(KUBECONFIG) HUB_SERVER_URL="https://$$(docker inspect $(HUB_KIND_CLUSTER_NAME)-control-plane --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'):6443" ./v1alpha1.test -test.v -ginkgo.v
275-
276-
.PHONY: create-kind-cluster
277-
create-kind-cluster: create-hub-kind-cluster create-member-kind-cluster install-helm
278-
279-
.PHONY: install-helm
280-
install-helm: load-hub-docker-image load-member-docker-image install-member-agent-helm
281-
282-
.PHONY: e2e-tests-v1alpha1
283-
e2e-tests-v1alpha1: create-kind-cluster run-e2e-v1alpha1
284-
285201
# E2E test label filter (can be overridden)
286202
LABEL_FILTER ?= !custom
287203

@@ -462,30 +378,6 @@ clean-bin: ## Remove all generated binaries
462378
rm -rf $(TOOLS_BIN_DIR)
463379
rm -rf ./bin
464380

465-
# Note that these targets are only used for E2E tests of the v1alpha1 API.
466-
467-
.PHONY: uninstall-helm
468-
uninstall-helm: clean-testing-resources
469-
kind export kubeconfig --name $(HUB_KIND_CLUSTER_NAME)
470-
helm uninstall hub-agent
471-
472-
kind export kubeconfig --name $(MEMBER_KIND_CLUSTER_NAME)
473-
helm uninstall member-agent
474-
475-
.PHONY: clean-testing-resources
476-
clean-testing-resources:
477-
kind export kubeconfig --name $(HUB_KIND_CLUSTER_NAME)
478-
kubectl delete ns fleet-member-kind-member-testing --ignore-not-found
479-
kubectl delete memberclusters.fleet.azure.com kind-$(MEMBER_KIND_CLUSTER_NAME) --ignore-not-found
480-
481-
kind export kubeconfig --name $(MEMBER_KIND_CLUSTER_NAME)
482-
kubectl delete ns fleet-member-kind-member-testing --ignore-not-found
483-
484-
.PHONY: clean-e2e-tests-v1alpha1
485-
clean-e2e-tests-v1alpha1:
486-
kind delete cluster --name $(HUB_KIND_CLUSTER_NAME)
487-
kind delete cluster --name $(MEMBER_KIND_CLUSTER_NAME)
488-
489381
.PHONY: clean-e2e-tests
490382
clean-e2e-tests:
491383
cd ./test/e2e && chmod +x ./stop.sh && ./stop.sh $(MEMBER_CLUSTER_COUNT)

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,44 @@ For any questions, please see the [KubeFleet discussion board](https://github.co
1515
For any issues, please open an issue in the [KubeFleet](https://github.com/kubefleet-dev/kubefleet/issues)
1616

1717

18-
[1]: https://img.shields.io/github/v/release/Azure/fleet
18+
## Quickstart
19+
20+
* [Get started here](https://kubefleet-dev.github.io/website/docs/getting-started/kind/)
21+
22+
## Documentation
23+
24+
To learn more about KubeFleet go to the [KubeFleet documentation](https://kubefleet-dev.github.io/website/).
25+
26+
## Community
27+
28+
You can reach the KubeFleet community and developers via the following channels:
29+
30+
* Q & A: [GitHub Discussions](https://github.com/kubefleet-dev/kubefleet/discussions)
31+
* Slack: [The #KubeFleet Slack channel](https://cloud-native.slack.com/archives/C08KR7589R8)
32+
* Mailing list: [mailing list](https://groups.google.com/g/kubefleet-dev)
33+
34+
## Community Meetings
35+
36+
We host bi-weekly community meetings that alternate between US/EU and APAC friendly time. In these sessions the community will showcase demos and discuss the current and future state of the project.
37+
38+
Please refer to the [calendar](https://zoom-lfx.platform.linuxfoundation.org/meetings/kubefleet?view=month) for the latest schedule:
39+
* Wednesdays at 09:30am PT [US/EU](https://zoom-lfx.platform.linuxfoundation.org/meeting/93624014488?password=27667a5c-9238-4b5a-b4d8-96daadaa9fa4) (weekly). [Convert to your timezone](https://dateful.com/convert/pacific-time-pt?t=930am).
40+
* Thursday at 9:00am CST [APAC](https://zoom-lfx.platform.linuxfoundation.org/meeting/98901589453?password=9ab588fd-1214-40c3-84c2-757c124e984f) (biweekly). [Convert to your timezone](https://dateful.com/convert/beijing-china?t=9am).
41+
42+
For more meeting information, minutes and recordings, please see the [KubeFleet community meeting doc](https://docs.google.com/document/d/1iMcHn11fPlb9ZGoMHiGEBvdIc44W1CjZvsPH3eBg6pA/edit?usp=sharing).
43+
44+
## Code of Conduct
45+
Participation in KubeFleet is governed by the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). See the [Code of Conduct](CODE_OF_CONDUCT.md) for more information.
46+
47+
## Contributing
48+
49+
The [contribution guide](CONTRIBUTING.md) covers everything you need to know about how you can contribute to KubeFleet.
50+
51+
## Support
52+
For more information, see [SUPPORT](SUPPORT.md).
53+
54+
55+
[1]: https://img.shields.io/github/v/release/kubefleet-dev/kubefleet
1956
[2]: https://goreportcard.com/badge/go.goms.io/fleet
2057
[3]: https://goreportcard.com/report/go.goms.io/fleet
2158
[4]: https://codecov.io/gh/Azure/fleet/branch/main/graph/badge.svg?token=D3mtbzACjC

0 commit comments

Comments
 (0)