diff --git a/charts/rancher/BUILD-README.md b/charts/rancher/BUILD-README.md index 00c250a..91097bd 100644 --- a/charts/rancher/BUILD-README.md +++ b/charts/rancher/BUILD-README.md @@ -35,13 +35,12 @@ $ git checkout -b update-rancher/2.9.1 cd ~/service-catalog/charts/rancher # 파일 삭제 전 삭제할 파일 목록 확인 - find . -type f -not \( -name "CUSTOM-README.md" -o -name "BUILD-README.md" -o -name "custom-values.yaml" -o -path "*/templates/preinstallHook/*" -o -path "*/templates/postdeleteHook/*" \) + find . -type f -not \( -name "CUSTOM-README.md" -o -name "BUILD-README.md" -o -name "custom-values.yaml" -o -path "./scripts/cleanup-rancher.sh" -o -path "./scripts/README.md" -o -path "*/templates/preinstallHook/*" \) # 파일 삭제 - find . -type f -not \( -name "CUSTOM-README.md" -o -name "BUILD-README.md" -o -name "custom-values.yaml" -o -path "*/templates/preinstallHook/*" -o -path "*/templates/postdeleteHook/*" \) -delete + find . -type f -not \( -name "CUSTOM-README.md" -o -name "BUILD-README.md" -o -name "custom-values.yaml" -o -path "./scripts/cleanup-rancher.sh" -o -path "./scripts/README.md" -o -path "*/templates/preinstallHook/*" \) -delete ``` - - 변경할 rancher 버전의 차트를 다운로드 ``` sh # charts 디렉토리로 이동 @@ -61,7 +60,46 @@ $ git checkout -b update-rancher/2.9.1 rm rancher-*.tgz ``` +### 2) 차트 수정 +- post delete hook 파일 삭제(argocd에서 실행시 문제 발생 > 해당 문제 해결 시 제외) + ``` sh + rm -f templates/post-delete-hook* + ``` +- post-delete-hook.sh 수정 + ``` sh + # line 81에 kubectl delete 문 추가 + kubectl --ignore-not-found=true delete secret tls-ca -n ${rancher_namespace} + ... + # 스크립트 마지막에 아래 내용 추가 + for ns in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}'); do + # Remove finalizers from the namespace itself + kubectl patch namespace "$ns" -p '{"metadata":{"finalizers":[]}}' --type=merge + # Remove finalizers from all roles in the namespace + for role in $(kubectl get roles -n "$ns" -o jsonpath='{.items[*].metadata.name}'); do + kubectl patch role "$role" -n "$ns" -p '{"metadata":{"finalizers":[]}}' --type=merge + done + + # Remove finalizers from all rolebindings in the namespace + for rolebinding in $(kubectl get rolebindings -n $ns -o jsonpath='{.items[*].metadata.name}'); do + kubectl patch rolebinding "$rolebinding" -n "$ns" -p '{"metadata":{"finalizers":[]}}' --type=merge + done + done + + for cr in $(kubectl get clusterroles -o jsonpath='{.items[*].metadata.name}'); do + kubectl patch clusterrole "$cr" -p '{"metadata":{"finalizers":[]}}' --type=merge + done + + for crb in $(kubectl get clusterrolebindings -o jsonpath='{.items[*].metadata.name}'); do + kubectl patch clusterrolebinding "$crb" -p '{"metadata":{"finalizers":[]}}' --type=merge + done + ``` + +- values.yaml에 `preinstallHook: false` 추가 + ``` yaml + # 문서 마지막에 아래 값 추가 + preinstallHook: false + ``` ## 3. git push 및 tag 추가 @@ -103,3 +141,6 @@ $ git push origin rancher/2.9.1 - Helm preinstall Hook에 rancher labels 추가 - Helm preinstall Hook으로 생성된 자원을 삭제하기 위해 Helm postdelete Hook을 추가하였다. - 변경 사항을 BUILD-README.md 문서에 반영하였다. +- rancher/2.9.1-3 + - Argocd post-delete Hook 이슈로 Hook을 삭제하였다. + - Rancher 삭제 후처리를 위한 스크립트 수정 및 추가하였다. \ No newline at end of file