mark --network-plugin-dir deprecated for kubelet, and update related bootstrap scripts

pull/6/head
supereagle 2017-05-24 14:34:13 +08:00
parent b7f52a8c2e
commit dc9f0f9729
7 changed files with 28 additions and 22 deletions

View File

@ -535,11 +535,7 @@ function start-kubelet {
fi fi
# Network plugin # Network plugin
if [[ -n "${NETWORK_PROVIDER:-}" ]]; then if [[ -n "${NETWORK_PROVIDER:-}" ]]; then
if [[ "${NETWORK_PROVIDER:-}" == "cni" ]]; then
flags+=" --cni-bin-dir=/opt/kubernetes/bin" flags+=" --cni-bin-dir=/opt/kubernetes/bin"
else
flags+=" --network-plugin-dir=/opt/kubernetes/bin"
fi
flags+=" --network-plugin=${NETWORK_PROVIDER}" flags+=" --network-plugin=${NETWORK_PROVIDER}"
fi fi
if [[ -n "${NON_MASQUERADE_CIDR:-}" ]]; then if [[ -n "${NON_MASQUERADE_CIDR:-}" ]]; then

View File

@ -708,11 +708,7 @@ function start-kubelet {
fi fi
# Network plugin # Network plugin
if [[ -n "${NETWORK_PROVIDER:-}" || -n "${NETWORK_POLICY_PROVIDER:-}" ]]; then if [[ -n "${NETWORK_PROVIDER:-}" || -n "${NETWORK_POLICY_PROVIDER:-}" ]]; then
if [[ "${NETWORK_PROVIDER:-}" == "cni" || "${NETWORK_POLICY_PROVIDER:-}" == "calico" ]]; then
flags+=" --cni-bin-dir=/home/kubernetes/bin" flags+=" --cni-bin-dir=/home/kubernetes/bin"
else
flags+=" --network-plugin-dir=/home/kubernetes/bin"
fi
if [[ "${NETWORK_POLICY_PROVIDER:-}" == "calico" ]]; then if [[ "${NETWORK_POLICY_PROVIDER:-}" == "calico" ]]; then
# Calico uses CNI always. # Calico uses CNI always.
flags+=" --network-plugin=cni" flags+=" --network-plugin=cni"

View File

@ -131,9 +131,9 @@
{% if pillar.get('network_provider', '').lower() == 'opencontrail' %} {% if pillar.get('network_provider', '').lower() == 'opencontrail' %}
{% set network_plugin = "--network-plugin=opencontrail" %} {% set network_plugin = "--network-plugin=opencontrail" %}
{% elif pillar.get('network_provider', '').lower() == 'cni' %} {% elif pillar.get('network_provider', '').lower() == 'cni' %}
{% set network_plugin = "--network-plugin=cni --network-plugin-dir=/etc/cni/net.d/" %} {% set network_plugin = "--network-plugin=cni --cni-bin-dir=/etc/cni/net.d/" %}
{%elif pillar.get('network_policy_provider', '').lower() == 'calico' and grains['roles'][0] != 'kubernetes-master' -%} {%elif pillar.get('network_policy_provider', '').lower() == 'calico' and grains['roles'][0] != 'kubernetes-master' -%}
{% set network_plugin = "--network-plugin=cni --network-plugin-dir=/etc/cni/net.d/ --cni-bin-dir=/home/kubernetes/bin/" %} {% set network_plugin = "--network-plugin=cni --cni-conf-dir=/etc/cni/net.d/ --cni-bin-dir=/home/kubernetes/bin/" %}
{% elif pillar.get('network_provider', '').lower() == 'kubenet' %} {% elif pillar.get('network_provider', '').lower() == 'kubenet' %}
{% set network_plugin = "--network-plugin=kubenet" -%} {% set network_plugin = "--network-plugin=kubenet" -%}
{% endif -%} {% endif -%}

View File

@ -131,7 +131,9 @@ func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) {
// Network plugin settings. Shared by both docker and rkt. // Network plugin settings. Shared by both docker and rkt.
fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, "<Warning: Alpha feature> The name of the network plugin to be invoked for various events in kubelet/pod lifecycle") fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, "<Warning: Alpha feature> The name of the network plugin to be invoked for various events in kubelet/pod lifecycle")
//TODO(#46410): Remove the network-plugin-dir flag.
fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins or CNI config") fs.StringVar(&s.NetworkPluginDir, "network-plugin-dir", s.NetworkPluginDir, "<Warning: Alpha feature> The full path of the directory in which to search for network plugins or CNI config")
fs.MarkDeprecated("network-plugin-dir", "Use --cni-bin-dir instead. This flag will be removed in a future version.")
fs.StringVar(&s.CNIConfDir, "cni-conf-dir", s.CNIConfDir, "<Warning: Alpha feature> The full path of the directory in which to search for CNI config files. Default: /etc/cni/net.d") fs.StringVar(&s.CNIConfDir, "cni-conf-dir", s.CNIConfDir, "<Warning: Alpha feature> The full path of the directory in which to search for CNI config files. Default: /etc/cni/net.d")
fs.StringVar(&s.CNIBinDir, "cni-bin-dir", s.CNIBinDir, "<Warning: Alpha feature> The full path of the directory in which to search for CNI plugin binaries. Default: /opt/cni/bin") fs.StringVar(&s.CNIBinDir, "cni-bin-dir", s.CNIBinDir, "<Warning: Alpha feature> The full path of the directory in which to search for CNI plugin binaries. Default: /opt/cni/bin")
fs.Int32Var(&s.NetworkPluginMTU, "network-plugin-mtu", s.NetworkPluginMTU, "<Warning: Alpha feature> The MTU to be passed to the network plugin, to override the default. Set to 0 to use the default 1460 MTU.") fs.Int32Var(&s.NetworkPluginMTU, "network-plugin-mtu", s.NetworkPluginMTU, "<Warning: Alpha feature> The MTU to be passed to the network plugin, to override the default. Set to 0 to use the default 1460 MTU.")

