From ab9652c985135f21886ecaf83419cc70ad1d0a9c Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Sat, 27 Jun 2020 06:14:06 +0300 Subject: [PATCH] operator: changes to generate olm-catalog for OperatorHub Used operator-sdk to generate base versions of crd and the olm-catalog and made additional changes. These files could be pushed to 'community-operators' for publishing pmem-csi-operator on OperatorHub. --- .gitignore | 2 +- ...-csi.intel.com_v1alpha1_deployment_cr.yaml | 11 +- ...em-csi-operator.clusterserviceversion.yaml | 287 ++++++++++++++++++ .../pmem-csi.intel.com_deployments_crd.yaml | 168 ++++++++++ operator/operator.make | 18 +- pkg/apis/pmemcsi/v1alpha1/deployment_types.go | 5 +- .../pmemcsi/v1alpha1/zz_generated.deepcopy.go | 2 +- 7 files changed, 479 insertions(+), 14 deletions(-) create mode 100644 deploy/operator/olm-catalog/pmem-csi-operator/manifests/pmem-csi-operator.clusterserviceversion.yaml create mode 100644 deploy/operator/olm-catalog/pmem-csi-operator/manifests/pmem-csi.intel.com_deployments_crd.yaml diff --git a/.gitignore b/.gitignore index 404a50f9c9..8b8e44a8d3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ /.tox Manifest /_build - +/deploy/crds diff --git a/deploy/common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml b/deploy/common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml index b7e71f3c2b..5e9d2d4a61 100644 --- a/deploy/common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml +++ b/deploy/common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml @@ -3,13 +3,8 @@ kind: Deployment metadata: name: pmem-csi.intel.com spec: + deviceMode: "lvm" pmemPercentage: 50 - controllerResources: - requests: - cpu: "200m" - memory: "100Mi" - nodeResources: - requests: - cpu: "200m" - memory: "100Mi" + nodeSelector: + storage: "pmem" diff --git a/deploy/operator/olm-catalog/pmem-csi-operator/manifests/pmem-csi-operator.clusterserviceversion.yaml b/deploy/operator/olm-catalog/pmem-csi-operator/manifests/pmem-csi-operator.clusterserviceversion.yaml new file mode 100644 index 0000000000..89b23951b4 --- /dev/null +++ b/deploy/operator/olm-catalog/pmem-csi-operator/manifests/pmem-csi-operator.clusterserviceversion.yaml @@ -0,0 +1,287 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: ClusterServiceVersion +metadata: + annotations: + alm-examples: |- + [ + { + "apiVersion": "pmem-csi.intel.com/v1alpha1", + "kind": "Deployment", + "metadata": { + "name": "pmem-csi.intel.com" + }, + "spec": { + "deviceMode": "lvm", + "nodeSelector": { + "storage": "pmem" + }, + "pmemPercentage": 50 + } + } + ] + capabilities: Basic Install + categories: Storage + certified: "false" + containerImage: intel/pmem-csi-driver:v0.7.0 + createdAt: 2020-06-25 10:50Z + description: An operator for deploying and managing the PMEM-CSI driver + repository: https://github.com/intel/pmem-csi/tree/release-0.7 + support: Intel + name: pmem-csi-operator.v0.7.0 + namespace: placeholder +spec: + apiservicedefinitions: {} + customresourcedefinitions: + owned: + - description: Represents a PMEM-CSI driver deployment in the cluster. + displayName: Deployment + kind: Deployment + name: deployments.pmem-csi.intel.com + resources: + - kind: StatefulSet + name: "" + version: apps/v1 + - kind: DaemonSet + name: "" + version: apps/v1 + - kind: Secret + name: "" + version: v1 + - kind: Service + name: "" + version: v1 + specDescriptors: + - description: 'CSI Driver mode for device management: ''lvl'' or ''direct''' + displayName: Device manager to use + path: deviceMode + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:advanced + version: v1alpha1 + description: |2 + + Intel PMEM-CSI is a [CSI](https://github.com/container-storage-interface/spec) + storage driver for container orchestrators like Kubernetes. It makes local + persistent memory ([PMEM](https://pmem.io/)) available as a filesystem volume to + container applications. It can currently utilize non-volatile memory devices + that can be controlled via the [libndctl utility library](https://github.com/pmem/ndctl). + *Persistent memory* in this context refers to a non-volatile dual in-line + memory module (NVDIMM). See the [PMEM-CSI documentation](https://intel.github.io/pmem-csi/0.7/README.html) + for more details. + + This is the operator to deploy and manage the [PMEM-CSI](https://intel.github.io/pmem-csi/0.7/README.html) + driver on a Kubernetes cluster. + + ## Prerequisite + ### Software required + + The recommended minimum Linux kernel version for running the PMEM-CSI driver is 4.15. + See [Persistent Memory Programming](https://pmem.io/2018/05/15/using_persistent_memory_devices_with_the_linux_device_mapper.html) + for more details about supported kernel versions. + + ### Hardware required + + Persistent memory device(s) are required for operation. However, some development + and testing can be done using [QEMU-emulated](https://docs.pmem.io/persistent-memory/getting-started-guide/creating-development-environments/virtualization/qemu) + persistent memory devices. + + ### Cluster requirements + + The operator can be installed on any OLM-enabled Kubernetes cluster with version >= 1.15. + Make sure that the alpha feature gates _`CSINodeInfo`_ and _`CSIDriverRegistry`_ are enabled + in your cluster. The method to configure alpha feature gates may vary, depending on + the Kubernetes deployment. It may not be necessary anymore when the feature has reached + beta state, which depends on the Kubernetes version. + + You also need to have the [kubectl CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/) + already configured to access your cluster. + + ### Preparing worker nodes + + **Persistent memory pre-provisioning** + + The PMEM-CSI driver needs pre-provisioned regions on the NVDIMM device(s). + The PMEM-CSI driver itself intentionally leaves that to the administrator who + then can decide how much and how PMEM is to be used for PMEM-CSI. + When running the Kubernetes cluster and PMEM-CSI on bare metal, the [ipmctl](https://github.com/intel/ipmctl) + utility can be used to create regions. + + Example of creating regions using all NVDIMMs: + ``` + $ ipmctl create -goal PersistentMemoryType=AppDirect + ``` + **Label the cluster nodes that provide persistent memory device(s)** + ``` + $ kubectl label node storage=pmem + ``` + + ## Deploying PMEM-CSI driver + + Once after installing the PMEM-CSI operator, you can deploy the PMEM-CSI driver by + creating an instance of the PMEM-CSI deployment custom resource as shown below: + ``` + $ kubectl create -f - <