@@ -91,12 +91,15 @@ type Spec struct {
9191 // Image to use for Splunk pod containers (overrides RELATED_IMAGE_SPLUNK_ENTERPRISE environment variables)
9292 Image string `json:"image"`
9393
94- // Sets pull policy for all images (either “Always” or the default: “IfNotPresent”)
95- // +kubebuilder:validation:Enum=Always;IfNotPresent
96- ImagePullPolicy string `json:"imagePullPolicy"`
94+ // Sets pull policy for all images ("Always", "Never", or the default: "IfNotPresent")
95+ // +kubebuilder:validation:Enum=Always;IfNotPresent;Never
96+ // +kubebuilder:default=IfNotPresent
97+ // +optional
98+ ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
9799
98100 // Name of Scheduler to use for pod placement (defaults to “default-scheduler”)
99- SchedulerName string `json:"schedulerName"`
101+ // +optional
102+ SchedulerName string `json:"schedulerName,omitempty"`
100103
101104 // Kubernetes Affinity rules that control how pods are assigned to particular nodes.
102105 Affinity corev1.Affinity `json:"affinity"`
@@ -137,7 +140,7 @@ const (
137140 // PhaseTerminating means a custom resource is in the process of being removed
138141 PhaseTerminating Phase = "Terminating"
139142
140- // PhaseError means an error occured with custom resource management
143+ // PhaseError means an error occurred with custom resource management
141144 PhaseError Phase = "Error"
142145)
143146
@@ -164,13 +167,16 @@ type CommonSplunkSpec struct {
164167 Spec `json:",inline"`
165168
166169 // Storage configuration for /opt/splunk/etc volume
167- EtcVolumeStorageConfig StorageClassSpec `json:"etcVolumeStorageConfig"`
170+ // +optional
171+ EtcVolumeStorageConfig StorageClassSpec `json:"etcVolumeStorageConfig,omitempty"`
168172
169173 // Storage configuration for /opt/splunk/var volume
170- VarVolumeStorageConfig StorageClassSpec `json:"varVolumeStorageConfig"`
174+ // +optional
175+ VarVolumeStorageConfig StorageClassSpec `json:"varVolumeStorageConfig,omitempty"`
171176
172177 // List of one or more Kubernetes volumes. These will be mounted in all pod containers as as /mnt/<name>
173- Volumes []corev1.Volume `json:"volumes"`
178+ // +optional
179+ Volumes []corev1.Volume `json:"volumes,omitempty"`
174180
175181 // Inline map of default.yml overrides used to initialize the environment
176182 Defaults string `json:"defaults"`
@@ -210,10 +216,12 @@ type CommonSplunkSpec struct {
210216 // ServiceAccount is the service account used by the pods deployed by the CRD.
211217 // If not specified uses the default serviceAccount for the namespace as per
212218 // https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
213- ServiceAccount string `json:"serviceAccount"`
219+ // +optional
220+ ServiceAccount string `json:"serviceAccount,omitempty"`
214221
215222 // ExtraEnv refers to extra environment variables to be passed to the Splunk instance containers
216223 // WARNING: Setting environment variables used by Splunk or Ansible will affect Splunk installation and operation
224+ // +optional
217225 ExtraEnv []corev1.EnvVar `json:"extraEnv,omitempty"`
218226
219227 // ReadinessInitialDelaySeconds defines initialDelaySeconds(See https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes) for Readiness probe
@@ -227,45 +235,64 @@ type CommonSplunkSpec struct {
227235 LivenessInitialDelaySeconds int32 `json:"livenessInitialDelaySeconds"`
228236
229237 // LivenessProbe as defined in https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command
238+ // +optional
239+ // +kubebuilder:default:={"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3}
230240 LivenessProbe * Probe `json:"livenessProbe,omitempty"`
231241
232242 // ReadinessProbe as defined in https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes
243+ // +optional
244+ // +kubebuilder:default:={"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3}
233245 ReadinessProbe * Probe `json:"readinessProbe,omitempty"`
234246
235247 // StartupProbe as defined in https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-startup-probes
248+ // +optional
249+ // +kubebuilder:default:={"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12}
236250 StartupProbe * Probe `json:"startupProbe,omitempty"`
237251
238252 // Sets imagePullSecrets if image is being pulled from a private registry.
239253 // See https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
254+ // +optional
240255 ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
241256}
242257
243258// StorageClassSpec defines storage class configuration
259+ // +kubebuilder:validation:XValidation:rule="!(size(self.storageClassName) > 0 && self.ephemeralStorage == true)",message="storageClassName and ephemeralStorage are mutually exclusive"
260+ // +kubebuilder:validation:XValidation:rule="!(size(self.storageCapacity) > 0 && self.ephemeralStorage == true)",message="storageCapacity and ephemeralStorage are mutually exclusive"
244261type StorageClassSpec struct {
245262 // Name of StorageClass to use for persistent volume claims
246- StorageClassName string `json:"storageClassName"`
263+ // +optional
264+ StorageClassName string `json:"storageClassName,omitempty"`
247265
248- // Storage capacity to request persistent volume claims (default=”10Gi” for etc and "100Gi" for var)
249- StorageCapacity string `json:"storageCapacity"`
266+ // Storage capacity to request persistent volume claims (default="10Gi" for etc and "100Gi" for var)
267+ // +optional
268+ StorageCapacity string `json:"storageCapacity,omitempty"`
250269
251270 // If true, ephemeral (emptyDir) storage will be used
252- // default false
253271 // +optional
254- EphemeralStorage bool `json:"ephemeralStorage"`
272+ // +kubebuilder:default=false
273+ EphemeralStorage bool `json:"ephemeralStorage,omitempty"`
255274}
256275
257276// SmartStoreSpec defines Splunk indexes and remote storage volume configuration
258277type SmartStoreSpec struct {
259278 // List of remote storage volumes
279+ // +optional
280+ // +listType=map
281+ // +listMapKey=name
260282 VolList []VolumeSpec `json:"volumes,omitempty"`
261283
262284 // List of Splunk indexes
285+ // +optional
286+ // +listType=map
287+ // +listMapKey=name
263288 IndexList []IndexSpec `json:"indexes,omitempty"`
264289
265290 // Default configuration for indexes
291+ // +optional
266292 Defaults IndexConfDefaultsSpec `json:"defaults,omitempty"`
267293
268294 // Defines Cache manager settings
295+ // +optional
269296 CacheManagerConf CacheManagerSpec `json:"cacheManager,omitempty"`
270297}
271298
@@ -274,18 +301,23 @@ type CacheManagerSpec struct {
274301 IndexAndCacheManagerCommonSpec `json:",inline"`
275302
276303 // Eviction policy to use
304+ // +optional
277305 EvictionPolicy string `json:"evictionPolicy,omitempty"`
278306
279307 // Max cache size per partition
308+ // +optional
280309 MaxCacheSizeMB uint `json:"maxCacheSize,omitempty"`
281310
282311 // Additional size beyond 'minFreeSize' before eviction kicks in
312+ // +optional
283313 EvictionPaddingSizeMB uint `json:"evictionPadding,omitempty"`
284314
285315 // Maximum number of buckets that can be downloaded from remote storage in parallel
316+ // +optional
286317 MaxConcurrentDownloads uint `json:"maxConcurrentDownloads,omitempty"`
287318
288319 // Maximum number of buckets that can be uploaded to remote storage in parallel
320+ // +optional
289321 MaxConcurrentUploads uint `json:"maxConcurrentUploads,omitempty"`
290322}
291323
@@ -295,40 +327,55 @@ type IndexConfDefaultsSpec struct {
295327}
296328
297329// VolumeSpec defines remote volume config
330+ // +kubebuilder:validation:XValidation:rule="self.provider != 'aws' || size(self.region) > 0",message="region is required when provider is aws"
298331type VolumeSpec struct {
299332 // Remote volume name
333+ // +kubebuilder:validation:Required
334+ // +kubebuilder:validation:MinLength=1
300335 Name string `json:"name"`
301336
302337 // Remote volume URI
338+ // +kubebuilder:validation:Required
339+ // +kubebuilder:validation:MinLength=1
303340 Endpoint string `json:"endpoint"`
304341
305342 // Remote volume path
343+ // +kubebuilder:validation:Required
344+ // +kubebuilder:validation:MinLength=1
306345 Path string `json:"path"`
307346
308347 // Secret object name
309- SecretRef string `json:"secretRef"`
348+ // +optional
349+ SecretRef string `json:"secretRef,omitempty"`
310350
311351 // Remote Storage type. Supported values: s3, blob, gcs. s3 works with aws or minio providers, whereas blob works with azure provider, gcs works for gcp.
352+ // +kubebuilder:validation:Enum=s3;blob;gcs
312353 Type string `json:"storageType"`
313354
314355 // App Package Remote Store provider. Supported values: aws, minio, azure, gcp.
315- Provider string `json:"provider"`
356+ // +optional
357+ // +kubebuilder:validation:Enum=aws;minio;azure;gcp
358+ Provider string `json:"provider,omitempty"`
316359
317- // Region of the remote storage volume where apps reside. Used for aws, if provided. Not used for minio and azure.
318- Region string `json:"region"`
360+ // Region of the remote storage volume where apps reside. Required for aws, optional for azure and gcp.
361+ // +optional
362+ Region string `json:"region,omitempty"`
319363}
320364
321- // VolumeAndTypeSpec used to add any custom varaibles for volume implementation
365+ // VolumeAndTypeSpec used to add any custom variables for volume implementation
322366type VolumeAndTypeSpec struct {
323367 VolumeSpec `json:",inline"`
324368}
325369
326370// IndexSpec defines Splunk index name and storage path
327371type IndexSpec struct {
328372 // Splunk index name
373+ // +kubebuilder:validation:Required
374+ // +kubebuilder:validation:MinLength=1
329375 Name string `json:"name"`
330376
331377 // Index location relative to the remote volume path
378+ // +optional
332379 RemotePath string `json:"remotePath,omitempty"`
333380
334381 IndexAndCacheManagerCommonSpec `json:",inline"`
@@ -340,21 +387,26 @@ type IndexSpec struct {
340387type IndexAndGlobalCommonSpec struct {
341388
342389 // Remote Volume name
390+ // +optional
343391 VolName string `json:"volumeName,omitempty"`
344392
345393 // MaxGlobalDataSizeMB defines the maximum amount of space for warm and cold buckets of an index
394+ // +optional
346395 MaxGlobalDataSizeMB uint `json:"maxGlobalDataSizeMB,omitempty"`
347396
348397 // MaxGlobalDataSizeMB defines the maximum amount of cumulative space for warm and cold buckets of an index
398+ // +optional
349399 MaxGlobalRawDataSizeMB uint `json:"maxGlobalRawDataSizeMB,omitempty"`
350400}
351401
352402// IndexAndCacheManagerCommonSpec defines configurations that can be configured at index level or at server level
353403type IndexAndCacheManagerCommonSpec struct {
354404 // Time period relative to the bucket's age, during which the bucket is protected from cache eviction
405+ // +optional
355406 HotlistRecencySecs uint `json:"hotlistRecencySecs,omitempty"`
356407
357408 // Time period relative to the bucket's age, during which the bloom filter file is protected from cache eviction
409+ // +optional
358410 HotlistBloomFilterRecencyHours uint `json:"hotlistBloomFilterRecencyHours,omitempty"`
359411}
360412
@@ -375,8 +427,9 @@ type AppSourceDefaultSpec struct {
375427
376428// PremiumAppsProps represents properties for premium apps such as ES
377429type PremiumAppsProps struct {
378- // Type: enterpriseSecurity for now, can accomodate itsi etc.. later
430+ // Type: enterpriseSecurity for now, can accommodate itsi etc.. later
379431 // +optional
432+ // +kubebuilder:validation:Enum=enterpriseSecurity
380433 Type string `json:"type,omitempty"`
381434
382435 // Enterpreise Security App defaults
@@ -403,9 +456,13 @@ type EsDefaults struct {
403456// AppSourceSpec defines list of App package (*.spl, *.tgz) locations on remote volumes
404457type AppSourceSpec struct {
405458 // Logical name for the set of apps placed in this location. Logical name must be unique to the appRepo
459+ // +kubebuilder:validation:Required
460+ // +kubebuilder:validation:MinLength=1
406461 Name string `json:"name"`
407462
408463 // Location relative to the volume path
464+ // +kubebuilder:validation:Required
465+ // +kubebuilder:validation:MinLength=1
409466 Location string `json:"location"`
410467
411468 AppSourceDefaultSpec `json:",inline"`
@@ -423,17 +480,18 @@ type AppFrameworkSpec struct {
423480 // 1. If no value or 0 is specified then it means periodic polling is disabled.
424481 // 2. If anything less than min is specified then we set it to 1 min.
425482 // 3. If anything more than the max value is specified then we set it to 1 day.
483+ // +optional
426484 AppsRepoPollInterval int64 `json:"appsRepoPollIntervalSeconds,omitempty"`
427485
428486 // App installation period within a reconcile. Apps will be installed during this period before the next reconcile is attempted.
429487 // Note: Do not change this setting unless instructed to do so by Splunk Support
430- // +kubebuilder:validation:Optional
488+ // +optional
431489 // +kubebuilder:validation:Minimum:=30
432490 // +kubebuilder:default:=90
433491 SchedulerYieldInterval uint64 `json:"appInstallPeriodSeconds,omitempty"`
434492
435493 // Maximum number of retries to install Apps
436- // +kubebuilder:validation:Optional
494+ // +optional
437495 // +kubebuilder:validation:Minimum:=0
438496 // +kubebuilder:default:=2
439497 PhaseMaxRetries uint32 `json:"installMaxRetries,omitempty"`
@@ -442,9 +500,13 @@ type AppFrameworkSpec struct {
442500 VolList []VolumeSpec `json:"volumes,omitempty"`
443501
444502 // List of App sources on remote storage
503+ // +optional
504+ // +listType=map
505+ // +listMapKey=name
445506 AppSources []AppSourceSpec `json:"appSources,omitempty"`
446507
447508 // Maximum number of apps that can be downloaded at same time
509+ // +optional
448510 MaxConcurrentAppDownloads uint64 `json:"maxConcurrentAppDownloads,omitempty"`
449511}
450512
@@ -483,7 +545,7 @@ type AppSrcDeployInfo struct {
483545type BundlePushStageType int
484546
485547const (
486- // BundlePushUninitialized indicates bundle push never happend
548+ // BundlePushUninitialized indicates bundle push never happened
487549 BundlePushUninitialized BundlePushStageType = iota
488550 // BundlePushPending waiting for all the apps to be copied to the Pod
489551 BundlePushPending
0 commit comments