Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
operator: changes to generate olm-catalog for OperatorHub
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
avalluri committed Jul 22, 2020
1 parent 1cbf6e9 commit ab9652c
Show file tree
Hide file tree
Showing 7 changed files with 479 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
/.tox
Manifest
/_build

/deploy/crds
11 changes: 3 additions & 8 deletions deploy/common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
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
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
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. Default 100
This is only valid for driver in LVM mode
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
18 changes: 17 additions & 1 deletion operator/operator.make
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OPERATOR_SDK_VERSION=v0.16.0
OPERATOR_SDK_VERSION=v0.18.2

# download operator-sdk binary
_work/bin/operator-sdk-$(OPERATOR_SDK_VERSION):
Expand All @@ -12,3 +12,19 @@ _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION):
# GOROOT is needed because of https://github.com/operator-framework/operator-sdk/issues/1854#issuecomment-525132306
operator-generate-k8s: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION)
GOROOT=$(shell $(GO) env GOROOT) _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) generate k8s

operator-generate-crds: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION)
GOROOT=$(shell $(GO) env GOROOT) $< generate crds --crd-version v1beta1

operator-clean-crds:
rm -rf ./deploy/crds

RELEASE_VERSION=0.7.0
operator-generate-csv: _work/bin/operator-sdk-$(OPERATOR_SDK_VERSION) operator-generate-crds
cd deploy/operator && cp ../common/pmem-csi.intel.com*_cr.yaml ./
GOROOT=$(shell $(GO) env GOROOT) WATCH_NAMESAPCE=default $< generate csv --make-manifests=true \
--operator-name pmem-csi-operator --interactive=false --update-crds=true\
--apis-dir=$(pwd)/pkg/apis --crd-dir=./deploy/crds --deploy-dir=./deploy/operator \
--csv-version ${RELEASE_VERSION}
rm deploy/operator/pmem-csi.intel.com*_cr.yaml
$(MAKE) operator-clean-crds
5 changes: 2 additions & 3 deletions pkg/apis/pmemcsi/v1alpha1/deployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ const (

// DeploymentSpec defines the desired state of Deployment
type DeploymentSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make operator-generate-k8s" to regenerate code after modifying this file

// Image holds container image options
// PMEM-CSI driver container image
Image string `json:"image,omitempty"`
// PullPolicy image pull policy one of Always, Never, IfNotPresent
PullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Expand Down Expand Up @@ -108,7 +107,7 @@ type DeploymentStatus struct {

// Deployment is the Schema for the deployments API
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=deployments,scope=Namespaced
// +kubebuilder:resource:path=deployments,scope=Cluster
type Deployment struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pmemcsi/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit ab9652c

Please sign in to comment.