From 3418663ea8328a10b7c2ed37a789312533a095dd Mon Sep 17 00:00:00 2001 From: sam-at-luther Date: Wed, 1 May 2024 19:10:52 -0700 Subject: [PATCH 1/3] Add peer storage overrides --- ansible-roles/k8s_fabric_peer/defaults/main.yml | 2 ++ ansible-roles/k8s_fabric_peer/tasks/inner.yml | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ansible-roles/k8s_fabric_peer/defaults/main.yml b/ansible-roles/k8s_fabric_peer/defaults/main.yml index 7a32686..e47c561 100644 --- a/ansible-roles/k8s_fabric_peer/defaults/main.yml +++ b/ansible-roles/k8s_fabric_peer/defaults/main.yml @@ -49,3 +49,5 @@ k8s_fabric_peer_snapshot_archiver_version: "v0.0.1" k8s_fabric_peer_service_account_iam_role_arns: {} k8s_fabric_peer_service_account: default + +k8s_fabric_peer_storage_size_overrides: [] diff --git a/ansible-roles/k8s_fabric_peer/tasks/inner.yml b/ansible-roles/k8s_fabric_peer/tasks/inner.yml index 2431d87..54b6f7c 100644 --- a/ansible-roles/k8s_fabric_peer/tasks/inner.yml +++ b/ansible-roles/k8s_fabric_peer/tasks/inner.yml @@ -9,7 +9,7 @@ k8s_pvc_name: "storage-fabric-peer{{item}}-{{k8s_fabric_peer_org}}" k8s_pvc_component: fabric k8s_pvc_part_of: bcpeer - k8s_pvc_storage_size: "{{k8s_fabric_peer_storage_size}}" + k8s_pvc_storage_size: "{{ k8s_fabric_peer_storage_size_overrides[item] | default(k8s_fabric_peer_storage_size, true) }}" k8s_pvc_storage_class: "{{k8s_fabric_peer_storage_class}}" k8s_pvc_volume_type_override: "{{k8s_fabric_peer_volume_type_override}}" when: k8s_fabric_peer_separate_pvc @@ -63,7 +63,7 @@ memory: "{{k8s_fabric_peer_chaincode_memory_limit}}" persistentVolume: create: "{{not k8s_fabric_peer_separate_pvc}}" - storageSize: "{{k8s_fabric_peer_storage_size}}" + storageSize: "{{ storage_size }}" storageClassName: "{{k8s_fabric_peer_storage_class}}" dockerStorageSize: "{{k8s_fabric_peer_dockerstorage_size}}" typeOverride: "{{k8s_fabric_peer_volume_type_override}}" @@ -86,6 +86,7 @@ environment: "{{ kubectl_env }}" vars: availability_zones: "{{k8s_fabric_peer_azs or k8s_pv_data_replica_azs}}" + storage_size: "{{ k8s_fabric_peer_storage_size_overrides[item] | default(k8s_fabric_peer_storage_size, true) }}" - name: Upgrade pauser has run when: is_fabric_upgrade | bool From 3e8a27c56d01b1613af480bcdbc1756d6128545e Mon Sep 17 00:00:00 2001 From: sam-at-luther Date: Wed, 1 May 2024 19:13:44 -0700 Subject: [PATCH 2/3] Sleep infinity for fabric peer recovery mode --- .../k8s_fabric_peer/files/fabric-peer/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible-roles/k8s_fabric_peer/files/fabric-peer/templates/deployment.yaml b/ansible-roles/k8s_fabric_peer/files/fabric-peer/templates/deployment.yaml index ce1ce4c..658ac34 100644 --- a/ansible-roles/k8s_fabric_peer/files/fabric-peer/templates/deployment.yaml +++ b/ansible-roles/k8s_fabric_peer/files/fabric-peer/templates/deployment.yaml @@ -70,7 +70,7 @@ spec: command: - /bin/sh - -c - - while true; do sleep 10; done + - sleep infinity {{- end }} env: - name: FABRIC_CFG_PATH From d46d9378aa3b145b834d2dec6261235358f15570 Mon Sep 17 00:00:00 2001 From: sam-at-luther Date: Wed, 1 May 2024 19:30:56 -0700 Subject: [PATCH 3/3] Add recovery mode overrides --- ansible-roles/k8s_fabric_peer/defaults/main.yml | 1 + ansible-roles/k8s_fabric_peer/tasks/inner.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible-roles/k8s_fabric_peer/defaults/main.yml b/ansible-roles/k8s_fabric_peer/defaults/main.yml index e47c561..7d8b6cc 100644 --- a/ansible-roles/k8s_fabric_peer/defaults/main.yml +++ b/ansible-roles/k8s_fabric_peer/defaults/main.yml @@ -51,3 +51,4 @@ k8s_fabric_peer_service_account_iam_role_arns: {} k8s_fabric_peer_service_account: default k8s_fabric_peer_storage_size_overrides: [] +k8s_fabric_peer_recovery_overrides: [] diff --git a/ansible-roles/k8s_fabric_peer/tasks/inner.yml b/ansible-roles/k8s_fabric_peer/tasks/inner.yml index 54b6f7c..6bf483f 100644 --- a/ansible-roles/k8s_fabric_peer/tasks/inner.yml +++ b/ansible-roles/k8s_fabric_peer/tasks/inner.yml @@ -53,7 +53,7 @@ version: "{{k8s_fabric_peer_substrate_version or shiro_phylum_substrate_version | default('')}}" image: repository: "{{k8s_fabric_peer_image_repository}}" - startService: "{{k8s_fabric_peer_start_service}}" + startService: "{{not recovery_mode}}" startProbes: "{{k8s_fabric_peer_start_probes}}" internal: container: @@ -87,6 +87,7 @@ vars: availability_zones: "{{k8s_fabric_peer_azs or k8s_pv_data_replica_azs}}" storage_size: "{{ k8s_fabric_peer_storage_size_overrides[item] | default(k8s_fabric_peer_storage_size, true) }}" + recovery_mode: "{{ k8s_fabric_peer_recovery_overrides[item] | default(not k8s_fabric_peer_start_service, true) }}" - name: Upgrade pauser has run when: is_fabric_upgrade | bool