/
type.go
274 lines (250 loc) · 12.5 KB
/
type.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
/*
Copyright AppsCode Inc. and Contributors
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 v1alpha1
import (
kmapi "kmodules.xyz/client-go/api/v1"
)
// List of possible condition types for a ops request
const (
AccessApproved = "Approved"
AccessDenied = "Denied"
DisableSharding = "DisableSharding"
EnableSharding = "EnableSharding"
Failed = "Failed"
HorizontalScalingDatabase = "HorizontalScaling"
MigratingData = "MigratingData"
NodeCreated = "NodeCreated"
NodeDeleted = "NodeDeleted"
NodeRestarted = "NodeRestarted"
PauseDatabase = "PauseDatabase"
Progressing = "Progressing"
ResumeDatabase = "ResumeDatabase"
ScalingDatabase = "Scaling"
ScalingDown = "ScalingDown"
ScalingUp = "ScalingUp"
Successful = "Successful"
Updating = "Updating"
Upgrading = "Upgrading"
UpgradeVersion = "UpgradeVersion"
VerticalScalingDatabase = "VerticalScaling"
VotingExclusionAdded = "VotingExclusionAdded"
VotingExclusionDeleted = "VotingExclusionDeleted"
UpdateStatefulSets = "UpdateStatefulSets"
VolumeExpansion = "VolumeExpansion"
Reconfigure = "Reconfigure"
UpgradeNodes = "UpgradeNodes"
RestartNodes = "RestartNodes"
TLSRemoved = "TLSRemoved"
TLSAdded = "TLSAdded"
TLSChanged = "TLSChanged"
IssuingConditionUpdated = "IssuingConditionUpdated"
CertificateIssuingSuccessful = "CertificateIssuingSuccessful"
TLSEnabling = "TLSEnabling"
Restart = "Restart"
RestartStatefulSet = "RestartStatefulSet"
CertificateSynced = "CertificateSynced"
Reconciled = "Reconciled"
RestartStatefulSetPods = "RestartStatefulSetPods"
// MongoDB Constants
StartingBalancer = "StartingBalancer"
StoppingBalancer = "StoppingBalancer"
UpdateShardImage = "UpdateShardImage"
UpdateStatefulSetResources = "UpdateStatefulSetResources"
UpdateShardResources = "UpdateShardResources"
ScaleDownShard = "ScaleDownShard"
ScaleUpShard = "ScaleUpShard"
UpdateReplicaSetImage = "UpdateReplicaSetImage"
UpdateConfigServerImage = "UpdateConfigServerImage"
UpdateMongosImage = "UpdateMongosImage"
UpdateReplicaSetResources = "UpdateReplicaSetResources"
UpdateConfigServerResources = "UpdateConfigServerResources"
UpdateMongosResources = "UpdateMongosResources"
FlushRouterConfig = "FlushRouterConfig"
ScaleDownReplicaSet = "ScaleDownReplicaSet"
ScaleUpReplicaSet = "ScaleUpReplicaSet"
ScaleUpShardReplicas = "ScaleUpShardReplicas"
ScaleDownShardReplicas = "ScaleDownShardReplicas"
ScaleDownConfigServer = "ScaleDownConfigServer "
ScaleUpConfigServer = "ScaleUpConfigServer "
ScaleMongos = "ScaleMongos"
ReconfigureReplicaset = "ReconfigureReplicaset"
ReconfigureStandalone = "ReconfigureStandalone"
ReconfigureMongos = "ReconfigureMongos"
ReconfigureShard = "ReconfigureShard"
ReconfigureConfigServer = "ReconfigureConfigServer"
ReconfigureArbiter = "ReconfigureArbiter"
UpdateStandaloneImage = "UpdateStandaloneImage"
UpdateStandaloneResources = "UpdateStandaloneResources"
ScaleDownStandalone = "ScaleDownStandalone"
ScaleUpStandalone = "ScaleUpStandalone"
StandaloneVolumeExpansion = "StandaloneVolumeExpansion"
ReplicasetVolumeExpansion = "ReplicasetVolumeExpansion"
ShardVolumeExpansion = "ShardVolumeExpansion"
ConfigServerVolumeExpansion = "ConfigServerVolumeExpansion"
RestartStandalone = "RestartStandalone"
RestartReplicaSet = "RestartReplicaSet"
RestartMongos = "RestartMongos"
RestartConfigServer = "RestartConfigServer"
RestartShard = "RestartShard"
RestartArbiter = "RestartArbiter"
DeleteStatefulSets = "DeleteStatefulSets"
DatabaseReady = "DatabaseReady"
// Elasticsearch Constant
OrphanStatefulSetPods = "OrphanStatefulSetPods"
ReadyStatefulSets = "ReadyStatefulSets"
ScaleMasterNode = "ScaleMasterNode"
ScaleDataNode = "ScaleDataNode"
ScaleDataHotNode = "ScaleDataHotNode"
ScaleDataWarmNode = "ScaleDataWarmNode"
ScaleDataColdNode = "ScaleDataColdNode"
ScaleDataFrozenNode = "ScaleDataFrozenNode"
ScaleDataContentNode = "ScaleDataContentNode"
ScaleMLNode = "ScaleMLNode"
ScaleTransformNode = "ScaleTransformNode"
ScaleCoordinatingNode = "ScaleCoordinatingNode"
ScaleIngestNode = "ScaleIngestNode"
ScaleCombinedNode = "ScaleCombinedNode"
UpdateCombinedNodePVCs = "UpdateCombinedNodePVCs"
UpdateMasterNodePVCs = "UpdateMasterNodePVCs"
UpdateIngestNodePVCs = "UpdateIngestNodePVCs"
UpdateDataNodePVCs = "UpdateDataNodePVCs"
UpdateDataContentNodePVCs = "UpdateDataContentNodePVCs"
UpdateDataHotNodePVCs = "UpdateDataHotNodePVCs"
UpdateDataWarmNodePVCs = "UpdateDataWarmNodePVCs"
UpdateDataColdNodePVCs = "UpdateDataColdNodePVCs"
UpdateDataFrozenNodePVCs = "UpdateDataFrozenNodePVCs"
UpdateMLNodePVCs = "UpdateMLNodePVCs"
UpdateTransformNodePVCs = "UpdateTransformNodePVCs"
UpdateCoordinatingNodePVCs = "UpdateCoordinatingNodePVCs"
UpdateElasticsearchCR = "UpdateElasticsearchCR"
UpdateNodeResources = "UpdateNodeResources"
UpdateMasterStatefulSetResources = "UpdateMasterStatefulSetResources"
UpdateDataStatefulSetResources = "UpdateDataStatefulSetResources"
UpdateIngestStatefulSetResources = "UpdateIngestStatefulSetResources"
UpdateCombinedStatefulSetResources = "UpdateCombinedStatefulSetResources"
UpdateMasterNodeResources = "UpdateMasterNodeResources"
UpdateDataNodeResources = "UpdateDataNodeResources"
UpdateIngestNodeResources = "UpdateIngestNodeResources"
UpdateCombinedNodeResources = "UpdateCombinedNodeResources"
PrepareCustomConfig = "PrepareCustomConfig"
PrepareSecureCustomConfig = "PrepareSecureCustomConfig"
ReconfigureSecurityAdmin = "ReconfigureSecurityAdmin"
// Redis Constants
PatchedSecret = "patchedSecret"
ConfigKeyRedis = "redis.conf"
RedisTLSArg = "--tls-port 6379"
DBReady = "DBReady"
RestartedPods = "RestartedPods"
// Stash Constants
PauseBackupConfiguration = "PauseBackupConfiguration"
ResumeBackupConfiguration = "ResumeBackupConfiguration"
// Postgres Constants
UpdatePrimaryPodImage = "UpdatePrimaryImage"
UpdateStandbyPodImage = "UpdateStandbyPodImage"
// PausePgCoordinator is used when need to pause postgres failover with pg coordinator.
// This is useful when we don't want failover for a certain period.
PausePgCoordinator = "PausePgCoordinator"
// ResumePgCoordinator is used when need to resume postgres failover with pg coordinator.
// This is set when we are done with all the process necessary to do failover again.
ResumePgCoordinator = "ResumePgCoordinator"
// DataDirectoryInitialized condition is used in major upgrade ops request.
// In major upgrade we need to initialized new directory wit initDB to run pg_upgrade.
DataDirectoryInitialized = "DataDirectoryInitialized"
// PgUpgraded is set when pg_upgrade command ran successfully.
// This is used in major upgrade.
PgUpgraded = "PgUpgraded"
// ReplacedDataDirectory condition is used in major upgrade. After pg_upgrade we need to replace old data directory with new one.
// after replace data directory successfully set this condition true.
ReplacedDataDirectory = "ReplacedDataDirectory"
PgCoordinatorStatusResumeDefaultPrimary = "ResumeDefaultPrimary"
PostgresPrimaryPodReady = "PostgresPrimaryPodReady"
RestartPrimaryPods = "RestartPrimaryPods"
RestartStandbyPods = "RestartStandbyPods"
// TransferLeaderShipToFirstNode is set when we need to set the pod-0 as primary.
// This condition is set after pod-0 restart process done.
TransferLeaderShipToFirstNode = "TransferPrimaryRoleToDefault"
// TransferLeaderShipToFirstNodeBeforeCoordinatorPaused is set when we need to set the pod-0 as primary Before pgcoordinator paused
// This is the initial step where we need to set pod-0 as primary. the condition is set before the pod-0 restart process.
TransferLeaderShipToFirstNodeBeforeCoordinatorPaused = "TransferLeaderShipToFirstNodeBeforeCoordinatorPaused"
// CopiedOldBinaries condition is used when we are done copying old postgres binary.
// This is needed when we are doing major upgrade.
CopiedOldBinaries = "CopiedOldBinaries"
UpdateStatefulSetImage = "UpdateStatefulSetImage"
// ResumePrimaryPgCoordinator condition is set when we have set pg-coordinator status to NonTranferableResume this is useful when primary need to run after restart.
ResumePrimaryPgCoordinator = "NonTransferableResumePgCoordinator"
ReconfigurePrimaryPod = "ReconfigurePrimaryPod"
ReconfigureStandbyPods = "ReconfigureStandbyPods"
// MySQL/MariaDB Constants
TempIniFilesPath = "/tmp/kubedb-custom-ini-files"
)
// +kubebuilder:validation:Enum=Pending;Progressing;Successful;WaitingForApproval;Failed;Approved;Denied
type OpsRequestPhase string
const (
// used for ops requests that are currently in queue
OpsRequestPhasePending OpsRequestPhase = "Pending"
// used for ops requests that are currently Progressing
OpsRequestPhaseProgressing OpsRequestPhase = "Progressing"
// used for ops requests that are executed successfully
OpsRequestPhaseSuccessful OpsRequestPhase = "Successful"
// used for ops requests that are waiting for approval
OpsRequestPhaseWaitingForApproval OpsRequestPhase = "WaitingForApproval"
// used for ops requests that are failed
OpsRequestPhaseFailed OpsRequestPhase = "Failed"
// used for ops requests that are approved
OpsRequestApproved OpsRequestPhase = "Approved"
// used for ops requests that are denied
OpsRequestDenied OpsRequestPhase = "Denied"
)
// +kubebuilder:validation:Enum=Upgrade;UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS;Reprovision
type OpsRequestType string
const (
// Deprecated. Use UpdateVersion
OpsRequestTypeUpgrade OpsRequestType = "Upgrade"
// used for UpdateVersion operation
OpsRequestTypeUpdateVersion OpsRequestType = "UpdateVersion"
// used for HorizontalScaling operation
OpsRequestTypeHorizontalScaling OpsRequestType = "HorizontalScaling"
// used for VerticalScaling operation
OpsRequestTypeVerticalScaling OpsRequestType = "VerticalScaling"
// used for VolumeExpansion operation
OpsRequestTypeVolumeExpansion OpsRequestType = "VolumeExpansion"
// used for Restart operation
OpsRequestTypeRestart OpsRequestType = "Restart"
// used for Reconfigure operation
OpsRequestTypeReconfigure OpsRequestType = "Reconfigure"
// used for ReconfigureTLS operation
OpsRequestTypeReconfigureTLSs OpsRequestType = "ReconfigureTLS"
// used for Reprovision operation
OpsRequestTypeReprovision OpsRequestType = "Reprovision"
)
// +kubebuilder:validation:Enum=Offline;Online
type VolumeExpansionMode string
const (
// used to define a Online volume expansion mode
VolumeExpansionModeOnline VolumeExpansionMode = "Online"
// used to define a Offline volume expansion mode
VolumeExpansionModeOffline VolumeExpansionMode = "Offline"
)
type RestartSpec struct{}
type Reprovision struct{}
type TLSSpec struct {
// TLSConfig contains updated tls configurations for client and server.
// +optional
kmapi.TLSConfig `json:",inline,omitempty"`
// RotateCertificates tells operator to initiate certificate rotation
// +optional
RotateCertificates bool `json:"rotateCertificates,omitempty"`
// Remove tells operator to remove TLS configuration
// +optional
Remove bool `json:"remove,omitempty"`
}