Skip to content

Commit

Permalink
fix: some init and cleanup bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Dec 5, 2019
1 parent 2f570d4 commit a5dc8bb
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 22 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ suspend:
cd vagrant && vagrant suspend

kind-init:
kind create cluster --config yamls/kind.yaml
kind delete cluster --name=kube-ovn
kind create cluster --config yamls/kind.yaml --name kube-ovn
@for role in ${ROLES} ; do \
kind load docker-image ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
done
kubectl label node kind-control-plane kube-ovn/role=master
kubectl label node kube-ovn-control-plane kube-ovn/role=master
kubectl apply -f yamls/crd.yaml
kubectl apply -f yamls/ovn.yaml
kubectl apply -f yamls/kube-ovn.yaml
Expand All @@ -75,3 +76,6 @@ kind-reload:
kind load docker-image ${REGISTRY}/kube-ovn-$$role:${RELEASE_TAG}; \
done
kubectl delete pod -n kube-ovn --all

kind-clean:
kind delete cluster --name=kube-ovn
21 changes: 13 additions & 8 deletions dist/images/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
#!/bin/bash
set -eu

for subnet in $(kubectl get subnet -o name); do
kubectl patch "$subnet" --type='json' -p '[{"op": "remove", "path": "/metadata/finalizers"}]'
done

# Delete Kube-OVN components
kubectl delete -f https://raw.githubusercontent.com/alauda/kube-ovn/master/yamls/kube-ovn.yaml --ignore-not-found=true
kubectl delete -f https://raw.githubusercontent.com/alauda/kube-ovn/master/yamls/ovn.yaml --ignore-not-found=true
kubectl delete -f https://raw.githubusercontent.com/alauda/kube-ovn/master/yamls/crd.yaml --ignore-not-found=true

# Remove annotations in all pods of all namespaces
for ns in $(kubectl get ns -o name |cut -c 11-); do
echo "annotating pods in ns:$ns"
kubectl annotate pod --all ovn.kubernetes.io/cidr- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/gateway- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/ip_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/logical_switch- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/mac_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/port_name- -n "$ns"
done
echo "annotating pods in ns:$ns"
kubectl annotate pod --all ovn.kubernetes.io/cidr- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/gateway- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/ip_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/logical_switch- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/mac_address- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/port_name- -n "$ns"
kubectl annotate pod --all ovn.kubernetes.io/allocated- -n "$ns"
done

# Remove annotations in namespaces and nodes
kubectl annotate no --all ovn.kubernetes.io/cidr-
Expand Down
3 changes: 3 additions & 0 deletions dist/images/start-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ trap quit EXIT

if [[ -z "$NODE_IPS" ]]; then
/usr/share/openvswitch/scripts/ovn-ctl restart_northd
ovn-nbctl set-connection ptcp:"${DB_NB_PORT}":["${DB_NB_ADDR}"]
ovn-sbctl set-connection ptcp:"${DB_SB_PORT}":["${DB_SB_ADDR}"]
ovn-sbctl set Connection . inactivity_probe=0
else
/usr/share/openvswitch/scripts/ovn-ctl stop_northd

Expand Down
8 changes: 4 additions & 4 deletions yamls/kube-ovn-ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
containers:
- name: kube-ovn-controller
image: "index.alauda.cn/alaudak8s/kube-ovn-controller:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command:
- /kube-ovn/start-controller.sh
args:
Expand Down Expand Up @@ -110,7 +110,7 @@ spec:
initContainers:
- name: install-cni
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:vv1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command: ["/kube-ovn/install-cni.sh"]
securityContext:
runAsUser: 0
Expand All @@ -127,7 +127,7 @@ spec:
args:
- --enable-mirror=false
- --mtu=1420
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
add: ["NET_ADMIN", "SYS_ADMIN"]
Expand Down Expand Up @@ -206,7 +206,7 @@ spec:
containers:
- name: pinger
image: "index.alauda.cn/alaudak8s/kube-ovn-pinger:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0
privileged: false
Expand Down
8 changes: 4 additions & 4 deletions yamls/kube-ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
containers:
- name: kube-ovn-controller
image: "index.alauda.cn/alaudak8s/kube-ovn-controller:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command:
- /kube-ovn/start-controller.sh
args:
Expand Down Expand Up @@ -113,7 +113,7 @@ spec:
initContainers:
- name: install-cni
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command: ["/kube-ovn/install-cni.sh"]
securityContext:
runAsUser: 0
Expand All @@ -126,7 +126,7 @@ spec:
containers:
- name: cni-server
image: "index.alauda.cn/alaudak8s/kube-ovn-cni:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command:
- sh
- /kube-ovn/start-cniserver.sh
Expand Down Expand Up @@ -216,7 +216,7 @@ spec:
containers:
- name: pinger
image: "index.alauda.cn/alaudak8s/kube-ovn-pinger:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0
privileged: false
Expand Down
4 changes: 2 additions & 2 deletions yamls/ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ spec:
containers:
- name: ovn-central
image: "index.alauda.cn/alaudak8s/kube-ovn-db:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
add: ["SYS_NICE"]
Expand Down Expand Up @@ -256,7 +256,7 @@ spec:
containers:
- name: openvswitch
image: "index.alauda.cn/alaudak8s/kube-ovn-node:v1.0.0-pre"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
securityContext:
runAsUser: 0
privileged: true
Expand Down
2 changes: 1 addition & 1 deletion yamls/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
containers:
- name: kube-ovn-webhook
image: "index.alauda.cn/alaudak8s/kube-ovn-webhook:v0.9.0"
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
command:
- /kube-ovn/start-webhook.sh
args:
Expand Down

0 comments on commit a5dc8bb

Please sign in to comment.