cpu-manager-for-kubernetes: add new recipe
authorJackie Huang <jackie.huang@windriver.com>
Mon, 28 Oct 2019 09:12:06 +0000 (17:12 +0800)
committerJackie Huang <jackie.huang@windriver.com>
Mon, 28 Oct 2019 09:45:19 +0000 (17:45 +0800)
CPU Manager for Kubernetes provides basic core affinity for
NFV-style workloads on top of vanilla Kubernetes v1.5+.

Issue-ID: INF-4
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I3195c26a9067006ab696af0765aedfb1e0f148ad

meta-oran/recipes-base/packagegroups/packagegroup-oran.bb
meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes/cmk-cluster-init-pod-template.yaml [new file with mode: 0644]
meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes/cmk-requirements.txt-add-urllib3-1.24.patch [new file with mode: 0644]
meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes_1.3.1.bb [new file with mode: 0644]

index 7adf524..2803428 100644 (file)
@@ -53,6 +53,7 @@ RDEPENDS_${PN}-k8s = "\
     kubernetes \
     kubernetes-dashboard \
     multus-cni \
+    cmk \
 "
 
 RRECOMMENDS_${PN}-k8s = "\
@@ -60,6 +61,7 @@ RRECOMMENDS_${PN}-k8s = "\
     kubernetes-img \
     kubernetes-dashboard-img \
     multus-cni-img \
+    cmk-img \
 "
 
 RDEPENDS_${PN}-vm = "\
diff --git a/meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes/cmk-cluster-init-pod-template.yaml b/meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes/cmk-cluster-init-pod-template.yaml
new file mode 100644 (file)
index 0000000..3ea5318
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright (c) 2017 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+apiVersion: v1
+kind: Pod
+metadata:
+  labels:
+    app: cmk-cluster-init-pod
+  name: cmk-cluster-init-pod
+  #namespace: user-supplied-namespace      
+spec:
+  serviceAccountName: cmk-serviceaccount
+  containers:
+  - args:
+      # Change this value to pass different options to cluster-init.
+      - "/cmk/cmk.py cluster-init --host-list=$HOST_LIST --saname=cmk-serviceaccount --num-exclusive-cores=$NUM_EXCLUSIVE_CORES --num-shared-cores=$NUM_SHARED_CORES --cmk-img=$CMK_IMG"
+    command:
+    - "/bin/bash"
+    - "-c"
+    image: cmk:v1.3.1
+    name: cmk-cluster-init-pod
+    env:
+    - name: HOST_LIST
+      value: "oran-master"
+    - name: NUM_EXCLUSIVE_CORES
+      value: "4"
+    - name: NUM_SHARED_CORES
+      value: "1"
+    - name: CMK_IMG
+      value: "cmk:v1.3.1"
+  restartPolicy: Never
diff --git a/meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes/cmk-requirements.txt-add-urllib3-1.24.patch b/meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes/cmk-requirements.txt-add-urllib3-1.24.patch
new file mode 100644 (file)
index 0000000..de8ca22
--- /dev/null
@@ -0,0 +1,28 @@
+From c0a24da25fed6503ae1eafc92d6d91277091039d Mon Sep 17 00:00:00 2001
+From: Jackie Huang <jackie.huang@windriver.com>
+Date: Mon, 28 Oct 2019 16:20:54 +0800
+Subject: [PATCH] requirements.txt: add urllib3<1.24
+
+Fixed the issue:
+/usr/local/lib/python3.4/site-packages/requests/__init__.py:91:
+RequestsDependencyWarning: urllib3 (1.25.6) or chardet (3.0.4) doesn't
+match a supported version!
+  RequestsDependencyWarning)
+
+Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
+---
+ requirements.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/requirements.txt b/requirements.txt
+index 64f8999..534b542 100644
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -10,3 +10,4 @@ cryptography>=2.3, <=2.4.2
+ yamlreader==3.0.4
+ pluggy>=0.5, <0.7
+ packaging==17.1
++urllib3<1.24
+-- 
+2.7.4
+
diff --git a/meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes_1.3.1.bb b/meta-oran/recipes-containers/kubernetes-plugins/cpu-manager-for-kubernetes_1.3.1.bb
new file mode 100644 (file)
index 0000000..58b30bd
--- /dev/null
@@ -0,0 +1,67 @@
+#
+# Copyright (C) 2019 Wind River Systems, Inc.
+#
+
+SUMMARY = "CPU Manager for Kubernetes"
+uDESCRIPTION = "\
+  This project provides basic core affinity for NFV-style workloads \
+  on top of vanilla Kubernetes v1.5+. \
+  This project ships a single multi-use command-line program to perform \
+  various functions for host configuration, managing groups of CPUs, \
+  and constraining workloads to specific CPUs. \
+"
+HOMEPAGE = "https://github.com/intel/CPU-Manager-for-Kubernetes"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d62f25248fea71c71fb2b520c72b5171"
+
+SRC_URI = "\
+    https://github.com/intel/${BPN}/archive/v${PV}.tar.gz;downloadfilename=${BPN}-v${PV}.tar.gz \
+    file://docker-img-cmk-v1.3.1.tar.bz2;unpack=0 \
+    file://cmk-requirements.txt-add-urllib3-1.24.patch \
+    file://cmk-cluster-init-pod-template.yaml \
+"
+
+SRC_URI[md5sum] = "5ec9f665524b86654dedb2e6826851ed"
+SRC_URI[sha256sum] = "e86feb81751c6715247577c47070beca273022b470ae09c856e6da72f185688f"
+
+S = "${WORKDIR}/CPU-Manager-for-Kubernetes-${PV}"
+
+PACKAGES =+ "${PN}-img"
+
+DOCKER_IMG = "/opt/docker_images/${BPN}"
+K8S_PLUGINS_SRC = "/opt/kubernetes_plugins/${BPN}"
+K8S_PLUGINS = "${sysconfdir}/kubernetes/plugins/${BPN}"
+
+do_configure() {
+    :
+}
+
+do_compile() {
+    :
+}
+
+do_install() {
+    # Install the config files
+    install -d ${D}${K8S_PLUGINS}
+    install -m 644 ${S}/resources/authorization/cmk-serviceaccount.yaml ${D}${K8S_PLUGINS}
+    install -m 644 ${S}/resources/authorization/cmk-rbac-rules.yaml ${D}${K8S_PLUGINS}
+    install -m 644 ${WORKDIR}/cmk-cluster-init-pod-template.yaml ${D}${K8S_PLUGINS}
+
+    # Install the saved docker image
+    install -d ${D}${DOCKER_IMG}
+    install -m 644 ${WORKDIR}/docker-img-*.tar.bz2 ${D}${DOCKER_IMG}
+
+    # Install all the src
+    install -d ${D}${K8S_PLUGINS_SRC}
+    cp -a --no-preserve=ownership ${S}/* ${D}${K8S_PLUGINS_SRC}
+}
+
+FILES_${PN} += "${K8S_PLUGINS_SRC}"
+FILES_${PN}-img = "${DOCKER_IMG}"
+
+# provides a short alias
+RPROVIDES_${PN} = "cmk"
+RPROVIDES_${PN}-img = "cmk-img"
+
+INSANE_SKIP_${PN} = "file-rdeps"