@@ -130,28 +130,29 @@ spec:
130
130
namespace : kube-system
131
131
- name : Delete child cluster
132
132
try :
133
- - delete :
134
- ref :
135
- apiVersion : cluster.x-k8s.io/v1beta1
136
- kind : Cluster
137
- name : ($cluster)
138
- - delete :
139
- ref :
140
- apiVersion : infrastructure.cluster.x-k8s.io/v1alpha2
141
- kind : LinodeVPC
142
- name : ($cluster)
143
- - delete :
144
- ref :
145
- apiVersion : infrastructure.cluster.x-k8s.io/v1alpha2
146
- kind : LinodeFirewall
147
- name : ($cluster)
148
- - delete :
149
- ref :
150
- apiVersion : infrastructure.cluster.x-k8s.io/v1alpha2
151
- kind : LinodeFirewall
152
- name : ($cluster)-nb
153
- - error :
154
- file : check-child-cluster-vpc-and-firewall-deleted.yaml
133
+ - script :
134
+ env :
135
+ - name : CLUSTER
136
+ value : ($cluster)
137
+ - name : NAMESPACE
138
+ value : ($namespace)
139
+ - name : CLUSTERCTL_CONFIG
140
+ value : (env('CLUSTERCTL_CONFIG'))
141
+ - name : SKIP_DELETE
142
+ value : (env('SKIP_CUSTOM_DELETE'))
143
+ content : |
144
+ set -e
145
+ if [[ -n "$SKIP_DELETE" ]]; then
146
+ echo "Skipping deletion of child cluster"
147
+ exit 0
148
+ fi
149
+ kubectl delete cluster $CLUSTER -n $NAMESPACE --timeout=60s || { echo "deletion failed!"; exit 1; }
150
+ kubectl delete linodevpc $CLUSTER -n $NAMESPACE --timeout=60s || { echo "deletion failed!"; exit 1; }
151
+ kubectl delete linodefirewall $CLUSTER -n $NAMESPACE --timeout=60s || { echo "deletion failed!"; exit 1; }
152
+ kubectl delete linodefirewall $CLUSTER-nb -n $NAMESPACE --timeout=60s || { echo "deletion failed!"; exit 1; }
153
+ check :
154
+ ($error == null) : true
155
+ (contains($stdout, 'deletion failed')) : false
155
156
- name : Check if the linodes are deleted
156
157
try :
157
158
- script :
@@ -164,8 +165,14 @@ spec:
164
165
value : linode/instances
165
166
- name : FILTER
166
167
value : (to_string({"tags":($cluster)}))
168
+ - name : SKIP_DELETE
169
+ value : (env('SKIP_CUSTOM_DELETE'))
167
170
content : |
168
171
set -e
172
+ if [[ -n "$SKIP_DELETE" ]]; then
173
+ echo {\"results\":0}
174
+ exit 0
175
+ fi
169
176
curl -s \
170
177
-H "Authorization: Bearer $LINODE_TOKEN" \
171
178
-H "X-Filter: $FILTER" \
0 commit comments