github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/apis/apps/v1alpha1/type.go (about) 1 /* 2 Copyright (C) 2022-2023 ApeCloud Co., Ltd 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 // Package v1alpha1 contains API Schema definitions for the apps v1alpha1 API group 18 package v1alpha1 19 20 import ( 21 "errors" 22 23 appsv1 "k8s.io/api/apps/v1" 24 "sigs.k8s.io/controller-runtime/pkg/client" 25 "sigs.k8s.io/controller-runtime/pkg/manager" 26 ) 27 28 const ( 29 APIVersion = "apps.kubeblocks.io/v1alpha1" 30 ClusterVersionKind = "ClusterVersion" 31 ClusterDefinitionKind = "ClusterDefinition" 32 ClusterKind = "Cluster" 33 OpsRequestKind = "OpsRequestKind" 34 ) 35 36 type ComponentTemplateSpec struct { 37 // Specify the name of configuration template. 38 // +kubebuilder:validation:Required 39 // +kubebuilder:validation:MaxLength=63 40 // +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$` 41 Name string `json:"name"` 42 43 // Specify the name of the referenced the configuration template ConfigMap object. 44 // +kubebuilder:validation:Required 45 // +kubebuilder:validation:MaxLength=63 46 // +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$` 47 TemplateRef string `json:"templateRef"` 48 49 // Specify the namespace of the referenced the configuration template ConfigMap object. 50 // An empty namespace is equivalent to the "default" namespace. 51 // +kubebuilder:validation:MaxLength=63 52 // +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$` 53 // +kubebuilder:default="default" 54 // +optional 55 Namespace string `json:"namespace,omitempty"` 56 57 // volumeName is the volume name of PodTemplate, which the configuration file produced through the configuration 58 // template will be mounted to the corresponding volume. Must be a DNS_LABEL name. 59 // The volume name must be defined in podSpec.containers[*].volumeMounts. 60 // +kubebuilder:validation:Required 61 // +kubebuilder:validation:MaxLength=63 62 // +kubebuilder:validation:Pattern:=`^[a-z]([a-z0-9\-]*[a-z0-9])?$` 63 VolumeName string `json:"volumeName"` 64 65 // defaultMode is optional: mode bits used to set permissions on created files by default. 66 // Must be an octal value between 0000 and 0777 or a decimal value between 0 and 511. 67 // YAML accepts both octal and decimal values, JSON requires decimal values for mode bits. 68 // Defaults to 0644. 69 // Directories within the path are not affected by this setting. 70 // This might be in conflict with other options that affect the file 71 // mode, like fsGroup, and the result can be other mode bits set. 72 // +optional 73 DefaultMode *int32 `json:"defaultMode,omitempty" protobuf:"varint,3,opt,name=defaultMode"` 74 } 75 76 type ConfigTemplateExtension struct { 77 // Specify the name of the referenced the configuration template ConfigMap object. 78 // +kubebuilder:validation:Required 79 // +kubebuilder:validation:MaxLength=63 80 // +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$` 81 TemplateRef string `json:"templateRef"` 82 83 // Specify the namespace of the referenced the configuration template ConfigMap object. 84 // An empty namespace is equivalent to the "default" namespace. 85 // +kubebuilder:default="default" 86 // +kubebuilder:validation:MaxLength=63 87 // +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$` 88 // +optional 89 Namespace string `json:"namespace,omitempty"` 90 91 // policy defines how to merge external imported templates into component templates. 92 // +kubebuilder:default="none" 93 // +optional 94 Policy MergedPolicy `json:"policy,omitempty"` 95 } 96 97 type LegacyRenderedTemplateSpec struct { 98 ConfigTemplateExtension `json:",inline"` 99 } 100 101 type ComponentConfigSpec struct { 102 ComponentTemplateSpec `json:",inline"` 103 104 // Specify a list of keys. 105 // If empty, ConfigConstraint takes effect for all keys in configmap. 106 // +listType=set 107 // +optional 108 Keys []string `json:"keys,omitempty"` 109 110 // lazyRenderedConfigSpec is optional: specify the secondary rendered config spec. 111 // +optional 112 LegacyRenderedConfigSpec *LegacyRenderedTemplateSpec `json:"legacyRenderedConfigSpec,omitempty"` 113 114 // Specify the name of the referenced the configuration constraints object. 115 // +kubebuilder:validation:MaxLength=63 116 // +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$` 117 // +optional 118 ConfigConstraintRef string `json:"constraintRef,omitempty"` 119 120 // asEnvFrom is optional: the list of containers will be injected into EnvFrom. 121 // +listType=set 122 // +optional 123 AsEnvFrom []string `json:"asEnvFrom,omitempty"` 124 } 125 126 // MergedPolicy defines how to merge external imported templates into component templates. 127 // +enum 128 // +kubebuilder:validation:Enum={patch,replace,none} 129 type MergedPolicy string 130 131 const ( 132 PatchPolicy MergedPolicy = "patch" 133 ReplacePolicy MergedPolicy = "replace" 134 OnlyAddPolicy MergedPolicy = "add" 135 NoneMergePolicy MergedPolicy = "none" 136 ) 137 138 // ClusterPhase defines the Cluster CR .status.phase 139 // +enum 140 // +kubebuilder:validation:Enum={Creating,Running,Updating,Stopping,Stopped,Deleting,Failed,Abnormal} 141 type ClusterPhase string 142 143 const ( 144 CreatingClusterPhase ClusterPhase = "Creating" 145 RunningClusterPhase ClusterPhase = "Running" 146 UpdatingClusterPhase ClusterPhase = "Updating" 147 StoppingClusterPhase ClusterPhase = "Stopping" 148 StoppedClusterPhase ClusterPhase = "Stopped" 149 DeletingClusterPhase ClusterPhase = "Deleting" 150 FailedClusterPhase ClusterPhase = "Failed" 151 AbnormalClusterPhase ClusterPhase = "Abnormal" 152 ) 153 154 // ClusterComponentPhase defines the Cluster CR .status.components.phase 155 // +enum 156 // +kubebuilder:validation:Enum={Creating,Running,Updating,Stopping,Stopped,Deleting,Failed,Abnormal} 157 type ClusterComponentPhase string 158 159 const ( 160 CreatingClusterCompPhase ClusterComponentPhase = "Creating" 161 RunningClusterCompPhase ClusterComponentPhase = "Running" 162 UpdatingClusterCompPhase ClusterComponentPhase = "Updating" 163 StoppingClusterCompPhase ClusterComponentPhase = "Stopping" 164 StoppedClusterCompPhase ClusterComponentPhase = "Stopped" 165 DeletingClusterCompPhase ClusterComponentPhase = "Deleting" 166 FailedClusterCompPhase ClusterComponentPhase = "Failed" 167 AbnormalClusterCompPhase ClusterComponentPhase = "Abnormal" 168 ) 169 170 const ( 171 // define the cluster condition type 172 ConditionTypeHaltRecovery = "HaltRecovery" // ConditionTypeHaltRecovery describe Halt recovery processing stage 173 ConditionTypeProvisioningStarted = "ProvisioningStarted" // ConditionTypeProvisioningStarted the operator starts resource provisioning to create or change the cluster 174 ConditionTypeApplyResources = "ApplyResources" // ConditionTypeApplyResources the operator start to apply resources to create or change the cluster 175 ConditionTypeReplicasReady = "ReplicasReady" // ConditionTypeReplicasReady all pods of components are ready 176 ConditionTypeReady = "Ready" // ConditionTypeReady all components are running 177 ConditionTypeSwitchoverPrefix = "Switchover-" // ConditionTypeSwitchoverPrefix component status condition of switchover 178 ) 179 180 // Phase defines the ClusterDefinition and ClusterVersion CR .status.phase 181 // +enum 182 // +kubebuilder:validation:Enum={Available,Unavailable} 183 type Phase string 184 185 const ( 186 AvailablePhase Phase = "Available" 187 UnavailablePhase Phase = "Unavailable" 188 ) 189 190 // ConfigConstraintPhase defines the ConfigConstraint CR .status.phase 191 // +enum 192 // +kubebuilder:validation:Enum={Available,Unavailable, Deleting} 193 type ConfigConstraintPhase string 194 195 const ( 196 CCAvailablePhase ConfigConstraintPhase = "Available" 197 CCUnavailablePhase ConfigConstraintPhase = "Unavailable" 198 CCDeletingPhase ConfigConstraintPhase = "Deleting" 199 ) 200 201 // OpsPhase defines opsRequest phase. 202 // +enum 203 // +kubebuilder:validation:Enum={Pending,Creating,Running,Cancelling,Cancelled,Failed,Succeed} 204 type OpsPhase string 205 206 const ( 207 OpsPendingPhase OpsPhase = "Pending" 208 OpsCreatingPhase OpsPhase = "Creating" 209 OpsRunningPhase OpsPhase = "Running" 210 OpsCancellingPhase OpsPhase = "Cancelling" 211 OpsSucceedPhase OpsPhase = "Succeed" 212 OpsCancelledPhase OpsPhase = "Cancelled" 213 OpsFailedPhase OpsPhase = "Failed" 214 ) 215 216 // OpsType defines operation types. 217 // +enum 218 // +kubebuilder:validation:Enum={Upgrade,VerticalScaling,VolumeExpansion,HorizontalScaling,Restart,Reconfiguring,Start,Stop,Expose,Switchover,DataScript,Backup} 219 type OpsType string 220 221 const ( 222 VerticalScalingType OpsType = "VerticalScaling" 223 HorizontalScalingType OpsType = "HorizontalScaling" 224 VolumeExpansionType OpsType = "VolumeExpansion" 225 UpgradeType OpsType = "Upgrade" 226 ReconfiguringType OpsType = "Reconfiguring" 227 SwitchoverType OpsType = "Switchover" 228 RestartType OpsType = "Restart" // RestartType the restart operation is a special case of the rolling update operation. 229 StopType OpsType = "Stop" // StopType the stop operation will delete all pods in a cluster concurrently. 230 StartType OpsType = "Start" // StartType the start operation will start the pods which is deleted in stop operation. 231 ExposeType OpsType = "Expose" 232 DataScriptType OpsType = "DataScript" // DataScriptType the data script operation will execute the data script against the cluster. 233 BackupType OpsType = "Backup" 234 ) 235 236 // ComponentResourceKey defines the resource key of component, such as pod/pvc. 237 // +enum 238 // +kubebuilder:validation:Enum={pods} 239 type ComponentResourceKey string 240 241 const PodsCompResourceKey ComponentResourceKey = "pods" 242 243 // AccessMode defines SVC access mode enums. 244 // +enum 245 // +kubebuilder:validation:Enum={None,Readonly,ReadWrite} 246 type AccessMode string 247 248 const ( 249 ReadWrite AccessMode = "ReadWrite" 250 Readonly AccessMode = "Readonly" 251 None AccessMode = "None" 252 ) 253 254 // UpdateStrategy defines Cluster Component update strategy. 255 // +enum 256 // +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel} 257 type UpdateStrategy string 258 259 const ( 260 SerialStrategy UpdateStrategy = "Serial" 261 BestEffortParallelStrategy UpdateStrategy = "BestEffortParallel" 262 ParallelStrategy UpdateStrategy = "Parallel" 263 ) 264 265 var DefaultLeader = ConsensusMember{ 266 Name: "leader", 267 AccessMode: ReadWrite, 268 } 269 270 // WorkloadType defines ClusterDefinition's component workload type. 271 // +enum 272 // +kubebuilder:validation:Enum={Stateless,Stateful,Consensus,Replication} 273 type WorkloadType string 274 275 const ( 276 Stateless WorkloadType = "Stateless" 277 Stateful WorkloadType = "Stateful" 278 Consensus WorkloadType = "Consensus" 279 Replication WorkloadType = "Replication" 280 ) 281 282 var WorkloadTypes = []string{"Stateless", "Stateful", "Consensus", "Replication"} 283 284 // TerminationPolicyType defines termination policy types. 285 // +enum 286 // +kubebuilder:validation:Enum={DoNotTerminate,Halt,Delete,WipeOut} 287 type TerminationPolicyType string 288 289 const ( 290 DoNotTerminate TerminationPolicyType = "DoNotTerminate" 291 Halt TerminationPolicyType = "Halt" 292 Delete TerminationPolicyType = "Delete" 293 WipeOut TerminationPolicyType = "WipeOut" 294 ) 295 296 // HScaleDataClonePolicyType defines data clone policy when horizontal scaling. 297 // +enum 298 // +kubebuilder:validation:Enum={None,CloneVolume,Snapshot} 299 type HScaleDataClonePolicyType string 300 301 const ( 302 HScaleDataClonePolicyNone HScaleDataClonePolicyType = "None" 303 HScaleDataClonePolicyCloneVolume HScaleDataClonePolicyType = "CloneVolume" 304 HScaleDataClonePolicyFromSnapshot HScaleDataClonePolicyType = "Snapshot" 305 ) 306 307 // PodAntiAffinity defines pod anti-affinity strategy. 308 // +enum 309 // +kubebuilder:validation:Enum={Preferred,Required} 310 type PodAntiAffinity string 311 312 const ( 313 Preferred PodAntiAffinity = "Preferred" 314 Required PodAntiAffinity = "Required" 315 ) 316 317 // TenancyType for cluster tenant resources. 318 // +enum 319 // +kubebuilder:validation:Enum={SharedNode,DedicatedNode} 320 type TenancyType string 321 322 const ( 323 SharedNode TenancyType = "SharedNode" 324 DedicatedNode TenancyType = "DedicatedNode" 325 ) 326 327 // AvailabilityPolicyType for cluster affinity policy. 328 // +enum 329 // +kubebuilder:validation:Enum={zone,node,none} 330 type AvailabilityPolicyType string 331 332 const ( 333 AvailabilityPolicyZone AvailabilityPolicyType = "zone" 334 AvailabilityPolicyNode AvailabilityPolicyType = "node" 335 AvailabilityPolicyNone AvailabilityPolicyType = "none" 336 ) 337 338 // ProgressStatus defines the status of the opsRequest progress. 339 // +enum 340 // +kubebuilder:validation:Enum={Processing,Pending,Failed,Succeed} 341 type ProgressStatus string 342 343 const ( 344 PendingProgressStatus ProgressStatus = "Pending" 345 ProcessingProgressStatus ProgressStatus = "Processing" 346 FailedProgressStatus ProgressStatus = "Failed" 347 SucceedProgressStatus ProgressStatus = "Succeed" 348 ) 349 350 type OpsRequestBehaviour struct { 351 FromClusterPhases []ClusterPhase 352 ToClusterPhase ClusterPhase 353 ProcessingReasonInClusterCondition string 354 } 355 356 type OpsRecorder struct { 357 // name OpsRequest name 358 Name string `json:"name"` 359 // clusterPhase the cluster phase when the OpsRequest is running 360 Type OpsType `json:"type"` 361 } 362 363 // ProvisionPolicyType defines the policy for creating accounts. 364 // +enum 365 type ProvisionPolicyType string 366 367 const ( 368 // CreateByStmt will create account w.r.t. deletion and creation statement given by provider. 369 CreateByStmt ProvisionPolicyType = "CreateByStmt" 370 // ReferToExisting will not create account, but create a secret by copying data from referred secret file. 371 ReferToExisting ProvisionPolicyType = "ReferToExisting" 372 ) 373 374 // ProvisionScope defines the scope (within component) of provision. 375 // +enum 376 type ProvisionScope string 377 378 const ( 379 // AllPods will create accounts for all pods belong to the component. 380 AllPods ProvisionScope = "AllPods" 381 // AndyPods will only create accounts on one pod. 382 AnyPods ProvisionScope = "AnyPods" 383 ) 384 385 // KBAccountType is used for bitwise operation. 386 type KBAccountType uint8 387 388 // System accounts represented in bit. 389 const ( 390 KBAccountInvalid KBAccountType = 0 391 KBAccountAdmin = 1 392 KBAccountDataprotection = 1 << 1 393 KBAccountProbe = 1 << 2 394 KBAccountMonitor = 1 << 3 395 KBAccountReplicator = 1 << 4 396 KBAccountMAX = KBAccountReplicator // KBAccountMAX indicates the max value of KBAccountType, used for validation. 397 ) 398 399 // AccountName defines system account names. 400 // +enum 401 // +kubebuilder:validation:Enum={kbadmin,kbdataprotection,kbprobe,kbmonitoring,kbreplicator} 402 type AccountName string 403 404 const ( 405 AdminAccount AccountName = "kbadmin" 406 DataprotectionAccount AccountName = "kbdataprotection" 407 ProbeAccount AccountName = "kbprobe" 408 MonitorAccount AccountName = "kbmonitoring" 409 ReplicatorAccount AccountName = "kbreplicator" 410 ) 411 412 func (r AccountName) GetAccountID() KBAccountType { 413 switch r { 414 case AdminAccount: 415 return KBAccountAdmin 416 case DataprotectionAccount: 417 return KBAccountDataprotection 418 case ProbeAccount: 419 return KBAccountProbe 420 case MonitorAccount: 421 return KBAccountMonitor 422 case ReplicatorAccount: 423 return KBAccountReplicator 424 } 425 return KBAccountInvalid 426 } 427 428 // LetterCase defines cases to use in password generation. 429 // +enum 430 type LetterCase string 431 432 const ( 433 LowerCases LetterCase = "LowerCases" 434 UpperCases LetterCase = "UpperCases" 435 MixedCases LetterCase = "MixedCases" 436 ) 437 438 var webhookMgr *webhookManager 439 440 type webhookManager struct { 441 client client.Client 442 } 443 444 // CfgFileFormat defines formatter of configuration files. 445 // +enum 446 // +kubebuilder:validation:Enum={xml,ini,yaml,json,hcl,dotenv,toml,properties,redis,props-plus} 447 type CfgFileFormat string 448 449 const ( 450 Ini CfgFileFormat = "ini" 451 YAML CfgFileFormat = "yaml" 452 JSON CfgFileFormat = "json" 453 XML CfgFileFormat = "xml" 454 HCL CfgFileFormat = "hcl" 455 Dotenv CfgFileFormat = "dotenv" 456 TOML CfgFileFormat = "toml" 457 Properties CfgFileFormat = "properties" 458 RedisCfg CfgFileFormat = "redis" 459 PropertiesPlus CfgFileFormat = "props-plus" 460 ) 461 462 // UpgradePolicy defines the policy of reconfiguring. 463 // +enum 464 // +kubebuilder:validation:Enum={simple,parallel,rolling,autoReload,operatorSyncUpdate} 465 type UpgradePolicy string 466 467 const ( 468 NonePolicy UpgradePolicy = "none" 469 NormalPolicy UpgradePolicy = "simple" 470 RestartPolicy UpgradePolicy = "parallel" 471 RollingPolicy UpgradePolicy = "rolling" 472 AutoReload UpgradePolicy = "autoReload" 473 OperatorSyncUpdate UpgradePolicy = "operatorSyncUpdate" 474 ) 475 476 // CfgReloadType defines reload method. 477 // +enum 478 type CfgReloadType string 479 480 const ( 481 UnixSignalType CfgReloadType = "signal" 482 SQLType CfgReloadType = "sql" 483 ShellType CfgReloadType = "exec" 484 HTTPType CfgReloadType = "http" 485 TPLScriptType CfgReloadType = "tpl" 486 ) 487 488 // SignalType defines which signals are valid. 489 // +enum 490 // +kubebuilder:validation:Enum={SIGHUP,SIGINT,SIGQUIT,SIGILL,SIGTRAP,SIGABRT,SIGBUS,SIGFPE,SIGKILL,SIGUSR1,SIGSEGV,SIGUSR2,SIGPIPE,SIGALRM,SIGTERM,SIGSTKFLT,SIGCHLD,SIGCONT,SIGSTOP,SIGTSTP,SIGTTIN,SIGTTOU,SIGURG,SIGXCPU,SIGXFSZ,SIGVTALRM,SIGPROF,SIGWINCH,SIGIO,SIGPWR,SIGSYS} 491 type SignalType string 492 493 const ( 494 SIGHUP SignalType = "SIGHUP" 495 SIGINT SignalType = "SIGINT" 496 SIGQUIT SignalType = "SIGQUIT" 497 SIGILL SignalType = "SIGILL" 498 SIGTRAP SignalType = "SIGTRAP" 499 SIGABRT SignalType = "SIGABRT" 500 SIGBUS SignalType = "SIGBUS" 501 SIGFPE SignalType = "SIGFPE" 502 SIGKILL SignalType = "SIGKILL" 503 SIGUSR1 SignalType = "SIGUSR1" 504 SIGSEGV SignalType = "SIGSEGV" 505 SIGUSR2 SignalType = "SIGUSR2" 506 SIGPIPE SignalType = "SIGPIPE" 507 SIGALRM SignalType = "SIGALRM" 508 SIGTERM SignalType = "SIGTERM" 509 SIGSTKFLT SignalType = "SIGSTKFLT" 510 SIGCHLD SignalType = "SIGCHLD" 511 SIGCONT SignalType = "SIGCONT" 512 SIGSTOP SignalType = "SIGSTOP" 513 SIGTSTP SignalType = "SIGTSTP" 514 SIGTTIN SignalType = "SIGTTIN" 515 SIGTTOU SignalType = "SIGTTOU" 516 SIGURG SignalType = "SIGURG" 517 SIGXCPU SignalType = "SIGXCPU" 518 SIGXFSZ SignalType = "SIGXFSZ" 519 SIGVTALRM SignalType = "SIGVTALRM" 520 SIGPROF SignalType = "SIGPROF" 521 SIGWINCH SignalType = "SIGWINCH" 522 SIGIO SignalType = "SIGIO" 523 SIGPWR SignalType = "SIGPWR" 524 SIGSYS SignalType = "SIGSYS" 525 ) 526 527 // IssuerName defines Tls certs issuer name 528 // +enum 529 type IssuerName string 530 531 const ( 532 // IssuerKubeBlocks Certificates signed by KubeBlocks Operator. 533 IssuerKubeBlocks IssuerName = "KubeBlocks" 534 // IssuerUserProvided User provided own CA-signed certificates. 535 IssuerUserProvided IssuerName = "UserProvided" 536 ) 537 538 // SwitchPolicyType defines switchPolicy type. 539 // Currently, only Noop is supported. MaximumAvailability and MaximumDataProtection will be supported in the future. 540 // +enum 541 // +kubebuilder:validation:Enum={Noop} 542 type SwitchPolicyType string 543 544 const ( 545 MaximumAvailability SwitchPolicyType = "MaximumAvailability" 546 MaximumDataProtection SwitchPolicyType = "MaximumDataProtection" 547 Noop SwitchPolicyType = "Noop" 548 ) 549 550 // SwitchStepRole defines the role to execute the switch command. 551 // +enum 552 // +kubebuilder:validation:Enum={NewPrimary, OldPrimary, Secondaries} 553 type SwitchStepRole string 554 555 const ( 556 NewPrimary SwitchStepRole = "NewPrimary" 557 OldPrimary SwitchStepRole = "OldPrimary" 558 Secondaries SwitchStepRole = "Secondaries" 559 ) 560 561 // VolumeType defines volume type for backup data or log. 562 // +enum 563 // +kubebuilder:validation:Enum={data,log} 564 type VolumeType string 565 566 const ( 567 VolumeTypeData VolumeType = "data" 568 VolumeTypeLog VolumeType = "log" 569 ) 570 571 // BaseBackupType the base backup type, keep synchronized with the BaseBackupType of the data protection API. 572 // +enum 573 // +kubebuilder:validation:Enum={full,snapshot} 574 type BaseBackupType string 575 576 // BackupStatusUpdateStage defines the stage of backup status update. 577 // +enum 578 // +kubebuilder:validation:Enum={pre,post} 579 type BackupStatusUpdateStage string 580 581 func RegisterWebhookManager(mgr manager.Manager) { 582 webhookMgr = &webhookManager{mgr.GetClient()} 583 } 584 585 type ComponentNameSet map[string]struct{} 586 587 var ( 588 ErrWorkloadTypeIsUnknown = errors.New("workloadType is unknown") 589 ErrWorkloadTypeIsStateless = errors.New("workloadType should not be stateless") 590 ErrNotMatchingCompDef = errors.New("not matching componentDefRef") 591 ) 592 593 // StatefulSetWorkload interface 594 // +kubebuilder:object:generate=false 595 type StatefulSetWorkload interface { 596 FinalStsUpdateStrategy() (appsv1.PodManagementPolicyType, appsv1.StatefulSetUpdateStrategy) 597 GetUpdateStrategy() UpdateStrategy 598 }