-
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add Redis Sentinel Support (#408)
* commit * sentinel Major Changes * example addition * example addition * add Env Variable * add Env variable * add Env Variable in sentinel * fix Issue from the int env Variable * name correction * add field for replication * fix : comments, api add : getMaster IP * add : Dynamic Client , fix : getMasterIP function * change Example * fix : bug * fixed : requirement * change : image name
- Loading branch information
1 parent
34ad273
commit e86884e
Showing
13 changed files
with
2,291 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type RedisSentinelSpec struct { | ||
// +kubebuilder:validation:Minimum=1 | ||
// +kubebuilder:validation:Default=3 | ||
// +kubebuilder:validation:Not=2 | ||
Size *int32 `json:"clusterSize"` | ||
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"` | ||
RedisSentinelConfig *RedisSentinelConfig `json:"redisSentinelConfig,omitempty"` | ||
NodeSelector map[string]string `json:"nodeSelector,omitempty"` | ||
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"` | ||
PriorityClassName string `json:"priorityClassName,omitempty"` | ||
Affinity *corev1.Affinity `json:"affinity,omitempty"` | ||
Tolerations *[]corev1.Toleration `json:"tolerations,omitempty"` | ||
TLS *TLSConfig `json:"TLS,omitempty"` | ||
PodDisruptionBudget *RedisPodDisruptionBudget `json:"pdb,omitempty"` | ||
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3} | ||
ReadinessProbe *Probe `json:"readinessProbe,omitempty" protobuf:"bytes,11,opt,name=readinessProbe"` | ||
// +kubebuilder:default:={initialDelaySeconds: 1, timeoutSeconds: 1, periodSeconds: 10, successThreshold: 1, failureThreshold:3} | ||
LivenessProbe *Probe `json:"livenessProbe,omitempty" protobuf:"bytes,11,opt,name=livenessProbe"` | ||
Sidecars *[]Sidecar `json:"sidecars,omitempty"` | ||
ServiceAccountName *string `json:"serviceAccountName,omitempty"` | ||
} | ||
|
||
func (cr *RedisSentinelSpec) GetSentinelCounts(t string) int32 { | ||
replica := cr.Size | ||
return *replica | ||
} | ||
|
||
type RedisSentinelConfig struct { | ||
AdditionalSentinelConfig *string `json:"additionalSentinelConfig,omitempty"` | ||
RedisReplicationName string `json:"redisReplicationName"` | ||
// +kubebuilder:default:=myMaster | ||
MasterGroupName string `json:"masterGroupName,omitempty"` | ||
// +kubebuilder:default:="6379" | ||
RedisPort string `json:"redisPort,omitempty"` | ||
// +kubebuilder:default:="2" | ||
Quorum string `json:"quorum,omitempty"` | ||
// +kubebuilder:default:="1" | ||
ParallelSyncs string `json:"parallelSyncs,omitempty"` | ||
// +kubebuilder:default:="180000" | ||
FailoverTimeout string `json:"failoverTimeout,omitempty"` | ||
// +kubebuilder:default:="30000" | ||
DownAfterMilliseconds string `json:"downAfterMilliseconds,omitempty"` | ||
} | ||
|
||
type RedisSentinelStatus struct { | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// Redis is the Schema for the redis API | ||
type RedisSentinel struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec RedisSentinelSpec `json:"spec"` | ||
Status RedisSentinelStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// RedisList contains a list of Redis | ||
type RedisSentinelList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []RedisSentinel `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&RedisSentinel{}, &RedisSentinelList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.