mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
vendor files
This commit is contained in:
108
vendor/k8s.io/kubernetes/cluster/centos/node/bin/mk-docker-opts.sh
generated
vendored
Executable file
108
vendor/k8s.io/kubernetes/cluster/centos/node/bin/mk-docker-opts.sh
generated
vendored
Executable file
@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Generate Docker daemon options based on flannel env file.
|
||||
|
||||
# exit on any error
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "$0 [-f FLANNEL-ENV-FILE] [-d DOCKER-ENV-FILE] [-i] [-c] [-m] [-k COMBINED-KEY]
|
||||
|
||||
Generate Docker daemon options based on flannel env file
|
||||
OPTIONS:
|
||||
-f Path to flannel env file. Defaults to /run/flannel/subnet.env
|
||||
-d Path to Docker env file to write to. Defaults to /run/docker_opts.env
|
||||
-i Output each Docker option as individual var. e.g. DOCKER_OPT_MTU=1500
|
||||
-c Output combined Docker options into DOCKER_OPTS var
|
||||
-k Set the combined options key to this value (default DOCKER_OPTS=)
|
||||
-m Do not output --ip-masq (useful for older Docker version)
|
||||
" >/dev/stderr
|
||||
exit 1
|
||||
}
|
||||
|
||||
flannel_env="/run/flannel/subnet.env"
|
||||
docker_env="/run/docker_opts.env"
|
||||
combined_opts_key="DOCKER_OPTS"
|
||||
indiv_opts=false
|
||||
combined_opts=false
|
||||
ipmasq=true
|
||||
|
||||
while getopts "f:d:ick:" opt; do
|
||||
case $opt in
|
||||
f)
|
||||
flannel_env=$OPTARG
|
||||
;;
|
||||
d)
|
||||
docker_env=$OPTARG
|
||||
;;
|
||||
i)
|
||||
indiv_opts=true
|
||||
;;
|
||||
c)
|
||||
combined_opts=true
|
||||
;;
|
||||
m)
|
||||
ipmasq=false
|
||||
;;
|
||||
k)
|
||||
combined_opts_key=$OPTARG
|
||||
;;
|
||||
\?)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $indiv_opts = false ]] && [[ $combined_opts = false ]]; then
|
||||
indiv_opts=true
|
||||
combined_opts=true
|
||||
fi
|
||||
|
||||
if [[ -f "$flannel_env" ]]; then
|
||||
source $flannel_env
|
||||
fi
|
||||
|
||||
if [[ -n "$FLANNEL_SUBNET" ]]; then
|
||||
DOCKER_OPT_BIP="--bip=$FLANNEL_SUBNET"
|
||||
fi
|
||||
|
||||
if [[ -n "$FLANNEL_MTU" ]]; then
|
||||
DOCKER_OPT_MTU="--mtu=$FLANNEL_MTU"
|
||||
fi
|
||||
|
||||
if [[ "$FLANNEL_IPMASQ" = true ]] && [[ $ipmasq = true ]]; then
|
||||
DOCKER_OPT_IPMASQ="--ip-masq=false"
|
||||
fi
|
||||
|
||||
eval docker_opts="\$${combined_opts_key}"
|
||||
docker_opts+=" "
|
||||
|
||||
echo -n "" >$docker_env
|
||||
for opt in $(compgen -v DOCKER_OPT_); do
|
||||
eval val=\$$opt
|
||||
|
||||
if [[ "$indiv_opts" = true ]]; then
|
||||
echo "$opt=\"$val\"" >>$docker_env
|
||||
fi
|
||||
|
||||
docker_opts+="$val "
|
||||
done
|
||||
|
||||
if [[ "$combined_opts" = true ]]; then
|
||||
echo "${combined_opts_key}=\"${docker_opts}\"" >>$docker_env
|
||||
fi
|
||||
|
27
vendor/k8s.io/kubernetes/cluster/centos/node/bin/remove-docker0.sh
generated
vendored
Executable file
27
vendor/k8s.io/kubernetes/cluster/centos/node/bin/remove-docker0.sh
generated
vendored
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Delete default docker bridge, so that docker can start with flannel network.
|
||||
|
||||
# exit on any error
|
||||
set -e
|
||||
|
||||
rc=0
|
||||
ip link show docker0 >/dev/null 2>&1 || rc="$?"
|
||||
if [[ "$rc" -eq "0" ]]; then
|
||||
ip link set dev docker0 down
|
||||
ip link delete docker0
|
||||
fi
|
48
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/docker.sh
generated
vendored
Executable file
48
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/docker.sh
generated
vendored
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
DOCKER_OPTS=${1:-""}
|
||||
|
||||
DOCKER_CONFIG=/opt/kubernetes/cfg/docker
|
||||
|
||||
cat <<EOF >$DOCKER_CONFIG
|
||||
DOCKER_OPTS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock -s overlay --selinux-enabled=false ${DOCKER_OPTS}"
|
||||
EOF
|
||||
|
||||
cat <<EOF >/usr/lib/systemd/system/docker.service
|
||||
[Unit]
|
||||
Description=Docker Application Container Engine
|
||||
Documentation=http://docs.docker.com
|
||||
After=network.target flannel.service
|
||||
Requires=flannel.service
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
EnvironmentFile=-/run/flannel/docker
|
||||
EnvironmentFile=-/opt/kubernetes/cfg/docker
|
||||
WorkingDirectory=/opt/kubernetes/bin
|
||||
ExecStart=/opt/kubernetes/bin/dockerd \$DOCKER_OPT_BIP \$DOCKER_OPT_MTU \$DOCKER_OPTS
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=1048576
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable docker
|
||||
systemctl restart docker
|
75
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/flannel.sh
generated
vendored
Executable file
75
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/flannel.sh
generated
vendored
Executable file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
ETCD_SERVERS=${1:-"https://8.8.8.18:2379"}
|
||||
FLANNEL_NET=${2:-"172.16.0.0/16"}
|
||||
|
||||
CA_FILE="/srv/kubernetes/etcd/ca.pem"
|
||||
CERT_FILE="/srv/kubernetes/etcd/client.pem"
|
||||
KEY_FILE="/srv/kubernetes/etcd/client-key.pem"
|
||||
|
||||
cat <<EOF >/opt/kubernetes/cfg/flannel
|
||||
FLANNEL_ETCD="-etcd-endpoints=${ETCD_SERVERS}"
|
||||
FLANNEL_ETCD_KEY="-etcd-prefix=/coreos.com/network"
|
||||
FLANNEL_ETCD_CAFILE="--etcd-cafile=${CA_FILE}"
|
||||
FLANNEL_ETCD_CERTFILE="--etcd-certfile=${CERT_FILE}"
|
||||
FLANNEL_ETCD_KEYFILE="--etcd-keyfile=${KEY_FILE}"
|
||||
EOF
|
||||
|
||||
cat <<EOF >/usr/lib/systemd/system/flannel.service
|
||||
[Unit]
|
||||
Description=Flanneld overlay address etcd agent
|
||||
After=network.target
|
||||
Before=docker.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/opt/kubernetes/cfg/flannel
|
||||
ExecStartPre=/opt/kubernetes/bin/remove-docker0.sh
|
||||
ExecStart=/opt/kubernetes/bin/flanneld --ip-masq \${FLANNEL_ETCD} \${FLANNEL_ETCD_KEY} \${FLANNEL_ETCD_CAFILE} \${FLANNEL_ETCD_CERTFILE} \${FLANNEL_ETCD_KEYFILE}
|
||||
ExecStartPost=/opt/kubernetes/bin/mk-docker-opts.sh -d /run/flannel/docker
|
||||
|
||||
Type=notify
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
RequiredBy=docker.service
|
||||
EOF
|
||||
|
||||
# Store FLANNEL_NET to etcd.
|
||||
attempt=0
|
||||
while true; do
|
||||
/opt/kubernetes/bin/etcdctl --ca-file ${CA_FILE} --cert-file ${CERT_FILE} --key-file ${KEY_FILE} \
|
||||
--no-sync -C ${ETCD_SERVERS} \
|
||||
get /coreos.com/network/config >/dev/null 2>&1
|
||||
if [[ "$?" == 0 ]]; then
|
||||
break
|
||||
else
|
||||
if (( attempt > 600 )); then
|
||||
echo "timeout for waiting network config" > ~/kube/err.log
|
||||
exit 2
|
||||
fi
|
||||
|
||||
/opt/kubernetes/bin/etcdctl --ca-file ${CA_FILE} --cert-file ${CERT_FILE} --key-file ${KEY_FILE} \
|
||||
--no-sync -C ${ETCD_SERVERS} \
|
||||
mk /coreos.com/network/config "{\"Network\":\"${FLANNEL_NET}\"}" >/dev/null 2>&1
|
||||
attempt=$((attempt+1))
|
||||
sleep 3
|
||||
fi
|
||||
done
|
||||
wait
|
||||
|
||||
systemctl daemon-reload
|
97
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/kubelet.sh
generated
vendored
Executable file
97
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/kubelet.sh
generated
vendored
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
MASTER_ADDRESS=${1:-"8.8.8.18"}
|
||||
NODE_ADDRESS=${2:-"8.8.8.20"}
|
||||
DNS_SERVER_IP=${3:-"192.168.3.100"}
|
||||
DNS_DOMAIN=${4:-"cluster.local"}
|
||||
KUBECONFIG_DIR=${KUBECONFIG_DIR:-/opt/kubernetes/cfg}
|
||||
|
||||
# Generate a kubeconfig file
|
||||
cat <<EOF > "${KUBECONFIG_DIR}/kubelet.kubeconfig"
|
||||
apiVersion: v1
|
||||
kind: Config
|
||||
clusters:
|
||||
- cluster:
|
||||
server: http://${MASTER_ADDRESS}:8080/
|
||||
name: local
|
||||
contexts:
|
||||
- context:
|
||||
cluster: local
|
||||
name: local
|
||||
current-context: local
|
||||
EOF
|
||||
|
||||
cat <<EOF >/opt/kubernetes/cfg/kubelet
|
||||
# --logtostderr=true: log to standard error instead of files
|
||||
KUBE_LOGTOSTDERR="--logtostderr=true"
|
||||
|
||||
# --v=0: log level for V logs
|
||||
KUBE_LOG_LEVEL="--v=4"
|
||||
|
||||
# --address=0.0.0.0: The IP address for the Kubelet to serve on (set to 0.0.0.0 for all interfaces)
|
||||
NODE_ADDRESS="--address=${NODE_ADDRESS}"
|
||||
|
||||
# --port=10250: The port for the Kubelet to serve on. Note that "kubectl logs" will not work if you set this flag.
|
||||
NODE_PORT="--port=10250"
|
||||
|
||||
# --hostname-override="": If non-empty, will use this string as identification instead of the actual hostname.
|
||||
NODE_HOSTNAME="--hostname-override=${NODE_ADDRESS}"
|
||||
|
||||
# Path to a kubeconfig file, specifying how to connect to the API server.
|
||||
KUBELET_KUBECONFIG="--kubeconfig=${KUBECONFIG_DIR}/kubelet.kubeconfig"
|
||||
|
||||
# --allow-privileged=false: If true, allow containers to request privileged mode. [default=false]
|
||||
KUBE_ALLOW_PRIV="--allow-privileged=false"
|
||||
|
||||
# DNS info
|
||||
KUBELET__DNS_IP="--cluster-dns=${DNS_SERVER_IP}"
|
||||
KUBELET_DNS_DOMAIN="--cluster-domain=${DNS_DOMAIN}"
|
||||
|
||||
# Add your own!
|
||||
KUBELET_ARGS=""
|
||||
EOF
|
||||
|
||||
KUBELET_OPTS=" \${KUBE_LOGTOSTDERR} \\
|
||||
\${KUBE_LOG_LEVEL} \\
|
||||
\${NODE_ADDRESS} \\
|
||||
\${NODE_PORT} \\
|
||||
\${NODE_HOSTNAME} \\
|
||||
\${KUBELET_KUBECONFIG} \\
|
||||
\${KUBE_ALLOW_PRIV} \\
|
||||
\${KUBELET__DNS_IP} \\
|
||||
\${KUBELET_DNS_DOMAIN} \\
|
||||
\$KUBELET_ARGS"
|
||||
|
||||
cat <<EOF >/usr/lib/systemd/system/kubelet.service
|
||||
[Unit]
|
||||
Description=Kubernetes Kubelet
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/opt/kubernetes/cfg/kubelet
|
||||
ExecStart=/opt/kubernetes/bin/kubelet ${KUBELET_OPTS}
|
||||
Restart=on-failure
|
||||
KillMode=process
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable kubelet
|
||||
systemctl restart kubelet
|
56
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/proxy.sh
generated
vendored
Executable file
56
vendor/k8s.io/kubernetes/cluster/centos/node/scripts/proxy.sh
generated
vendored
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
MASTER_ADDRESS=${1:-"8.8.8.18"}
|
||||
NODE_ADDRESS=${2:-"8.8.8.20"}
|
||||
|
||||
cat <<EOF >/opt/kubernetes/cfg/kube-proxy
|
||||
# --logtostderr=true: log to standard error instead of files
|
||||
KUBE_LOGTOSTDERR="--logtostderr=true"
|
||||
|
||||
# --v=0: log level for V logs
|
||||
KUBE_LOG_LEVEL="--v=4"
|
||||
|
||||
# --hostname-override="": If non-empty, will use this string as identification instead of the actual hostname.
|
||||
NODE_HOSTNAME="--hostname-override=${NODE_ADDRESS}"
|
||||
|
||||
# --master="": The address of the Kubernetes API server (overrides any value in kubeconfig)
|
||||
KUBE_MASTER="--master=http://${MASTER_ADDRESS}:8080"
|
||||
EOF
|
||||
|
||||
KUBE_PROXY_OPTS=" \${KUBE_LOGTOSTDERR} \\
|
||||
\${KUBE_LOG_LEVEL} \\
|
||||
\${NODE_HOSTNAME} \\
|
||||
\${KUBE_MASTER}"
|
||||
|
||||
cat <<EOF >/usr/lib/systemd/system/kube-proxy.service
|
||||
[Unit]
|
||||
Description=Kubernetes Proxy
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/opt/kubernetes/cfg/kube-proxy
|
||||
ExecStart=/opt/kubernetes/bin/kube-proxy ${KUBE_PROXY_OPTS}
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable kube-proxy
|
||||
systemctl restart kube-proxy
|
Reference in New Issue
Block a user