Skip to content

Commit

Permalink
Merge pull request #13 from wolf31o2/dcos-one-eleven-enterprise
Browse files Browse the repository at this point in the history
Support DC/OS Enterprise
  • Loading branch information
wolf31o2 authored Mar 20, 2018
2 parents e3048dd + ae94777 commit 07ec3c3
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 15 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Description
===========

Manage deployment and configuration of underlying Mesosphere DC/OS installation.
Manage deployment and configuration of underlying Mesosphere DC/OS installation. This cookbook supports both DC/OS
OSS installations (default) and DC/OS Enterprise.

Requirements
------------
Expand All @@ -19,8 +20,10 @@ The `node['dcos']['dcos_role']` attribute controls the DC/OS role to apply to th
`static` to specify the list of DC/OS master node IPv4 addresses to connect at startup (this must be an odd number
of masters and cannot be changed, later).

This cookbook uses the EarlyAccess channel, by default. Setting `node['dcos']['dcos_version']` to `stable` will
install the latest stable version of DC/OS (currently `1.9.3`).
This cookbook uses the stable channel, by default. Setting `node['dcos']['dcos_version']` to `earlyaccess` will
install the latest EarlyAccess version of DC/OS OSS. Enterprise support can be enabled by setting
`node['dcos']['dcos_enterprise']` to `true` and providing a license key in `node['dcos']['dcos_license_text']`
via whichever manner you prefer.

Roles
----------
Expand Down Expand Up @@ -103,7 +106,7 @@ There is basic coverage for the default recipe.

InSpec
------
TBD
There is basic functional testing of the DC/OS OSS setup for a single master node.

Test Kitchen
------------
Expand Down
19 changes: 17 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Cookbook Name:: dcos
#
# Copyright 2016 Chef Software, Inc
# Copyright 2017 Chris Gianelloni
# Copyright 2017-2018 Chris Gianelloni
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,18 +18,33 @@
# limitations under the License.
#

default['dcos']['dcos_earlyaccess'] = true
# DC/OS Edition/Version Setup
default['dcos']['dcos_earlyaccess'] = false
default['dcos']['dcos_version'] = node['dcos']['dcos_earlyaccess'] ? 'earlyaccess' : 'stable'
default['dcos']['dcos_enterprise'] = false

# DC/OS role
default['dcos']['dcos_role'] = 'master' # 'master', 'slave' or 'slave_public'

# DC/OS license (Enterprise only, 1.11+)
default['dcos']['dcos_license_text'] = nil

# DC/OS config.yaml
default['dcos']['config']['bootstrap_url'] = 'file:///usr/src/dcos/genconf/serve'
default['dcos']['config']['cluster_name'] = 'DCOS'
default['dcos']['config']['exhibitor_storage_backend'] = 'static'
default['dcos']['config']['ip_detect_public_filename'] = 'genconf/ip-detect-public'
default['dcos']['config']['master_discovery'] = 'static'
# ipv4 only, must be odd number 1-9
default['dcos']['config']['master_list'] = []
# upstream DNS for MesosDNS
default['dcos']['config']['resolvers'] = ['8.8.8.8', '8.8.4.4']
default['dcos']['config']['security'] = 'permissive' if node['dcos']['dcos_enterprise']
default['dcos']['config']['superuser_username'] = 'dcos' if node['dcos']['dcos_enterprise']
# WARNING: this password is 'dcos', CHANGE IT!
default['dcos']['config']['superuser_password_hash'] =
'$6$rounds=656000$jebZ9.mHzOGexfOq$NEpBlsUot6mGe3ExpfOGioRY02.WEFYlZCIeTDtq7d648FI4oyPt07w8tgNVub0PNVxRT0am9NbWDiYCHYkM9.' \
if node['dcos']['dcos_enterprise']

default['dcos']['manage_docker'] = true
default['dcos']['docker_storage_driver'] = 'overlay'
Expand Down
31 changes: 28 additions & 3 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Dcos
module Helpers
def dcos_generate_config_url
return node['dcos']['dcos_generate_config_url'] if node['dcos'].key?('dcos_generate_config_url')
return "#{dcos_base_url}/dcos_generate_config.ee.sh" if dcos_enterprise?
case node['dcos']['dcos_version']
when 'EarlyAccess', 'earlyaccess'
"#{dcos_base_url}/dcos_generate_config.sh"
Expand All @@ -11,22 +12,46 @@ def dcos_generate_config_url
end
end

