-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Application resource watching (#43)
Co-authored-by: Matt Morrison <[email protected]> Co-authored-by: Mmadu Manasseh <[email protected]>
- Loading branch information
1 parent
6d7a424
commit d0614c1
Showing
27 changed files
with
735 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "kubechecks.fullname" . }} | ||
rules: | ||
- apiGroups: ['*'] | ||
resources: ['applications', 'appprojects', 'services'] | ||
verbs: ['*'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "kubechecks.fullname" . }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "kubechecks.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "kubechecks.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Deleting ArgoCD test Applications & AppSets (gracefully)..." | ||
|
||
# Delete ApplicationSets | ||
for a in $(kubectl get ApplicationSet -n kubechecks -o=jsonpath='{.items[*].metadata.name}'); do | ||
kubectl delete ApplicationSet $a -n kubechecks --timeout=10s; | ||
done; | ||
|
||
# Delete Applications | ||
for a in $(kubectl get application -n kubechecks -o=jsonpath='{.items[*].metadata.name}'); do | ||
kubectl delete application $a -n kubechecks --timeout=10s; | ||
done; | ||
|
||
exit 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
# check if Applications CRD still exists | ||
exists=$(kubectl get crd | grep "applications.argoproj.io" | wc -l) | ||
if [ "$exists" -eq 0 ]; then | ||
echo "Applications CRD doesn't exist. Exiting..." | ||
exit 0; | ||
fi | ||
|
||
# give time for other processes to cleanup properly | ||
echo "ArgoCD Cleanup: waiting 20 seconds..." | ||
sleep 20 | ||
echo "Cleaning up ArgoCD test Applications and CRDs..." | ||
|
||
# Cleanup Applications | ||
for a in $(kubectl get application -n kubechecks -o=jsonpath='{.items[*].metadata.name}'); do | ||
# remove finalizer from Applications (ArgoCD is probably shutdown by now and deleting apps will hang) | ||
kubectl patch application $a -n kubechecks --type json -p='[{"op": "remove", "path": "/metadata/finalizers"}]'; | ||
kubectl delete application $a -n kubechecks; | ||
done; | ||
|
||
# Cleanup ArgoCD CRDs | ||
for crd in applications.argoproj.io applicationsets.argoproj.io appprojects.argoproj.io; do | ||
kubectl delete crd $crd; | ||
done; | ||
|
||
exit 0; |
Oops, something went wrong.