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
3f91f18a
Commit
3f91f18a
authored
Dec 19, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18488 from yifan-gu/dockerized_python
Auto commit by PR queue bot
parents
1bd7f720
516032f3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
5 deletions
+39
-5
common.sh
build/common.sh
+10
-0
README.md
cluster/addons/README.md
+2
-0
Dockerfile
cluster/addons/python-image/Dockerfile
+3
-0
README.md
cluster/addons/python-image/README.md
+6
-0
kube-addon-update.sh
cluster/saltbase/salt/kube-addons/kube-addon-update.sh
+2
-2
kube-addons.sh
cluster/saltbase/salt/kube-addons/kube-addons.sh
+16
-3
No files found.
build/common.sh
View file @
3f91f18a
...
@@ -820,6 +820,16 @@ function kube::release::write_addon_docker_images_for_server() {
...
@@ -820,6 +820,16 @@ function kube::release::write_addon_docker_images_for_server() {
)
&
)
&
done
done
if
[[
!
-z
"
${
BUILD_PYTHON_IMAGE
:-}
"
]]
;
then
(
kube::log::status
"Building Docker python image"
local
img_name
=
python:2.7-slim-pyyaml
docker build
-t
"
${
img_name
}
"
"
${
KUBE_ROOT
}
/cluster/addons/python-image"
docker save
"
${
img_name
}
"
>
"
${
1
}
/
${
img_name
}
.tar"
)
&
fi
kube::util::wait-for-jobs
||
{
kube::log::error
"unable to pull or write addon image"
;
return
1
;
}
kube::util::wait-for-jobs
||
{
kube::log::error
"unable to pull or write addon image"
;
return
1
;
}
kube::log::status
"Addon images done"
kube::log::status
"Addon images done"
)
)
...
...
cluster/addons/README.md
View file @
3f91f18a
...
@@ -58,6 +58,8 @@ of:
...
@@ -58,6 +58,8 @@ of:
pods.
pods.
1.
Note that this cannot happen for Services as their version is always empty.
1.
Note that this cannot happen for Services as their version is always empty.
Note that in order to run the updator script, python is required on the machine.
For OS distros that don't have python installed, a python container will be used.
...
...
cluster/addons/python-image/Dockerfile
0 → 100644
View file @
3f91f18a
FROM
python:2.7-slim
RUN
pip
install
pyyaml
cluster/addons/python-image/README.md
0 → 100644
View file @
3f91f18a
# Python image
The python image here is used by OS distros that don't have python installed to
run python scripts to parse the yaml files in the addon updator script.
[

]()
cluster/saltbase/salt/kube-addons/kube-addon-update.sh
View file @
3f91f18a
...
@@ -98,7 +98,7 @@ function log() {
...
@@ -98,7 +98,7 @@ function log() {
function
get-object-kind-from-file
()
{
function
get-object-kind-from-file
()
{
# prints to stdout, so log cannot be used
# prints to stdout, so log cannot be used
#WARNING: only yaml is supported
#WARNING: only yaml is supported
cat
$1
|
python
-c
'''
cat
$1
|
${
PYTHON
}
-c
'''
try:
try:
import pipes,sys,yaml
import pipes,sys,yaml
y = yaml.load(sys.stdin)
y = yaml.load(sys.stdin)
...
@@ -120,7 +120,7 @@ function get-object-nsname-from-file() {
...
@@ -120,7 +120,7 @@ function get-object-nsname-from-file() {
# prints to stdout, so log cannot be used
# prints to stdout, so log cannot be used
#WARNING: only yaml is supported
#WARNING: only yaml is supported
#addons that do not specify a namespace are assumed to be in "default".
#addons that do not specify a namespace are assumed to be in "default".
cat
$1
|
python
-c
'''
cat
$1
|
${
PYTHON
}
-c
'''
try:
try:
import pipes,sys,yaml
import pipes,sys,yaml
y = yaml.load(sys.stdin)
y = yaml.load(sys.stdin)
...
...
cluster/saltbase/salt/kube-addons/kube-addons.sh
View file @
3f91f18a
...
@@ -24,6 +24,16 @@ ADDON_CHECK_INTERVAL_SEC=${TEST_ADDON_CHECK_INTERVAL_SEC:-600}
...
@@ -24,6 +24,16 @@ ADDON_CHECK_INTERVAL_SEC=${TEST_ADDON_CHECK_INTERVAL_SEC:-600}
SYSTEM_NAMESPACE
=
kube-system
SYSTEM_NAMESPACE
=
kube-system
token_dir
=
${
TOKEN_DIR
:-
/srv/kubernetes
}
token_dir
=
${
TOKEN_DIR
:-
/srv/kubernetes
}
function
ensure_python
()
{
if
!
python
--version
>
/dev/null 2>&1
;
then
echo
"No python on the machine, will use a python image"
local
-r
PYTHON_IMAGE
=
python:2.7-slim-pyyaml
export
PYTHON
=
"docker run --interactive --rm --net=none
${
PYTHON_IMAGE
}
python"
else
export
PYTHON
=
python
fi
}
function
create-kubeconfig-secret
()
{
function
create-kubeconfig-secret
()
{
local
-r
token
=
$1
local
-r
token
=
$1
local
-r
username
=
$2
local
-r
username
=
$2
...
@@ -152,11 +162,16 @@ function load-docker-images() {
...
@@ -152,11 +162,16 @@ function load-docker-images() {
# managed result is of that. Start everything below that directory.
# managed result is of that. Start everything below that directory.
echo
"== Kubernetes addon manager started at
$(
date
-Is
)
with ADDON_CHECK_INTERVAL_SEC=
${
ADDON_CHECK_INTERVAL_SEC
}
=="
echo
"== Kubernetes addon manager started at
$(
date
-Is
)
with ADDON_CHECK_INTERVAL_SEC=
${
ADDON_CHECK_INTERVAL_SEC
}
=="
# Load any images that we may need
load-docker-images /srv/salt/kube-addons-images
ensure_python
# Load the kube-env, which has all the environment variables we care
# Load the kube-env, which has all the environment variables we care
# about, in a flat yaml format.
# about, in a flat yaml format.
kube_env_yaml
=
"/var/cache/kubernetes-install/kube_env.yaml"
kube_env_yaml
=
"/var/cache/kubernetes-install/kube_env.yaml"
if
[
!
-e
"
${
kubelet_kubeconfig_file
}
"
]
;
then
if
[
!
-e
"
${
kubelet_kubeconfig_file
}
"
]
;
then
eval
$(
python
-c
'''
eval
$(
${
PYTHON
}
-c
'''
import pipes,sys,yaml
import pipes,sys,yaml
for k,v in yaml.load(sys.stdin).iteritems():
for k,v in yaml.load(sys.stdin).iteritems():
...
@@ -164,8 +179,6 @@ for k,v in yaml.load(sys.stdin).iteritems():
...
@@ -164,8 +179,6 @@ for k,v in yaml.load(sys.stdin).iteritems():
'''
<
"
${
kube_env_yaml
}
"
)
'''
<
"
${
kube_env_yaml
}
"
)
fi
fi
# Load any images that we may need
load-docker-images /srv/salt/kube-addons-images
# Create the namespace that will be used to host the cluster-level add-ons.
# Create the namespace that will be used to host the cluster-level add-ons.
start_addon /etc/kubernetes/addons/namespace.yaml 100 10
""
&
start_addon /etc/kubernetes/addons/namespace.yaml 100 10
""
&
...
...
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