def dcos_enterprise?
node['dcos']['dcos_enterprise']
end

private

def dcos_base_url
case node['dcos']['dcos_version']
when '1.10.4', '1.10.2', '1.10.1', '1.10.0', '1.9.7', '1.9.6', '1.9.5', '1.9.4', '1.9.3', '1.9.2', '1.9.1', '1.8.9'
"https://downloads.dcos.io/dcos/stable/#{node['dcos']['dcos_version']}"
when
'1.11.0',
'1.10.5',
'1.10.4',
'1.10.2',
'1.10.1',
'1.10.0',
'1.9.7',
'1.9.6',
'1.9.5',
'1.9.4',
'1.9.3',
'1.9.2',
'1.9.1',
'1.8.9'
return "https://downloads.mesosphere.com/dcos-enterprise/stable/#{node['dcos']['dcos_version']}" if dcos_enterprise?
return "https://downloads.dcos.io/dcos/stable/#{node['dcos']['dcos_version']}"
when 'EarlyAccess', 'earlyaccess'
'https://downloads.dcos.io/dcos/EarlyAccess'
else # stable or older releases
return 'https://downloads.mesosphere.com/dcos-enterprise/stable/1.11.0' if dcos_enterprise?
'https://downloads.dcos.io/dcos/stable'
end
end

def dcos_commit_id
case node['dcos']['dcos_version']
when 'stable', '1.10.4'
when 'stable', '1.11.0'
'b6d6ad4722600877fde2860122f870031d109da3'
when '1.10.5'
'5831285e56a88d3f54446a987a0384f915832f40'
when '1.10.4'
'2d45a8f9e277a60007f277f70f01d076c913a7fe'
when '1.10.2'
'12b494a3309c65a22b7d5553debd1c053e008a31'
Expand Down
10 changes: 5 additions & 5 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name 'dcos'
maintainer 'Chef Software, Inc.'
name 'dcos'
maintainer 'Chef Software, Inc.'
maintainer_email 'partnereng@chef.io'
license 'Apache-2.0'
version '1.1.0'
description 'Installs/Configures Mesosphere DC/OS'
license 'Apache-2.0'
description 'Installs/Configures Mesosphere DC/OS'
long_description 'Installs/Configures Mesosphere DC/OS'
version '1.2.0'

source_url 'https://github.com/chef-partners/dcos-cookbook' if
respond_to?(:source_url)
Expand Down
18 changes: 17 additions & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Recipe:: default
#
# Copyright 2016, Chef Software, Inc.
# Copyright 2017-2018 Chris Gianelloni
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +40,7 @@

group 'nogroup'

include_recipe 'chef-yum-docker' if node['dcos']['docker_version']
include_recipe 'chef-yum-docker' if node['dcos']['manage_docker']

# Install docker with overlayfs
docker_service 'default' do
Expand All @@ -55,11 +56,26 @@
recursive true
end

# Only used on DC/OS Enterprise 1.11+
file '/usr/src/dcos/genconf/license.txt' do
content node['dcos']['dcos_license_text']
sensitive true
only_if { dcos_enterprise? && node['dcos']['dcos_version'].to_f >= 1.11 }
end

template '/usr/src/dcos/genconf/config.yaml' do
source 'config.yaml.erb'
variables config: node['dcos']['config']
end

# Only supported on DC/OS Enterprise 1.11+
remote_file '/usr/src/dcos/genconf/fault-domain-detect' do
# Pull latest from GitHub
source 'https://raw.githubusercontent.com/dcos/dcos/master/gen/fault-domain-detect/cloud.sh'
mode '0755'
only_if { dcos_enterprise? && node['dcos']['dcos_version'].to_f >= 1.11 }
end

remote_file '/usr/src/dcos/dcos_generate_config.sh' do
source dcos_generate_config_url
mode '0755'
Expand Down

0 comments on commit 07ec3c3

Please # to comment.