/
system_types.go
1107 lines (1025 loc) · 43.6 KB
/
system_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 2021.
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 (
"github.com/3scale/saas-operator/pkg/util"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"sigs.k8s.io/controller-runtime/pkg/client"
)
type systemSidekiqType string
const (
Default systemSidekiqType = "default"
Billing systemSidekiqType = "billing"
Low systemSidekiqType = "low"
)
var (
// Common
systemDefaultSandboxProxyOpensslVerifyMode string = "VERIFY_NONE"
systemDefaultForceSSL bool = true
systemDefaultSSLCertsDir string = "/etc/pki/tls/certs"
systemDefaultThreescaleProviderPlan string = "enterprise"
systemDefaultThreescaleSuperdomain string = "localhost"
systemDefaultRailsConsole bool = false
systemDefaultRailsEnvironment string = "preview"
systemDefaultRailsLogLevel string = "info"
systemDefaultConfigFilesSecret string = "system-config"
systemDefaultBugsnagSpec BugsnagSpec = BugsnagSpec{}
systemDefaultImage defaultImageSpec = defaultImageSpec{
Name: pointer.String("quay.io/3scale/porta"),
Tag: pointer.String("nightly"),
PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))),
}
systemDefaultGrafanaDashboard defaultGrafanaDashboardSpec = defaultGrafanaDashboardSpec{
SelectorKey: pointer.String("monitoring-key"),
SelectorValue: pointer.String("middleware"),
}
systemDefaultTerminationGracePeriodSeconds *int64 = pointer.Int64(60)
systemDefaultSearchServer SearchServerSpec = SearchServerSpec{
AddressSpec: AddressSpec{
Host: pointer.String("system-sphinx"),
Port: pointer.Int32(9306),
},
BatchSize: pointer.Int32(100),
}
// App
systemDefaultAppReplicas int32 = 2
systemDefaultAppResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("200m"),
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("400m"),
corev1.ResourceMemory: resource.MustParse("2Gi"),
},
}
systemDefaultAppDeploymentStrategy defaultDeploymentRollingStrategySpec = defaultDeploymentRollingStrategySpec{
MaxUnavailable: util.IntStrPtr(intstr.FromInt(0)),
MaxSurge: util.IntStrPtr(intstr.FromString("10%")),
}
systemDefaultAppHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{
MinReplicas: pointer.Int32(2),
MaxReplicas: pointer.Int32(4),
ResourceUtilization: pointer.Int32(90),
ResourceName: pointer.String("cpu"),
}
systemDefaultAppLivenessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(30),
TimeoutSeconds: pointer.Int32(1),
PeriodSeconds: pointer.Int32(10),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(3),
}
systemDefaultAppReadinessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(30),
TimeoutSeconds: pointer.Int32(5),
PeriodSeconds: pointer.Int32(10),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(3),
}
systemDefaultAppPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{
MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)),
}
// Sidekiq
systemDefaultSidekiqReplicas int32 = 2
systemDefaultSidekiqResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("500m"),
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("1"),
corev1.ResourceMemory: resource.MustParse("2Gi"),
},
}
systemDefaultSidekiqDeploymentStrategy defaultDeploymentRollingStrategySpec = defaultDeploymentRollingStrategySpec{
MaxUnavailable: util.IntStrPtr(intstr.FromInt(0)),
MaxSurge: util.IntStrPtr(intstr.FromInt(1)),
}
systemDefaultSidekiqHPA defaultHorizontalPodAutoscalerSpec = defaultHorizontalPodAutoscalerSpec{
MinReplicas: pointer.Int32(2),
MaxReplicas: pointer.Int32(4),
ResourceUtilization: pointer.Int32(90),
ResourceName: pointer.String("cpu"),
}
systemDefaultSidekiqLivenessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(10),
TimeoutSeconds: pointer.Int32(3),
PeriodSeconds: pointer.Int32(15),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(5),
}
systemDefaultSidekiqReadinessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(10),
TimeoutSeconds: pointer.Int32(5),
PeriodSeconds: pointer.Int32(30),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(5),
}
systemDefaultSidekiqPDB defaultPodDisruptionBudgetSpec = defaultPodDisruptionBudgetSpec{
MaxUnavailable: util.IntStrPtr(intstr.FromInt(1)),
}
systemDefaultSidekiqConfigDefault defaultSidekiqConfig = defaultSidekiqConfig{
Queues: []string{
"critical", "backend_sync", "events", "zync,40",
"priority,25", "default,15", "web_hooks,10", "deletion,5",
},
MaxThreads: pointer.Int32(15),
}
systemDefaultSidekiqConfigBilling defaultSidekiqConfig = defaultSidekiqConfig{
Queues: []string{"billing"},
MaxThreads: pointer.Int32(15),
}
systemDefaultSidekiqConfigLow defaultSidekiqConfig = defaultSidekiqConfig{
Queues: []string{
"mailers", "low", "bulk_indexing",
},
MaxThreads: pointer.Int32(15),
}
// Sphinx
systemDefaultSphinxEnabled bool = true
systemDefaultSphinxServiceName string = "system-sphinx"
systemDefaultSphinxPort int32 = 9306
systemDefaultSphinxBindAddress string = "0.0.0.0"
systemDefaultSphinxConfigFile string = "/opt/system/db/sphinx/sphinx.conf"
systemDefaultSphinxBatchSize int32 = 100
systemDefaultSphinxDBPath string = "/opt/system/db/sphinx"
systemDefaultSphinxDatabaseStorageSize string = "30Gi"
systemDefaultSphinxPIDFile string = "/opt/system/tmp/pids/searchd.pid"
systemDefaultSphinxResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("250m"),
corev1.ResourceMemory: resource.MustParse("4Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("750m"),
corev1.ResourceMemory: resource.MustParse("5Gi"),
},
}
systemDefaultSphinxLivenessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(60),
TimeoutSeconds: pointer.Int32(3),
PeriodSeconds: pointer.Int32(15),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(5),
}
systemDefaultSphinxReadinessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(60),
TimeoutSeconds: pointer.Int32(5),
PeriodSeconds: pointer.Int32(30),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(5),
}
// Searchd
systemDefaultSearchdEnabled bool = false
systemDefaultSearchdImage defaultImageSpec = defaultImageSpec{
Name: pointer.String("quay.io/3scale/searchd"),
Tag: pointer.String("latest"),
PullPolicy: (*corev1.PullPolicy)(pointer.String(string(corev1.PullIfNotPresent))),
}
systemDefaultSearchdServiceName string = "system-searchd"
systemDefaultSearchdPort int32 = 9306
systemDefaultSearchdDBPath string = "/var/lib/searchd"
systemDefaultSearchdDatabaseStorageSize string = "30Gi"
systemDefaultSearchdResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("250m"),
corev1.ResourceMemory: resource.MustParse("4Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("750m"),
corev1.ResourceMemory: resource.MustParse("5Gi"),
},
}
systemDefaultSearchdLivenessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(60),
TimeoutSeconds: pointer.Int32(3),
PeriodSeconds: pointer.Int32(15),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(5),
}
systemDefaultSearchdReadinessProbe defaultProbeSpec = defaultProbeSpec{
InitialDelaySeconds: pointer.Int32(60),
TimeoutSeconds: pointer.Int32(5),
PeriodSeconds: pointer.Int32(30),
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(5),
}
systemDefaultRailsConsoleResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("200m"),
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("400m"),
corev1.ResourceMemory: resource.MustParse("2Gi"),
},
}
)
// SystemSpec defines the desired state of System
type SystemSpec struct {
// Application specific configuration options for System components
// +operator-sdk:csv:customresourcedefinitions:type=spec
Config SystemConfig `json:"config"`
// Image specification for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Image *ImageSpec `json:"image,omitempty"`
// Application specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
App *SystemAppSpec `json:"app,omitempty"`
// Sidekiq Default specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
SidekiqDefault *SystemSidekiqSpec `json:"sidekiqDefault,omitempty"`
// Sidekiq Billing specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
SidekiqBilling *SystemSidekiqSpec `json:"sidekiqBilling,omitempty"`
// Sidekiq Low specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
SidekiqLow *SystemSidekiqSpec `json:"sidekiqLow,omitempty"`
// Sphinx specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Sphinx *SystemSphinxSpec `json:"sphinx,omitempty"`
// Searchd specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Searchd *SystemSearchdSpec `json:"searchd,omitempty"`
// Console specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Console *SystemRailsConsoleSpec `json:"console,omitempty"`
// Configures the Grafana Dashboard for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
GrafanaDashboard *GrafanaDashboardSpec `json:"grafanaDashboard,omitempty"`
// Configures twemproxy
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Twemproxy *TwemproxySpec `json:"twemproxy,omitempty"`
}
// Default implements defaulting for SystemSpec
func (spec *SystemSpec) Default() {
spec.Config.Default()
spec.Image = InitializeImageSpec(spec.Image, systemDefaultImage)
spec.GrafanaDashboard = InitializeGrafanaDashboardSpec(spec.GrafanaDashboard, systemDefaultGrafanaDashboard)
if spec.App == nil {
spec.App = &SystemAppSpec{}
}
spec.App.Default()
if spec.SidekiqDefault == nil {
spec.SidekiqDefault = &SystemSidekiqSpec{}
}
spec.SidekiqDefault.Default(Default)
if spec.SidekiqBilling == nil {
spec.SidekiqBilling = &SystemSidekiqSpec{}
}
spec.SidekiqBilling.Default(Billing)
if spec.SidekiqLow == nil {
spec.SidekiqLow = &SystemSidekiqSpec{}
}
spec.SidekiqLow.Default(Low)
if spec.Searchd == nil {
spec.Searchd = &SystemSearchdSpec{}
}
spec.Searchd.Default()
if spec.Sphinx == nil {
spec.Sphinx = &SystemSphinxSpec{}
}
spec.Sphinx.Default(spec.Image)
if spec.Console == nil {
spec.Console = &SystemRailsConsoleSpec{}
}
spec.Console.Default(spec.Image)
if spec.Twemproxy != nil {
spec.Twemproxy.Default()
}
}
type SearchServerSpec struct {
AddressSpec `json:",inline"`
// Defines the batch size
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
BatchSize *int32 `json:"batchSize,omitempty"`
}
// SystemConfig holds configuration for SystemApp component
type SystemConfig struct {
// Rails configuration options for system components
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Rails *SystemRailsSpec `json:"rails,omitempty"`
// OpenSSL verification mode for sandbox proxy
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
SandboxProxyOpensslVerifyMode *string `json:"sandboxProxyOpensslVerifyMode,omitempty"`
// Enable (true) or disable (false) enforcing SSL
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ForceSSL *bool `json:"forceSSL,omitempty"`
// SSL certificates path
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
SSLCertsDir *string `json:"sslCertsDir,omitempty"`
// Search service options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
SearchServer SearchServerSpec `json:"searchServer,omitempty"`
// 3scale provider plan
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ThreescaleProviderPlan *string `json:"threescaleProviderPlan,omitempty"`
// 3scale superdomain
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ThreescaleSuperdomain *string `json:"threescaleSuperdomain,omitempty"`
// Secret containging system configuration files to be mounted in the pods
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ConfigFilesSecret *string `json:"configFilesSecret,omitempty"`
// External Secret common configuration
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ExternalSecret ExternalSecret `json:"externalSecret,omitempty"`
// DSN of system's main database
// +operator-sdk:csv:customresourcedefinitions:type=spec
DatabaseDSN SecretReference `json:"databaseDSN"`
// EventsSharedSecret
// +operator-sdk:csv:customresourcedefinitions:type=spec
EventsSharedSecret SecretReference `json:"eventsSharedSecret"`
// Holds recaptcha configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
Recaptcha SystemRecaptchaSpec `json:"recaptcha"`
// SecretKeyBase
// +operator-sdk:csv:customresourcedefinitions:type=spec
SecretKeyBase SecretReference `json:"secretKeyBase"`
// AccessCode to protect admin urls
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
AccessCode *SecretReference `json:"accessCode,omitempty"`
// Options for Segment integration
// +operator-sdk:csv:customresourcedefinitions:type=spec
Segment SegmentSpec `json:"segment"`
// Options for Github integration
// +operator-sdk:csv:customresourcedefinitions:type=spec
Github GithubSpec `json:"github"`
// Options for configuring RH Customer Portal integration
// +operator-sdk:csv:customresourcedefinitions:type=spec
RedHatCustomerPortal RedHatCustomerPortalSpec `json:"redhatCustomerPortal"`
// Options for configuring Bugsnag integration
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Bugsnag *BugsnagSpec `json:"bugsnag,omitempty"`
// Database secret
// +operator-sdk:csv:customresourcedefinitions:type=spec
DatabaseSecret SecretReference `json:"databaseSecret"`
// Memcached servers
// +operator-sdk:csv:customresourcedefinitions:type=spec
MemcachedServers string `json:"memcachedServers"`
// Redis configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
Redis RedisSpec `json:"redis"`
// SMTP configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
SMTP SMTPSpec `json:"smtp"`
// Mapping Service access token
// +operator-sdk:csv:customresourcedefinitions:type=spec
MappingServiceAccessToken SecretReference `json:"mappingServiceAccessToken"`
// Zync authentication token
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ZyncAuthToken *SecretReference `json:"zyncAuthToken,omitempty"`
// Zync has configuration options for system to contact zync
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Zync *SystemZyncSpec `json:"zync,omitempty"`
// Backend has configuration options for system to contact backend
// +operator-sdk:csv:customresourcedefinitions:type=spec
Backend SystemBackendSpec `json:"backend"`
// Assets has configuration to access assets in AWS s3
Assets AssetsSpec `json:"assets"`
}
// Default applies default values to a SystemConfig struct
func (sc *SystemConfig) Default() {
if sc.Rails == nil {
sc.Rails = &SystemRailsSpec{}
}
sc.Rails.Default()
sc.ConfigFilesSecret = stringOrDefault(sc.ConfigFilesSecret, pointer.String(systemDefaultConfigFilesSecret))
if sc.Bugsnag == nil {
sc.Bugsnag = &systemDefaultBugsnagSpec
}
sc.SandboxProxyOpensslVerifyMode = stringOrDefault(sc.SandboxProxyOpensslVerifyMode, pointer.String(systemDefaultSandboxProxyOpensslVerifyMode))
sc.ForceSSL = boolOrDefault(sc.ForceSSL, pointer.Bool(systemDefaultForceSSL))
sc.SSLCertsDir = stringOrDefault(sc.SSLCertsDir, pointer.String(systemDefaultSSLCertsDir))
sc.ThreescaleProviderPlan = stringOrDefault(sc.ThreescaleProviderPlan, pointer.String(systemDefaultThreescaleProviderPlan))
sc.ThreescaleSuperdomain = stringOrDefault(sc.ThreescaleSuperdomain, pointer.String(systemDefaultThreescaleSuperdomain))
sc.ExternalSecret.SecretStoreRef = InitializeExternalSecretSecretStoreReferenceSpec(sc.ExternalSecret.SecretStoreRef, defaultExternalSecretSecretStoreReference)
sc.ExternalSecret.RefreshInterval = durationOrDefault(sc.ExternalSecret.RefreshInterval, &defaultExternalSecretRefreshInterval)
sc.SearchServer.Host = stringOrDefault(sc.SearchServer.Host, systemDefaultSearchServer.Host)
sc.SearchServer.Port = intOrDefault(sc.SearchServer.Port, systemDefaultSearchServer.Port)
sc.SearchServer.BatchSize = intOrDefault(sc.SearchServer.BatchSize, systemDefaultSearchServer.BatchSize)
}
// ResolveCanarySpec modifies the SystemSpec given the provided canary configuration
func (spec *SystemSpec) ResolveCanarySpec(canary *Canary) (*SystemSpec, error) {
canarySpec := &SystemSpec{}
if err := canary.PatchSpec(spec, canarySpec); err != nil {
return nil, err
}
if canary.ImageName != nil {
canarySpec.Image.Name = canary.ImageName
}
if canary.ImageTag != nil {
canarySpec.Image.Tag = canary.ImageTag
}
canarySpec.App.Replicas = canary.Replicas
canarySpec.SidekiqDefault.Replicas = canary.Replicas
canarySpec.SidekiqLow.Replicas = canary.Replicas
canarySpec.SidekiqBilling.Replicas = canary.Replicas
// Call Default() on the resolved canary spec to apply
// defaulting to potentially added fields
canarySpec.Default()
return canarySpec, nil
}
// SystemRecaptchaSpec holds recaptcha configurations
type SystemRecaptchaSpec struct {
// Public key
// +operator-sdk:csv:customresourcedefinitions:type=spec
PublicKey SecretReference `json:"publicKey"`
// Private key
// +operator-sdk:csv:customresourcedefinitions:type=spec
PrivateKey SecretReference `json:"privateKey"`
}
// SegmentSpec has configuration for Segment integration
type SegmentSpec struct {
// Deletion workspace
// +operator-sdk:csv:customresourcedefinitions:type=spec
DeletionWorkspace string `json:"deletionWorkspace"`
// Deletion token
// +operator-sdk:csv:customresourcedefinitions:type=spec
DeletionToken SecretReference `json:"deletionToken"`
// Write key
// +operator-sdk:csv:customresourcedefinitions:type=spec
WriteKey SecretReference `json:"writeKey"`
}
// GithubSpec has configuration for Github integration
type GithubSpec struct {
// Client ID
// +operator-sdk:csv:customresourcedefinitions:type=spec
ClientID SecretReference `json:"clientID"`
// Client secret
// +operator-sdk:csv:customresourcedefinitions:type=spec
ClientSecret SecretReference `json:"clientSecret"`
}
// RedHatCustomerPortalSpec has configuration for integration with
// Red Hat Customer Portal
type RedHatCustomerPortalSpec struct {
// Client ID
// +operator-sdk:csv:customresourcedefinitions:type=spec
ClientID SecretReference `json:"clientID"`
// Client secret
// +operator-sdk:csv:customresourcedefinitions:type=spec
ClientSecret SecretReference `json:"clientSecret"`
// Realm
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Realm *string `json:"realm,omitempty"`
}
// RedisSpec holds redis configuration
type RedisSpec struct {
// Data source name
// +operator-sdk:csv:customresourcedefinitions:type=spec
QueuesDSN string `json:"queuesDSN"`
}
// SMTPSpec has options to configure system's SMTP
type SMTPSpec struct {
// Address
// +operator-sdk:csv:customresourcedefinitions:type=spec
Address string `json:"address"`
// User
// +operator-sdk:csv:customresourcedefinitions:type=spec
User SecretReference `json:"user"`
// Password
// +operator-sdk:csv:customresourcedefinitions:type=spec
Password SecretReference `json:"password"`
// Port
// +operator-sdk:csv:customresourcedefinitions:type=spec
Port int32 `json:"port"`
// Authentication protocol
// +operator-sdk:csv:customresourcedefinitions:type=spec
AuthProtocol string `json:"authProtocol"`
// OpenSSL verify mode
// +operator-sdk:csv:customresourcedefinitions:type=spec
OpenSSLVerifyMode string `json:"opensslVerifyMode"`
// Enable/disable STARTTLS
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
STARTTLS *bool `json:"starttls,omitempty"`
// Enable/disable auto STARTTLS
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
STARTTLSAuto *bool `json:"starttlsAuto,omitempty"`
}
// SystemZyncSpec has configuration options for zync
type SystemZyncSpec struct {
// Zync authentication token
// +operator-sdk:csv:customresourcedefinitions:type=spec
AuthToken SecretReference `json:"authToken"`
// Zync endpoint
// +operator-sdk:csv:customresourcedefinitions:type=spec
Endpoint string `json:"endpoint"`
}
// SystemBackendSpec has configuration options for backend
type SystemBackendSpec struct {
// External endpoint
// +operator-sdk:csv:customresourcedefinitions:type=spec
ExternalEndpoint string `json:"externalEndpoint"`
// Internal endpoint
// +operator-sdk:csv:customresourcedefinitions:type=spec
InternalEndpoint string `json:"internalEndpoint"`
// Internal API user
// +operator-sdk:csv:customresourcedefinitions:type=spec
InternalAPIUser SecretReference `json:"internalAPIUser"`
// Internal API password
// +operator-sdk:csv:customresourcedefinitions:type=spec
InternalAPIPassword SecretReference `json:"internalAPIPassword"`
// Redis data source name
// +operator-sdk:csv:customresourcedefinitions:type=spec
RedisDSN string `json:"redisDSN"`
}
// AssetsSpec has configuration to access assets in AWS s3
type AssetsSpec struct {
// AWS S3 bucket name
// +operator-sdk:csv:customresourcedefinitions:type=spec
Bucket string `json:"bucket"`
// AWS S3 region
// +operator-sdk:csv:customresourcedefinitions:type=spec
Region string `json:"region"`
// AWS access key
// +operator-sdk:csv:customresourcedefinitions:type=spec
AccessKey SecretReference `json:"accessKey"`
// AWS secret access key
// +operator-sdk:csv:customresourcedefinitions:type=spec
SecretKey SecretReference `json:"secretKey"`
// Assets host (CDN)
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Host *string `json:"host,omitempty"`
}
// SystemRailsSpec configures rails for system components
type SystemRailsSpec struct {
// Rails Console
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Console *bool `json:"console,omitempty"`
// Rails environment
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Environment *string `json:"environment,omitempty"`
// Rails log level (debug, info, warn, error, fatal or unknown)
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +kubebuilder:validation:Enum=debug;info;warn;error;fatal;unknown
// +optional
LogLevel *string `json:"logLevel,omitempty"`
}
// Default applies defaults for SystemRailsSpec
func (srs *SystemRailsSpec) Default() {
srs.Console = boolOrDefault(srs.Console, pointer.Bool(systemDefaultRailsConsole))
srs.Environment = stringOrDefault(srs.Environment, pointer.String(systemDefaultRailsEnvironment))
srs.LogLevel = stringOrDefault(srs.LogLevel, pointer.String(systemDefaultRailsLogLevel))
}
// SystemAppSpec configures the App component of System
type SystemAppSpec struct {
// The deployment strategy to use to replace existing pods with new ones.
// +optional
// +patchStrategy=retainKeys
DeploymentStrategy *DeploymentStrategySpec `json:"deploymentStrategy,omitempty"`
// Pod Disruption Budget for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
PDB *PodDisruptionBudgetSpec `json:"pdb,omitempty"`
// Horizontal Pod Autoscaler for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
HPA *HorizontalPodAutoscalerSpec `json:"hpa,omitempty"`
// Number of replicas (ignored if hpa is enabled) for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// Resource requirements for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Resources *ResourceRequirementsSpec `json:"resources,omitempty"`
// Liveness probe for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
LivenessProbe *ProbeSpec `json:"livenessProbe,omitempty"`
// Readiness probe for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ReadinessProbe *ProbeSpec `json:"readinessProbe,omitempty"`
// Describes node affinity scheduling rules for the pod.
// +optional
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
// Canary defines spec changes for the canary Deployment. If
// left unset the canary Deployment wil not be created.
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Canary *Canary `json:"canary,omitempty"`
// Configures the TerminationGracePeriodSeconds
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
}
// Default implements defaulting for the system App component
func (spec *SystemAppSpec) Default() {
spec.DeploymentStrategy = InitializeDeploymentStrategySpec(spec.DeploymentStrategy, systemDefaultAppDeploymentStrategy)
spec.HPA = InitializeHorizontalPodAutoscalerSpec(spec.HPA, systemDefaultAppHPA)
spec.Replicas = intOrDefault(spec.Replicas, &systemDefaultAppReplicas)
spec.PDB = InitializePodDisruptionBudgetSpec(spec.PDB, systemDefaultAppPDB)
spec.Resources = InitializeResourceRequirementsSpec(spec.Resources, systemDefaultAppResources)
spec.LivenessProbe = InitializeProbeSpec(spec.LivenessProbe, systemDefaultAppLivenessProbe)
spec.ReadinessProbe = InitializeProbeSpec(spec.ReadinessProbe, systemDefaultAppReadinessProbe)
spec.TerminationGracePeriodSeconds = int64OrDefault(
spec.TerminationGracePeriodSeconds, systemDefaultTerminationGracePeriodSeconds,
)
}
// SystemSidekiqSpec configures the Sidekiq component of System
type SystemSidekiqSpec struct {
// The deployment strategy to use to replace existing pods with new ones.
// +optional
// +patchStrategy=retainKeys
DeploymentStrategy *DeploymentStrategySpec `json:"deploymentStrategy,omitempty"`
// Sidekiq specific configuration options for the component element
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Config *SidekiqConfig `json:"config,omitempty"`
// Pod Disruption Budget for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
PDB *PodDisruptionBudgetSpec `json:"pdb,omitempty"`
// Horizontal Pod Autoscaler for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
HPA *HorizontalPodAutoscalerSpec `json:"hpa,omitempty"`
// Number of replicas (ignored if hpa is enabled) for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Replicas *int32 `json:"replicas,omitempty"`
// Resource requirements for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Resources *ResourceRequirementsSpec `json:"resources,omitempty"`
// Liveness probe for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
LivenessProbe *ProbeSpec `json:"livenessProbe,omitempty"`
// Readiness probe for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ReadinessProbe *ProbeSpec `json:"readinessProbe,omitempty"`
// Describes node affinity scheduling rules for the pod.
// +optional
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
// Canary defines spec changes for the canary Deployment. If
// left unset the canary Deployment wil not be created.
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Canary *Canary `json:"canary,omitempty"`
// Configures the TerminationGracePeriodSeconds
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
}
// SidekiqConfig configures app behavior for System Sidekiq
type SidekiqConfig struct {
// List of queues to be consumed by sidekiq. Format: queue[,Priority]
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Queues []string `json:"queues,omitempty"`
// Number of rails max threads per sidekiq pod
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
MaxThreads *int32 `json:"maxThreads,omitempty"`
}
type defaultSidekiqConfig struct {
Queues []string
MaxThreads *int32
}
// Default sets default values for any value not specifically set in the SidekiqConfig struct
func (cfg *SidekiqConfig) Default(def defaultSidekiqConfig) {
if cfg.Queues == nil {
cfg.Queues = def.Queues
}
cfg.MaxThreads = intOrDefault(cfg.MaxThreads, pointer.Int32(*def.MaxThreads))
}
// Default implements defaulting for the system Sidekiq component
func (spec *SystemSidekiqSpec) Default(sidekiqType systemSidekiqType) {
spec.DeploymentStrategy = InitializeDeploymentStrategySpec(spec.DeploymentStrategy, systemDefaultSidekiqDeploymentStrategy)
spec.HPA = InitializeHorizontalPodAutoscalerSpec(spec.HPA, systemDefaultSidekiqHPA)
spec.Replicas = intOrDefault(spec.Replicas, &systemDefaultSidekiqReplicas)
spec.PDB = InitializePodDisruptionBudgetSpec(spec.PDB, systemDefaultSidekiqPDB)
spec.Resources = InitializeResourceRequirementsSpec(spec.Resources, systemDefaultSidekiqResources)
spec.LivenessProbe = InitializeProbeSpec(spec.LivenessProbe, systemDefaultSidekiqLivenessProbe)
spec.ReadinessProbe = InitializeProbeSpec(spec.ReadinessProbe, systemDefaultSidekiqReadinessProbe)
spec.TerminationGracePeriodSeconds = int64OrDefault(
spec.TerminationGracePeriodSeconds, systemDefaultTerminationGracePeriodSeconds,
)
if spec.Config == nil {
spec.Config = &SidekiqConfig{}
}
if sidekiqType == Billing {
spec.Config.Default(systemDefaultSidekiqConfigBilling)
} else if sidekiqType == Low {
spec.Config.Default(systemDefaultSidekiqConfigLow)
} else {
spec.Config.Default(systemDefaultSidekiqConfigDefault)
}
}
// SystemSphinxSpec configures the App component of System
type SystemSphinxSpec struct {
// Image specification for the Sphinx component.
// Defaults to system image if not defined.
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Image *ImageSpec `json:"image,omitempty"`
// Configuration options for System's sphinx
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Config *SphinxConfig `json:"config,omitempty"`
// Resource requirements for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Resources *ResourceRequirementsSpec `json:"resources,omitempty"`
// Liveness probe for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
LivenessProbe *ProbeSpec `json:"livenessProbe,omitempty"`
// Readiness probe for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ReadinessProbe *ProbeSpec `json:"readinessProbe,omitempty"`
// Describes node affinity scheduling rules for the pod.
// +optional
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
// Configures the TerminationGracePeriodSeconds
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
}
// Default implements defaulting for the system sphinx component
func (spec *SystemSphinxSpec) Default(systemDefaultImage *ImageSpec) {
spec.Image = InitializeImageSpec(spec.Image, defaultImageSpec(*systemDefaultImage))
spec.Resources = InitializeResourceRequirementsSpec(spec.Resources, systemDefaultSphinxResources)
spec.LivenessProbe = InitializeProbeSpec(spec.LivenessProbe, systemDefaultSphinxLivenessProbe)
spec.ReadinessProbe = InitializeProbeSpec(spec.ReadinessProbe, systemDefaultSphinxReadinessProbe)
if spec.Config == nil {
spec.Config = &SphinxConfig{}
}
spec.Config.Default()
spec.TerminationGracePeriodSeconds = int64OrDefault(
spec.TerminationGracePeriodSeconds, systemDefaultTerminationGracePeriodSeconds,
)
}
// SphinxConfig has configuration options for System's sphinx
type SphinxConfig struct {
// Deploy Sphinx instance
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Enabled *bool `json:"enabled,omitempty"`
// Thinking configuration for sphinx
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Thinking *ThinkingSpec `json:"thinking,omitempty"`
}
// Default implements defaulting for SphinxConfig
func (sc *SphinxConfig) Default() {
sc.Enabled = boolOrDefault(
sc.Enabled, pointer.Bool(systemDefaultSphinxEnabled),
)
if sc.Thinking == nil {
sc.Thinking = &ThinkingSpec{}
}
sc.Thinking.Default()
}
// ThinkingSpec configures the thinking library for sphinx
type ThinkingSpec struct {
// Allows setting the service name for Sphinx
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ServiceName *string `json:"serviceName,omitempty"`
// The TCP port Sphinx will run its daemon on
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Port *int32 `json:"port,omitempty"`
// Allows setting the TCP host for Sphinx to a different address
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
BindAddress *string `json:"bindAddress,omitempty"`
// Sphinx configuration file path
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ConfigFile *string `json:"configFile,omitempty"`
// Sphinx batch size
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
BatchSize *int32 `json:"batchSize,omitempty"`
// Sphinx database path
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
DatabasePath *string `json:"databasePath,omitempty"`
// Sphinx database storage size
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
DatabaseStorageSize *resource.Quantity `json:"databaseStorageSize,omitempty"`
// Sphinx database storage type
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
DatabaseStorageClass *string `json:"databaseStorageClass,omitempty"`
// Sphinx PID file path
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
PIDFile *string `json:"pidFile,omitempty"`
}
// Default implements defaulting for ThinkingSpec
func (tc *ThinkingSpec) Default() {
tc.ServiceName = stringOrDefault(tc.ServiceName, pointer.String(systemDefaultSphinxServiceName))
tc.Port = intOrDefault(tc.Port, pointer.Int32(systemDefaultSphinxPort))
tc.BindAddress = stringOrDefault(tc.BindAddress, pointer.String(systemDefaultSphinxBindAddress))
tc.ConfigFile = stringOrDefault(tc.ConfigFile, pointer.String(systemDefaultSphinxConfigFile))
tc.BatchSize = intOrDefault(tc.BatchSize, pointer.Int32(systemDefaultSphinxBatchSize))
tc.DatabasePath = stringOrDefault(tc.DatabasePath, pointer.String(systemDefaultSphinxDBPath))
tc.PIDFile = stringOrDefault(tc.PIDFile, pointer.String(systemDefaultSphinxPIDFile))
if tc.DatabaseStorageSize == nil {
size := resource.MustParse(systemDefaultSphinxDatabaseStorageSize)
tc.DatabaseStorageSize = &size
}
}
// SystemSearchdSpec configures the App component of System
type SystemSearchdSpec struct {
// Deploy searchd instance
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Enabled *bool `json:"enabled,omitempty"`
// Image specification for the Searchd component.
// Defaults to system image if not defined.
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Image *ImageSpec `json:"image,omitempty"`
// Configuration options for System's Searchd
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Config *SearchdConfig `json:"config,omitempty"`
// Resource requirements for the Searchd component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Resources *ResourceRequirementsSpec `json:"resources,omitempty"`
// Liveness probe for the Searchd component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
LivenessProbe *ProbeSpec `json:"livenessProbe,omitempty"`
// Readiness probe for the Searchd component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
ReadinessProbe *ProbeSpec `json:"readinessProbe,omitempty"`
// Describes node affinity scheduling rules for the Searchd pod
// +optional
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"`
// If specified, the Searchd pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
// Configures the TerminationGracePeriodSeconds for Searchd
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
}
// Default implements defaulting for the system sphinx component
func (spec *SystemSearchdSpec) Default() {
spec.Enabled = boolOrDefault(spec.Enabled, pointer.Bool(systemDefaultSearchdEnabled))
spec.Image = InitializeImageSpec(spec.Image, defaultImageSpec(systemDefaultSearchdImage))
spec.Resources = InitializeResourceRequirementsSpec(spec.Resources, systemDefaultSearchdResources)
spec.LivenessProbe = InitializeProbeSpec(spec.LivenessProbe, systemDefaultSearchdLivenessProbe)
spec.ReadinessProbe = InitializeProbeSpec(spec.ReadinessProbe, systemDefaultSearchdReadinessProbe)
if spec.Config == nil {
spec.Config = &SearchdConfig{}
}
spec.Config.Default()