-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌱 Cleanup v1 cluster before creating v3 clusters on upgrade (#576)
* Cleanup v1 cluster before creating v3 clusters on upgrade Signed-off-by: Danil-Grigorev <[email protected]> * Cover provisioning to management v3 migration - Add e2e tests, verifying the added migration functionality Signed-off-by: Danil-Grigorev <[email protected]> * Clean up space for short e2e run Signed-off-by: Danil-Grigorev <[email protected]> --------- Signed-off-by: Danil-Grigorev <[email protected]>
- Loading branch information
1 parent
e9aa608
commit 80e434b
Showing
6 changed files
with
542 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,23 @@ jobs: | |
e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cleanup space | ||
run: | | ||
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y '^llvm-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^llvm-.*' --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..." | ||
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..." | ||
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..." | ||
sudo docker image prune --all --force || true | ||
sudo swapoff -a || true | ||
sudo rm -f /mnt/swapfile || true | ||
free -h | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
|
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,67 @@ | ||
{{- if and (index .Values "rancherTurtles" "features" "managementv3-cluster" "enabled") (index .Values "rancherTurtles" "features" "managementv3-cluster-migration" "enabled") }} | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: post-upgrade-job | ||
namespace: rancher-turtles-system | ||
annotations: | ||
"helm.sh/hook": post-upgrade | ||
"helm.sh/hook-weight": "1" | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: post-upgrade-job-delete-clusters | ||
annotations: | ||
"helm.sh/hook": post-upgrade | ||
"helm.sh/hook-weight": "1" | ||
rules: | ||
- apiGroups: | ||
- provisioning.cattle.io | ||
resources: | ||
- clusters | ||
verbs: | ||
- list | ||
- delete | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: post-upgrade-job-delete-clusters | ||
annotations: | ||
"helm.sh/hook": post-upgrade | ||
"helm.sh/hook-weight": "1" | ||
subjects: | ||
- kind: ServiceAccount | ||
name: post-upgrade-job | ||
namespace: rancher-turtles-system | ||
roleRef: | ||
kind: ClusterRole | ||
name: post-upgrade-job-delete-clusters | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: post-upgrade-delete-clusters | ||
annotations: | ||
"helm.sh/hook": post-upgrade | ||
"helm.sh/hook-weight": "2" | ||
spec: | ||
ttlSecondsAfterFinished: 300 | ||
template: | ||
spec: | ||
serviceAccountName: post-upgrade-job | ||
containers: | ||
- name: post-upgrade-delete-clusters | ||
image: {{ index .Values "rancherTurtles" "features" "rancher-webhook" "kubectlImage" }} | ||
args: | ||
- delete | ||
- clusters.provisioning.cattle.io | ||
- --selector=cluster-api.cattle.io/owned | ||
- -A | ||
- --ignore-not-found=true | ||
- --wait | ||
restartPolicy: OnFailure | ||
{{- end }} |
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
Oops, something went wrong.