Skip to content

Instantly share code, notes, and snippets.

@zshi-redhat
Created January 10, 2019 09:31
Show Gist options
  • Save zshi-redhat/c408c88de083248a921c61391c1f5bb0 to your computer and use it in GitHub Desktop.
Save zshi-redhat/c408c88de083248a921c61391c1f5bb0 to your computer and use it in GitHub Desktop.
Openshift Containernetworking cni plugins (supported/unsupported) DaemonSet yaml file
  1. In above yaml files, apiVersion is set to app/v1 as below, I copied it from Dan's PR which I think is used in openshift. With kubernetes, apiVersion is set to extensions/v1beta1

apiVersion: apps/v1

  1. the image names in above files will be replaced by env vars set in network operator manifests; example can be found here: https://github.com/openshift/cluster-network-operator/pull/54/commits/4211d3a41cf0b9cd526a1229c08453f18038a7d9#diff-1cf3d8447bdd10b4fd172cc55ca05700R37

{{.ContainerNetworkingCNIPluginsSupportedImage}} and {{.ContainerNetworkingCNIPluginsUnsupportedImage}}

  1. Tomo helped to provide the correct format of command and arg, espically how * shall be used in pod spec args:

     command: ["/bin/sh"]
     args: ["-c", "cp -rf /usr/src/plugins/bin/* /host/opt/cni/bin"]
    
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: containernetworking-cni-plugins-supported
namespace: multus
annotations:
kubernetes.io/description: |
This daemon set launches supported container networking cni plugins on each node.
spec:
selector:
matchLabels:
app: containernetworking-cni-plugins-supported
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: containernetworking-cni-plugins-supported
component: network
type: infra
openshift.io/component: network
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- operator: Exists
containers:
- name: cni-plugins-supported
image: {{.ContainerNetworkingCNIPluginsSupportedImage}}
command: ["/bin/sh"]
args: ["-c", "cp -rf /usr/src/plugins/bin/* /host/opt/cni/bin"]
volumeMounts:
- mountPath: /host/opt/cni/bin
name: cnibin
volumes:
- name: cnibin
hostPath:
path: /opt/cni/bin
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: containernetworking-cni-plugins-unsupported
namespace: multus
annotations:
kubernetes.io/description: |
This daemon set launches unsupported container networking cni plugins on each node.
spec:
selector:
matchLabels:
app: containernetworking-cni-plugins-unsupported
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: containernetworking-cni-plugins-unsupported
component: network
type: infra
openshift.io/component: network
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- operator: Exists
containers:
- name: cni-plugins-unsupported
image: {{.ContainerNetworkingCNIPluginsUnsupportedImage}}
command: ["/bin/sh"]
args: ["-c", "cp -rf /usr/src/plugins/bin/* /host/opt/cni/bin"]
volumeMounts:
- mountPath: /host/opt/cni/bin
name: cnibin
volumes:
- name: cnibin
hostPath:
path: /opt/cni/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment