Skip to content

Instantly share code, notes, and snippets.

@mariomac
Last active November 26, 2021 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariomac/9e8acf4620794f0448d02bfae47d774e to your computer and use it in GitHub Desktop.
Save mariomac/9e8acf4620794f0448d02bfae47d774e to your computer and use it in GitHub Desktop.
Deploy development version of the CNO and OVS-Kubernetes

Deploy development version of the CNO and OVS-Kubernetes

Using pre-built images (at quay.io/mmacias)

Download the CNO:

git clone github.com/openshift/cluster-network-operator

Apply this override patch so the downstream CNO is not redeployed automatically:

cd cluster-network-operator
oc patch --type=json -p "$(cat hack/overrides-patch.yaml)" clusterversion version

You need to patch the manifests/0000_70_cluster-network-operator_03_deployment.yaml to run the development versions of the CNO and OVN-K:

24c24,25
<         image: quay.io/openshift/origin-cluster-network-operator:latest
---
>         image: quay.io/mmaciasl/cluster-network-operator:latest
>         imagePullPolicy: Always
41a43,44
>         - name: NETWORK_PLUGIN
>           value: "OVNKubernetes"
65c68
<           value: "quay.io/openshift/origin-ovn-kubernetes:latest"
---
>           value: "quay.io/mmaciasl/ovn-daemonset-f:latest"

(The patched 0000_70_cluster-network-operator_03_deployment.yaml file is attached).

Compiling yourself the images

1. Compile OVN-kubernetes

git clone github.com/ovn-org/ovn-kubernetes
cd ovn-kubernetes/go-controller
make
cd ../dist/images/
find ../../go-controller/_output/go/bin/ -maxdepth 1 -type f -exec cp -f {} . \;
echo "ref: $(git rev-parse  --symbolic-full-name HEAD)  commit: $(git rev-parse  HEAD)" > git_info
export OVN_IMAGE=quay.io/mmaciasl/ovn-daemonset-f:latest
docker build -t $OVN_IMAGE -f Dockerfile.fedora .
docker push $OVN_IMAGE

(replace quay.io/mmaciasl by your own images repo)

2. Compile the CNO

git clone github.com/openshift/cluster-network-operator
cd cluster-network-operator
podman build -t quay.io/mmaciasl/cluster-network-operator:latest .
podman push quay.io/mmaciasl/cluster-network-operator:latest

(replace quay.io/mmaciasl by your own images repo)

Then follow the steps of the Using-pre-built-images section, providing your own repository in the image paths.

apiVersion: apps/v1
kind: Deployment
metadata:
name: network-operator
namespace: openshift-network-operator
labels:
name: network-operator
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
spec:
selector:
matchLabels:
name: network-operator
template:
metadata:
annotations:
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
labels:
name: network-operator
spec:
containers:
- name: network-operator
image: quay.io/mmaciasl/cluster-network-operator:latest
imagePullPolicy: Always
command:
- /bin/bash
- -c
- |
#!/bin/bash
set -o allexport
if [[ -f /etc/kubernetes/apiserver-url.env ]]; then
source /etc/kubernetes/apiserver-url.env
else
URL_ONLY_KUBECONFIG=/etc/kubernetes/kubeconfig
fi
exec /usr/bin/cluster-network-operator start --listen=0.0.0.0:9104
resources:
requests:
cpu: 10m
memory: 50Mi
env:
- name: NETWORK_PLUGIN
value: "OVNKubernetes"
- name: RELEASE_VERSION
value: "0.0.1-snapshot"
- name: SDN_IMAGE
value: "quay.io/openshift/origin-sdn:latest"
- name: KUBE_PROXY_IMAGE
value: "quay.io/openshift/origin-kube-proxy:latest"
- name: KUBE_RBAC_PROXY_IMAGE
value: "quay.io/openshift/origin-kube-rbac-proxy:latest"
- name: MULTUS_IMAGE
value: "quay.io/openshift/origin-multus-cni:latest"
- name: MULTUS_ADMISSION_CONTROLLER_IMAGE
value: "quay.io/openshift/origin-multus-admission-controller:latest"
- name: CNI_PLUGINS_IMAGE
value: "quay.io/openshift/origin-container-networking-plugins:latest"
- name: BOND_CNI_PLUGIN_IMAGE
value: "quay.io/openshift/origin-network-interface-bond-cni:latest"
- name: WHEREABOUTS_CNI_IMAGE
value: "quay.io/openshift/origin-multus-whereabouts-ipam-cni:latest"
- name: ROUTE_OVERRRIDE_CNI_IMAGE
value: "quay.io/openshift/origin-multus-route-override-cni:latest"
- name: MULTUS_NETWORKPOLICY_IMAGE
value: "quay.io/openshift/origin-multus-networkpolicy:latest"
- name: OVN_IMAGE
value: "quay.io/mmaciasl/ovn-daemonset-f:latest"
- name: OVN_NB_RAFT_ELECTION_TIMER
value: "10"
- name: OVN_SB_RAFT_ELECTION_TIMER
value: "16"
- name: OVN_NORTHD_PROBE_INTERVAL
value: "5000"
- name: OVN_CONTROLLER_INACTIVITY_PROBE
value: "180000"
- name: OVN_NB_INACTIVITY_PROBE
value: "60000"
- name: EGRESS_ROUTER_CNI_IMAGE
value: "quay.io/openshift/origin-egress-router-cni:latest"
- name: KURYR_DAEMON_IMAGE
value: "quay.io/openshift/origin-kuryr-cni:latest"
- name: KURYR_CONTROLLER_IMAGE
value: "quay.io/openshift/origin-kuryr-controller:latest"
- name: NETWORK_METRICS_DAEMON_IMAGE
value: "quay.io/openshift/origin-network-metrics-daemon:latest"
- name: NETWORK_CHECK_SOURCE_IMAGE
value: "quay.io/openshift/origin-cluster-network-operator:latest"
- name: NETWORK_CHECK_TARGET_IMAGE
value: "quay.io/openshift/origin-cluster-network-operator:latest"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- mountPath: /etc/kubernetes
name: host-etc-kube
readOnly: true
hostNetwork: true
nodeSelector:
node-role.kubernetes.io/master: ""
priorityClassName: "system-cluster-critical"
volumes:
- name: host-etc-kube
hostPath:
path: /etc/kubernetes
type: Directory
restartPolicy: Always
securityContext:
runAsNonRoot: true
runAsUser: 65534
tolerations:
- key: "node-role.kubernetes.io/master"
operator: Exists
effect: NoSchedule
- key: "node.kubernetes.io/not-ready"
operator: Exists
effect: NoSchedule
- key: node.kubernetes.io/network-unavailable
operator: Exists
effect: NoSchedule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment