Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
875e3d49
Commit
875e3d49
authored
Nov 10, 2015
by
Justin Santa Barbara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AWS: Create a helper to set salt grain from env var
This is better from a DRY standpoint. This helps reduce the script size, so we have a little bit of breathing room vs the 16KB limit.
parent
33a5874d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
salt-master.sh
cluster/aws/templates/salt-master.sh
+16
-27
No files found.
cluster/aws/templates/salt-master.sh
View file @
875e3d49
...
...
@@ -26,35 +26,24 @@ grains:
cbr-cidr: "
${
MASTER_IP_RANGE
}
"
EOF
if
[[
-n
"
${
DOCKER_OPTS
}
"
]]
;
then
cat
<<
EOF
>>/etc/salt/minion.d/grains.conf
docker_opts: '
$(
echo
"
$DOCKER_OPTS
"
|
sed
-e
"s/'/''/g"
)
'
# Helper that sets a salt grain in grains.conf, if the upper-cased key is a non-empty env
function
env_to_salt
{
local
key
=
$1
local
env_key
=
`
echo
$key
|
tr
'[:lower:]'
'[:upper:]'
`
local
value
=
${
!env_key
}
if
[[
-n
"
${
value
}
"
]]
;
then
# Note this is yaml, so indentation matters
cat
<<
EOF
# >>/etc/salt/minion.d/grains.conf
${
key
}
: '
$(
echo
"
${
value
}
"
|
sed
-e
"s/'/''/g"
)
'
EOF
fi
fi
}
if
[[
-n
"
${
DOCKER_ROOT
}
"
]]
;
then
cat
<<
EOF
>>/etc/salt/minion.d/grains.conf
docker_root: '
$(
echo
"
$DOCKER_ROOT
"
|
sed
-e
"s/'/''/g"
)
'
EOF
fi
if
[[
-n
"
${
KUBELET_ROOT
}
"
]]
;
then
cat
<<
EOF
>>/etc/salt/minion.d/grains.conf
kubelet_root: '
$(
echo
"
$KUBELET_ROOT
"
|
sed
-e
"s/'/''/g"
)
'
EOF
fi
if
[[
-n
"
${
MASTER_EXTRA_SANS
}
"
]]
;
then
cat
<<
EOF
>>/etc/salt/minion.d/grains.conf
master_extra_sans: '
$(
echo
"
$MASTER_EXTRA_SANS
"
|
sed
-e
"s/'/''/g"
)
'
EOF
fi
if
[[
!
-z
"
${
RUNTIME_CONFIG
:-}
"
]]
;
then
cat
<<
EOF
>>/etc/salt/minion.d/grains.conf
runtime_config: '
$(
echo
"
$RUNTIME_CONFIG
"
|
sed
-e
"s/'/''/g"
)
'
EOF
fi
env_to_salt docker_opts
env_to_salt docker_root
env_to_salt kubelet_root
env_to_salt master_extra_sans
env_to_salt runtime_config
# Auto accept all keys from minions that try to join
mkdir
-p
/etc/salt/master.d
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment