From 670945cc0ffa5a8fe0a81f9c6a6ef823017596c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 30 Mar 2021 10:16:29 +0200 Subject: [PATCH] ceph: add a few missing crd fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the recent auto crds generation, I missed a few fields, re-adding now: * additionalPrinterColumns * min and max Signed-off-by: Sébastien Han --- .../charts/rook-ceph/templates/resources.yaml | 97 ++++++++++++++-- cluster/examples/kubernetes/ceph/crds.yaml | 104 +++++++++++++++--- pkg/apis/ceph.rook.io/v1/types.go | 27 ++++- 3 files changed, 203 insertions(+), 25 deletions(-) diff --git a/cluster/charts/rook-ceph/templates/resources.yaml b/cluster/charts/rook-ceph/templates/resources.yaml index ff5058fcc..148d45ee0 100644 --- a/cluster/charts/rook-ceph/templates/resources.yaml +++ b/cluster/charts/rook-ceph/templates/resources.yaml @@ -64,9 +64,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -82,7 +86,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools @@ -408,7 +412,34 @@ spec: singular: cephcluster scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Directory used on the K8s nodes + jsonPath: .spec.dataDirHostPath + name: DataDirHostPath + type: string + - description: Number of MONs + jsonPath: .spec.mon.count + name: MonCount + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Phase + jsonPath: .status.phase + name: Phase + type: string + - description: Message + jsonPath: .status.message + name: Message + type: string + - description: Ceph Health + jsonPath: .status.ceph.health + name: Health + type: string + - jsonPath: .spec.external.enable + name: External + type: boolean + name: v1 schema: openAPIV3Schema: description: CephCluster is a Ceph storage cluster @@ -457,6 +488,7 @@ spec: confirmation: description: Confirmation represents the cleanup confirmation nullable: true + pattern: ^$|^yes-really-destroy-data$ type: string sanitizeDisks: description: SanitizeDisks represents way we sanitize disks @@ -474,6 +506,9 @@ spec: type: integer method: description: Method is the method we use to sanitize disks + enum: + - complete + - quick type: string type: object type: object @@ -500,6 +535,8 @@ spec: type: boolean port: description: Port is the dashboard webserver port + maximum: 65535 + minimum: 0 type: integer ssl: description: SSL determines whether SSL should be used @@ -510,6 +547,7 @@ spec: type: object dataDirHostPath: description: The path on the host where config and data can be persisted + pattern: ^/(\S+) type: string disruptionManagement: description: A spec for configuring disruption management. @@ -710,6 +748,8 @@ spec: type: boolean count: description: Count is the number of manager to run + maximum: 2 + minimum: 0 type: integer modules: description: Modules is the list of ceph manager modules to enable/disable @@ -1117,6 +1157,8 @@ spec: type: array externalMgrPrometheusPort: description: ExternalMgrPrometheusPort Prometheus exporter port + maximum: 65535 + minimum: 0 type: integer rulesNamespace: description: RulesNamespace is the namespace where the prometheus rules and alerts should be created. If empty, the same namespace as the cluster will be used. @@ -4103,6 +4145,7 @@ spec: type: object served: true storage: true + subresources: {} status: acceptedNames: kind: "" @@ -4634,7 +4677,15 @@ spec: singular: cephfilesystem scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Number of desired active MDS daemons + jsonPath: .spec.metadataServer.activeCount + name: ActiveMDS + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: CephFilesystem represents a Ceph Filesystem @@ -4686,9 +4737,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -4704,7 +4759,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools @@ -4819,9 +4874,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -4837,7 +4896,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools @@ -4923,6 +4982,7 @@ spec: activeCount: description: The number of metadata servers that are active. The remaining servers in the cluster will be in standby mode. format: int32 + maximum: 10 minimum: 1 type: integer activeStandby: @@ -5421,6 +5481,7 @@ spec: type: object served: true storage: true + subresources: {} status: acceptedNames: kind: "" @@ -6101,9 +6162,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -6119,7 +6184,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools @@ -6717,6 +6782,8 @@ spec: securePort: description: The port the rgw service will be listening on (https) format: int32 + maximum: 65535 + minimum: 0 type: integer sslCertificateRef: description: The name of the secret that stores the ssl certificate for secure rgw connections @@ -6865,9 +6932,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -6883,7 +6954,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools @@ -7212,9 +7283,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -7230,7 +7305,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools @@ -7344,9 +7419,13 @@ spec: type: string codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -7362,7 +7441,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for mirrored images/pools diff --git a/cluster/examples/kubernetes/ceph/crds.yaml b/cluster/examples/kubernetes/ceph/crds.yaml index 68cc796e7..a6c23241d 100644 --- a/cluster/examples/kubernetes/ceph/crds.yaml +++ b/cluster/examples/kubernetes/ceph/crds.yaml @@ -75,10 +75,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -95,7 +99,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot for @@ -451,7 +455,34 @@ spec: singular: cephcluster scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Directory used on the K8s nodes + jsonPath: .spec.dataDirHostPath + name: DataDirHostPath + type: string + - description: Number of MONs + jsonPath: .spec.mon.count + name: MonCount + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: Phase + jsonPath: .status.phase + name: Phase + type: string + - description: Message + jsonPath: .status.message + name: Message + type: string + - description: Ceph Health + jsonPath: .status.ceph.health + name: Health + type: string + - jsonPath: .spec.external.enable + name: External + type: boolean + name: v1 schema: openAPIV3Schema: description: CephCluster is a Ceph storage cluster @@ -510,6 +541,7 @@ spec: confirmation: description: Confirmation represents the cleanup confirmation nullable: true + pattern: ^$|^yes-really-destroy-data$ type: string sanitizeDisks: description: SanitizeDisks represents way we sanitize disks @@ -529,6 +561,9 @@ spec: type: integer method: description: Method is the method we use to sanitize disks + enum: + - complete + - quick type: string type: object type: object @@ -558,6 +593,8 @@ spec: type: boolean port: description: Port is the dashboard webserver port + maximum: 65535 + minimum: 0 type: integer ssl: description: SSL determines whether SSL should be used @@ -569,6 +606,7 @@ spec: type: object dataDirHostPath: description: The path on the host where config and data can be persisted + pattern: ^/(\S+) type: string disruptionManagement: description: A spec for configuring disruption management. @@ -821,6 +859,8 @@ spec: type: boolean count: description: Count is the number of manager to run + maximum: 2 + minimum: 0 type: integer modules: description: Modules is the list of ceph manager modules to enable/disable @@ -1401,6 +1441,8 @@ spec: type: array externalMgrPrometheusPort: description: ExternalMgrPrometheusPort Prometheus exporter port + maximum: 65535 + minimum: 0 type: integer rulesNamespace: description: RulesNamespace is the namespace where the prometheus @@ -6624,6 +6666,7 @@ spec: type: object served: true storage: true + subresources: {} status: acceptedNames: kind: "" @@ -7489,7 +7532,15 @@ spec: singular: cephfilesystem scope: Namespaced versions: - - name: v1 + - additionalPrinterColumns: + - description: Number of desired active MDS daemons + jsonPath: .spec.metadataServer.activeCount + name: ActiveMDS + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 schema: openAPIV3Schema: description: CephFilesystem represents a Ceph Filesystem @@ -7550,10 +7601,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -7570,8 +7625,8 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" - or "image"' + description: 'Mode is the mirroring mode: either pool or + image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot @@ -7704,10 +7759,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -7724,8 +7783,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or - "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot @@ -7824,6 +7882,7 @@ spec: description: The number of metadata servers that are active. The remaining servers in the cluster will be in standby mode. format: int32 + maximum: 10 minimum: 1 type: integer activeStandby: @@ -8686,6 +8745,7 @@ spec: type: object served: true storage: true + subresources: {} status: acceptedNames: kind: "" @@ -9744,10 +9804,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -9764,8 +9828,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or - "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot @@ -10756,6 +10819,8 @@ spec: securePort: description: The port the rgw service will be listening on (https) format: int32 + maximum: 65535 + minimum: 0 type: integer sslCertificateRef: description: The name of the secret that stores the ssl certificate @@ -10944,10 +11009,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -10964,8 +11033,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or - "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot @@ -11325,10 +11393,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -11345,8 +11417,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or - "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot @@ -11476,10 +11547,14 @@ spec: codingChunks: description: Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer dataChunks: description: Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + maximum: 9 + minimum: 0 type: integer required: - codingChunks @@ -11496,8 +11571,7 @@ spec: description: Enabled whether this pool is mirrored or not type: boolean mode: - description: 'Mode is the mirroring mode: either "pool" or - "image"' + description: 'Mode is the mirroring mode: either pool or image' type: string snapshotSchedules: description: SnapshotSchedules is the scheduling of snapshot diff --git a/pkg/apis/ceph.rook.io/v1/types.go b/pkg/apis/ceph.rook.io/v1/types.go index 55831c251..d5ac23eff 100755 --- a/pkg/apis/ceph.rook.io/v1/types.go +++ b/pkg/apis/ceph.rook.io/v1/types.go @@ -35,6 +35,13 @@ import ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // CephCluster is a Ceph storage cluster +// +kubebuilder:printcolumn:name="DataDirHostPath",type=string,JSONPath=`.spec.dataDirHostPath`,description="Directory used on the K8s nodes" +// +kubebuilder:printcolumn:name="MonCount",type=string,JSONPath=`.spec.mon.count`,description="Number of MONs" +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` +// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`,description="Phase" +// +kubebuilder:printcolumn:name="Message",type=string,JSONPath=`.status.message`,description="Message" +// +kubebuilder:printcolumn:name="Health",type=string,JSONPath=`.status.ceph.health`,description="Ceph Health" +// +kubebuilder:printcolumn:name="External",type=boolean,JSONPath=`.spec.external.enable` type CephCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata"` @@ -129,6 +136,7 @@ type ClusterSpec struct { PriorityClassNames rookv1.PriorityClassNamesSpec `json:"priorityClassNames,omitempty"` // The path on the host where config and data can be persisted + // +kubebuilder:validation:Pattern=`^/(\S+)` // +optional DataDirHostPath string `json:"dataDirHostPath,omitempty"` @@ -259,6 +267,8 @@ type DashboardSpec struct { // +optional URLPrefix string `json:"urlPrefix,omitempty"` // Port is the dashboard webserver port + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 // +optional Port int `json:"port,omitempty"` // SSL determines whether SSL should be used @@ -284,6 +294,8 @@ type MonitoringSpec struct { ExternalMgrEndpoints []v1.EndpointAddress `json:"externalMgrEndpoints,omitempty"` // ExternalMgrPrometheusPort Prometheus exporter port + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 // +optional ExternalMgrPrometheusPort uint16 `json:"externalMgrPrometheusPort,omitempty"` } @@ -449,6 +461,8 @@ type StretchClusterZoneSpec struct { // MgrSpec represents options to configure a ceph mgr type MgrSpec struct { // Count is the number of manager to run + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=2 // +optional Count int `json:"count,omitempty"` // AllowMultiplePerNode allows to run multiple managers on the same node (not recommended) @@ -780,7 +794,7 @@ type MirroringSpec struct { // +optional Enabled bool `json:"enabled,omitempty"` - // Mode is the mirroring mode: either "pool" or "image" + // Mode is the mirroring mode: either pool or image // +optional Mode string `json:"mode,omitempty"` @@ -820,9 +834,13 @@ type QuotaSpec struct { // ErasureCodedSpec represents the spec for erasure code in a pool type ErasureCodedSpec struct { // Number of coding chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=9 CodingChunks uint `json:"codingChunks"` // Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type) + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=9 DataChunks uint `json:"dataChunks"` // The algorithm for erasure coding @@ -835,6 +853,8 @@ type ErasureCodedSpec struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // CephFilesystem represents a Ceph Filesystem +// +kubebuilder:printcolumn:name="ActiveMDS",type=string,JSONPath=`.spec.metadataServer.activeCount`,description="Number of desired active MDS daemons" +// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` type CephFilesystem struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata"` @@ -881,6 +901,7 @@ type FilesystemSpec struct { type MetadataServerSpec struct { // The number of metadata servers that are active. The remaining servers in the cluster will be in standby mode. // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Maximum=10 ActiveCount int32 `json:"activeCount"` // Whether each active MDS instance will have an active standby with a warm metadata cache for faster failover. @@ -1001,6 +1022,8 @@ type GatewaySpec struct { Port int32 `json:"port,omitempty"` // The port the rgw service will be listening on (https) + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=65535 // +optional SecurePort int32 `json:"securePort,omitempty"` @@ -1390,6 +1413,7 @@ type CleanupPolicySpec struct { } // CleanupConfirmationProperty represents the cleanup confirmation +// +kubebuilder:validation:Pattern=`^$|^yes-really-destroy-data$` type CleanupConfirmationProperty string // SanitizeDataSourceProperty represents a sanitizing data source @@ -1402,6 +1426,7 @@ type SanitizeMethodProperty string type SanitizeDisksSpec struct { // Method is the method we use to sanitize disks // +optional + // +kubebuilder:validation:Enum=complete;quick Method SanitizeMethodProperty `json:"method,omitempty"` // DataSource is the data source to use to sanitize the disk with // +optional