Skip to content

Commit

Permalink
feat(fabric): update playbooks to refresh certificates for fabric ver…
Browse files Browse the repository at this point in the history
…sion 2.5.x
  • Loading branch information
alvaropicazo committed Jun 11, 2024
1 parent 88b6e24 commit c50fc49
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
component: "{{ item.name | lower}}"
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
sc_name: "{{ item.name | lower}}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
Expand Down Expand Up @@ -81,6 +82,7 @@
component_type: "{{ item.type | lower}}"
component_services: "{{ item.services }}"
orderer_org: "{{ item.orderer_org | lower }}"
sc_name: "{{ item.name | lower}}-bevel-storageclass"
kubernetes: "{{ item.k8s }}"
vault: "{{ item.vault }}"
ca: "{{ item.services.ca }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
- name: "Set Variable channel_name"
set_fact:
channel_name: "{{ network['channels'] | map(attribute='channel_name') | first | lower }}"
when: item.type == 'orderer' and ('2.2.' in network.version or '1.4.' in network.version)
when: item.type == 'orderer' and ('2.2.' in network.version or '1.4.' in network.version or '2.5.' in network.version)

# Fetch the genesis block from vault to the build directory
- name: Fetch the genesis block from vault
shell: |
vault kv get -field={{ network.env.type }}GenesisBlock {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ item.name | lower }}-net > {{ channel_name}}.genesis.block.base64
vault kv get -field={{ network.env.type }}GenesisBlock {{ item.vault.secret_path | default('secretsv2') }}/{{ item.name | lower }}/ordererOrganizations/{{ item.name | lower }}-net > {{ channel_name }}.genesis.block.base64
mkdir -p ./build/channel-artifacts
mv {{ channel_name}}.genesis.block.base64 ./build/channel-artifacts/
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
channel_name: "{{ sys_channel_name }}"
orderer: "{{ org.services.orderers | first }}"
check: "latest_block"
when: add_new_org == 'false' and ('2.2.' in network.version or '1.4.' in network.version)

# Call get_update_block to get the latest from appchannel channel block.
- name: Call get_update_block to get latest appchannel block
Expand All @@ -37,10 +38,23 @@
path: "{{ build_path }}/channel-artifacts"
state: directory

# Create the genesis block by consuming the latest config block for 2.5.x fabric versions
- name: "Create genesis block"
shell: |
cat {{ build_path }}/{{ channel.channel_name | lower }}_config_block.pb | base64 > {{ build_path }}/channel-artifacts/{{ channel.channel_name | lower }}.genesis.block.base64
loop: "{{ network.channels }}"
loop_control:
loop_var: channel
when: add_new_org == 'false' and ('2.5.' in network.version)

# Create the genesis block by consuming the latest config block
- name: "Create genesis block"
shell: |
cat {{ build_path }}/{{ sys_channel_name }}_config_block.pb | base64 > {{ build_path }}/channel-artifacts/{{ channel.channel_name | lower }}.genesis.block.base64
cat {{ build_path }}/{{ sys_channel_name | lower }}_config_block.pb | base64 > {{ build_path }}/channel-artifacts/{{ channel.channel_name | lower }}.genesis.block.base64
loop: "{{ network.channels }}"
loop_control:
loop_var: channel
when: add_new_org == 'false' and ('2.2.' in network.version or '1.4.' in network.version)

# Add new genesis block to the vault
- name: "Write genesis block to Vault"
Expand All @@ -49,6 +63,10 @@
environment:
VAULT_ADDR: "{{ org.vault.url }}"
VAULT_TOKEN: "{{ org.vault.root_token }}"
loop: "{{ network.channels }}"
loop_control:
loop_var: channel
when: add_new_org == 'false' and ('2.5.' in network.version)

# Delete the orderer cli
- name: "Delete all temp {{ orderer.name }}-{{ org.name }}-cli"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
script: "syschannel-update-script.sh"
channel_name: "{{ sys_channel_name }}"
check: "fetch_block"
when: add_new_org == 'false' and ('1.4.' in network.version or '2.2.' in network.version)

# Call get_update_block to fetch the appchannel channels block
- name: Call get_update_block to fetch the {{ channel_name }} channel block
Expand All @@ -71,6 +72,7 @@
script: "syschannel-update-script.sh"
channel_name: "{{ sys_channel_name }}"
check: "update_block"
when: add_new_org == 'false' and ('1.4.' in network.version or '2.2.' in network.version)

# Call get_update_block to fetch the appchannel channels block
- name: Call get_update_block to update the {{ channel_name }} channel block
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
channel_name: "{{ sys_channel_name }}"
namespace: "{{ component_ns }}"

# Create the update-channel-scriptk.sh file for organizations
# Create the update-channel-script.sh file for organizations
- name: "Create update-channel-script.sh script file for orderers"
template:
src: "update_consenter_script.tpl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CURRENT_DIR=${PWD}

echo "installing jq "
apt-get install -y jq
echo "installing wget "
apt-get wget
echo "installing sed "
apk add sed
echo "installing configtxlator"
Expand Down
2 changes: 1 addition & 1 deletion platforms/shared/configuration/setup-k8s-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
git_protocol: "{{ item.gitops.git_protocol | default('https') }}"
git_url: "{{ item.gitops.git_url }}"
git_key: "{{ item.gitops.private_key | default() }}"
flux_version: "0.41.2"
flux_version: "2.3.0"
with_items: "{{ network.organizations }}"
when: network.env.type != 'operator'

Expand Down

0 comments on commit c50fc49

Please sign in to comment.