/
common_types.go
96 lines (79 loc) · 3.29 KB
/
common_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
/*
Copyright 2020 Opstree Solutions.
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 v1beta2
import (
common "github.com/cafe24-dhkim05/redis-operator/api"
corev1 "k8s.io/api/core/v1"
)
// KubernetesConfig will be the JSON struct for Basic Redis Config
type KubernetesConfig struct {
common.KubernetesConfig `json:",inline"`
}
// ServiceConfig define the type of service to be created and its annotations
type ServiceConfig struct {
// +kubebuilder:validation:Enum=LoadBalancer;NodePort;ClusterIP
ServiceType string `json:"serviceType,omitempty"`
ServiceAnnotations map[string]string `json:"annotations,omitempty"`
}
// RedisConfig defines the external configuration of Redis
type RedisConfig struct {
common.RedisConfig `json:",inline"`
}
// ExistingPasswordSecret is the struct to access the existing secret
type ExistingPasswordSecret struct {
Name *string `json:"name,omitempty"`
Key *string `json:"key,omitempty"`
}
// Storage is the inteface to add pvc and pv support in redis
type Storage struct {
common.Storage `json:",inline"`
}
// Node-conf needs to be added only in redis cluster
type ClusterStorage struct {
// +kubebuilder:default=false
NodeConfVolume bool `json:"nodeConfVolume,omitempty"`
NodeConfVolumeClaimTemplate corev1.PersistentVolumeClaim `json:"nodeConfVolumeClaimTemplate,omitempty"`
common.Storage `json:",inline"`
}
// RedisExporter interface will have the information for redis exporter related stuff
type RedisExporter struct {
common.RedisExporter `json:",inline"`
}
// TLS Configuration for redis instances
type TLSConfig struct {
common.TLSConfig `json:",inline"`
}
type ACLConfig struct {
Secret *corev1.SecretVolumeSource `json:"secret,omitempty"`
}
// Probe is a interface for ReadinessProbe and LivenessProbe
type Probe struct {
common.Probe `json:",inline"`
}
// Sidecar for each Redis pods
type Sidecar struct {
common.Sidecar `json:",inline"`
Volumes *[]corev1.VolumeMount `json:"mountPath,omitempty"`
Command []string `json:"command,omitempty" protobuf:"bytes,3,rep,name=command"`
Ports *[]corev1.ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"`
}
// InitContainer for each Redis pods
type InitContainer struct {
Enabled *bool `json:"enabled,omitempty"`
Image string `json:"image"`
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
EnvVars *[]corev1.EnvVar `json:"env,omitempty"`
Command []string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
}