Skip to content

Commit 95850ce

Browse files
authored
Merge pull request #1129 from IBM/sov-core
Sovereign core updates
2 parents 0911502 + 3c98811 commit 95850ce

4 files changed

Lines changed: 33 additions & 30 deletions

File tree

automation-roles/50-install-cloud-pak/cpfs/cp-ocp-global-pull-secret/tasks/apply-global-pull-secret-private.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@
2222
shell: |
2323
set -o pipefail
2424
{{ _add_cred_global_pull_secret_command }} | tee -a {{ status_dir }}/log/add-cred-to-global-pull-secret.log
25-
when: not cpd_dry_run
25+
when: not cpd_dry_run
26+
args:
27+
chdir: /opt/ansible

automation-roles/50-install-cloud-pak/cpfs/cp-ocp-global-pull-secret/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
---
2+
- ansible.builtin.stat:
3+
path: "/tmp/work/registries.conf"
4+
register: _registries_conf
5+
6+
- name: Create /tmp/work/registries.conf file
7+
ansible.builtin.copy:
8+
content: "{{ lookup('template','registries_conf.j2') }}"
9+
dest: /tmp/work/registries.conf
10+
mode: u+rw
11+
212
- include_tasks: apply-global-pull-secret-entitled.yml
313
when: (_p_registry_url | default('')) == ''
414

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[[registry]]
2+
location = "icr.io"
3+
[[registry.mirror]]
4+
location = "127.0.0.1:12443"

scripts/cp4d/cp4d-delete-instance.sh

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ COMMON OPTIONS:
1919
--scheduler-ns <NS> Scheduler namespace (if different from auto-detected)
2020
--dry-run Show what would be deleted (safe, no changes)
2121
--sequential Use sequential deletion (slower, default is parallel)
22-
--force-finalizer Force cleanup of stuck resources
2322
--timeout <SECONDS> Deletion timeout (default: 60)
2423
-h, --help Show this help
2524
@@ -41,9 +40,6 @@ EXAMPLES:
4140
# Sequential deletion (slower but more controlled)
4241
$(basename $0) cpd --sequential
4342
44-
# Fast deletion with forced cleanup
45-
$(basename $0) cpd --force-finalizer
46-
4743
WHAT GETS DELETED:
4844
• CP4D instance namespace (specified)
4945
• Operator namespace (default: <instance>-operators)
@@ -202,10 +198,6 @@ else
202198
command_usage 2
203199
fi
204200
;;
205-
--force-finalizer)
206-
export FORCE_FINALIZER=true
207-
shift 1
208-
;;
209201
--timeout*)
210202
if [[ "$1" =~ "=" ]] && [ ! -z "${1#*=}" ] && [ "${1#*=:0:1}" != "-" ];then
211203
export NAMESPACE_DELETE_TIMEOUT="${1#*=}"
@@ -272,7 +264,7 @@ wait_ns_deleted() {
272264
TIMEOUT=${NAMESPACE_DELETE_TIMEOUT:-60}
273265
ELAPSED=0
274266
RETRY_COUNT=0
275-
MAX_RETRIES=3
267+
MAX_RETRIES=10
276268
log "Waiting for deletion of namespace ${NS} (timeout: ${TIMEOUT}s)..."
277269

278270
while $(oc get ns ${NS} > /dev/null 2>&1);do
@@ -286,14 +278,13 @@ wait_ns_deleted() {
286278
# Run diagnostics
287279
diagnose_namespace_stuck ${NS}
288280

289-
if [ "${FORCE_FINALIZER}" = "true" ] && [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
281+
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
290282
RETRY_COUNT=$((RETRY_COUNT + 1))
291283
log_info "Attempting forced cleanup (attempt ${RETRY_COUNT}/${MAX_RETRIES})..."
292284
force_remove_finalizers ${NS}
293285

294286
# Reset timeout for retry
295287
ELAPSED=0
296-
TIMEOUT=300 # Shorter timeout for retries
297288
log "Waiting additional ${TIMEOUT}s after forced cleanup..."
298289
continue
299290
else
@@ -366,17 +357,15 @@ wait_multiple_ns_deleted() {
366357
if oc get ns ${ns} > /dev/null 2>&1; then
367358
failed_ns+=("$ns")
368359
log_warning "Namespace ${ns} still exists after timeout"
369-
if [ "${FORCE_FINALIZER}" = "true" ]; then
370-
log_info "Applying forced cleanup to ${ns}..."
371-
force_remove_finalizers ${ns}
372-
fi
360+
log_info "Applying forced cleanup to ${ns}..."
361+
force_remove_finalizers ${ns}
373362
else
374363
log_success "Namespace ${ns} deleted successfully"
375364
fi
376365
done
377366

378-
# If there are failed namespaces and force finalizer is enabled, wait a bit more
379-
if [ ${#failed_ns[@]} -gt 0 ] && [ "${FORCE_FINALIZER}" = "true" ]; then
367+
# If there are failed namespaces, wait a bit more
368+
if [ ${#failed_ns[@]} -gt 0 ]; then
380369
log_info "Waiting additional 120s for forced cleanup to complete..."
381370
sleep 120
382371

@@ -392,18 +381,16 @@ wait_multiple_ns_deleted() {
392381

393382
force_remove_finalizers() {
394383
NS=$1
395-
if [ "${FORCE_FINALIZER}" = "true" ]; then
396-
log_info "Force removing finalizers for ${NS} namespace"
397-
398-
# First, try to remove finalizers from blocking resources
399-
force_remove_resource_finalizers ${NS}
400-
401-
# Then remove namespace finalizers using oc patch
402-
if oc get ns ${NS} > /dev/null 2>&1; then
403-
log_info "Removing finalizers from namespace ${NS}..."
404-
oc patch ns ${NS} --type=merge -p '{"metadata":{"finalizers":null}}' 2>/dev/null || true
405-
log_success "Namespace finalizers removed for ${NS}"
406-
fi
384+
log_info "Force removing finalizers for ${NS} namespace"
385+
386+
# First, try to remove finalizers from blocking resources
387+
force_remove_resource_finalizers ${NS}
388+
389+
# Then remove namespace finalizers using oc patch
390+
if oc get ns ${NS} > /dev/null 2>&1; then
391+
log_info "Removing finalizers from namespace ${NS}..."
392+
oc patch ns ${NS} --type=merge -p '{"metadata":{"finalizers":null}}' 2>/dev/null || true
393+
log_success "Namespace finalizers removed for ${NS}"
407394
fi
408395
}
409396

0 commit comments

Comments
 (0)