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
265bd984
Commit
265bd984
authored
Jul 23, 2020
by
Josh McSavaney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always validate K3S_URL.
Also move K3S_URL validation to its own function. Signed-off-by:
Josh McSavaney
<
mcsaucy@csh.rit.edu
>
parent
4eb88a2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
install.sh
install.sh
+16
-8
No files found.
install.sh
View file @
265bd984
...
@@ -141,6 +141,19 @@ escape_dq() {
...
@@ -141,6 +141,19 @@ escape_dq() {
printf
'%s'
"
$@
"
|
sed
-e
's/"/\\"/g'
printf
'%s'
"
$@
"
|
sed
-e
's/"/\\"/g'
}
}
# --- ensures $K3S_URL is empty or begins with https://, exiting fatally otherwise ---
verify_k3s_url
()
{
case
"
${
K3S_URL
}
"
in
""
)
;;
https://
*
)
;;
*
)
fatal
"Only https:// URLs are supported for K3S_URL (have
${
K3S_URL
}
)"
;;
esac
}
# --- define needed environment variables ---
# --- define needed environment variables ---
setup_env
()
{
setup_env
()
{
# --- use command args if passed or create default ---
# --- use command args if passed or create default ---
...
@@ -153,14 +166,6 @@ setup_env() {
...
@@ -153,14 +166,6 @@ setup_env() {
if
[
-z
"
${
K3S_TOKEN
}
"
]
&&
[
-z
"
${
K3S_CLUSTER_SECRET
}
"
]
;
then
if
[
-z
"
${
K3S_TOKEN
}
"
]
&&
[
-z
"
${
K3S_CLUSTER_SECRET
}
"
]
;
then
fatal
"Defaulted k3s exec command to 'agent' because K3S_URL is defined, but K3S_TOKEN or K3S_CLUSTER_SECRET is not defined."
fatal
"Defaulted k3s exec command to 'agent' because K3S_URL is defined, but K3S_TOKEN or K3S_CLUSTER_SECRET is not defined."
fi
fi
case
"
${
K3S_URL
}
"
in
https://
*
)
;;
*
)
fatal
"Only https:// URLs are supported for K3S_URL (have
${
K3S_URL
}
)"
;;
esac
CMD_K3S
=
agent
CMD_K3S
=
agent
fi
fi
;;
;;
...
@@ -170,6 +175,9 @@ setup_env() {
...
@@ -170,6 +175,9 @@ setup_env() {
shift
shift
;;
;;
esac
esac
verify_k3s_url
CMD_K3S_EXEC
=
"
${
CMD_K3S
}$(
quote_indent
"
$@
"
)
"
CMD_K3S_EXEC
=
"
${
CMD_K3S
}$(
quote_indent
"
$@
"
)
"
# --- use systemd name if defined or create default ---
# --- use systemd name if defined or create default ---
...
...
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