Skip to content

Commit

Permalink
operator: do not install/uninstall CRD.
Browse files Browse the repository at this point in the history
As per operator developer [best-practices](https://github.com/operator-framework/community-operators/blob/master/docs/best-practices.md)
the operator shall not self-register CRDs. So we stop doing so.

FIXES: intel#761
  • Loading branch information
avalluri committed Oct 9, 2020
1 parent 2bb701f commit 70aad37
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 302 deletions.
183 changes: 183 additions & 0 deletions deploy/crd/pmem-csi.intel.com_deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: deployments.pmem-csi.intel.com
spec:
group: pmem-csi.intel.com
names:
kind: Deployment
listKind: DeploymentList
plural: deployments
singular: deployment
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Deployment is the Schema for the deployments API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: DeploymentSpec defines the desired state of Deployment
properties:
caCert:
description: CACert encoded root certificate of the CA by which the
registry and node controller certificates are signed If not provided
operator uses a self-signed CA certificate
format: byte
type: string
controllerResources:
description: ControllerResources Compute resources required by Controller
driver
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute resources
allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute resources
required. If Requests is omitted for a container, it defaults
to Limits if that is explicitly specified, otherwise to an implementation-defined
value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
deviceMode:
description: DeviceMode to use to manage PMEM devices. One of lvm, direct
type: string
image:
description: PMEM-CSI driver container image
type: string
imagePullPolicy:
description: PullPolicy image pull policy one of Always, Never, IfNotPresent
type: string
kubeletDir:
description: KubeletDir kubelet's root directory path
type: string
labels:
additionalProperties:
type: string
description: Labels contains additional labels for all objects created
by the operator.
type: object
logLevel:
description: LogLevel number for the log verbosity kubebuilder:default=3
type: integer
nodeControllerCert:
description: NodeControllerCert encoded certificate signed by a CA for
node controller server authentication If not provided, provisioned
one by the operator using self-signed CA
format: byte
type: string
nodeControllerKey:
description: NodeControllerPrivateKey encoded private key used for node
controller server certificate If not provided, provisioned one by
the operator
format: byte
type: string
nodeRegistrarImage:
description: NodeRegistrarImage CSI node driver registrar sidecar image
type: string
nodeResources:
description: NodeResources Compute resources required by Node driver
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute resources
allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute resources
required. If Requests is omitted for a container, it defaults
to Limits if that is explicitly specified, otherwise to an implementation-defined
value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
nodeSelector:
additionalProperties:
type: string
description: NodeSelector node labels to use for selection of driver
node
type: object
pmemPercentage:
description: PMEMPercentage represents the percentage of space to be
used by the driver in each PMEM region on every node. This is only
valid for driver in LVM mode. -kubebuilder:validation:Minimum=1 -kubebuilder:validation:Maximum=100
-kubebuilder:default=100
type: integer
provisionerImage:
description: ProvisionerImage CSI provisioner sidecar image
type: string
registryCert:
description: RegistryCert encoded certificate signed by a CA for registry
server authentication If not provided, provisioned one by the operator
using self-signed CA
format: byte
type: string
registryKey:
description: RegistryPrivateKey encoded private key used for registry
server certificate If not provided, provisioned one by the operator
format: byte
type: string
type: object
status:
description: DeploymentStatus defines the observed state of Deployment
properties:
lastUpdated:
description: LastUpdated time of the deployment status
format: date-time
type: string
phase:
description: Phase indicates the state of the deployment
type: string
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
2 changes: 1 addition & 1 deletion deploy/kustomize/olm-catalog/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
bases:
- ./crd # this would be generated using: make operator-generate-crd
- ../operator

resources:
- ../../common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml
- ../../crd/pmem-csi.intel.com_deployments.yaml

images:
- name: intel/pmem-csi-driver
Expand Down
8 changes: 0 additions & 8 deletions deploy/kustomize/operator/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ rules:
- csidrivers
verbs:
- '*'
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- create
- delete
- apiGroups:
- pmem-csi.intel.com
resources:
Expand Down
6 changes: 6 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ by the operator.
operator's self-signed CA instead must provide the certificates generated
from a trusted certificate authority.

- **Install the PMEM-CSI Deployment CRD**

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

- **Install the PMEM-CSI operator**

``` console
Expand Down
8 changes: 4 additions & 4 deletions operator/operator.make
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ endif
MANIFESTS_DIR=deploy/kustomize/olm-catalog
CATALOG_DIR=deploy/olm-catalog
BUNDLE_DIR=deploy/bundle
CRD_DIR=deploy/crd

KUBECONFIG := $(shell echo $(PWD)/_work/$(CLUSTER)/kube.config)

Expand All @@ -52,9 +53,8 @@ OPERATOR_OUTPUT_DIR := $(CATALOG_DIR)/$(MAJOR_MINOR_PATCH_VERSION)

# Generate CRD and add kustomization support
operator-generate-crd: controller-gen
@echo "Generating CRD in $(MANIFESTS_DIR)/crd ..."
$(CONTROLLER_GEN) crd:trivialVersions=true,crdVersions=v1beta1 paths=./pkg/apis/... output:dir=$(MANIFESTS_DIR)/crd/
@echo "resources: [pmem-csi.intel.com_deployments.yaml]" > $(MANIFESTS_DIR)/crd/kustomization.yaml
@echo "Generating CRD in $(CRD_DIR) ..."
$(CONTROLLER_GEN) crd:trivialVersions=true,crdVersions=v1beta1 paths=./pkg/apis/... output:dir=$(CRD_DIR)/

# Generate packagemanifests using operator-sdk.
operator-generate-catalog: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) _work/kustomize operator-generate-crd
Expand All @@ -73,7 +73,7 @@ operator-generate-bundle: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) _work/k
@$(PATCH_VERSIONS) $(OPERATOR_OUTPUT_DIR)/pmem-csi-operator.clusterserviceversion.yaml

operator-clean-crd:
rm -rf $(MANIFESTS_DIR)/crd
rm -rf $(CRD_DIR)

operator-clean-catalog:
rm -rf $(CATALOG_DIR)
Loading

0 comments on commit 70aad37

Please sign in to comment.