Skip to content

Commit

Permalink
refactor(Makefile): update chainsaw setup and Helm targets in Makefile
Browse files Browse the repository at this point in the history
Description:
This PR refactors the Helm targets and updates the chainsaw setup in the Makefile. The changes include:

- Removed helm-install and helm-uninstall targets.
- Updated chainsaw-setup target to use helm-install-depends instead of helm-install.

Purpose:
1. Refactor chainsaw test to rely on the helm-install-depends task for better modularity and dependency management.
2. Ensure the current operator uses the deploy task for deployment, aligning with the updated setup process.

These changes improve the modularity, clarity, and maintainability of the Makefile, making it easier to manage Helm dependencies and the chainsaw setup process.
  • Loading branch information
lwpk110 committed Nov 12, 2024
1 parent 930c362 commit a81b7a0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,14 @@ ifneq ($(strip $(HELM_DEPENDS)),)
done
endif

.PHONY: helm-install
helm-install: helm-install-depends ## Install the helm chart.
$(HELM) upgrade --install --create-namespace --namespace $(TEST_NAMESPACE) --wait $(PROJECT_NAME) kubedoop/$(PROJECT_NAME) --version $(VERSION)

.PHONY: helm-uninstall
helm-uninstall: ## Uninstall the helm chart.
$(HELM) uninstall --namespace $(TEST_NAMESPACE) $(PROJECT_NAME)
## helm uninstall depends
.PHONY: helm-uninstall-depends
helm-uninstall-depends: ## Uninstall the helm chart depends.
ifneq ($(strip $(HELM_DEPENDS)),)
for dep in $(HELM_DEPENDS); do \
$(HELM) uninstall --namespace $(TEST_NAMESPACE) $$dep; \
done
endif

# kind
KIND_VERSION ?= v0.24.0
Expand Down Expand Up @@ -448,12 +449,14 @@ $(CHAINSAW): $(LOCALBIN)
chainsaw-setup: ## Run the chainsaw setup
make docker-build
$(KIND) --name $(KIND_CLUSTER_NAME) load docker-image $(IMG)
KUBECONFIG=$(KIND_KUBECONFIG) make helm-install
KUBECONFIG=$(KIND_KUBECONFIG) make helm-install-depends
KUBECONFIG=$(KIND_KUBECONFIG) make deploy

.PHONY: chainsaw-test
chainsaw-test: chainsaw ## Run the chainsaw test
KUBECONFIG=$(KIND_KUBECONFIG) $(CHAINSAW) test --cluster cluster-1=$(KIND_KUBECONFIG) --test-dir ./test/e2e/

.PHONY: chainsaw-cleanup
chainsaw-cleanup: ## Run the chainsaw cleanup
KUBECONFIG=$(KIND_KUBECONFIG) make helm-uninstall
KUBECONFIG=$(KIND_KUBECONFIG) make helm-uninstall-depends
KUBECONFIG=$(KIND_KUBECONFIG) make undeploy
17 changes: 17 additions & 0 deletions test/e2e/kerberos/chainsaw-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,23 @@ spec:
cleanup:
- sleep:
duration: 10s
catch:
- sleep:
duration: 5s
- script:
env:
- name: NAMESPACE
value: ($namespace)
content: |
set -ex
kubectl -n $NAMESPACE get pods
- describe:
apiVersion: v1
kind: Pod
selector: app.kubernetes.io/managed-by=hdfs-operator
- podLogs:
selector: app.kubernetes.io/managed-by=hdfs-operator
tail: -1
- try:
- apply:
file: hbase.yaml
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/setup/hdfs-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ kind: StatefulSet
metadata:
name: hdfs-default-datanode
status:
availableReplicas: 2
replicas: 2
availableReplicas: 1
replicas: 1
2 changes: 1 addition & 1 deletion test/e2e/setup/hdfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:
dataNode:
roleGroups:
default:
replicas: 2
replicas: 1
config:
logging:
datanode:
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/setup/zookeeper-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: StatefulSet
metadata:
name: zk-server-default
status:
availableReplicas: 3
readyReplicas: 3
currentReplicas: 3
replicas: 3
availableReplicas: 1
readyReplicas: 1
currentReplicas: 1
replicas: 1
2 changes: 1 addition & 1 deletion test/e2e/setup/zookeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
server:
roleGroups:
default:
replicas: 3
replicas: 1
config:
logging:
zookeeperCluster:
Expand Down

0 comments on commit a81b7a0

Please sign in to comment.