Skip to content
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ef003db
wip: updating toolchain
debdutdeb Nov 19, 2025
3b00303
refactor: using k3d cluster
debdutdeb Nov 20, 2025
f6608b2
test: first real test also run in ci now
debdutdeb Nov 20, 2025
f7787c4
fix: add patch to go.mod
debdutdeb Nov 20, 2025
dd12c5f
fix: add k3d to ci
debdutdeb Nov 20, 2025
be103e8
fix: build controller image first
debdutdeb Nov 20, 2025
b836a76
fix: move around the order of building and testing targets
debdutdeb Nov 20, 2025
aaa2deb
tests: add more tests
debdutdeb Nov 20, 2025
f36f214
chore: remove envtest references
debdutdeb Nov 20, 2025
bec9182
ci: bump go version in golang-ci workflow
debdutdeb Nov 20, 2025
0cfa83a
wip: outlining backup controller
debdutdeb Nov 21, 2025
085c39e
chore: local configuration details
debdutdeb Nov 21, 2025
813652d
chore: load mongo testing data k3d
debdutdeb Dec 8, 2025
da80faa
docs: Makefile new targets
debdutdeb Dec 8, 2025
61cac3f
chore: test suites to use make targets
debdutdeb Dec 10, 2025
897a926
chore: moving code around
debdutdeb Dec 10, 2025
d6f4895
noop
debdutdeb Dec 11, 2025
7995f92
wip: ....
debdutdeb Jan 21, 2026
b04eab3
fix: use patch
debdutdeb Jan 21, 2026
4ae6f21
chore: from mac, switching to linux
debdutdeb Feb 9, 2026
bdea110
chore: push the rest
debdutdeb Feb 13, 2026
847355c
fix: run internal unit tests
debdutdeb Feb 13, 2026
d9c4240
chore: add support for encryption
debdutdeb Feb 15, 2026
221e984
...
debdutdeb Feb 16, 2026
6c76305
simplifying for reviews and better condition handling
debdutdeb Feb 21, 2026
8ee0885
chore: use DatabaseManifestName constant
debdutdeb Feb 21, 2026
6139c51
chore: update portmaster
debdutdeb Feb 22, 2026
afb6ce6
chore: common portmaster reconciler
debdutdeb Feb 26, 2026
9d7de8b
chore: reove old code
debdutdeb Feb 26, 2026
d9aa06a
chore: use podspec directly
debdutdeb Feb 26, 2026
1b99a98
fix: portmaster missing restart policy
debdutdeb Feb 26, 2026
8ba1269
chore: old
debdutdeb Mar 6, 2026
7db1282
chore: add webhook support
debdutdeb Mar 6, 2026
7072666
simplify webhook
debdutdeb Mar 11, 2026
0e841ec
chore: better way to pass portmaster config
debdutdeb Mar 12, 2026
5f810e4
chore: implement queue for webhooks
debdutdeb Mar 12, 2026
a977b79
allow webhook body
debdutdeb Mar 12, 2026
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
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ jobs:
with:
go-version: '=1.21.0'
cache: false
- uses: RocketChat/k3d-with-registry@main
- name: Build binary
env:
CI: true
run: |
cd $__W_SRC_REL
go mod tidy
make build
make docker-build-no-test IMG=controller:latest
make test
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.21
go-version: 1.25
- uses: actions/checkout@v3
- name: Configure git for private modules
env:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ mongoValues.yaml
db-secret.yaml
db-cluster.yaml
*.ignore

tests/k3d/disk/

.operator-test-suite.mk

.envrc
105 changes: 92 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ endif

# Image URL to use all building/pushing image targets
IMG ?= $(IMAGE_TAG_BASE):$(VERSION)
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.25.0


# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -93,6 +91,7 @@ help: ## Display this help.
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
cd config/crd && $(KUSTOMIZE) edit add resource bases/*.yaml

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand All @@ -107,13 +106,17 @@ vet: ## Run go vet against code.
go vet ./...

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
test: manifests generate fmt vet ## Run tests (Ginkgo suite only).
go test ./tests/ -v -ginkgo.v -coverprofile cover.out

.PHONY: test-unit
test-unit: ## Run unit tests (excludes Ginkgo suite).
go test -tags=unit ./internal/... -v -count=1

##@ Build

.PHONY: build
build: generate fmt vet ## Build manager binary.
build: generate manifests fmt vet ## Build manager binary.
CGO_ENABLED=0 GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -o bin/manager main.go

.PHONY: run
Expand All @@ -127,6 +130,10 @@ run: manifests generate fmt vet ## Run a controller from your host.
docker-build: test ## Build docker image with the manager.
docker build -t ${IMG} .

.PHONY: docker-build-no-test
docker-build-no-test: build
docker build -t ${IMG} .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}
Expand Down Expand Up @@ -181,11 +188,10 @@ $(LOCALBIN):
## Tool Binaries
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.10.0
CONTROLLER_TOOLS_VERSION ?= v0.19.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand All @@ -198,11 +204,6 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest

.PHONY: bundle
bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files.
operator-sdk generate kustomize manifests -q
Expand Down Expand Up @@ -258,3 +259,81 @@ catalog-build: opm ## Build a catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)

OPERATOR_TEST_SUITE_MAKE_URL := https://raw.githubusercontent.com/RocketChat/operator-test-suite/refs/heads/main/Makefile
OPERATOR_TEST_SUITE_MAKE_FILE := .operator-test-suite.mk

# Download the file if it doesn't exist
$(OPERATOR_TEST_SUITE_MAKE_FILE):
@curl -sSL $(OPERATOR_TEST_SUITE_MAKE_URL) -o $(OPERATOR_TEST_SUITE_MAKE_FILE)

# Include it (the dash before 'include' ignores errors if the file is missing)
-include $(OPERATOR_TEST_SUITE_MAKE_FILE)

# Ensure the file is downloaded before running other targets
bootstrap: $(OPERATOR_TEST_SUITE_MAKE_FILE)

.PHONY: k3d-load-image
k3d-load-image: IMG=airlock:local
k3d-load-image: docker-build-no-test k3d-cluster k3d-add-storageclass
k3d image load ${IMG} -c ${NAME}

.PHONY: k3d-load-portmaster-image
k3d-load-portmaster-image:
k3d image load portmaster:local -c ${NAME}

.PHONY: k3d-deploy
k3d-deploy-airlock: k3d-load-image k3d-load-portmaster-image
$(KUBECTL_WITH_CONFIG) apply -k tests/assets/airlock

.PHONY: k3d-deploy-mongo
k3d-deploy-mongo: k3d-cluster k3d-add-storageclass
$(KUBECTL_WITH_CONFIG) apply -f ./tests/assets/mongo

.PHONY: k3d-deploy-minio
Comment thread
debdutdeb marked this conversation as resolved.
k3d-deploy-minio: k3d-cluster k3d-add-storageclass
$(KUBECTL_WITH_CONFIG) apply -k "github.com/minio/operator?ref=v6.0.4"
$(KUBECTL_WITH_CONFIG) rollout status deployment/minio-operator -n minio-operator
$(KUBECTL_WITH_CONFIG) apply -f ./tests/assets/minio
# ensures minio is ready
$(KUBECTL_WITH_CONFIG) wait --for=condition=complete job/create-minio-buckets -n minio-tenant --timeout=5m

.PHONY: k3d-run-portmaster
k3d-run-portmaster: k3d-cluster
envsubst < ./tests/assets/local-tests/backup-pod.yaml | $(KUBECTL_WITH_CONFIG) apply -f -

.PHONY: k3d-load-mongo-data
k3d-load-mongo-data: k3d-deploy-mongo k3d-add-storageclass k3d-deploy-minio
$(KUBECTL_WITH_CONFIG) apply -f ./tests/assets/local-tests/mongo-restore-job.yaml
# wait for the job to complete
# weird hack for me to fix dns for one term
[ "$CI" = "true" ] || sudo systemctl restart NetworkManager
$(KUBECTL_WITH_CONFIG) wait --for=condition=complete job/restore-job -n mongo --timeout=5m

.PHONY: k3d-retsart-airlock
k3d-restart-airlock:
ifndef NAME
$(error NAME is required. Usage: make k3d-restart-airlock NAME=my-cluster)
endif
$(KUBECTL_WITH_CONFIG) rollout restart deployment airlock-controller-manager -n airlock-system

.PHONY: k3d-add-age-secret
k3d-add-age-secret: k3d-cluster
$(KUBECTL_WITH_CONFIG) apply -f ./tests/assets/local-tests/age-secret.yaml

.PHONY: k3d-add-destination-bucket
k3d-add-destination-bucket: k3d-cluster
envsubst < ./tests/assets/local-tests/destination-bucket.yaml | $(KUBECTL_WITH_CONFIG) apply -f -

.PHONY: k3d-add-mongodb-cluster
k3d-add-mongodb-cluster: k3d-cluster
envsubst < ./tests/assets/local-tests/mongodbcluster.yaml | $(KUBECTL_WITH_CONFIG) apply -f -

.PHONY: k3d-add-mongodb-backup
k3d-add-mongodb-backup: k3d-cluster k3d-add-mongodb-cluster k3d-add-destination-bucket
$(KUBECTL_WITH_CONFIG) apply -f ./tests/assets/local-tests/mongodbbackup.yaml

.PHONY: k3d-add-mongodb-restore
k3d-add-mongodb-restore: k3d-cluster k3d-add-mongodb-cluster k3d-add-destination-bucket
$(KUBECTL_WITH_CONFIG) apply -f ./tests/assets/local-tests/mongodbrestore.yaml

Loading