View File

@ -33,8 +33,10 @@ POD_MANIFEST_PATH=${POD_MANIFEST_PATH:-"/var/run/kubernetes/static-pods"}
KUBELET_FLAGS=${KUBELET_FLAGS:-""} KUBELET_FLAGS=${KUBELET_FLAGS:-""}
# Name of the network plugin, eg: "kubenet" # Name of the network plugin, eg: "kubenet"
NET_PLUGIN=${NET_PLUGIN:-""} NET_PLUGIN=${NET_PLUGIN:-""}
# Place the binaries required by NET_PLUGIN in this directory, eg: "/home/kubernetes/bin". # Place the config files and binaries required by NET_PLUGIN in these directory,
NET_PLUGIN_DIR=${NET_PLUGIN_DIR:-""} # eg: "/etc/cni/net.d" for config files, and "/opt/cni/bin" for binaries.
CNI_CONF_DIR=${CNI_CONF_DIR:-""}
CNI_BIN_DIR=${CNI_BIN_DIR:-""}
SERVICE_CLUSTER_IP_RANGE=${SERVICE_CLUSTER_IP_RANGE:-10.0.0.0/24} SERVICE_CLUSTER_IP_RANGE=${SERVICE_CLUSTER_IP_RANGE:-10.0.0.0/24}
FIRST_SERVICE_CLUSTER_IP=${FIRST_SERVICE_CLUSTER_IP:-10.0.0.1} FIRST_SERVICE_CLUSTER_IP=${FIRST_SERVICE_CLUSTER_IP:-10.0.0.1}
# if enabled, must set CGROUP_ROOT # if enabled, must set CGROUP_ROOT
@ -625,9 +627,14 @@ function start_kubelet {
auth_args="${auth_args} --client-ca-file=${CLIENT_CA_FILE}" auth_args="${auth_args} --client-ca-file=${CLIENT_CA_FILE}"
fi fi
net_plugin_dir_args="" cni_conf_dir_args=""
if [[ -n "${NET_PLUGIN_DIR}" ]]; then if [[ -n "${CNI_CONF_DIR}" ]]; then
net_plugin_dir_args="--network-plugin-dir=${NET_PLUGIN_DIR}" cni_conf_dir_args="--cni-conf-dir=${CNI_CONF_DIR}"
fi
cni_bin_dir_args=""
if [[ -n "${CNI_BIN_DIR}" ]]; then
cni_bin_dir_args="--cni-bin-dir=${CNI_BIN_DIR}"
fi fi
container_runtime_endpoint_args="" container_runtime_endpoint_args=""
@ -664,7 +671,8 @@ function start_kubelet {
--pod-manifest-path="${POD_MANIFEST_PATH}" \ --pod-manifest-path="${POD_MANIFEST_PATH}" \
${auth_args} \ ${auth_args} \
${dns_args} \ ${dns_args} \
${net_plugin_dir_args} \ ${cni_conf_dir_args} \
${cni_bin_dir_args} \
${net_plugin_args} \ ${net_plugin_args} \
${container_runtime_endpoint_args} \ ${container_runtime_endpoint_args} \
${image_service_endpoint_args} \ ${image_service_endpoint_args} \

View File

@ -148,7 +148,7 @@ else
# Do not use any network plugin by default. User could override the flags with # Do not use any network plugin by default. User could override the flags with
# test_args. # test_args.
test_args='--kubelet-flags="--network-plugin= --network-plugin-dir=" '$test_args test_args='--kubelet-flags="--network-plugin= --cni-bin-dir=" '$test_args
# Runtime flags # Runtime flags
test_args='--kubelet-flags="--container-runtime='$runtime'" '$test_args test_args='--kubelet-flags="--container-runtime='$runtime'" '$test_args

View File

@ -70,8 +70,11 @@ mkdir -p $LOG_DIR
# plugin by default. # plugin by default.
NETWORK_PLUGIN=${NETWORK_PLUGIN:-""} NETWORK_PLUGIN=${NETWORK_PLUGIN:-""}
# NETWORK_PLUGIN_PATH is the path to network plugin binary. # CNI_CONF_DIR is the path to network plugin binaries.
NETWORK_PLUGIN_PATH=${NETWORK_PLUGIN_PATH:-""} CNI_CONF_DIR=${CNI_CONF_DIR:-""}
# CNI_BIN_DIR is the path to network plugin config files.
CNI_BIN_DIR=${CNI_BIN_DIR:-""}
# start_kubelet starts kubelet and redirect kubelet log to $LOG_DIR/kubelet.log. # start_kubelet starts kubelet and redirect kubelet log to $LOG_DIR/kubelet.log.
kubelet_log=kubelet.log kubelet_log=kubelet.log
@ -164,7 +167,8 @@ start_kubelet --api-servers $apiserver \
--system-cgroups=/system \ --system-cgroups=/system \
--cgroup-root=/ \ --cgroup-root=/ \
--network-plugin=$NETWORK_PLUGIN \ --network-plugin=$NETWORK_PLUGIN \
--network-plugin-dir=$NETWORK_PLUGIN_PATH \ --cni-conf-dir=$CNI_CONF_DIR \
--cni-bin-dir=$CNI_BIN_DIR \
--v=$log_level \ --v=$log_level \
--logtostderr --logtostderr