Skip to content

Commit

Permalink
operator: Rename deployment CRD name to pmemcsideployment
Browse files Browse the repository at this point in the history
Renaming the operator `Deployment` API to `PmemCSIDeployment'. Prefixed
only the `Deployment` type with 'PmemCSI' not its sub-types, because
this is what used by the 'kubebuilder' to determine the generated CRD
Kind is.

FIXES intel#814
  • Loading branch information
avalluri committed Jan 8, 2021
1 parent 7a5c5ea commit 84030da
Show file tree
Hide file tree
Showing 24 changed files with 253 additions and 237 deletions.
18 changes: 9 additions & 9 deletions deploy/bindata_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: pmem-csi.intel.com/v1beta1
kind: Deployment
kind: PmemCSIDeployment
metadata:
name: pmem-csi.intel.com
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: deployments.pmem-csi.intel.com
name: pmemcsideployments.pmem-csi.intel.com
spec:
group: pmem-csi.intel.com
names:
kind: Deployment
listKind: DeploymentList
plural: deployments
singular: deployment
kind: PmemCSIDeployment
listKind: PmemCSIDeploymentList
plural: pmemcsideployments
shortNames:
- pcd
singular: pmemcsideployment
scope: Cluster
versions:
- additionalPrinterColumns:
Expand All @@ -36,7 +38,7 @@ spec:
name: v1beta1
schema:
openAPIV3Schema:
description: Deployment is the Schema for the deployments API
description: PmemCSIDeployment is the Schema for the deployments API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down
4 changes: 2 additions & 2 deletions deploy/kustomize/olm-catalog/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ bases:
- ../operator

resources:
- ../../common/pmem-csi.intel.com_v1beta1_deployment_cr.yaml
- ../../crd/pmem-csi.intel.com_deployments.yaml
- ../../common/pmem-csi.intel.com_v1beta1_pmemcsideployment_cr.yaml
- ../../crd/pmem-csi.intel.com_pmemcsideployments.yaml

images:
- name: intel/pmem-csi-driver
Expand Down
6 changes: 3 additions & 3 deletions deploy/kustomize/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ rules:
- apiGroups:
- pmem-csi.intel.com
resources:
- deployments
- deployments/status
- deployments/finalizers
- pmemcsideployments
- pmemcsideployments/status
- pmemcsideployments/finalizers
verbs:
- '*'
---
Expand Down
6 changes: 3 additions & 3 deletions deploy/operator/pmem-csi-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ rules:
- apiGroups:
- pmem-csi.intel.com
resources:
- deployments
- deployments/status
- deployments/finalizers
- pmemcsideployments
- pmemcsideployments/status
- pmemcsideployments/finalizers
verbs:
- '*'
---
Expand Down
6 changes: 3 additions & 3 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ on a Kubernetes cluster. This operator is based on the CoreOS [operator-sdk](htt
tools and APIs.

The driver deployment is controlled by a cluster-scoped [custom resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/)
named [`Deployment`](./install.md#pmem-csi-deployment-crd) in the
named [`PmemCSIDeployment`](./install.md#pmem-csi-deployment-crd) in the
`pmem-csi.intel.com/v1beta1` API group. The operator runs inside the cluster
and listens for deployment changes. It makes sure that the required Kubernetes
objects are created for a driver deployment.
Refer to [Deployment CRD](./install.md#deployment) for details.
objects are created for a driver deployment. Refer to the PmemCSIDeployment
CRD for details.
51 changes: 28 additions & 23 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ particular log output in "text" format.
##### Installing the operator from YAML

Alternatively, the you can install the operator manually from YAML files.
First install the PMEM-CSI Deployment CRD:
First install the PmemCSIDeployment CRD:

``` console
$ kubectl create -f https://github.com/intel/pmem-csi/raw/devel/deploy/crd/pmem-csi.intel.com_deployments.yaml
$ kubectl create -f https://github.com/intel/pmem-csi/raw/devel/deploy/crd/pmem-csi.intel.com_pmemcsideployments.yaml
```

Then install the PMEM-CSI operator itself:
Expand All @@ -271,17 +271,17 @@ The operator gets deployed in a namespace called 'pmem-csi' which gets created b

##### Create a driver deployment

Once the operator is installed and running,
it is ready to handle PMEM-CSI `Deployment` objects in the `pmem-csi.intel.com`
API group. Refer to the [Deployment CRD API](#PMEM-CSI-Deployment-CRD) for
a complete list of supported properties.
Once the operator is installed and running, it is ready to handle
`PmemCSIDeployment` objects in the `pmem-csi.intel.com` API group.
Refer to the [PmemCSIDeployment CRD API](#PMEM-CSI-Deployment-CRD)
for a complete list of supported properties.

Here is a minimal example driver deployment created with a custom resource:

``` ShellSession
$ kubectl create -f - <<EOF
apiVersion: pmem-csi.intel.com/v1beta1
kind: Deployment
kind: PmemCSIDeployment
metadata:
name: pmem-csi.intel.com
spec:
Expand All @@ -298,17 +298,17 @@ installation and setup section](#installation-and-setup).
Once the above deployment installation is successful, we can see all the driver
pods in `Running` state:
``` console
$ kubectl get deployments.pmem-csi.intel.com
$ kubectl get pmemcsideployments
NAME DEVICEMODE NODESELECTOR IMAGE STATUS AGE
pmem-deployment lvm Running 50s

$ kubectl describe deployment.pmem-csi.intel.com/pmem-csi.intel.com
$ kubectl describe pmemcsideployment/pmem-csi.intel.com
Name: pmem-csi.intel.com
Namespace:
Labels: <none>
Annotations: <none>
API Version: pmem-csi.intel.com/v1beta1
Kind: Deployment
Kind: PmemCSIDeployment
Metadata:
Creation Timestamp: 2020-10-07T07:31:58Z
Generation: 1
Expand Down Expand Up @@ -338,7 +338,7 @@ Metadata:
Operation: Update
Time: 2020-10-07T07:32:22Z
Resource Version: 1235740
Self Link: /apis/pmem-csi.intel.com/v1beta1/deployments/pmem-csi.intel.com
Self Link: /apis/pmem-csi.intel.com/v1beta1/pmemcsideployments/pmem-csi.intel.com
UID: d8635490-53fa-4eec-970d-cd4c76f53b23
Spec:
Device Mode: lvm
Expand Down Expand Up @@ -385,9 +385,9 @@ By default, the operator creates the needed private keys and certificates requir
for running the driver as described in the [driver security](./design.md#security)
section. Those certificates are generated by the operator using a self-signed CA.
This can be overridden with custom keys and certificates by using appropriate fields
in the [deployment specification](#deploymentspec).These encoded certificates and
private keys are made available to driver pods via Kubernetes [secrets](https://kubernetes.io/docs/concepts/configuration/secret/)
by the operator.
in the [PmemCSIDeployment specification](#deploymentspec). These encoded certificates
and private keys are made available to driver pods via Kubernetes
[secrets](https://kubernetes.io/docs/concepts/configuration/secret/) by the operator.

**NOTE:** A production deployment that is not supposed to depend on the
operator's self-signed CA instead must provide the certificates generated
Expand Down Expand Up @@ -1203,7 +1203,7 @@ pmem_csi_node_operations_seconds_count{method_name="/csi.v1.Controller/CreateVol

## PMEM-CSI Deployment CRD

`Deployment` is a cluster-scoped Kubernetes resource in the
`PmemCSIDeployment` is a cluster-scoped Kubernetes resource in the
`pmem-csi.intel.com` API group. It describes how a PMEM-CSI driver
instance is to be created.

Expand All @@ -1224,14 +1224,19 @@ The name is also used as prefix for the names of all objects created
for the deployment and for the local `/var/lib/<name>` state directory
on each node.

The current API for PMEM-CSI `Deployment` resources is:
**NOTE**: Starting from release v0.9.0 reconciling of the `Deployment`
CRD in `pmem-csi.intel.com/v1alpha1` API group is not supported by the
PMEM-CSI operator anymore. Such resources in the cluster must be migrated
manually to new the `PmemCSIDeployment` API.

### Deployment
The current API for `PmemCSIDeployment` resources is:

### PmemCSIDeployment

|Field | Type | Description |
|---|---|---|
| apiVersion | string | `pmem-csi.intel.com/v1beta1` or `pmem-csi.intel.com/v1alpha1` |
| kind | string | `Deployment`|
| apiVersion | string | `pmem-csi.intel.com/v1beta1` |
| kind | string | `PmemCSIDeployment`|
| metadata | [ObjectMeta](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata) | Object metadata, name used for CSI driver and as prefix for sub-objects |
| spec | [DeploymentSpec](#deployment-spec) | Specification of the desired behavior of the deployment |

Expand Down Expand Up @@ -1298,16 +1303,16 @@ active volumes.
A PMEM-CSI Deployment's `status` field is a `DeploymentStatus` object, which
carries the detailed state of the driver deployment. It is comprised of [deployment
conditions](#deployment-conditions), [driver component status](#driver-component-status),
and a `phase` field. The phase of a Deployment is a high-level summary
of where the Deployment is in its lifecycle.
and a `phase` field. The phase of a PMEM-CSI deployment is a high-level summary
of where the the PmemCSIDployment is in its lifecycle.

The possible `phase` values and their meaning are as below:

| Value | Meaning |
|---|---|
| empty string | A new deployment. |
| Running | The operator has determined that the driver is usable<sup>1</sup>. |
| Failed | For some reason the state of the `Deployment` failed and cannot be progressed. The failure reason is placed in the `DeploymentStatus.Reason` field. |
| Failed | For some reason, the `PmemCSIDeployment` failed and cannot be progressed. The failure reason is placed in the `DeploymentStatus.Reason` field. |

<sup>1</sup> This check has not been implemented yet. Instead, the deployment goes straight to `Running` after creating sub-resources.

Expand Down Expand Up @@ -1339,7 +1344,7 @@ Below are the fields and their meanings of `DriverStatus`:

#### Deployment Events

The PMEM-CSI operator posts events on the progress of a `Deployment`. If the
The PMEM-CSI operator posts events on the progress of a `PmemCSIDeployment`. If the
deployment is in the `Failed` state, then one can look into the event(s) using
`kubectl describe` on that deployment for the detailed failure reason.

Expand Down
Loading

0 comments on commit 84030da

Please sign in to comment.