Skip to content

Commit

Permalink
chore: added few CR samples (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
chideat authored Aug 26, 2024
1 parent a4d508a commit a10f436
Show file tree
Hide file tree
Showing 29 changed files with 644 additions and 1,509 deletions.
41 changes: 0 additions & 41 deletions api/middleware/v1/redis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ type RedisSpec struct {
// CustomConfig defines custom Redis configuration settings. Some of these settings can be modified using the config set command at runtime.
// +optional
CustomConfig map[string]string `json:"customConfig,omitempty"`
// SentinelCustomConfig defines custom Sentinel configuration settings
// +kubebuilder:deprecatedversion:warning=remove in 3.20 use sentinel.customConfig instead
SentinelCustomConfig map[string]string `json:"sentinelCustomConfig,omitempty"`
// RedisProxy defines RedisProxy settings
// +optional
// +kubebuilder:deprecatedversion:warning=remove in 3.20
RedisProxy *RedisProxy `json:"redisProxy,omitempty"`
// PodAnnotations holds Kubernetes Pod annotations PodAnnotations
// +optional
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
Expand All @@ -128,10 +121,6 @@ type RedisSpec struct {
// Sentinel defines Sentinel configuration settings Sentinel
// +optional
Sentinel *redisfailoverv1.SentinelSettings `json:"sentinel,omitempty"`
// Backup holds information for Redis backups
Backup core.RedisBackup `json:"backup,omitempty"`
// Restore contains information for Redis
Restore core.RedisRestore `json:"restore,omitempty"`

// EnableActiveRedis enable active-active model for Redis
EnableActiveRedis bool `json:"enableActiveRedis,omitempty"`
Expand Down Expand Up @@ -201,10 +190,6 @@ type RedisStatus struct {
ServiceName string `json:"serviceName,omitempty"`
// Matching labels selector for Redis
MatchLabels map[string]string `json:"matchLabels,omitempty"`
// Matching label selector for Redis proxy.
ProxyMatchLabels map[string]string `json:"proxyMatchLabels,omitempty"`
// The name of the kubernetes Service for Redis Proxy
ProxyServiceName string `json:"proxyServiceName,omitempty"`
// ClusterNodes redis nodes info
ClusterNodes []core.RedisNode `json:"clusterNodes,omitempty"`
// Restored indicates whether the instance has been restored from a backup.
Expand Down Expand Up @@ -310,32 +295,6 @@ func (r *Redis) RecoverStatusError() {
// r.Status.Message = ""
}

type RedisProxy struct {
// a boolean indicating whether or not the Redis Proxy service is enabled.
Enable bool `json:"enable,omitempty"`
// a string representing the Docker image to use for the proxy.
Image string `json:"image,omitempty"`
// an integer indicating the number of replicas to create for the proxy.
Replicas int32 `json:"replicas,omitempty"`
// a map holding additional configuration options for the proxy.
Config map[string]string `json:"config,omitempty"`
// Resources holds ResourceRequirements for the MySQL Agent & Server Containers
// +optional
Resources *v1.ResourceRequirements `json:"resources,omitempty"`
// Tolerations allows specifying a list of tolerations for controlling which
// set of Nodes a Pod can be scheduled on
// +optional
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// If specified, affinity will define the pod's scheduling constraints
// +optional
Affinity *v1.Affinity `json:"affinity,omitempty"`
}

func (r *Redis) SetPasswordSecret(secretName string) {
r.Status.PasswordSecretName = secretName
}
Expand Down
7 changes: 0 additions & 7 deletions api/middleware/v1/redis_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ func (r *Redis) Default() {

switch r.Spec.Arch {
case core.RedisSentinel:
r.Spec.RedisProxy = nil
if r.Spec.Replicas == nil {
r.Spec.Replicas = &RedisReplicas{}
}
Expand All @@ -201,10 +200,6 @@ func (r *Redis) Default() {
if r.Spec.Sentinel.Replicas <= 0 {
r.Spec.Sentinel.Replicas = 3
}
if len(r.Spec.SentinelCustomConfig) != 0 {
r.Spec.Sentinel.MonitorConfig = r.Spec.SentinelCustomConfig
r.Spec.SentinelCustomConfig = nil
}

sentinel := r.Spec.Sentinel
if r.Annotations["createType"] != "managerView" &&
Expand Down Expand Up @@ -254,9 +249,7 @@ func (r *Redis) Default() {
}
r.Spec.Replicas.Sentinel.Master = pointer.Int32(1)
r.Spec.Replicas.Sentinel.Slave = nil
r.Spec.RedisProxy = nil
r.Spec.Sentinel = nil
r.Spec.SentinelCustomConfig = nil

if r.Spec.Expose.ServiceType == v1.ServiceTypeNodePort {
if len(r.Spec.Expose.NodePortMap) != 0 {
Expand Down
67 changes: 0 additions & 67 deletions api/middleware/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a10f436

Please sign in to comment.