Skip to content

Commit

Permalink
Fix cilium in an ha cluster (#1453)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsakalozos authored Aug 10, 2020
1 parent db9212e commit fb35011
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 11 additions & 5 deletions microk8s-resources/actions/disable.cilium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ then
run_with_sudo $SNAP/sbin/ip link delete "cilium_vxlan"
fi

set_service_expected_to_start flanneld

echo "Restarting flanneld"
run_with_sudo preserve_env snapctl stop "${SNAP_NAME}.daemon-flanneld"

if [ -e "$SNAP_DATA/var/lock/ha-cluster" ] && [ -e "$SNAP_DATA/args/cni-network/cni.yaml.disabled" ]
then
echo "Restarting default cni"
run_with_sudo mv "$SNAP_DATA/args/cni-network/cni.yaml.disabled" "$SNAP_DATA/args/cni-network/cni.yaml"
"$SNAP/kubectl" "--kubeconfig=$SNAP_DATA/credentials/client.config" apply -f "$SNAP_DATA/args/cni-network/cni.yaml"
else
echo "Restarting flanneld"
set_service_expected_to_start flanneld

run_with_sudo preserve_env snapctl start "${SNAP_NAME}.daemon-flanneld"
fi
echo "Cilium is terminating"
6 changes: 6 additions & 0 deletions microk8s-resources/actions/enable.cilium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ else
"$SNAP/kubectl" "--kubeconfig=$SNAP_DATA/credentials/client.config" apply -f "$SNAP_DATA/actions/cilium.yaml"
"$SNAP/kubectl" "--kubeconfig=$SNAP_DATA/credentials/client.config" -n $NAMESPACE rollout status ds/cilium

if [ -e "$SNAP_DATA/args/cni-network/cni.yaml" ]
then
"$SNAP/kubectl" "--kubeconfig=$SNAP_DATA/credentials/client.config" delete -f "$SNAP_DATA/args/cni-network/cni.yaml"
run_with_sudo mv "$SNAP_DATA/args/cni-network/cni.yaml" "$SNAP_DATA/args/cni-network/cni.yaml.disabled"
fi

# Fetch the Cilium CLI binary and install
CILIUM_POD=$("$SNAP/kubectl" "--kubeconfig=$SNAP_DATA/credentials/client.config" -n $NAMESPACE get pod -l $CILIUM_LABELS -o jsonpath="{.items[0].metadata.name}")
CILIUM_BIN=$(mktemp)
Expand Down

0 comments on commit fb35011

Please sign in to comment.