Skip to content

Commit

Permalink
Changed templates to set MESOS_ env vars
Browse files Browse the repository at this point in the history
This may cause conflicts, but it's better than
relying on Mesosphere script that all it seems to
do is to replace these with MESOS prefixed vars
anyway.
  • Loading branch information
Cosmin Lehene committed Mar 27, 2016
1 parent 0a90409 commit d70b90d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 32 deletions.
1 change: 1 addition & 0 deletions manifests/slave.pp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
$secret = undef,
$syslog_logger = true,
$force_provider = undef, #temporary workaround for starting services
$containerizers = "docker,mesos",
$use_hiera = $mesos::use_hiera,
$single_role = $mesos::single_role,
) inherits mesos {
Expand Down
37 changes: 12 additions & 25 deletions templates/master.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
# Managed by Puppet
#
# A list of the available options can be seen by running `mesos-master --help`. Each
Expand All @@ -11,30 +10,18 @@
# Configuration values are searched for first in the environment, thus values set
# in here precede those loaded from /etc/mesos-master (passed as command line arguments).

# ZooKeeper URL (used for leader election amongst masters)
export MESOS_ZK="<%= @zookeeper_url %>"
MESOS_WORK_DIR="<%= @work_dir %>"
MESOS_ZK="<%= @zookeeper %>"
MESOS_QUORUM=<%= @quorum %>
<% if @listen_address && @listen_address != "" %>
MESOS_IP="<%= @listen_address %>"
<% end %>
MESOS_PORT=<%= @master_port %>
MESOS_CLUSTER="<%= @cluster %>"
MESOS_LOG_DIR="<%= @log_dir %>"
MESOS_LOGBUFSECS=1
MESOS_LOGGING_LEVEL="INFO"

# The size of the quorum of replicas when using 'replicated_log' based
# registry. It is imperative to set this value to be a majority of
# masters i.e., quorum > (number of masters)/2.

QUORUM=<%= @quorum %>

# Human readable name for the cluster, displayed in the webui
export MESOS_CLUSTER="<%= @cluster %>"

# IP address to listen on (in case that you start master
# on this node, it will bind to this address)
<% if @listen_address -%>
export MESOS_IP="<%= @listen_address %>"
<% else -%>
#export MESOS_IP=""
<% end -%>

# Port to listen on (default: 5050)
export MESOS_PORT=<%= @master_port %>

# master environment variables
<% @env_var.sort.each do |key,val| -%>
export <%= key %>="<%= val %>"
<%= key %>="<%= val %>"
<% end if @env_var -%>
34 changes: 27 additions & 7 deletions templates/slave.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,46 @@
# If zookeeper URL is not specified, slaves will connect directly
# to specified master (not a fault-tolerant mode)
<% if !@zookeeper_url.nil? && !@zookeeper_url.empty? -%>
export MESOS_MASTER="<%= @zookeeper_url %>"
MESOS_MASTER="<%= @zookeeper_url %>"
<% else -%>
export MESOS_MASTER="<%= @master %>:<%= @master_port %>"
MESOS_MASTER="<%= @master %>:<%= @master_port %>"
<% end -%>

# public slave's ip, must be unique in mesos cluster
<% if @listen_address -%>
export MESOS_IP="<%= @listen_address %>"
MESOS_IP="<%= @listen_address %>"
<% else -%>
#export MESOS_IP=""
#MESOS_IP=""
<% end -%>

# Port to listen on (default: 5051)
export MESOS_PORT=<%= @port %>
MESOS_PORT=<%= @port %>

<% @cgroups.sort.each do |key, val| -%>
export MESOS_CGROUPS_<%= key.upcase %>="<%= val %>"
MESOS_CGROUPS_<%= key.upcase %>="<%= val %>"
<% end if @isolation == 'cgroups' -%>


MESOS_isolation='cgroups/cpu,cgroups/mem'
MESOS_cgroups_root='system.slice/mesos-slave.service'
MESOS_cgroups_hierarchy=/sys/fs/cgroup
MESOS_slave_subsystems=cpu,memory
MESOS_gc_delay=1days

MESOS_executor_registration_timeout=5mins

<% if @listen_address && @listen_address != "" %>
MESOS_ip="<%= @listen_address %>"
<% end %>
MESOS_port=<%= @port %>
MESOS_log_dir="<%= @log_dir %>"
MESOS_logbufsecs=1
MESOS_logging_level="INFO"
#TODO(clehene) note that we're also passing -containerizers to mesos-slave as this doesn't seem to be working
MESOS_containerizers=<%= @containerizers %>
MESOS_hadoop_home=$HADOOP_HOME

# slave environment variables
<% @env_var.sort.each do |key,val| -%>
export <%= key %>="<%= val %>"
<%= key %>="<%= val %>"
<% end if @env_var -%>

0 comments on commit d70b90d

Please sign in to comment.