[entrypoint] Adds CRIO restart

Co-authored-by: s1061123 <tohayash@redhat.com>
This commit is contained in:
dougbtv
2019-08-19 15:31:07 -04:00
committed by Tomofumi Hayashi
parent b38ab9771c
commit b2e1098ab5
3 changed files with 21 additions and 0 deletions

View File

@@ -537,3 +537,7 @@ Used only with `--multus-conf-file=auto`. Allows you to specify CNI spec version
In some cases, the original CNI configuration that the Multus configuration was generated from (using `--multus-conf-file=auto`) may be used as a sort of semaphor for network readiness -- as this model is used by the Kubelet itself. If you need to disable Multus' availablity, you may wish to clean out the generated configuration file when the source file for autogeneration of the config file is no longer present. You can use this functionality by setting: In some cases, the original CNI configuration that the Multus configuration was generated from (using `--multus-conf-file=auto`) may be used as a sort of semaphor for network readiness -- as this model is used by the Kubelet itself. If you need to disable Multus' availablity, you may wish to clean out the generated configuration file when the source file for autogeneration of the config file is no longer present. You can use this functionality by setting:
--cleanup-config-on-exit=true --cleanup-config-on-exit=true
When using CRIO, you may need to restart CRIO to get the Multus configuration file to take -- this is rarely necessary.
--restart-crio=false

View File

@@ -29,6 +29,7 @@ MULTUS_LOG_LEVEL=""
MULTUS_LOG_FILE="" MULTUS_LOG_FILE=""
OVERRIDE_NETWORK_NAME=false OVERRIDE_NETWORK_NAME=false
MULTUS_CLEANUP_CONFIG_ON_EXIT=false MULTUS_CLEANUP_CONFIG_ON_EXIT=false
RESTART_CRIO=false
# Give help text for parameters. # Give help text for parameters.
function usage() function usage()
@@ -54,6 +55,7 @@ function usage()
echo -e "\t--multus-log-file=$MULTUS_LOG_FILE (empty by default, used only with --multus-conf-file=auto)" echo -e "\t--multus-log-file=$MULTUS_LOG_FILE (empty by default, used only with --multus-conf-file=auto)"
echo -e "\t--override-network-name=false (used only with --multus-conf-file=auto)" echo -e "\t--override-network-name=false (used only with --multus-conf-file=auto)"
echo -e "\t--cleanup-config-on-exit=false (used only with --multus-conf-file=auto)" echo -e "\t--cleanup-config-on-exit=false (used only with --multus-conf-file=auto)"
echo -e "\t--restart-crio=false (restarts CRIO after config file is generated)"
} }
function log() function log()
@@ -116,6 +118,9 @@ while [ "$1" != "" ]; do
--cleanup-config-on-exit) --cleanup-config-on-exit)
MULTUS_CLEANUP_CONFIG_ON_EXIT=$VALUE MULTUS_CLEANUP_CONFIG_ON_EXIT=$VALUE
;; ;;
--restart-crio)
RESTART_CRIO=$VALUE
;;
*) *)
warn "unknown parameter \"$PARAM\"" warn "unknown parameter \"$PARAM\""
;; ;;
@@ -302,6 +307,11 @@ EOF
echo $CONF > $CNI_CONF_DIR/00-multus.conf echo $CONF > $CNI_CONF_DIR/00-multus.conf
log "Config file created @ $CNI_CONF_DIR/00-multus.conf" log "Config file created @ $CNI_CONF_DIR/00-multus.conf"
echo $CONF echo $CONF
if [ "$RESTART_CRIO" == true ]; then
log "Restarting crio"
systemctl restart crio
fi
fi fi
done done
fi fi

View File

@@ -150,7 +150,11 @@ spec:
memory: "50Mi" memory: "50Mi"
securityContext: securityContext:
privileged: true privileged: true
capabilities:
add: ["SYS_ADMIN"]
volumeMounts: volumeMounts:
- name: run
mountPath: /run
- name: cni - name: cni
mountPath: /host/etc/cni/net.d mountPath: /host/etc/cni/net.d
- name: cnibin - name: cnibin
@@ -158,6 +162,9 @@ spec:
- name: multus-cfg - name: multus-cfg
mountPath: /tmp/multus-conf mountPath: /tmp/multus-conf
volumes: volumes:
- name: run
hostPath:
path: /run
- name: cni - name: cni
hostPath: hostPath:
path: /etc/cni/net.d path: /etc/cni/net.d