/
types.go
executable file
·2292 lines (2007 loc) · 79.7 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright 2020 The Rook Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
"time"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ***************************************************************************
// IMPORTANT FOR CODE GENERATION
// If the types in this file are updated, you will need to run
// `make codegen` to generate the new types under the client/clientset folder.
// ***************************************************************************
// +genclient
// +genclient:noStatus
// +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`
// +kubebuilder:subresource:status
type CephCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec ClusterSpec `json:"spec"`
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
// +nullable
Status ClusterStatus `json:"status,omitempty"`
}
// CephClusterHealthCheckSpec represent the healthcheck for Ceph daemons
type CephClusterHealthCheckSpec struct {
// DaemonHealth is the health check for a given daemon
// +optional
// +nullable
DaemonHealth DaemonHealthSpec `json:"daemonHealth,omitempty"`
// LivenessProbe allows to change the livenessprobe configuration for a given daemon
// +optional
LivenessProbe map[KeyType]*ProbeSpec `json:"livenessProbe,omitempty"`
}
// DaemonHealthSpec is a daemon health check
type DaemonHealthSpec struct {
// Status represents the health check settings for the Ceph health
// +optional
// +nullable
Status HealthCheckSpec `json:"status,omitempty"`
// Monitor represents the health check settings for the Ceph monitor
// +optional
// +nullable
Monitor HealthCheckSpec `json:"mon,omitempty"`
// ObjectStorageDaemon represents the health check settings for the Ceph OSDs
// +optional
// +nullable
ObjectStorageDaemon HealthCheckSpec `json:"osd,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CephClusterList is a list of CephCluster
type CephClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []CephCluster `json:"items"`
}
// ClusterSpec represents the specification of Ceph Cluster
type ClusterSpec struct {
// The version information that instructs Rook to orchestrate a particular version of Ceph.
// +optional
// +nullable
CephVersion CephVersionSpec `json:"cephVersion,omitempty"`
// A spec for available storage in the cluster and how it should be used
// +optional
// +nullable
Storage StorageScopeSpec `json:"storage,omitempty"`
// The annotations-related configuration to add/set on each Pod related object.
// +nullable
// +optional
Annotations AnnotationsSpec `json:"annotations,omitempty"`
// The labels-related configuration to add/set on each Pod related object.
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
// +optional
Labels LabelsSpec `json:"labels,omitempty"`
// The placement-related configuration to pass to kubernetes (affinity, node selector, tolerations).
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
// +optional
Placement PlacementSpec `json:"placement,omitempty"`
// Network related configuration
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
// +optional
Network NetworkSpec `json:"network,omitempty"`
// Resources set resource requests and limits
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
// +optional
Resources ResourceSpec `json:"resources,omitempty"`
// PriorityClassNames sets priority classes on components
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
// +optional
PriorityClassNames 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"`
// SkipUpgradeChecks defines if an upgrade should be forced even if one of the check fails
// +optional
SkipUpgradeChecks bool `json:"skipUpgradeChecks,omitempty"`
// ContinueUpgradeAfterChecksEvenIfNotHealthy defines if an upgrade should continue even if PGs are not clean
// +optional
ContinueUpgradeAfterChecksEvenIfNotHealthy bool `json:"continueUpgradeAfterChecksEvenIfNotHealthy,omitempty"`
// WaitTimeoutForHealthyOSDInMinutes defines the time the operator would wait before an OSD can be stopped for upgrade or restart.
// If the timeout exceeds and OSD is not ok to stop, then the operator would skip upgrade for the current OSD and proceed with the next one
// if `continueUpgradeAfterChecksEvenIfNotHealthy` is `false`. If `continueUpgradeAfterChecksEvenIfNotHealthy` is `true`, then operator would
// continue with the upgrade of an OSD even if its not ok to stop after the timeout. This timeout won't be applied if `skipUpgradeChecks` is `true`.
// The default wait timeout is 10 minutes.
// +optional
WaitTimeoutForHealthyOSDInMinutes time.Duration `json:"waitTimeoutForHealthyOSDInMinutes,omitempty"`
// A spec for configuring disruption management.
// +nullable
// +optional
DisruptionManagement DisruptionManagementSpec `json:"disruptionManagement,omitempty"`
// A spec for mon related options
// +optional
// +nullable
Mon MonSpec `json:"mon,omitempty"`
// A spec for the crash controller
// +optional
// +nullable
CrashCollector CrashCollectorSpec `json:"crashCollector,omitempty"`
// Dashboard settings
// +optional
// +nullable
Dashboard DashboardSpec `json:"dashboard,omitempty"`
// Prometheus based Monitoring settings
// +optional
// +nullable
Monitoring MonitoringSpec `json:"monitoring,omitempty"`
// Whether the Ceph Cluster is running external to this Kubernetes cluster
// mon, mgr, osd, mds, and discover daemons will not be created for external clusters.
// +optional
// +nullable
External ExternalSpec `json:"external,omitempty"`
// A spec for mgr related options
// +optional
// +nullable
Mgr MgrSpec `json:"mgr,omitempty"`
// Remove the OSD that is out and safe to remove only if this option is true
// +optional
RemoveOSDsIfOutAndSafeToRemove bool `json:"removeOSDsIfOutAndSafeToRemove,omitempty"`
// Indicates user intent when deleting a cluster; blocks orchestration and should not be set if cluster
// deletion is not imminent.
// +optional
// +nullable
CleanupPolicy CleanupPolicySpec `json:"cleanupPolicy,omitempty"`
// Internal daemon healthchecks and liveness probe
// +optional
// +nullable
HealthCheck CephClusterHealthCheckSpec `json:"healthCheck,omitempty"`
// Security represents security settings
// +optional
// +nullable
Security SecuritySpec `json:"security,omitempty"`
// Logging represents loggings settings
// +optional
// +nullable
LogCollector LogCollectorSpec `json:"logCollector,omitempty"`
}
// LogCollectorSpec is the logging spec
type LogCollectorSpec struct {
// Enabled represents whether the log collector is enabled
// +optional
Enabled bool `json:"enabled,omitempty"`
// Periodicity is the periodicity of the log rotation
// +optional
Periodicity string `json:"periodicity,omitempty"`
}
// SecuritySpec is security spec to include various security items such as kms
type SecuritySpec struct {
// KeyManagementService is the main Key Management option
// +optional
// +nullable
KeyManagementService KeyManagementServiceSpec `json:"kms,omitempty"`
}
// KeyManagementServiceSpec represent various details of the KMS server
type KeyManagementServiceSpec struct {
// ConnectionDetails contains the KMS connection details (address, port etc)
// +optional
// +nullable
// +kubebuilder:pruning:PreserveUnknownFields
ConnectionDetails map[string]string `json:"connectionDetails,omitempty"`
// TokenSecretName is the kubernetes secret containing the KMS token
// +optional
TokenSecretName string `json:"tokenSecretName,omitempty"`
}
// CephVersionSpec represents the settings for the Ceph version that Rook is orchestrating.
type CephVersionSpec struct {
// Image is the container image used to launch the ceph daemons, such as quay.io/ceph/ceph:<tag>
// The full list of images can be found at https://quay.io/repository/ceph/ceph?tab=tags
// +optional
Image string `json:"image,omitempty"`
// Whether to allow unsupported versions (do not set to true in production)
// +optional
AllowUnsupported bool `json:"allowUnsupported,omitempty"`
}
// DashboardSpec represents the settings for the Ceph dashboard
type DashboardSpec struct {
// Enabled determines whether to enable the dashboard
// +optional
Enabled bool `json:"enabled,omitempty"`
// URLPrefix is a prefix for all URLs to use the dashboard with a reverse proxy
// +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
// +optional
SSL bool `json:"ssl,omitempty"`
}
// MonitoringSpec represents the settings for Prometheus based Ceph monitoring
type MonitoringSpec struct {
// Enabled determines whether to create the prometheus rules for the ceph cluster. If true, the prometheus
// types must exist or the creation will fail.
// +optional
Enabled bool `json:"enabled,omitempty"`
// RulesNamespace is the namespace where the prometheus rules and alerts should be created.
// If empty, the same namespace as the cluster will be used.
// +optional
RulesNamespace string `json:"rulesNamespace,omitempty"`
// ExternalMgrEndpoints points to an existing Ceph prometheus exporter endpoint
// +optional
// +nullable
ExternalMgrEndpoints []v1.EndpointAddress `json:"externalMgrEndpoints,omitempty"`
// ExternalMgrPrometheusPort Prometheus exporter port
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=65535
// +optional
ExternalMgrPrometheusPort uint16 `json:"externalMgrPrometheusPort,omitempty"`
}
// ClusterStatus represents the status of a Ceph cluster
type ClusterStatus struct {
State ClusterState `json:"state,omitempty"`
Phase ConditionType `json:"phase,omitempty"`
Message string `json:"message,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
CephStatus *CephStatus `json:"ceph,omitempty"`
CephStorage *CephStorage `json:"storage,omitempty"`
CephVersion *ClusterVersion `json:"version,omitempty"`
}
// CephDaemonsVersions show the current ceph version for different ceph daemons
type CephDaemonsVersions struct {
// Mon shows Mon Ceph version
// +optional
Mon map[string]int `json:"mon,omitempty"`
// Mgr shows Mgr Ceph version
// +optional
Mgr map[string]int `json:"mgr,omitempty"`
// Osd shows Osd Ceph version
// +optional
Osd map[string]int `json:"osd,omitempty"`
// Rgw shows Rgw Ceph version
// +optional
Rgw map[string]int `json:"rgw,omitempty"`
// Mds shows Mds Ceph version
// +optional
Mds map[string]int `json:"mds,omitempty"`
// RbdMirror shows RbdMirror Ceph version
// +optional
RbdMirror map[string]int `json:"rbd-mirror,omitempty"`
// CephFSMirror shows CephFSMirror Ceph version
// +optional
CephFSMirror map[string]int `json:"cephfs-mirror,omitempty"`
// Overall shows overall Ceph version
// +optional
Overall map[string]int `json:"overall,omitempty"`
}
// CephStatus is the details health of a Ceph Cluster
type CephStatus struct {
Health string `json:"health,omitempty"`
Details map[string]CephHealthMessage `json:"details,omitempty"`
LastChecked string `json:"lastChecked,omitempty"`
LastChanged string `json:"lastChanged,omitempty"`
PreviousHealth string `json:"previousHealth,omitempty"`
Capacity Capacity `json:"capacity,omitempty"`
// +optional
Versions *CephDaemonsVersions `json:"versions,omitempty"`
}
// Capacity is the capacity information of a Ceph Cluster
type Capacity struct {
TotalBytes uint64 `json:"bytesTotal,omitempty"`
UsedBytes uint64 `json:"bytesUsed,omitempty"`
AvailableBytes uint64 `json:"bytesAvailable,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty"`
}
// CephStorage represents flavors of Ceph Cluster Storage
type CephStorage struct {
DeviceClasses []DeviceClasses `json:"deviceClasses,omitempty"`
}
// DeviceClasses represents device classes of a Ceph Cluster
type DeviceClasses struct {
Name string `json:"name,omitempty"`
}
// ClusterVersion represents the version of a Ceph Cluster
type ClusterVersion struct {
Image string `json:"image,omitempty"`
Version string `json:"version,omitempty"`
}
// CephHealthMessage represents the health message of a Ceph Cluster
type CephHealthMessage struct {
Severity string `json:"severity"`
Message string `json:"message"`
}
// Condition represents a status condition on any Rook-Ceph Custom Resource.
type Condition struct {
Type ConditionType `json:"type,omitempty"`
Status v1.ConditionStatus `json:"status,omitempty"`
Reason ConditionReason `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}
// ConditionReason is a reason for a condition
type ConditionReason string
const (
// ClusterCreatedReason is cluster created reason
ClusterCreatedReason ConditionReason = "ClusterCreated"
// ClusterConnectedReason is cluster connected reason
ClusterConnectedReason ConditionReason = "ClusterConnected"
// ClusterProgressingReason is cluster progressing reason
ClusterProgressingReason ConditionReason = "ClusterProgressing"
// ClusterDeletingReason is cluster deleting reason
ClusterDeletingReason ConditionReason = "ClusterDeleting"
// ClusterConnectingReason is cluster connecting reason
ClusterConnectingReason ConditionReason = "ClusterConnecting"
// ReconcileSucceeded represents when a resource reconciliation was successful.
ReconcileSucceeded ConditionReason = "ReconcileSucceeded"
// ReconcileFailed represents when a resource reconciliation failed.
ReconcileFailed ConditionReason = "ReconcileFailed"
// DeletingReason represents when Rook has detected a resource object should be deleted.
DeletingReason ConditionReason = "Deleting"
// ObjectHasDependentsReason represents when a resource object has dependents that are blocking
// deletion.
ObjectHasDependentsReason ConditionReason = "ObjectHasDependents"
// ObjectHasNoDependentsReason represents when a resource object has no dependents that are
// blocking deletion.
ObjectHasNoDependentsReason ConditionReason = "ObjectHasNoDependents"
)
// ConditionType represent a resource's status
type ConditionType string
const (
// ConditionConnecting represents Connecting state of an object
ConditionConnecting ConditionType = "Connecting"
// ConditionConnected represents Connected state of an object
ConditionConnected ConditionType = "Connected"
// ConditionProgressing represents Progressing state of an object
ConditionProgressing ConditionType = "Progressing"
// ConditionReady represents Ready state of an object
ConditionReady ConditionType = "Ready"
// ConditionFailure represents Failure state of an object
ConditionFailure ConditionType = "Failure"
// ConditionDeleting represents Deleting state of an object
ConditionDeleting ConditionType = "Deleting"
// ConditionDeletionIsBlocked represents when deletion of the object is blocked.
ConditionDeletionIsBlocked ConditionType = "DeletionIsBlocked"
)
// ClusterState represents the state of a Ceph Cluster
type ClusterState string
const (
// ClusterStateCreating represents the Creating state of a Ceph Cluster
ClusterStateCreating ClusterState = "Creating"
// ClusterStateCreated represents the Created state of a Ceph Cluster
ClusterStateCreated ClusterState = "Created"
// ClusterStateUpdating represents the Updating state of a Ceph Cluster
ClusterStateUpdating ClusterState = "Updating"
// ClusterStateConnecting represents the Connecting state of a Ceph Cluster
ClusterStateConnecting ClusterState = "Connecting"
// ClusterStateConnected represents the Connected state of a Ceph Cluster
ClusterStateConnected ClusterState = "Connected"
// ClusterStateError represents the Error state of a Ceph Cluster
ClusterStateError ClusterState = "Error"
)
// MonSpec represents the specification of the monitor
type MonSpec struct {
// Count is the number of Ceph monitors
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=9
// +optional
Count int `json:"count,omitempty"`
// AllowMultiplePerNode determines if we can run multiple monitors on the same node (not recommended)
// +optional
AllowMultiplePerNode bool `json:"allowMultiplePerNode,omitempty"`
// StretchCluster is the stretch cluster specification
// +optional
StretchCluster *StretchClusterSpec `json:"stretchCluster,omitempty"`
// VolumeClaimTemplate is the PVC definition
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
VolumeClaimTemplate *v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
}
// StretchClusterSpec represents the specification of a stretched Ceph Cluster
type StretchClusterSpec struct {
// FailureDomainLabel the failure domain name (e,g: zone)
// +optional
FailureDomainLabel string `json:"failureDomainLabel,omitempty"`
// SubFailureDomain is the failure domain within a zone
// +optional
SubFailureDomain string `json:"subFailureDomain,omitempty"`
// Zones is the list of zones
// +optional
// +nullable
Zones []StretchClusterZoneSpec `json:"zones,omitempty"`
}
// StretchClusterZoneSpec represents the specification of a stretched zone in a Ceph Cluster
type StretchClusterZoneSpec struct {
// Name is the name of the zone
// +optional
Name string `json:"name,omitempty"`
// Arbiter determines if the zone contains the arbiter
// +optional
Arbiter bool `json:"arbiter,omitempty"`
// VolumeClaimTemplate is the PVC template
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
VolumeClaimTemplate *v1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`
}
// 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)
// +optional
AllowMultiplePerNode bool `json:"allowMultiplePerNode,omitempty"`
// Modules is the list of ceph manager modules to enable/disable
// +optional
// +nullable
Modules []Module `json:"modules,omitempty"`
}
// Module represents mgr modules that the user wants to enable or disable
type Module struct {
// Name is the name of the ceph manager module
// +optional
Name string `json:"name,omitempty"`
// Enabled determines whether a module should be enabled or not
// +optional
Enabled bool `json:"enabled,omitempty"`
}
// ExternalSpec represents the options supported by an external cluster
// +kubebuilder:pruning:PreserveUnknownFields
// +nullable
type ExternalSpec struct {
// Enable determines whether external mode is enabled or not
// +optional
Enable bool `json:"enable,omitempty"`
}
// CrashCollectorSpec represents options to configure the crash controller
type CrashCollectorSpec struct {
// Disable determines whether we should enable the crash collector
// +optional
Disable bool `json:"disable,omitempty"`
// DaysToRetain represents the number of days to retain crash until they get pruned
// +optional
DaysToRetain uint `json:"daysToRetain,omitempty"`
}
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CephBlockPool represents a Ceph Storage Pool
// +kubebuilder:subresource:status
type CephBlockPool struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec PoolSpec `json:"spec"`
// +kubebuilder:pruning:PreserveUnknownFields
Status *CephBlockPoolStatus `json:"status,omitempty"`
}
// CephBlockPoolList is a list of Ceph Storage Pools
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type CephBlockPoolList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []CephBlockPool `json:"items"`
}
const (
// DefaultFailureDomain for PoolSpec
DefaultFailureDomain = "host"
// DefaultCRUSHRoot is the default name of the CRUSH root bucket
DefaultCRUSHRoot = "default"
)
// PoolSpec represents the spec of ceph pool
type PoolSpec struct {
// The failure domain: osd/host/(region or zone if available) - technically also any type in the crush map
// +optional
FailureDomain string `json:"failureDomain,omitempty"`
// The root of the crush hierarchy utilized by the pool
// +optional
// +nullable
CrushRoot string `json:"crushRoot,omitempty"`
// The device class the OSD should set to for use in the pool
// +optional
// +nullable
DeviceClass string `json:"deviceClass,omitempty"`
// DEPRECATED: use Parameters instead, e.g., Parameters["compression_mode"] = "force"
// The inline compression mode in Bluestore OSD to set to (options are: none, passive, aggressive, force)
// +kubebuilder:validation:Enum=none;passive;aggressive;force;""
// Do NOT set a default value for kubebuilder as this will override the Parameters
// +optional
// +nullable
CompressionMode string `json:"compressionMode,omitempty"`
// The replication settings
// +optional
Replicated ReplicatedSpec `json:"replicated,omitempty"`
// The erasure code settings
// +optional
ErasureCoded ErasureCodedSpec `json:"erasureCoded,omitempty"`
// Parameters is a list of properties to enable on a given pool
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
// +nullable
Parameters map[string]string `json:"parameters,omitempty"`
// EnableRBDStats is used to enable gathering of statistics for all RBD images in the pool
EnableRBDStats bool `json:"enableRBDStats,omitempty"`
// The mirroring settings
Mirroring MirroringSpec `json:"mirroring,omitempty"`
// The mirroring statusCheck
// +kubebuilder:pruning:PreserveUnknownFields
StatusCheck MirrorHealthCheckSpec `json:"statusCheck,omitempty"`
// The quota settings
// +optional
// +nullable
Quotas QuotaSpec `json:"quotas,omitempty"`
}
// NamedPoolSpec represents the named ceph pool spec
type NamedPoolSpec struct {
// Name of pool
Name string `json:"name,omitempty"`
// PoolSpec represents the spec of ceph pool
PoolSpec `json:",inline"`
}
// MirrorHealthCheckSpec represents the health specification of a Ceph Storage Pool mirror
type MirrorHealthCheckSpec struct {
// +optional
// +nullable
Mirror HealthCheckSpec `json:"mirror,omitempty"`
}
// CephBlockPoolStatus represents the mirroring status of Ceph Storage Pool
type CephBlockPoolStatus struct {
// +optional
Phase ConditionType `json:"phase,omitempty"`
// +optional
MirroringStatus *MirroringStatusSpec `json:"mirroringStatus,omitempty"`
// +optional
MirroringInfo *MirroringInfoSpec `json:"mirroringInfo,omitempty"`
// +optional
SnapshotScheduleStatus *SnapshotScheduleStatusSpec `json:"snapshotScheduleStatus,omitempty"`
// +optional
// +nullable
Info map[string]string `json:"info,omitempty"`
}
// MirroringStatusSpec is the status of the pool mirroring
type MirroringStatusSpec struct {
// PoolMirroringStatus is the mirroring status of a pool
// +optional
PoolMirroringStatus `json:",inline"`
// LastChecked is the last time time the status was checked
// +optional
LastChecked string `json:"lastChecked,omitempty"`
// LastChanged is the last time time the status last changed
// +optional
LastChanged string `json:"lastChanged,omitempty"`
// Details contains potential status errors
// +optional
Details string `json:"details,omitempty"`
}
// PoolMirroringStatus is the pool mirror status
type PoolMirroringStatus struct {
// Summary is the mirroring status summary
// +optional
Summary *PoolMirroringStatusSummarySpec `json:"summary,omitempty"`
}
// PoolMirroringStatusSummarySpec is the summary output of the command
type PoolMirroringStatusSummarySpec struct {
// Health is the mirroring health
// +optional
Health string `json:"health,omitempty"`
// DaemonHealth is the health of the mirroring daemon
// +optional
DaemonHealth string `json:"daemon_health,omitempty"`
// ImageHealth is the health of the mirrored image
// +optional
ImageHealth string `json:"image_health,omitempty"`
// States is the various state for all mirrored images
// +optional
// +nullable
States StatesSpec `json:"states,omitempty"`
}
// StatesSpec are rbd images mirroring state
type StatesSpec struct {
// StartingReplay is when the replay of the mirroring journal starts
// +optional
StartingReplay int `json:"starting_replay,omitempty"`
// Replaying is when the replay of the mirroring journal is on-going
// +optional
Replaying int `json:"replaying,omitempty"`
// Syncing is when the image is syncing
// +optional
Syncing int `json:"syncing,omitempty"`
// StopReplaying is when the replay of the mirroring journal stops
// +optional
StopReplaying int `json:"stopping_replay,omitempty"`
// Stopped is when the mirroring state is stopped
// +optional
Stopped int `json:"stopped,omitempty"`
// Unknown is when the mirroring state is unknown
// +optional
Unknown int `json:"unknown,omitempty"`
// Error is when the mirroring state is errored
// +optional
Error int `json:"error,omitempty"`
}
// MirroringInfoSpec is the status of the pool mirroring
type MirroringInfoSpec struct {
// +optional
*PoolMirroringInfo `json:",inline"`
// +optional
LastChecked string `json:"lastChecked,omitempty"`
// +optional
LastChanged string `json:"lastChanged,omitempty"`
// +optional
Details string `json:"details,omitempty"`
}
// PoolMirroringInfo is the mirroring info of a given pool
type PoolMirroringInfo struct {
// Mode is the mirroring mode
// +optional
Mode string `json:"mode,omitempty"`
// SiteName is the current site name
// +optional
SiteName string `json:"site_name,omitempty"`
// Peers are the list of peer sites connected to that cluster
// +optional
Peers []PeersSpec `json:"peers,omitempty"`
}
// PeersSpec contains peer details
type PeersSpec struct {
// UUID is the peer UUID
// +optional
UUID string `json:"uuid,omitempty"`
// Direction is the peer mirroring direction
// +optional
Direction string `json:"direction,omitempty"`
// SiteName is the current site name
// +optional
SiteName string `json:"site_name,omitempty"`
// MirrorUUID is the mirror UUID
// +optional
MirrorUUID string `json:"mirror_uuid,omitempty"`
// ClientName is the CephX user used to connect to the peer
// +optional
ClientName string `json:"client_name,omitempty"`
}
// SnapshotScheduleStatusSpec is the status of the snapshot schedule
type SnapshotScheduleStatusSpec struct {
// SnapshotSchedules is the list of snapshots scheduled
// +nullable
// +optional
SnapshotSchedules []SnapshotSchedulesSpec `json:"snapshotSchedules,omitempty"`
// LastChecked is the last time time the status was checked
// +optional
LastChecked string `json:"lastChecked,omitempty"`
// LastChanged is the last time time the status last changed
// +optional
LastChanged string `json:"lastChanged,omitempty"`
// Details contains potential status errors
// +optional
Details string `json:"details,omitempty"`
}
// SnapshotSchedulesSpec is the list of snapshot scheduled for images in a pool
type SnapshotSchedulesSpec struct {
// Pool is the pool name
// +optional
Pool string `json:"pool,omitempty"`
// Namespace is the RADOS namespace the image is part of
// +optional
Namespace string `json:"namespace,omitempty"`
// Image is the mirrored image
// +optional
Image string `json:"image,omitempty"`
// Items is the list schedules times for a given snapshot
// +optional
Items []SnapshotSchedule `json:"items,omitempty"`
}
// SnapshotSchedule is a schedule
type SnapshotSchedule struct {
// Interval is the interval in which snapshots will be taken
// +optional
Interval string `json:"interval,omitempty"`
// StartTime is the snapshot starting time
// +optional
StartTime string `json:"start_time,omitempty"`
}
// Status represents the status of an object
type Status struct {
// +optional
Phase string `json:"phase,omitempty"`
}
// ReplicatedSpec represents the spec for replication in a pool
type ReplicatedSpec struct {
// Size - Number of copies per object in a replicated storage pool, including the object itself (required for replicated pool type)
// +kubebuilder:validation:Minimum=0
Size uint `json:"size"`
// TargetSizeRatio gives a hint (%) to Ceph in terms of expected consumption of the total cluster capacity
// +optional
TargetSizeRatio float64 `json:"targetSizeRatio,omitempty"`
// RequireSafeReplicaSize if false allows you to set replica 1
// +optional
RequireSafeReplicaSize bool `json:"requireSafeReplicaSize,omitempty"`
// ReplicasPerFailureDomain the number of replica in the specified failure domain
// +kubebuilder:validation:Minimum=1
// +optional
ReplicasPerFailureDomain uint `json:"replicasPerFailureDomain,omitempty"`
// SubFailureDomain the name of the sub-failure domain
// +optional
SubFailureDomain string `json:"subFailureDomain,omitempty"`
// HybridStorage represents hybrid storage tier settings
// +optional
// +nullable
HybridStorage *HybridStorageSpec `json:"hybridStorage,omitempty"`
}
// HybridStorageSpec represents the settings for hybrid storage pool
type HybridStorageSpec struct {
// PrimaryDeviceClass represents high performance tier (for example SSD or NVME) for Primary OSD
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Required
// +required
PrimaryDeviceClass string `json:"primaryDeviceClass"`
// SecondaryDeviceClass represents low performance tier (for example HDDs) for remaining OSDs
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Required
// +required
SecondaryDeviceClass string `json:"secondaryDeviceClass"`
}
// MirroringSpec represents the setting for a mirrored pool
type MirroringSpec struct {
// Enabled whether this pool is mirrored or not
// +optional
Enabled bool `json:"enabled,omitempty"`
// Mode is the mirroring mode: either pool or image
// +optional
Mode string `json:"mode,omitempty"`
// SnapshotSchedules is the scheduling of snapshot for mirrored images/pools
// +optional
SnapshotSchedules []SnapshotScheduleSpec `json:"snapshotSchedules,omitempty"`
// Peers represents the peers spec
// +nullable
// +optional
Peers *MirroringPeerSpec `json:"peers,omitempty"`
}
// SnapshotScheduleSpec represents the snapshot scheduling settings of a mirrored pool
type SnapshotScheduleSpec struct {
// Path is the path to snapshot, only valid for CephFS
// +optional
Path string `json:"path,omitempty"`
// Interval represent the periodicity of the snapshot.
// +optional
Interval string `json:"interval,omitempty"`
// StartTime indicates when to start the snapshot
// +optional
StartTime string `json:"startTime,omitempty"`
}
// QuotaSpec represents the spec for quotas in a pool
type QuotaSpec struct {
// MaxBytes represents the quota in bytes
// Deprecated in favor of MaxSize
// +optional
MaxBytes *uint64 `json:"maxBytes,omitempty"`
// MaxSize represents the quota in bytes as a string
// +kubebuilder:validation:Pattern=`^[0-9]+[\.]?[0-9]*([KMGTPE]i|[kMGTPE])?$`
// +optional
MaxSize *string `json:"maxSize,omitempty"`
// MaxObjects represents the quota in objects
// +optional
MaxObjects *uint64 `json:"maxObjects,omitempty"`
}
// 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).
// This is the number of OSDs that can be lost simultaneously before data cannot be recovered.
// +kubebuilder:validation:Minimum=0
CodingChunks uint `json:"codingChunks"`
// Number of data chunks per object in an erasure coded storage pool (required for erasure-coded pool type).
// The number of chunks required to recover an object when any single OSD is lost is the same
// as dataChunks so be aware that the larger the number of data chunks, the higher the cost of recovery.
// +kubebuilder:validation:Minimum=0
DataChunks uint `json:"dataChunks"`
// The algorithm for erasure coding
// +optional
Algorithm string `json:"algorithm,omitempty"`
}
// +genclient
// +genclient:noStatus
// +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`
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:subresource:status
type CephFilesystem struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec FilesystemSpec `json:"spec"`
// +kubebuilder:pruning:PreserveUnknownFields
Status *CephFilesystemStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CephFilesystemList represents a list of Ceph Filesystems
type CephFilesystemList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []CephFilesystem `json:"items"`
}
// FilesystemSpec represents the spec of a file system
type FilesystemSpec struct {
// The metadata pool settings
// +nullable
MetadataPool PoolSpec `json:"metadataPool"`
// The data pool settings, with optional predefined pool name.
// +optional
DataPools []NamedPoolSpec `json:"dataPools"`
// Preserve pools on filesystem deletion
// +optional
PreservePoolsOnDelete bool `json:"preservePoolsOnDelete,omitempty"`
// Preserve the fs in the cluster on CephFilesystem CR deletion. Setting this to true automatically implies PreservePoolsOnDelete is true.
// +optional
PreserveFilesystemOnDelete bool `json:"preserveFilesystemOnDelete,omitempty"`
// The mds pod info
MetadataServer MetadataServerSpec `json:"metadataServer"`
// The mirroring settings
// +nullable
// +optional
Mirroring *FSMirroringSpec `json:"mirroring,omitempty"`
// The mirroring statusCheck
// +kubebuilder:pruning:PreserveUnknownFields
StatusCheck MirrorHealthCheckSpec `json:"statusCheck,omitempty"`
}
// MetadataServerSpec represents the specification of a Ceph Metadata Server