Pre-cache images when using TP ucp image
Related-Prod: PRODX-7035
Change-Id: I8f682efd4c39156f6db4b6299f3a48663da26423
diff --git a/de/heat-templates/fragments/SrvInstancesBM.yaml b/de/heat-templates/fragments/SrvInstancesBM.yaml
index 3041de1..14876f5 100644
--- a/de/heat-templates/fragments/SrvInstancesBM.yaml
+++ b/de/heat-templates/fragments/SrvInstancesBM.yaml
@@ -48,7 +48,6 @@
type: string
docker_ucp_image:
type: string
- default: 'docker/ucp:3.2.4'
hardware_metadata:
description: The content of lab metadata.
default: ''
@@ -69,13 +68,13 @@
$docker_ee_url: { get_param: docker_ee_url }
$docker_ee_release: { get_param: docker_ee_release }
$ucp_master_host: { get_param: ucp_master_host }
+ $docker_ucp_image: { get_param: docker_ucp_image }
$node_metadata: { get_param: metadata }
$control_network_cidr: { get_param: control_network_cidr }
$private_floating_interface: { get_param: private_floating_interface }
$private_floating_network_cidr: { get_param: private_floating_network_cidr }
$private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
$functions_override: { get_param: functions_override }
- $docker_ucp_image: { get_param: docker_ucp_image }
inject_files:
type: "OS::Heat::CloudConfig"
diff --git a/de/heat-templates/fragments/SrvInstancesBMCeph.yaml b/de/heat-templates/fragments/SrvInstancesBMCeph.yaml
index 1512f16..e96a0e3 100644
--- a/de/heat-templates/fragments/SrvInstancesBMCeph.yaml
+++ b/de/heat-templates/fragments/SrvInstancesBMCeph.yaml
@@ -53,6 +53,8 @@
ucp_master_host:
type: string
default: ''
+ docker_ucp_image:
+ type: string
public_net_id:
type: string
default: ''
@@ -79,6 +81,7 @@
$docker_ee_url: { get_param: docker_ee_url }
$docker_ee_release: { get_param: docker_ee_release }
$ucp_master_host: { get_param: ucp_master_host }
+ $docker_ucp_image: { get_param: docker_ucp_image }
$node_metadata: { get_param: metadata }
$control_network_cidr: { get_param: control_network_cidr }
$private_floating_interface: { get_param: private_floating_interface }
diff --git a/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml b/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml
index 438af6e..b03830f 100644
--- a/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml
+++ b/de/heat-templates/fragments/SrvInstancesBMCephOSD.yaml
@@ -67,6 +67,8 @@
ucp_master_host:
type: string
default: ''
+ docker_ucp_image:
+ type: string
public_net_id:
type: string
default: ''
@@ -97,6 +99,7 @@
$docker_ee_url: { get_param: docker_ee_url }
$docker_ee_release: { get_param: docker_ee_release }
$ucp_master_host: { get_param: ucp_master_host }
+ $docker_ucp_image: { get_param: docker_ucp_image }
$node_metadata: { get_param: metadata }
$control_network_cidr: { get_param: control_network_cidr }
$private_floating_interface: { get_param: private_floating_interface }
diff --git a/de/heat-templates/fragments/SrvInstancesVM.yaml b/de/heat-templates/fragments/SrvInstancesVM.yaml
index fab95cf..6d2bbb9 100644
--- a/de/heat-templates/fragments/SrvInstancesVM.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVM.yaml
@@ -68,6 +68,7 @@
$docker_ee_url: { get_param: docker_ee_url }
$docker_ee_release: { get_param: docker_ee_release }
$ucp_master_host: { get_param: ucp_master_host }
+ $docker_ucp_image: { get_param: docker_ucp_image }
$node_metadata: { get_param: metadata }
$control_network_cidr: { get_param: control_network_cidr }
$private_floating_interface: { get_param: private_floating_interface }
diff --git a/de/heat-templates/fragments/SrvInstancesVMCeph.yaml b/de/heat-templates/fragments/SrvInstancesVMCeph.yaml
index 7ab4451..a367c7f 100644
--- a/de/heat-templates/fragments/SrvInstancesVMCeph.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVMCeph.yaml
@@ -53,6 +53,8 @@
ucp_master_host:
type: string
default: ''
+ docker_ucp_image:
+ type: string
public_net_id:
type: string
docker_ee_release:
@@ -87,6 +89,7 @@
$docker_ee_url: { get_param: docker_ee_url }
$docker_ee_release: { get_param: docker_ee_release }
$ucp_master_host: { get_param: ucp_master_host }
+ $docker_ucp_image: { get_param: docker_ucp_image }
$node_metadata: { get_param: metadata }
$control_network_cidr: { get_param: control_network_cidr }
$private_floating_interface: { get_param: private_floating_interface }
diff --git a/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml b/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
index 74587cb..588b0c9 100644
--- a/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
@@ -67,6 +67,8 @@
ucp_master_host:
type: string
default: ''
+ docker_ucp_image:
+ type: string
public_net_id:
type: string
docker_ee_release:
@@ -105,6 +107,7 @@
$docker_ee_url: { get_param: docker_ee_url }
$docker_ee_release: { get_param: docker_ee_release }
$ucp_master_host: { get_param: ucp_master_host }
+ $docker_ucp_image: { get_param: docker_ucp_image }
$node_metadata: { get_param: metadata }
$control_network_cidr: { get_param: control_network_cidr }
$private_floating_interface: { get_param: private_floating_interface }
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index 920cedc..3dd5518 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -154,6 +154,22 @@
}
+function cache_images {
+
+ function cache_images_retry {
+ local image_prefix=${DOCKER_UCP_IMAGE%/*}
+ local image_name=${DOCKER_UCP_IMAGE##*/}
+ if [[ "$image_name" =~ .*-tp[0-9]+ ]]; then
+ for image in $(docker container run --rm --name ucp -v /var/run/docker.sock:/var/run/docker.sock ${DOCKER_UCP_IMAGE} images --list); do
+ docker pull ${image_prefix}/${image##*/};
+ docker tag ${image_prefix}/${image##*/} ${image}
+ done
+ fi
+ }
+
+ retry 10 "Can't cache docker images" cache_images_retry
+}
+
function install_ucp {
local tmpd
tmpd=$(mktemp -d)
@@ -488,6 +504,7 @@
install_docker
swarm_init
create_ucp_config
+ cache_images
install_ucp
download_bundles
rm_ucp_config
@@ -509,6 +526,7 @@
configure_atop
workaround_default_forward_policy
install_docker
+ cache_images
download_bundles
join_node manager
install_kubectl
@@ -529,6 +547,7 @@
configure_atop
workaround_default_forward_policy
install_docker
+ cache_images
download_bundles
join_node worker
install_kubectl
@@ -547,6 +566,7 @@
install_required_packages
configure_atop
install_docker
+ cache_images
download_bundles
workaround_default_forward_policy
configure_contrack
diff --git a/de/heat-templates/top.yaml b/de/heat-templates/top.yaml
index dbc7589..8f7ca7a 100644
--- a/de/heat-templates/top.yaml
+++ b/de/heat-templates/top.yaml
@@ -329,6 +329,7 @@
flavor: { get_param: masters_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -358,6 +359,7 @@
key_name: { get_param: "OS::stack_name" }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -400,6 +402,7 @@
flavor: { get_param: cmps_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -442,6 +445,7 @@
flavor: { get_param: gtws_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -477,6 +481,7 @@
flavor: { get_param: lmas_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -512,6 +517,7 @@
flavor: { get_param: osds_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -554,6 +560,7 @@
flavor: { get_param: spares_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -596,6 +603,7 @@
flavor: { get_param: ntws_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
@@ -631,6 +639,7 @@
flavor: { get_param: vbmcs_flavor }
docker_ee_url: { get_param: docker_ee_url }
docker_ee_release: { get_param: docker_ee_release }
+ docker_ucp_image: { get_param: docker_ucp_image}
accessible_network: { get_attr: [accessible_network, public_network] }
private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }