Skip to content

Commit

Permalink
Sam at luther/add ccid override (#52)
Browse files Browse the repository at this point in the history
* Add peer storage overrides

* Sleep infinity for fabric peer recovery mode

* Add recovery mode overrides

* Add CCID override

* Add CCID override
  • Loading branch information
sam-at-luther authored May 3, 2024
1 parent 50a7507 commit 03b6540
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions ansible-roles/k8s_fabric_chaincode/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ k8s_fabric_chaincode_external: false
k8s_fabric_chaincode_loglevel: info
k8s_fabric_chaincode_helm_chart_path: "{{kubectl_asset_root_path}}/chaincode"
k8s_fabric_chaincode_azs: []
# ccid override is a hack to work with old substrate/buildpack versions
k8s_fabric_chaincode_ccid_override: ""
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- {{ .Values.ccid }}
- "{{ .Values.ccid }}"
env:
{{- range $var, $value := .Values.env }}
- name: {{ $var }}
Expand Down
26 changes: 13 additions & 13 deletions ansible-roles/k8s_fabric_chaincode/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
changed_when: false
failed_when: false
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Store committed facts
set_fact:
Expand All @@ -26,7 +26,7 @@
committed_json: "{{ query_committed.stdout | from_json }}"
sequence: "{{ committed_json | json_query('sequence') }}"
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Install chaincode on peers
command:
Expand All @@ -46,7 +46,7 @@
register: install_result
changed_when: '"peers have installed the chaincode" in install_result.stderr'
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Helm chart exists
synchronize:
Expand All @@ -59,7 +59,7 @@
use_ssh_args: yes
when: k8s_fabric_chaincode_external
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: External chaincode is installed
kubernetes.core.helm:
Expand All @@ -72,7 +72,7 @@
version: "{{k8s_fabric_chaincode_version}}"
service:
name: "substrate-{{ cc_dash_ver }}-peer{{ item.1 }}"
ccid: "{{install_result.results[index].stdout}}"
ccid: "{{ k8s_fabric_chaincode_ccid_override | default(install_result.results[index].stdout, true) }}"
dlt:
organization: "{{item.0 }}"
peerIndex: "{{item.1}}"
Expand All @@ -85,7 +85,7 @@
when:
- k8s_fabric_chaincode_external | bool
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade
environment: "{{ kubectl_env }}"
vars:
availability_zones: "{{k8s_fabric_chaincode_azs}}"
Expand All @@ -104,11 +104,11 @@
environment: "{{ kubectl_env }}"
when: not committed
# TODO: only approve on luther orgs!
loop: "{{ k8s_fabric_chaincode_orgs }}"
loop: "{{ k8s_fabric_chaincode_orgs }}"
register: approve_result
changed_when: '"has approved the chaincode" in approve_result.stderr'
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Generate approval script
command:
Expand All @@ -124,7 +124,7 @@
when: not committed
register: approval_script
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Check chaincode approvals
command:
Expand All @@ -142,17 +142,17 @@
register: readiness_report
changed_when: false
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Display approval information
debug:
msg:
- "{{readiness_report.stdout}}"
- "{{approval_script.stdout}}"
- "{{readiness_report.stdout}}"
- "{{approval_script.stdout}}"
when: not committed
loop: "{{ k8s_fabric_chaincode_orgs }}"
tags:
- prepare_chaincode_upgrade
- prepare_chaincode_upgrade

- name: Wait for chaincode approvals
command:
Expand Down

0 comments on commit 03b6540

Please sign in to comment.