-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
157 lines (128 loc) · 6.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
NAME := confluent-platform
HOSTNAME := aidanmelen
PROVIDER := kubernetes
VERSION := 0.9.5
SHELL := /bin/bash
.PHONY: help all
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-35s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
build: ## Build docker dev container
cd .devcontainer && docker build -f Dockerfile . -t $(NAME)
run: ## Run docker dev container
docker run -it --rm -v "$$(pwd)":/workspaces/$(NAME) -v ~/.kube:/root/.kube -v ~/.cache/pre-commit:/root/.cache/pre-commit -v ~/.terraform.d/plugins:/root/.terraform.d/plugins --workdir /workspaces/$(NAME) $(NAME) /bin/bash
apply-cfk-crds:
kubectl config set-cluster docker-desktop
kubectl apply -f ./crds/2.4.0
setup: apply-cfk-crds ## Setup project
# terraform
terraform init
cd modules/confluent_operator && terraform init
cd modules/kafka_rest_class && terraform init
cd modules/confluent_role_binding && terraform init
cd modules/kafka_topic && terraform init
cd modules/connector && terraform init
cd modules/schema && terraform init
cd examples/confluent_operator && terraform init
cd examples/confluent_platform && terraform init
cd examples/confluent_platform_singlenode && terraform init
cd examples/complete && terraform init
cd examples/autogenerated_tls_only && terraform init
cd examples/kafka_topic && terraform init
cd examples/schema && terraform init
cd examples/connector && terraform init
cd examples/hybrid_aws_msk/aws && terraform init
cd examples/hybrid_aws_msk/confluent_platform && terraform init
cd examples/hybrid_aws_msk/confluent_platform_tls_only && terraform init
cd examples/hybrid_aws_msk/confluent_platform_sasl_iam_secure && terraform init
# pre-commit
git init
git add -A
pre-commit install
# terratest
rm -rf go.mod*
go get github.com/gruntwork-io/terratest/modules/terraform
go mod init test/terraform_confluent_operator_test.go
go mod tidy -go=1.16 && go mod tidy -go=1.17
docs:
./bin/render-docs.sh $(NAME) $(HOSTNAME) $(PROVIDER) $(VERSION)
./bin/render-terratest-docs.sh $(VERSION)
./bin/render-makefile-docs.sh
lint: docs ## Lint with pre-commit
git add -A
pre-commit run
git add -A
lint-all: docs ## Lint all files with pre-commit
git add -A
pre-commit run --all-files
git add -A
tests: test-confluent-operator test-confluent-platform test-confluent-platform-singlenode test-complete test-kafka-topic test-schema test-connector test-confluent-role-binding ## Tests with Terratest
test-confluent-operator: ## Test the confluent_operator example
go test test/terraform_confluent_operator_test.go -timeout 5m -v |& tee test/terraform_confluent_operator_test.log
test-setup:
cd examples/confluent_operator && terraform apply --auto-approve
test-clean:
cd examples/confluent_operator && terraform destroy --auto-approve
_test-confluent-platform:
go test test/terraform_confluent_platform_test.go -timeout 30m -v |& tee test/terraform_confluent_platform_test.log
_test-confluent-platform-singlenode:
go test test/terraform_confluent_platform_singlenode_test.go -timeout 30m -v |& tee test/terraform_confluent_platform_singlenode_test.log
test-confluent-platform: test-setup _test-confluent-platform test-clean ## Test the confluent_platform example
test-confluent-platform-singlenode: test-setup _test-confluent-platform-singlenode test-clean ## Test the confluent_platform_singlenode example
test-complete: ## Test the complete example
go test test/terraform_complete_test.go -timeout 30m -v |& tee test/terraform_complete_test.log
test-kafka-topic: ## Test the kafka_topic example
go test test/terraform_kafka_topic_test.go -timeout 30m -v |& tee test/terraform_kafka_topic_test.log
test-schema: ## Test the schema example
go test test/terraform_schema_test.go -timeout 30m -v |& tee test/terraform_schema_test.log
test-connector: ## Test the connector example
go test test/terraform_connector_test.go -timeout 30m -v |& tee test/terraform_connector_test.log
delete-cfk-crds:
kubectl config set-cluster docker-desktop
kubectl delete -f ./crds/2.4.0
release: ## Tag remote triggering Terraform Registry release
git tag v${VERSION}
git push --tag
clean: delete-cfk-crds ## Clean project
@rm -f .terraform.lock.hcl
@rm -f modules/confluent_operator/.terraform.lock.hcl
@rm -f modules/kafka_rest_class/.terraform.lock.hcl
@rm -f modules/confluent_role_binding/.terraform.lock.hcl
@rm -f modules/kafka_topic/.terraform.lock.hcl
@rm -f modules/connector/.terraform.lock.hcl
@rm -f modules/schema/.terraform.lock.hcl
@rm -f examples/confluent_operator/.terraform.lock.hcl
@rm -f examples/confluent_platform/.terraform.lock.hcl
@rm -f examples/confluent_platform_singlenode/.terraform.lock.hcl
@rm -f examples/complete/.terraform.lock.hcl
@rm -f examples/autogenerated_tls_only/.terraform.lock.hcl
@rm -f examples/kafka_topic/.terraform.lock.hcl
@rm -f examples/schema/.terraform.lock.hcl
@rm -f examples/connector/.terraform.lock.hcl
@rm -f examples/hybrid_aws_msk/aws.terraform.lock.hcl
@rm -f examples/hybrid_aws_msk/confluent_platform.terraform.lock.hcl
@rm -f examples/hybrid_aws_msk/confluent_platform_tls_only.terraform.lock.hcl
@rm -f examples/hybrid_aws_msk/confluent_platform_sasl_iam_secure.terraform.lock.hcl
@rm -rf .terraform
@rm -rf modules/confluent_operator/.terraform
@rm -rf modules/kafka_rest_class/.terraform
@rm -rf modules/confluent_role_binding/.terraform
@rm -rf modules/kafka_topic/.terraform
@rm -rf modules/connector/.terraform
@rm -rf modules/schema/.terraform
@rm -rf examples/confluent_operator/.terraform
@rm -rf examples/confluent_platform/.terraform
@rm -rf examples/confluent_platform_singlenode/.terraform
@rm -rf examples/complete/.terraform
@rm -rf examples/autogenerated_tls_only/.terraform
@rm -rf examples/kafka_topic/.terraform
@rm -rf examples/schema/.terraform
@rm -rf examples/connector/.terraform
@rm -rf examples/hybrid_aws_msk/aws.terraform
@rm -rf examples/hybrid_aws_msk/confluent_platform.terraform
@rm -rf examples/hybrid_aws_msk/confluent_platform_tls_only.terraform
@rm -rf examples/hybrid_aws_msk/confluent_platform_sasl_iam_secure.terraform
@rm -f go.mod
@rm -f go.sum
@rm -f test/go.mod
@rm -f test/go.sum