From fa477ef3807a373b175c4a1218c5507755f46f57 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Tue, 5 May 2015 11:25:40 +1200 Subject: Config & deployments to update overcloud packages This change adds config and deployment resources to trigger package updates on nodes. The deployments are triggered by doing a stack-update and setting one of the parameters to a unique value. The intent is that rolling update will be controlled by setting breakpoints on all of the UpdateDeployment resources inside the role resource groups. Change-Id: I56bbf944ecd6cbdbf116021b8a53f9f9111c134f --- ceph-storage.yaml | 6 +++++ cinder-storage.yaml | 7 ++++++ compute.yaml | 6 +++++ controller.yaml | 6 +++++ extraconfig/tasks/yum_update.sh | 41 +++++++++++++++++++++++++++++++++ extraconfig/tasks/yum_update.yaml | 26 +++++++++++++++++++++ overcloud-resource-registry-puppet.yaml | 1 + overcloud-resource-registry.yaml | 1 + overcloud-without-mergepy.yaml | 13 +++++++++++ puppet/ceph-storage-puppet.yaml | 18 +++++++++++++++ puppet/cinder-storage-puppet.yaml | 18 +++++++++++++++ puppet/compute-puppet.yaml | 18 +++++++++++++++ puppet/controller-puppet.yaml | 18 +++++++++++++++ puppet/swift-storage-puppet.yaml | 18 +++++++++++++++ swift-storage.yaml | 6 +++++ 15 files changed, 203 insertions(+) create mode 100755 extraconfig/tasks/yum_update.sh create mode 100644 extraconfig/tasks/yum_update.yaml diff --git a/ceph-storage.yaml b/ceph-storage.yaml index 05d80927..138e6ea5 100644 --- a/ceph-storage.yaml +++ b/ceph-storage.yaml @@ -33,6 +33,12 @@ parameters: description: Mapping of service_name -> network name. Typically set via parameter_defaults in the resource registry. type: json + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: CephStorage: diff --git a/cinder-storage.yaml b/cinder-storage.yaml index aee67c9d..9541ed1c 100644 --- a/cinder-storage.yaml +++ b/cinder-storage.yaml @@ -100,6 +100,13 @@ parameters: description: The user password for SNMPd with readonly rights running on all Overcloud nodes type: string hidden: true + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes + resources: BlockStorage: type: OS::Nova::Server diff --git a/compute.yaml b/compute.yaml index f434c277..abd59103 100644 --- a/compute.yaml +++ b/compute.yaml @@ -248,6 +248,12 @@ parameters: description: Mapping of service_name -> network name. Typically set via parameter_defaults in the resource registry. type: json + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: diff --git a/controller.yaml b/controller.yaml index 82cff3f6..51dba076 100644 --- a/controller.yaml +++ b/controller.yaml @@ -438,6 +438,12 @@ parameters: description: Mapping of service_name -> network name. Typically set via parameter_defaults in the resource registry. type: json + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: diff --git a/extraconfig/tasks/yum_update.sh b/extraconfig/tasks/yum_update.sh new file mode 100755 index 00000000..3d4c772b --- /dev/null +++ b/extraconfig/tasks/yum_update.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# A heat-config-script which runs yum update during a stack-update. +# Inputs: +# deploy_action - yum will only be run if this is UPDATE +# update_identifier - yum will only run for previously unused values of update_identifier +# command - yum sub-command to run, defaults to "update" +# command_arguments - yum command arguments, defaults to "" + +echo "Started yum_update.sh on server $deploy_server_id at `date`" + +if [[ -z "$update_identifier" ]]; then + echo "Not running due to unset update_identifier" + exit 0 +fi + +timestamp_dir=/var/lib/overcloud-yum-update +mkdir -p $timestamp_dir + +# sanitise to remove unusual characters +update_identifier=${update_identifier//[^a-zA-Z0-9-_]/} + +timestamp_file="$timestamp_dir/$update_identifier" +if [[ -a "$timestamp_file" ]]; then + echo "Not running for already-run timestamp \"$update_identifier\"" + exit 0 +fi +touch "$timestamp_file" + +command=${command:-update} +full_command="yum -y $command $command_arguments" +echo "Running: $full_command" + +result=$($full_command) +return_code=$? +echo "$result" +echo "yum return code: $return_code" + +echo "Finished yum_update.sh on server $deploy_server_id at `date`" + +exit $return_code diff --git a/extraconfig/tasks/yum_update.yaml b/extraconfig/tasks/yum_update.yaml new file mode 100644 index 00000000..e918149e --- /dev/null +++ b/extraconfig/tasks/yum_update.yaml @@ -0,0 +1,26 @@ +heat_template_version: 2014-10-16 + +description: > + Software-config for performing package updates using yum + +resources: + + config: + type: OS::Heat::SoftwareConfig + properties: + group: script + config: {get_file: yum_update.sh} + inputs: + - name: update_identifier + description: yum will only run for previously unused values of update_identifier + default: '' + - name: command + description: yum sub-command to run, defaults to "update" + default: update + - name: command_arguments + description: yum command arguments, defaults to "" + default: '' + +outputs: + OS::stack_id: + value: {get_resource: config} \ No newline at end of file diff --git a/overcloud-resource-registry-puppet.yaml b/overcloud-resource-registry-puppet.yaml index b7e0c1f8..881ca791 100644 --- a/overcloud-resource-registry-puppet.yaml +++ b/overcloud-resource-registry-puppet.yaml @@ -23,6 +23,7 @@ resource_registry: OS::TripleO::BootstrapNode::SoftwareConfig: puppet/bootstrap-config.yaml OS::TripleO::NodeUserData: firstboot/userdata_default.yaml OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml + OS::TripleO::Tasks::PackageUpdate: extraconfig/tasks/yum_update.yaml # TripleO overcloud networks OS::TripleO::Network: network/networks.yaml diff --git a/overcloud-resource-registry.yaml b/overcloud-resource-registry.yaml index 3d92082c..7be199da 100644 --- a/overcloud-resource-registry.yaml +++ b/overcloud-resource-registry.yaml @@ -21,6 +21,7 @@ resource_registry: OS::TripleO::BootstrapNode::SoftwareConfig: bootstrap-config.yaml OS::TripleO::NodeUserData: firstboot/userdata_default.yaml OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml + OS::TripleO::Tasks::PackageUpdate: extraconfig/tasks/yum_update.yaml # TripleO overcloud networks OS::TripleO::Network: network/networks.yaml diff --git a/overcloud-without-mergepy.yaml b/overcloud-without-mergepy.yaml index 61dcc3bb..583634f1 100644 --- a/overcloud-without-mergepy.yaml +++ b/overcloud-without-mergepy.yaml @@ -562,6 +562,14 @@ parameters: constraints: - custom_constraint: nova.flavor +# Identifiers to trigger tasks on nodes + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes + resources: HeatAuthEncryptionKey: @@ -672,6 +680,7 @@ resources: MysqlVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, MysqlNetwork]}]} KeystonePublicApiVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}]} NeutronApiVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, NeutronApiNetwork]}]} + UpdateIdentifier: {get_param: UpdateIdentifier} Compute: type: OS::Heat::ResourceGroup @@ -729,6 +738,7 @@ resources: SnmpdReadonlyUserName: {get_param: SnmpdReadonlyUserName} SnmpdReadonlyUserPassword: {get_param: SnmpdReadonlyUserPassword} ServiceNetMap: {get_param: ServiceNetMap} + UpdateIdentifier: {get_param: UpdateIdentifier} BlockStorage: type: OS::Heat::ResourceGroup @@ -753,6 +763,7 @@ resources: RabbitClientUseSSL: {get_param: RabbitClientUseSSL} RabbitClientPort: {get_param: RabbitClientPort} NtpServer: {get_param: NtpServer} + UpdateIdentifier: {get_param: UpdateIdentifier} ObjectStorage: type: OS::Heat::ResourceGroup @@ -771,6 +782,7 @@ resources: Image: {get_param: SwiftStorageImage} Replicas: { get_param: SwiftReplicas} NtpServer: {get_param: NtpServer} + UpdateIdentifier: {get_param: UpdateIdentifier} CephStorage: type: OS::Heat::ResourceGroup @@ -785,6 +797,7 @@ resources: Flavor: {get_param: OvercloudCephStorageFlavor} NtpServer: {get_param: NtpServer} ServiceNetMap: {get_param: ServiceNetMap} + UpdateIdentifier: {get_param: UpdateIdentifier} ControllerIpListMap: type: OS::TripleO::Network::Ports::NetIpListMap diff --git a/puppet/ceph-storage-puppet.yaml b/puppet/ceph-storage-puppet.yaml index e3fa56b9..1ab381af 100644 --- a/puppet/ceph-storage-puppet.yaml +++ b/puppet/ceph-storage-puppet.yaml @@ -33,6 +33,12 @@ parameters: description: Mapping of service_name -> network name. Typically set via parameter_defaults in the resource registry. type: json + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: CephStorage: @@ -116,6 +122,18 @@ resources: ceph::profile::params::cluster_network: {get_input: ceph_cluster_network} ceph::profile::params::public_network: {get_input: ceph_public_network} + UpdateConfig: + type: OS::TripleO::Tasks::PackageUpdate + + UpdateDeployment: + type: OS::Heat::SoftwareDeployment + properties: + config: {get_resource: UpdateConfig} + server: {get_resource: CephStorage} + input_values: + update_identifier: + get_param: UpdateIdentifier + outputs: hosts_entry: value: diff --git a/puppet/cinder-storage-puppet.yaml b/puppet/cinder-storage-puppet.yaml index 007a489c..74df116a 100644 --- a/puppet/cinder-storage-puppet.yaml +++ b/puppet/cinder-storage-puppet.yaml @@ -111,6 +111,12 @@ parameters: default: 'false' description: Set to true to enable package installation via Puppet type: boolean + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: BlockStorage: @@ -221,6 +227,18 @@ resources: snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name} snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password} + UpdateConfig: + type: OS::TripleO::Tasks::PackageUpdate + + UpdateDeployment: + type: OS::Heat::SoftwareDeployment + properties: + config: {get_resource: UpdateConfig} + server: {get_resource: BlockStorage} + input_values: + update_identifier: + get_param: UpdateIdentifier + outputs: hosts_entry: value: diff --git a/puppet/compute-puppet.yaml b/puppet/compute-puppet.yaml index de888c7f..12e701dd 100644 --- a/puppet/compute-puppet.yaml +++ b/puppet/compute-puppet.yaml @@ -252,6 +252,12 @@ parameters: description: Mapping of service_name -> network name. Typically set via parameter_defaults in the resource registry. type: json + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: @@ -466,6 +472,18 @@ resources: server: {get_param: NtpServer} enable_package_install: {get_param: EnablePackageInstall} + UpdateConfig: + type: OS::TripleO::Tasks::PackageUpdate + + UpdateDeployment: + type: OS::Heat::SoftwareDeployment + properties: + config: {get_resource: UpdateConfig} + server: {get_resource: NovaCompute} + input_values: + update_identifier: + get_param: UpdateIdentifier + outputs: ip_address: description: IP address of the server in the ctlplane network diff --git a/puppet/controller-puppet.yaml b/puppet/controller-puppet.yaml index ff3f9336..98c8f5db 100644 --- a/puppet/controller-puppet.yaml +++ b/puppet/controller-puppet.yaml @@ -446,6 +446,12 @@ parameters: description: Mapping of service_name -> network name. Typically set via parameter_defaults in the resource registry. type: json + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: @@ -976,6 +982,18 @@ resources: tripleo::loadbalancer::public_virtual_interface: {get_input: public_virtual_interface} enable_package_install: {get_input: enable_package_install} + UpdateConfig: + type: OS::TripleO::Tasks::PackageUpdate + + UpdateDeployment: + type: OS::Heat::SoftwareDeployment + properties: + config: {get_resource: UpdateConfig} + server: {get_resource: Controller} + input_values: + update_identifier: + get_param: UpdateIdentifier + outputs: ip_address: description: IP address of the server in the ctlplane network diff --git a/puppet/swift-storage-puppet.yaml b/puppet/swift-storage-puppet.yaml index 12292dec..2268f41f 100644 --- a/puppet/swift-storage-puppet.yaml +++ b/puppet/swift-storage-puppet.yaml @@ -51,6 +51,12 @@ parameters: default: 'false' description: Set to true to enable package installation via Puppet type: boolean + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: @@ -151,6 +157,18 @@ resources: server: {get_param: NtpServer} enable_package_install: {get_param: EnablePackageInstall} + UpdateConfig: + type: OS::TripleO::Tasks::PackageUpdate + + UpdateDeployment: + type: OS::Heat::SoftwareDeployment + properties: + config: {get_resource: UpdateConfig} + server: {get_resource: SwiftStorage} + input_values: + update_identifier: + get_param: UpdateIdentifier + outputs: hosts_entry: value: diff --git a/swift-storage.yaml b/swift-storage.yaml index 68923eef..c2819349 100644 --- a/swift-storage.yaml +++ b/swift-storage.yaml @@ -82,6 +82,12 @@ parameters: description: The user password for SNMPd with readonly rights running on all Overcloud nodes type: string hidden: true + UpdateIdentifier: + default: '' + type: string + description: > + Setting to a previously unused value during stack-update will trigger + package update on all nodes resources: SwiftConfig: -- cgit 1.2.3-korg