Skip to content

Commit

Permalink
Spawn relevant resources in the cattle-system namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
nflynt committed Aug 10, 2023
1 parent f96eb3a commit 4e18baa
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cleanup/ad-guid-unmigration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: cattle-cleanup-sa
namespace: default
namespace: cattle-system
labels:
rancher-cleanup: "true"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cattle-cleanup-binding
namespace: default
labels:
rancher-cleanup: "true"
roleRef:
Expand All @@ -49,13 +48,13 @@ roleRef:
subjects:
- kind: ServiceAccount
name: cattle-cleanup-sa
namespace: default
namespace: cattle-system
---
apiVersion: batch/v1
kind: Job
metadata:
name: cattle-cleanup-job
namespace: default
namespace: cattle-system
labels:
rancher-cleanup: "true"
spec:
Expand Down Expand Up @@ -92,8 +91,7 @@ spec:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cattle-cleanup-role
namespace: default
name: cattle-cleanup-role
labels:
rancher-cleanup: "true"
rules:
Expand Down Expand Up @@ -205,10 +203,10 @@ fi
echo "$yaml" | kubectl apply -f -

# Get the pod ID to tail the logs
pod_id=$(kubectl get pod -l job-name=cattle-cleanup-job -o jsonpath="{.items[0].metadata.name}")
pod_id=$(kubectl --namespace=cattle-system get pod -l job-name=cattle-cleanup-job -o jsonpath="{.items[0].metadata.name}")

declare -i count=0
until kubectl logs $pod_id -f
until kubectl --namespace=cattle-system logs $pod_id -f
do
if [ $count -gt $timeout ]
then
Expand Down

0 comments on commit 4e18baa

Please sign in to comment.