/
solr_types.go
212 lines (166 loc) · 7.29 KB
/
solr_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
/*
Copyright 2023.
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 v1alpha2
import (
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kmapi "kmodules.xyz/client-go/api/v1"
mona "kmodules.xyz/monitoring-agent-api/api/v1"
ofst "kmodules.xyz/offshoot-api/api/v2"
)
// Solr is the schema for the Sole API
// +genclient
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=sl,scope=Namespaced
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".apiVersion"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type Solr struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec SolrSpec `json:"spec,omitempty"`
Status SolrStatus `json:"status,omitempty"`
}
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// SolrSpec defines the desired state of Solr c
type SolrSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Version of Solr to be deployed
Version string `json:"version"`
// Number of instances to deploy for a Solr database
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// Solr topology for node specification
// +optional
Topology *SolrClusterTopology `json:"topology,omitempty"`
// StorageType van be durable (default) or ephemeral
StorageType StorageType `json:"storageType,omitempty"`
// Storage to specify how storage shall be used
Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"`
// // ZooKeeper contains information for Solr to store configurations for collections
ZookeeperRef *kmapi.ObjectReference `json:"zookeeperRef,omitempty"`
// +optional
SolrModules []string `json:"solrModules,omitempty"`
// +optional
SolrOpts []string `json:"solrOpts,omitempty"`
// To enable ssl for http layer
EnableSSL bool `json:"enableSSL,omitempty"`
// TLS contains tls configurations for client and server.
// +optional
TLS *kmapi.TLSConfig `json:"tls,omitempty"`
// Disable security. It disables authentication security of users.
// If unset, default is false
// +optional
DisableSecurity bool `json:"disableSecurity,omitempty"`
// +optional
ConfigSecret *core.LocalObjectReference `json:"configSecret,omitempty"`
// +optional
AuthSecret *core.LocalObjectReference `json:"authSecret,omitempty"`
// +optional
ZookeeperDigestSecret *core.LocalObjectReference `json:"zookeeperDigestSecret,omitempty"`
// +optional
ZookeeperDigestReadonlySecret *core.LocalObjectReference `json:"zookeeperDigestReadonlySecret,omitempty"`
// +optional
AuthConfigSecret *core.LocalObjectReference `json:"authConfigSecret,omitempty"`
// PodTemplate is an optional configuration for pods used to expose database
// +optional
PodTemplate ofst.PodTemplateSpec `json:"podTemplate,omitempty"`
// ServiceTemplates is an optional configuration for services used to expose database
// +optional
ServiceTemplates []NamedServiceTemplateSpec `json:"serviceTemplates,omitempty"`
// TerminationPolicy controls the delete operation for database
// +optional
TerminationPolicy TerminationPolicy `json:"terminationPolicy,omitempty"`
// HealthChecker defines attributes of the health checker
// +optional
// +kubebuilder:default={periodSeconds: 20, timeoutSeconds: 10, failureThreshold: 3}
HealthChecker kmapi.HealthCheckSpec `json:"healthChecker"`
// Monitor is used monitor database instance
// +optional
Monitor *mona.AgentSpec `json:"monitor,omitempty"`
// PodPlacementPolicy is the reference of the podPlacementPolicy
// +kubebuilder:default={name: "default"}
// +optional
PodPlacementPolicy *core.LocalObjectReference `json:"podPlacementPolicy,omitempty"`
}
type SolrClusterTopology struct {
Overseer *SolrNode `json:"overseer,omitempty"`
Data *SolrNode `json:"data,omitempty"`
Coordinator *SolrNode `json:"coordinator,omitempty"`
}
type SolrNode struct {
// Replica represents number of replica for this specific type of nodes
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// suffix to append with node name
// +optional
Suffix string `json:"suffix,omitempty"`
// Storage to specify how storage shall be used.
// +optional
Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"`
// PodTemplate is an optional configuration for pods used to expose database
// +optional
PodTemplate ofst.PodTemplateSpec `json:"podTemplate,omitempty"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
// +mapType=atomic
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// If specified, the pod's tolerations.
// +optional
Tolerations []core.Toleration `json:"tolerations,omitempty"`
// PodPlacementPolicy is the reference of the podPlacementPolicy
// +kubebuilder:default={name: "default"}
// +optional
PodPlacementPolicy *core.LocalObjectReference `json:"podPlacementPolicy,omitempty"`
}
// SolrStatus defines the observed state of Solr
type SolrStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Specifies the current phase of the database
// +optional
Phase DatabasePhase `json:"phase,omitempty"`
// observedGeneration is the most recent generation observed for this resource. It corresponds to the
// resource's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Conditions applied to the database, such as approval or denial.
// +optional
Conditions []kmapi.Condition `json:"conditions,omitempty"`
// +optional
Gateway *Gateway `json:"gateway,omitempty"`
}
// +kubebuilder:validation:Enum=overseer;data;coordinator;combined
type SolrNodeRoleType string
const (
SolrNodeRoleOverseer SolrNodeRoleType = "overseer"
SolrNodeRoleData SolrNodeRoleType = "data"
SolrNodeRoleCoordinator SolrNodeRoleType = "coordinator"
SolrNodeRoleSet = "set"
)
//+kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// SolrList contains a list of Solr
type SolrList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Solr `json:"items"`
}