Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# The ovnkube control-plane components
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: ovnkube-master
namespace: openshift-ovn-kubernetes
annotations:
kubernetes.io/description: |
This daemonset launches the ovn-kubernetes controller (master) networking components.
release.openshift.io/version: "{{.ReleaseVersion}}"
spec:
selector:
matchLabels:
app: ovnkube-master
updateStrategy:
type: RollingUpdate
rollingUpdate:
# by default, Deployments spin up the new pod before terminating the old one
# but we don't want that - because ovsdb holds the lock.
maxSurge: 0
maxUnavailable: 3
template:
metadata:
annotations:
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
labels:
app: ovnkube-master
ovn-db-pod: "true"
component: network
type: infra
openshift.io/component: network
kubernetes.io/os: "linux"
spec:
serviceAccountName: ovn-kubernetes-controller
hostNetwork: true
dnsPolicy: Default
priorityClassName: "system-cluster-critical"
# volumes in all containers:
# (container) -> (host)
# /etc/openvswitch -> /var/lib/ovn/etc - ovsdb data
# /var/lib/openvswitch -> /var/lib/ovn/data - ovsdb pki state
# /run/openvswitch -> tmpfs - sockets
# /env -> configmap env-overrides - debug overrides
containers:
- name: kube-rbac-proxy
image: {{.KubeRBACProxyImage}}
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -euo pipefail
TLS_PK=/etc/pki/tls/metrics-cert/tls.key
TLS_CERT=/etc/pki/tls/metrics-cert/tls.crt
# As the secret mount is optional we must wait for the files to be present.
# The service is created in monitor.yaml and this is created in sdn.yaml.
TS=$(date +%s)
WARN_TS=$(( ${TS} + $(( 20 * 60)) ))
HAS_LOGGED_INFO=0

log_missing_certs(){
CUR_TS=$(date +%s)
if [[ "${CUR_TS}" -gt "WARN_TS" ]]; then
echo $(date -Iseconds) WARN: ovn-master-metrics-cert not mounted after 20 minutes.
elif [[ "${HAS_LOGGED_INFO}" -eq 0 ]] ; then
echo $(date -Iseconds) INFO: ovn-master-metrics-cert not mounted. Waiting 20 minutes.
HAS_LOGGED_INFO=1
fi
}
while [[ ! -f "${TLS_PK}" || ! -f "${TLS_CERT}" ]] ; do
log_missing_certs
sleep 5
done

echo $(date -Iseconds) INFO: ovn-master-metrics-certs mounted, starting kube-rbac-proxy
exec /usr/bin/kube-rbac-proxy \
--logtostderr \
--secure-listen-address=:9106 \
--tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 \
--upstream=http://127.0.0.1:29104/ \
--tls-private-key-file=${TLS_PK} \
--tls-cert-file=${TLS_CERT}
ports:
- containerPort: 9206
name: https
resources:
requests:
cpu: 10m
memory: 20Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: ovn-master-metrics-cert
mountPath: /etc/pki/tls/metrics-cert
readOnly: True

# ovnkube master: convert kubernetes objects in to nbdb logical network components
- name: ovnkube-control-plane
image: "{{.OvnImage}}"
command:
- /bin/bash
- -c
- |
set -xe
if [[ -f "/env/_master" ]]; then
set -o allexport
source "/env/_master"
set +o allexport
fi

if [ "{{.OVN_GATEWAY_MODE}}" == "shared" ]; then
gateway_mode_flags="--gateway-mode shared --gateway-interface br-ex"
elif [ "{{.OVN_GATEWAY_MODE}}" == "local" ]; then
gateway_mode_flags="--gateway-mode local --gateway-interface br-ex"
else
echo "Invalid OVN_GATEWAY_MODE: \"{{.OVN_GATEWAY_MODE}}\". Must be \"local\" or \"shared\"."
exit 1
fi

multi_network_enabled_flag=
if [[ "{{.OVN_MULTI_NETWORK_ENABLE}}" == "true" ]]; then
multi_network_enabled_flag="--enable-multi-network"
fi

echo "I$(date "+%m%d %H:%M:%S.%N") - ovnkube-control-plane - start ovnkube --init-master ${K8S_NODE}"
exec /usr/bin/ovnkube \
--init-cluster-manager "${K8S_NODE}" \
--config-file=/run/ovnkube-config/ovnkube.conf \
--ovn-empty-lb-events \
--loglevel "${OVN_KUBE_LOG_LEVEL}" \
--metrics-bind-address "127.0.0.1:29104" \
--metrics-enable-pprof \
--metrics-enable-config-duration \
${gateway_mode_flags} \
--sb-address "{{.OVN_SB_DB_LIST}}" \
--sb-client-privkey /ovn-cert/tls.key \
--sb-client-cert /ovn-cert/tls.crt \
--sb-client-cacert /ovn-ca/ca-bundle.crt \
--sb-cert-common-name "{{.OVN_CERT_CN}}" \
--nb-address "{{.OVN_NB_DB_LIST}}" \
--nb-client-privkey /ovn-cert/tls.key \
--nb-client-cert /ovn-cert/tls.crt \
--nb-client-cacert /ovn-ca/ca-bundle.crt \
--nb-cert-common-name "{{.OVN_CERT_CN}}" \
--enable-multicast \
--disable-snat-multiple-gws \
${multi_network_enabled_flag} \
--enable-interconnect \
--dns-service-namespace openshift-dns \
--dns-service-name dns-default \
--acl-logging-rate-limit "{{.OVNPolicyAuditRateLimit}}"
volumeMounts:
# for checking ovs-configuration service
- mountPath: /etc/systemd/system
name: systemd-units
readOnly: true
- mountPath: /etc/openvswitch/
name: etc-openvswitch
- mountPath: /etc/ovn/
name: etc-openvswitch
- mountPath: /var/lib/openvswitch/
name: var-lib-openvswitch
- mountPath: /run/openvswitch/
name: run-openvswitch
- mountPath: /run/ovn/
name: run-ovn
- mountPath: /run/ovnkube-config/
name: ovnkube-config
- mountPath: /env
name: env-overrides
- mountPath: /ovn-cert
name: ovn-cert
- mountPath: /ovn-ca
name: ovn-ca
resources:
requests:
cpu: 10m
memory: 300Mi
env:
- name: OVN_KUBE_LOG_LEVEL
value: "4"
- name: K8S_NODE
valueFrom:
fieldRef:
fieldPath: spec.nodeName
ports:
- name: metrics-port
containerPort: 29204
terminationMessagePolicy: FallbackToLogsOnError
nodeSelector:
node-role.kubernetes.io/master: ""
beta.kubernetes.io/os: "linux"
volumes:
# for checking ovs-configuration service
- name: systemd-units
hostPath:
path: /etc/systemd/system
- name: etc-openvswitch
hostPath:
path: /var/lib/ovn/etc
- name: var-lib-openvswitch
hostPath:
path: /var/lib/ovn/data
- name: run-openvswitch
hostPath:
path: /var/run/openvswitch
- name: run-ovn
hostPath:
path: /var/run/ovn
- name: ovnkube-config
configMap:
name: ovnkube-config
- name: env-overrides
configMap:
name: env-overrides
optional: true
- name: ovn-ca
configMap:
name: ovn-ca
- name: ovn-cert
secret:
secretName: ovn-cert
- name: ovn-master-metrics-cert
secret:
secretName: ovn-master-metrics-cert
optional: true
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
- key: "node.kubernetes.io/network-unavailable"
operator: "Exists"
Loading