-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed local:// dependency for upgrades #24
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Fails if any nodes have the chosen transport. | ||
# | ||
# Useful for excluding PCP when it's not appopriate | ||
# | ||
function pe_xl::fail_on_transport ( | ||
TargetSpec $nodes, | ||
String $transport, | ||
) { | ||
$targets = get_targets($nodes) | ||
$targets.each |$target| { | ||
if $target.protocol == $transport { | ||
fail_plan( | ||
"${target.name} uses ${transport} transport. This is not supported", | ||
'unexpected-transport', | ||
{ | ||
'target' => $target, | ||
'transport' => $transport, | ||
} | ||
) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,25 @@ | |
Optional[String[1]] $master_replica_host = undef, | ||
Optional[String[1]] $puppetdb_database_replica_host = undef, | ||
|
||
String[1] $version = '2018.1.4', | ||
String[1] $version, | ||
|
||
# This parameter exists to enable the use case of running pe_xl::upgrade over | ||
# the PCP transport. An orchestrator restart happens during provision | ||
# replica. Running `bolt plan run` directly on the master and using local | ||
# transport for that node will let the plan to run to completion without | ||
# failing due to being disconnected from the orchestrator. | ||
Boolean $executing_on_master = false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to do this though? Wouldn't it be better for the user to just specify the target properly? Instead of not specifying it then telling the plan it's running on the master, who not just have the user supply There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would, yeah. However, at that point we would need to do a little more work to update the plans to use proper Target objects so that we can distinguish between their hostnames / assumed certnames, and the protocol+name used to connect to them. The variables are currently used kind of interchangeably. For example, it wouldn't be good to end up writing a whitelist file that specified "local://master". I implemented it this way for now to match the pe_xl::configure plan. It should be a straightforward iteration to clean up the code to use |
||
|
||
String[1] $stagingdir = '/tmp', | ||
String[1] $pe_source = "https://s3.amazonaws.com/pe-builds/released/${version}/puppet-enterprise-${version}-el-7-x86_64.tar.gz", | ||
) { | ||
|
||
# Allow for the upgrade task to be run local to the master. | ||
$master_target = $executing_on_master ? { | ||
true => "local://${master_host}", | ||
false => $master_host, | ||
} | ||
|
||
$ha_replica_target = [ | ||
$master_replica_host, | ||
].pe_xl::flatten_compact() | ||
|
@@ -40,23 +53,24 @@ | |
| PQL | ||
|
||
$all_hosts = [ | ||
$master_host, | ||
$master_target, | ||
$puppetdb_database_host, | ||
$master_replica_host, | ||
$puppetdb_database_replica_host, | ||
$compiler_cluster_master_hosts, | ||
$compiler_cluster_master_replica_hosts, | ||
].pe_xl::flatten_compact() | ||
|
||
$master_local = "local://${master_host}" | ||
# We need to make sure we aren't using PCP as this will go down during the upgrade | ||
$all_hosts.pe_xl::fail_on_transport('pcp') | ||
|
||
# TODO: Do we need to update the pe.conf(s) with a console password? | ||
|
||
# Download the PE tarball on the nodes that need it | ||
$upload_tarball_path = "/tmp/puppet-enterprise-${version}-el-7-x86_64.tar.gz" | ||
|
||
$download_hosts = [ | ||
$master_host, | ||
$master_target, | ||
$puppetdb_database_host, | ||
$puppetdb_database_replica_host, | ||
].pe_xl::flatten_compact() | ||
|
@@ -81,17 +95,15 @@ | |
# Shut down pe-* services on the master. Only shutting down the ones | ||
# that have failover pairs on the master replica. | ||
['pe-console-services', 'pe-nginx', 'pe-puppetserver', 'pe-puppetdb', 'pe-postgresql'].each |$service| { | ||
run_task('service', $master_local, | ||
run_task('service', $master_target, | ||
action => 'stop', | ||
name => $service, | ||
) | ||
} | ||
|
||
# TODO: Firewall up the master | ||
|
||
# Upgrade the master using the local:// transport in anticipation of | ||
# the orchestrator service being restarted during the upgrade. | ||
run_task('pe_xl::pe_install', $master_local, | ||
run_task('pe_xl::pe_install', $master_target, | ||
tarball => $upload_tarball_path, | ||
) | ||
|
||
|
@@ -104,23 +116,23 @@ | |
run_task('pe_xl::puppet_runonce', $puppetdb_database_host) | ||
|
||
# Stop PuppetDB on the master | ||
run_task('service', $master_local, | ||
run_task('service', $master_target, | ||
action => 'stop', | ||
name => 'pe-puppetdb', | ||
) | ||
|
||
# TODO: Unblock 8081 between the master and the master replica | ||
|
||
# Start PuppetDB on the master | ||
run_task('service', $master_local, | ||
run_task('service', $master_target, | ||
action => 'start', | ||
name => 'pe-puppetdb', | ||
) | ||
|
||
# TODO: Remove remaining firewall blocks | ||
|
||
# Wait until orchestrator service is healthy to proceed | ||
run_task('pe_xl::orchestrator_healthcheck', $master_local) | ||
run_task('pe_xl::orchestrator_healthcheck', $master_target) | ||
|
||
# Upgrade the compiler group A hosts | ||
run_task('pe_xl::agent_upgrade', $compiler_cluster_master_hosts, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
God damn it. How did I miss this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should delete my function then (
pe_xl::transport
)