-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathtypes.go
More file actions
143 lines (121 loc) · 4.98 KB
/
types.go
File metadata and controls
143 lines (121 loc) · 4.98 KB
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
/*
Copyright (C) 2022-2025 ApeCloud Co., Ltd
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
// CfgFileFormat defines formatter of configuration files.
// +enum
// +kubebuilder:validation:Enum={xml,ini,yaml,json,hcl,dotenv,toml,properties,redis,props-plus,props-ultra}
type CfgFileFormat string
const (
Ini CfgFileFormat = "ini"
YAML CfgFileFormat = "yaml"
JSON CfgFileFormat = "json"
XML CfgFileFormat = "xml"
HCL CfgFileFormat = "hcl"
Dotenv CfgFileFormat = "dotenv"
TOML CfgFileFormat = "toml"
Properties CfgFileFormat = "properties"
RedisCfg CfgFileFormat = "redis"
PropertiesPlus CfgFileFormat = "props-plus"
PropertiesUltra CfgFileFormat = "props-ultra"
)
// ParametersDescPhase defines the ParametersDescription CR .status.phase
// +enum
// +kubebuilder:validation:Enum={Available,Unavailable, Deleting}
type ParametersDescPhase string
const (
PDAvailablePhase ParametersDescPhase = "Available"
PDUnavailablePhase ParametersDescPhase = "Unavailable"
PDDeletingPhase ParametersDescPhase = "Deleting"
)
// Deprecated: It is retained for API compatibility with existing ParametersDefinition objects.
//
// ParameterDeletedMethod defines how to handle parameter remove
// +enum
// +kubebuilder:validation:Enum={RestoreToDefault, Reset}
type ParameterDeletedMethod string
const (
PDPDefault ParameterDeletedMethod = "RestoreToDefault"
PDPReset ParameterDeletedMethod = "Reset"
)
// Deprecated: It is retained for API compatibility with existing ParamConfigRenderer objects.
//
// RerenderResourceType defines the resource requirements for a component.
// +enum
// +kubebuilder:validation:Enum={vscale,hscale,tls,shardingHScale}
type RerenderResourceType string
const (
ComponentVScaleType RerenderResourceType = "vscale"
ComponentHScaleType RerenderResourceType = "hscale"
ComponentTLSType RerenderResourceType = "tls"
ShardingComponentHScaleType RerenderResourceType = "shardingHScale"
)
// ParameterPhase defines the Configuration FSM phase
// +enum
// +kubebuilder:validation:Enum={Creating,Init,Running,Pending,Merged,MergeFailed,FailedAndPause,Upgrading,Deleting,FailedAndRetry,Finished}
type ParameterPhase string
const (
CCreatingPhase ParameterPhase = "Creating"
CInitPhase ParameterPhase = "Init"
CRunningPhase ParameterPhase = "Running"
CPendingPhase ParameterPhase = "Pending"
CFailedPhase ParameterPhase = "FailedAndRetry"
CFailedAndPausePhase ParameterPhase = "FailedAndPause"
CMergedPhase ParameterPhase = "Merged"
CMergeFailedPhase ParameterPhase = "MergeFailed"
CDeletingPhase ParameterPhase = "Deleting"
CUpgradingPhase ParameterPhase = "Upgrading"
CFinishedPhase ParameterPhase = "Finished"
)
type ParametersInFile struct {
// Holds the configuration keys and values. This field is a workaround for issues found in kubebuilder and code-generator.
// Refer to https://github.com/kubernetes-sigs/kubebuilder/issues/528 and https://github.com/kubernetes/code-generator/issues/50 for more details.
//
// Represents the content of the configuration file.
//
// +optional
Content *string `json:"content"`
// Represents the updated parameters for a single configuration file.
//
// +optional
Parameters map[string]*string `json:"parameters,omitempty"`
}
type ComponentParameters map[string]*string
// MergedPolicy defines how to merge external imported templates into component templates.
// +enum
// +kubebuilder:validation:Enum={patch,replace,none}
type MergedPolicy string
const (
PatchPolicy MergedPolicy = "patch"
ReplacePolicy MergedPolicy = "replace"
OnlyAddPolicy MergedPolicy = "add"
NoneMergePolicy MergedPolicy = "none"
)
type ConfigTemplateExtension struct {
// Specifies the name of the referenced configuration template ConfigMap object.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\.\-]*[a-z0-9])?$`
TemplateRef string `json:"templateRef"`
// Specifies the namespace of the referenced configuration template ConfigMap object.
// An empty namespace is equivalent to the "default" namespace.
//
// +kubebuilder:default="default"
// +kubebuilder:validation:Pattern:=`^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$`
// +optional
Namespace string `json:"namespace,omitempty"`
// Defines the strategy for merging externally imported templates into component templates.
//
// +kubebuilder:default="none"
// +optional
Policy MergedPolicy `json:"policy,omitempty"`
}