-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] : Add Replication Mode to the Redis Operator (#417)
* add Api Support * api + controller * subsentinel * add Finalizers * fix naming convention * fix name convention * create master slave replication * remove extra CRD * add redis replication to reconcile loop * fix naming * fix error and logs * add example * add TLS to redis replication * remove additional field * examples
- Loading branch information
1 parent
77b4275
commit cd4661e
Showing
25 changed files
with
4,795 additions
and
3 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,60 @@ | ||
package v1beta1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type RedisReplicationSpec struct { | ||
Size *int32 `json:"clusterSize"` | ||
KubernetesConfig KubernetesConfig `json:"kubernetesConfig"` | ||
RedisExporter *RedisExporter `json:"redisExporter,omitempty"` | ||
RedisConfig *RedisConfig `json:"redisConfig,omitempty"` | ||
Storage *Storage `json:"storage,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"` | ||
// +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 *RedisReplicationSpec) GetReplicationCounts(t string) int32 { | ||
replica := cr.Size | ||
return *replica | ||
} | ||
|
||
// RedisStatus defines the observed state of Redis | ||
type RedisReplicationStatus struct { | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// Redis is the Schema for the redis API | ||
type RedisReplication struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec RedisReplicationSpec `json:"spec"` | ||
Status RedisReplicationStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// RedisList contains a list of Redis | ||
type RedisReplicationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Redis `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&RedisReplication{}, &RedisReplicationList{}) | ||
} |
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.