-
Notifications
You must be signed in to change notification settings - Fork 0
Argocdcloud #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Argocdcloud #35
Changes from all commits
10e14ce
2ea1bd8
c4ec4df
ed31f63
135b233
3dca2a2
d41fc1d
74c3e10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ | |
| .terraform.lock.hcl | ||
| *.tfplan | ||
| *.tfplan.json | ||
| tfplan* | ||
| tfplan-* | ||
| crash.log | ||
| crash.*.log | ||
| override.tf | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,13 @@ TF_DIR=infra/terraform | |
| POLICY_TF_DIR=policies/terraform | ||
| POLICY_K8S_DIR=policies/kubernetes | ||
| CLOUD?=aws | ||
| ARGOCD_NAMESPACE?=argocd | ||
| ARGOCD_APP_NAME?=dissertation-sample-api | ||
| ARGOCD_APP_MANIFEST?=argocd/application.yaml | ||
| ARGOCD_TEST_APP_NAME?=dissertation-test-api | ||
| ARGOCD_TEST_APP_MANIFEST?=argocd/test-application.yaml | ||
|
|
||
| .PHONY: help tf-init tf-fmt tf-validate tf-plan tf-apply tf-destroy policy-tf policy-k8s clean all | ||
| .PHONY: help tf-init tf-fmt tf-validate tf-plan tf-apply tf-destroy policy-tf policy-k8s k8s-dry-run argocd-apply argocd-status argocd-test argocd-test-app-apply argocd-test-app-status argocd-test-app-sync clean all | ||
|
|
||
| help: ## Display this help message | ||
| @echo "Available targets:" | ||
|
|
@@ -31,11 +36,41 @@ tf-destroy: ## Destroy Terraform resources (use CLOUD=aws|azure|gcp) | |
| terraform -chdir=$(TF_DIR)/$(CLOUD) destroy | ||
|
|
||
| policy-tf: ## Evaluate Terraform policies | ||
| opa eval --fail-defined --format pretty --data $(POLICY_TF_DIR) --input $(POLICY_TF_DIR)/sample-tfplan.json "data.terraform.deny" | ||
| opa eval --fail-defined --format pretty --data $(POLICY_TF_DIR) --input $(POLICY_TF_DIR)/sample-tfplan.json "data.terraform.deny[_]" | ||
|
|
||
| policy-k8s: ## Evaluate Kubernetes policies | ||
| conftest test k8s/app -p $(POLICY_K8S_DIR) | ||
| conftest test k8s -p $(POLICY_K8S_DIR) | ||
|
|
||
| k8s-dry-run: ## Validate Kubernetes manifests with kubectl client-side dry run | ||
| kubectl apply --dry-run=client -f k8s | ||
|
|
||
| argocd-apply: ## Apply ArgoCD Application manifest | ||
| kubectl apply -f $(ARGOCD_APP_MANIFEST) | ||
|
|
||
| argocd-status: ## Show ArgoCD Application status | ||
| kubectl get application -n $(ARGOCD_NAMESPACE) $(ARGOCD_APP_NAME) | ||
|
|
||
| argocd-test: ## Apply app and wait until ArgoCD reports Synced + Healthy | ||
| kubectl apply -f $(ARGOCD_APP_MANIFEST) | ||
| kubectl wait --for=jsonpath='{.status.sync.status}'=Synced application/$(ARGOCD_APP_NAME) -n $(ARGOCD_NAMESPACE) --timeout=300s | ||
| kubectl wait --for=jsonpath='{.status.health.status}'=Healthy application/$(ARGOCD_APP_NAME) -n $(ARGOCD_NAMESPACE) --timeout=300s | ||
| kubectl get application -n $(ARGOCD_NAMESPACE) $(ARGOCD_APP_NAME) | ||
| kubectl get all -n dissertation | ||
|
|
||
| argocd-test-app-apply: ## Apply dedicated test ArgoCD Application manifest | ||
| kubectl apply -f $(ARGOCD_TEST_APP_MANIFEST) | ||
|
|
||
| argocd-test-app-status: ## Show dedicated test ArgoCD Application status | ||
| kubectl get application -n $(ARGOCD_NAMESPACE) $(ARGOCD_TEST_APP_NAME) | ||
|
|
||
| argocd-test-app-sync: ## Apply test app and wait until ArgoCD reports Synced + Healthy | ||
| kubectl apply -f $(ARGOCD_TEST_APP_MANIFEST) | ||
| kubectl wait --for=jsonpath='{.status.sync.status}'=Synced application/$(ARGOCD_TEST_APP_NAME) -n $(ARGOCD_NAMESPACE) --timeout=300s | ||
| kubectl wait --for=jsonpath='{.status.health.status}'=Healthy application/$(ARGOCD_TEST_APP_NAME) -n $(ARGOCD_NAMESPACE) --timeout=300s | ||
| kubectl get application -n $(ARGOCD_NAMESPACE) $(ARGOCD_TEST_APP_NAME) | ||
| kubectl get all -n dissertation-test | ||
|
|
||
| clean: ## Clean generated files | ||
| rm -f $(TF_DIR)/*.tfplan $(TF_DIR)/*.tfplan.json $(TF_DIR)/.terraform.lock.hcl | ||
| rm -rf $(TF_DIR)/.terraform | ||
| rm -f $(TF_DIR)/aws/*.tfplan $(TF_DIR)/aws/tfplan $(TF_DIR)/aws/tfplan*.json $(TF_DIR)/azure/*.tfplan $(TF_DIR)/azure/tfplan $(TF_DIR)/azure/tfplan*.json $(TF_DIR)/gcp/*.tfplan $(TF_DIR)/gcp/tfplan $(TF_DIR)/gcp/tfplan*.json | ||
| rm -rf $(TF_DIR)/aws/.terraform $(TF_DIR)/azure/.terraform $(TF_DIR)/gcp/.terraform | ||
| rm -f $(TF_DIR)/aws/.terraform.lock.hcl $(TF_DIR)/azure/.terraform.lock.hcl $(TF_DIR)/gcp/.terraform.lock.hcl | ||
|
Comment on lines
+74
to
+76
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argocd-testhard-codes the application namespace (dissertation) for the finalkubectl get all, while other values are parameterized (e.g.,ARGOCD_NAMESPACE, app name, manifest path). This makes the target brittle if the destination namespace changes. Make the destination namespace configurable (e.g.,APP_NAMESPACE?=dissertation) and use it here, similar to how the test app usesdissertation-test.