-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ovn support ic ecmp enhance
- Loading branch information
Showing
27 changed files
with
1,564 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ovn_ic_controller | ||
|
||
import ( | ||
"k8s.io/klog/v2" | ||
"k8s.io/sample-controller/pkg/signals" | ||
|
||
"github.com/kubeovn/kube-ovn/pkg/ovn_ic_controller" | ||
"github.com/kubeovn/kube-ovn/pkg/util" | ||
"github.com/kubeovn/kube-ovn/versions" | ||
) | ||
|
||
func CmdMain() { | ||
defer klog.Flush() | ||
|
||
klog.Infof(versions.String()) | ||
config, err := ovn_ic_controller.ParseFlags() | ||
if err != nil { | ||
util.LogFatalAndExit(err, "failed to parse config") | ||
} | ||
|
||
stopCh := signals.SetupSignalHandler() | ||
ctl := ovn_ic_controller.NewController(config) | ||
ctl.Run(stopCh) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "use method $0 {az|node} {azName|nodeName}" | ||
echo " eg: ./clean-ic-az-db.sh az az1" | ||
echo " eg: ./clean-ic-az-db.sh node kube-ovn-worker; it will delete all resource of az that the node belong to" | ||
exit 1 | ||
fi | ||
|
||
filter_type=$1 | ||
filter_value=$2 | ||
availability_zone_uuid= | ||
|
||
if [ "$filter_type" != "az" ] && [ "$filter_type" != "node" ]; then | ||
echo "filter_type should be az or node." | ||
exit 1 | ||
fi | ||
|
||
if [ "$filter_type" == "az" ]; then | ||
availability_zone_uuid=$(ovn-ic-sbctl --columns=_uuid find availability_zone name=$filter_value | awk '{print $3}') | ||
fi | ||
|
||
echo $availability_zone_uuid | ||
|
||
if [ "$filter_type" == "node" ]; then | ||
availability_zone_uuid=$(ovn-ic-sbctl --columns=availability_zone find gateway hostname=$filter_value | awk '{print $3}') | ||
fi | ||
|
||
if ! ovn-ic-sbctl get availability_zone $availability_zone_uuid name >/dev/null 2>&1; then | ||
echo "Availability zone $availability_zone_uuid not found." | ||
exit 1 | ||
fi | ||
|
||
resource_types=("Gateway" "Route" "Port_Binding") | ||
|
||
for resource_type in "${resource_types[@]}"; do | ||
uuid_array=($(ovn-ic-sbctl --columns=_uuid find $resource_type availability_zone=$availability_zone_uuid | awk '{print $3}')) | ||
|
||
for uuid in "${uuid_array[@]}"; do | ||
ovn-ic-sbctl destroy $resource_type $uuid | ||
echo "Destroyed $resource_type: $uuid" | ||
done | ||
done | ||
|
||
ovn-ic-sbctl destroy availability_zone $availability_zone_uuid | ||
echo "Destroyed availability_zone: $availability_zone_uuid" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
REGISTRY="kubeovn" | ||
VERSION="v1.11.14" | ||
TS_NUM=${TS_NUM:-3} | ||
IMAGE_PULL_POLICY="IfNotPresent" | ||
addresses=$(kubectl get no -lkube-ovn/role=master --no-headers -o wide | awk '{print $6}' | tr \\n ',') | ||
count=$(kubectl get no -lkube-ovn/role=master --no-headers | wc -l) | ||
OVN_LEADER_PROBE_INTERVAL=${OVN_LEADER_PROBE_INTERVAL:-5} | ||
|
||
cat <<EOF > ovn-ic-server.yaml | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: ovn-ic-server | ||
namespace: kube-system | ||
annotations: | ||
kubernetes.io/description: | | ||
OVN IC Server | ||
spec: | ||
replicas: $count | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 0 | ||
maxUnavailable: 1 | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: ovn-ic-server | ||
template: | ||
metadata: | ||
labels: | ||
app: ovn-ic-server | ||
component: network | ||
type: infra | ||
spec: | ||
tolerations: | ||
- effect: NoSchedule | ||
operator: Exists | ||
- effect: NoExecute | ||
operator: Exists | ||
- key: CriticalAddonsOnly | ||
operator: Exists | ||
affinity: | ||
podAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- labelSelector: | ||
matchLabels: | ||
app: ovn-ic-server | ||
topologyKey: kubernetes.io/hostname | ||
priorityClassName: system-cluster-critical | ||
serviceAccountName: ovn | ||
hostNetwork: true | ||
containers: | ||
- name: ovn-ic-server | ||
image: "$REGISTRY/kube-ovn:$VERSION" | ||
imagePullPolicy: $IMAGE_PULL_POLICY | ||
command: ["/kube-ovn/start-ic-db.sh"] | ||
securityContext: | ||
capabilities: | ||
add: ["SYS_NICE"] | ||
env: | ||
- name: ENABLE_SSL | ||
value: "false" | ||
- name: TS_NUM | ||
value: "$TS_NUM" | ||
- name: NODE_IPS | ||
value: $addresses | ||
- name: POD_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP | ||
- name: OVN_LEADER_PROBE_INTERVAL | ||
value: "$OVN_LEADER_PROBE_INTERVAL" | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: POD_IPS | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIPs | ||
resources: | ||
requests: | ||
cpu: 300m | ||
memory: 200Mi | ||
limits: | ||
cpu: 3 | ||
memory: 1Gi | ||
volumeMounts: | ||
- mountPath: /var/run/ovn | ||
name: host-run-ovn | ||
- mountPath: /etc/ovn | ||
name: host-config-ovn | ||
- mountPath: /var/log/ovn | ||
name: host-log-ovn | ||
- mountPath: /etc/localtime | ||
name: localtime | ||
- mountPath: /var/run/tls | ||
name: kube-ovn-tls | ||
readinessProbe: | ||
exec: | ||
command: | ||
- bash | ||
- /kube-ovn/ovn-ic-healthcheck.sh | ||
periodSeconds: 15 | ||
timeoutSeconds: 45 | ||
livenessProbe: | ||
exec: | ||
command: | ||
- bash | ||
- /kube-ovn/ovn-ic-healthcheck.sh | ||
initialDelaySeconds: 30 | ||
periodSeconds: 15 | ||
failureThreshold: 5 | ||
timeoutSeconds: 4 | ||
nodeSelector: | ||
kubernetes.io/os: "linux" | ||
kube-ovn/role: "master" | ||
volumes: | ||
- name: host-run-ovn | ||
hostPath: | ||
path: /run/ovn | ||
- name: host-config-ovn | ||
hostPath: | ||
path: /etc/origin/ovn | ||
- name: host-log-ovn | ||
hostPath: | ||
path: /var/log/ovn | ||
- name: localtime | ||
hostPath: | ||
path: /etc/localtime | ||
- name: kube-ovn-tls | ||
secret: | ||
optional: true | ||
secretName: kube-ovn-tls | ||
EOF | ||
|
||
kubectl apply -f ovn-ic-server.yaml | ||
kubectl rollout status deployment/ovn-ic-server -n kube-system --timeout 600s | ||
|
||
echo "OVN IC Server installed Successfully" |
Oops, something went wrong.