diff --git a/api/middleware/v1/redis_types.go b/api/middleware/v1/redis_types.go index 341224e..7a34589 100644 --- a/api/middleware/v1/redis_types.go +++ b/api/middleware/v1/redis_types.go @@ -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"` @@ -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"` @@ -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. @@ -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 } diff --git a/api/middleware/v1/redis_webhook.go b/api/middleware/v1/redis_webhook.go index 1aac885..c7983ac 100644 --- a/api/middleware/v1/redis_webhook.go +++ b/api/middleware/v1/redis_webhook.go @@ -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{} } @@ -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" && @@ -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 { diff --git a/api/middleware/v1/zz_generated.deepcopy.go b/api/middleware/v1/zz_generated.deepcopy.go index 09c3b29..ffbde7a 100644 --- a/api/middleware/v1/zz_generated.deepcopy.go +++ b/api/middleware/v1/zz_generated.deepcopy.go @@ -203,52 +203,6 @@ func (in *RedisPersistent) DeepCopy() *RedisPersistent { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *RedisProxy) DeepCopyInto(out *RedisProxy) { - *out = *in - if in.Config != nil { - in, out := &in.Config, &out.Config - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Resources != nil { - in, out := &in.Resources, &out.Resources - *out = new(corev1.ResourceRequirements) - (*in).DeepCopyInto(*out) - } - if in.Tolerations != nil { - in, out := &in.Tolerations, &out.Tolerations - *out = make([]corev1.Toleration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.NodeSelector != nil { - in, out := &in.NodeSelector, &out.NodeSelector - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.Affinity != nil { - in, out := &in.Affinity, &out.Affinity - *out = new(corev1.Affinity) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RedisProxy. -func (in *RedisProxy) DeepCopy() *RedisProxy { - if in == nil { - return nil - } - out := new(RedisProxy) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RedisReplicas) DeepCopyInto(out *RedisReplicas) { *out = *in @@ -328,18 +282,6 @@ func (in *RedisSpec) DeepCopyInto(out *RedisSpec) { (*out)[key] = val } } - if in.SentinelCustomConfig != nil { - in, out := &in.SentinelCustomConfig, &out.SentinelCustomConfig - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.RedisProxy != nil { - in, out := &in.RedisProxy, &out.RedisProxy - *out = new(RedisProxy) - (*in).DeepCopyInto(*out) - } if in.PodAnnotations != nil { in, out := &in.PodAnnotations, &out.PodAnnotations *out = make(map[string]string, len(*in)) @@ -358,8 +300,6 @@ func (in *RedisSpec) DeepCopyInto(out *RedisSpec) { *out = new(databasesv1.SentinelSettings) (*in).DeepCopyInto(*out) } - in.Backup.DeepCopyInto(&out.Backup) - out.Restore = in.Restore if in.ServiceID != nil { in, out := &in.ServiceID, &out.ServiceID *out = new(int32) @@ -397,13 +337,6 @@ func (in *RedisStatus) DeepCopyInto(out *RedisStatus) { (*out)[key] = val } } - if in.ProxyMatchLabels != nil { - in, out := &in.ProxyMatchLabels, &out.ProxyMatchLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } if in.ClusterNodes != nil { in, out := &in.ClusterNodes, &out.ClusterNodes *out = make([]core.RedisNode, len(*in)) diff --git a/config/crd/bases/middleware.alauda.io_redis.yaml b/config/crd/bases/middleware.alauda.io_redis.yaml index f89d435..fa20be8 100644 --- a/config/crd/bases/middleware.alauda.io_redis.yaml +++ b/config/crd/bases/middleware.alauda.io_redis.yaml @@ -849,54 +849,6 @@ spec: - sentinel - standalone type: string - backup: - description: Backup holds information for Redis backups - properties: - image: - type: string - schedule: - items: - properties: - keep: - format: int32 - type: integer - keepAfterDeletion: - type: boolean - name: - type: string - schedule: - type: string - storage: - properties: - size: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - storageClassName: - type: string - type: object - target: - properties: - s3Option: - description: S3Option - properties: - bucket: - type: string - dir: - type: string - s3Secret: - type: string - type: object - type: object - required: - - keep - - schedule - - storage - type: object - type: array - type: object customConfig: additionalProperties: type: string @@ -1289,1076 +1241,178 @@ spec: description: ServicePort contains information on service's port. properties: - appProtocol: - description: |- - The application protocol for this port. - This is used as a hint for implementations to offer richer behavior for protocols that they understand. - This field follows standard Kubernetes label syntax. - Valid values are either: - - - * Un-prefixed protocol names - reserved for IANA standard service names (as per - RFC-6335 and https://www.iana.org/assignments/service-names). - - - * Kubernetes-defined prefixed names: - * 'kubernetes.io/h2c' - HTTP/2 over cleartext as described in https://www.rfc-editor.org/rfc/rfc7540 - * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 - * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 - - - * Other protocols should use implementation-defined prefixed names such as - mycompany.com/my-custom-protocol. - type: string - name: - description: |- - The name of this port within the service. This must be a DNS_LABEL. - All ports within a ServiceSpec must have unique names. When considering - the endpoints for a Service, this must match the 'name' field in the - EndpointPort. - Optional if only one ServicePort is defined on this service. - type: string - nodePort: - description: |- - The port on each node on which this service is exposed when type is - NodePort or LoadBalancer. Usually assigned by the system. If a value is - specified, in-range, and not in use it will be used, otherwise the - operation will fail. If not specified, a port will be allocated if this - Service requires one. If this field is specified when creating a - Service which does not need it, creation will fail. This field will be - wiped when updating a Service to no longer need it (e.g. changing type - from NodePort to ClusterIP). - More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - format: int32 - type: integer - port: - description: The port that will be exposed by - this service. - format: int32 - type: integer - protocol: - default: TCP - description: |- - The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". - Default is TCP. - type: string - targetPort: - anyOf: - - type: integer - - type: string - description: |- - Number or name of the port to access on the pods targeted by the service. - Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. - If this is a string, it will be looked up as a named port in the - target Pod's container ports. If this is not specified, the value - of the 'port' field is used (an identity map). - This field is ignored for services with clusterIP=None, and should be - omitted or set equal to the 'port' field. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service - x-kubernetes-int-or-string: true - required: - - port - type: object - type: array - x-kubernetes-list-map-keys: - - port - - protocol - x-kubernetes-list-type: map - publishNotReadyAddresses: - description: |- - publishNotReadyAddresses indicates that any agent which deals with endpoints for this - Service should disregard any indications of ready/not-ready. - The primary use case for setting this field is for a StatefulSet's Headless Service to - propagate SRV DNS records for its Pods for the purpose of peer discovery. - The Kubernetes controllers that generate Endpoints and EndpointSlice resources for - Services interpret this to mean that all endpoints are considered "ready" even if the - Pods themselves are not. Agents which consume only Kubernetes generated endpoints - through the Endpoints or EndpointSlice resources can safely assume this behavior. - type: boolean - selector: - additionalProperties: - type: string - description: |- - Route service traffic to pods with label keys and values matching this - selector. If empty or not present, the service is assumed to have an - external process managing its endpoints, which Kubernetes will not - modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. - Ignored if type is ExternalName. - More info: https://kubernetes.io/docs/concepts/services-networking/service/ - type: object - x-kubernetes-map-type: atomic - sessionAffinity: - description: |- - Supports "ClientIP" and "None". Used to maintain session affinity. - Enable client IP based session affinity. - Must be ClientIP or None. - Defaults to None. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies - type: string - sessionAffinityConfig: - description: sessionAffinityConfig contains the configurations - of session affinity. - properties: - clientIP: - description: clientIP contains the configurations - of Client IP based session affinity. - properties: - timeoutSeconds: - description: |- - timeoutSeconds specifies the seconds of ClientIP type session sticky time. - The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". - Default value is 10800(for 3 hours). - format: int32 - type: integer - type: object - type: object - type: - description: |- - type determines how the Service is exposed. Defaults to ClusterIP. Valid - options are ExternalName, ClusterIP, NodePort, and LoadBalancer. - "ClusterIP" allocates a cluster-internal IP address for load-balancing - to endpoints. Endpoints are determined by the selector or if that is not - specified, by manual construction of an Endpoints object or - EndpointSlice objects. If clusterIP is "None", no virtual IP is - allocated and the endpoints are published as a set of endpoints rather - than a virtual IP. - "NodePort" builds on ClusterIP and allocates a port on every node which - routes to the same endpoints as the clusterIP. - "LoadBalancer" builds on NodePort and creates an external load-balancer - (if supported in the current cloud) which routes to the same endpoints - as the clusterIP. - "ExternalName" aliases this service to the specified externalName. - Several other fields do not apply to ExternalName services. - More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types - type: string - type: object - type: object - type: array - type: object - pause: - description: Pause field indicates whether Redis is paused. - type: boolean - persistent: - description: Persistent for Redis - properties: - storageClassName: - description: This field specifies the name of the storage class - that should be used for the persistent storage of Redis - type: string - required: - - storageClassName - type: object - persistentSize: - anyOf: - - type: integer - - type: string - description: PersistentSize set the size of the persistent volume - for the Redis - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - podAnnotations: - additionalProperties: - type: string - description: PodAnnotations holds Kubernetes Pod annotations PodAnnotations - type: object - redisProxy: - description: RedisProxy defines RedisProxy settings - properties: - affinity: - description: If specified, affinity will define the pod's scheduling - constraints - properties: - nodeAffinity: - description: Describes node affinity scheduling rules for - the pod. - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node matches the corresponding matchExpressions; the - node(s) with the highest sum are the most preferred. - items: - description: |- - An empty preferred scheduling term matches all objects with implicit weight 0 - (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). - properties: - preference: - description: A node selector term, associated with - the corresponding weight. - properties: - matchExpressions: - description: A list of node selector requirements - by node's labels. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - description: A list of node selector requirements - by node's fields. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - x-kubernetes-map-type: atomic - weight: - description: Weight associated with matching the - corresponding nodeSelectorTerm, in the range 1-100. - format: int32 - type: integer - required: - - preference - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to an update), the system - may or may not try to eventually evict the pod from its node. - properties: - nodeSelectorTerms: - description: Required. A list of node selector terms. - The terms are ORed. - items: - description: |- - A null or empty node selector term matches no objects. The requirements of - them are ANDed. - The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. - properties: - matchExpressions: - description: A list of node selector requirements - by node's labels. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchFields: - description: A list of node selector requirements - by node's fields. - items: - description: |- - A node selector requirement is a selector that contains values, a key, and an operator - that relates the key and values. - properties: - key: - description: The label key that the selector - applies to. - type: string - operator: - description: |- - Represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. - type: string - values: - description: |- - An array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. If the operator is Gt or Lt, the values - array must have a single element, which will be interpreted as an integer. - This array is replaced during a strategic merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - type: object - x-kubernetes-map-type: atomic - type: array - required: - - nodeSelectorTerms - type: object - x-kubernetes-map-type: atomic - type: object - podAffinity: - description: Describes pod affinity scheduling rules (e.g. - co-locate this pod in the same node, zone, etc. as some - other pod(s)). - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the - node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm - fields are added per-node to find the most preferred - node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, associated - with the corresponding weight. - properties: - labelSelector: - description: A label query over a set of resources, - in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: |- - weight associated with matching the corresponding podAffinityTerm, - in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a pod label update), the - system may or may not try to eventually evict the pod from its node. - When there are multiple elements, the lists of nodes corresponding to each - podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: |- - Defines a set of pods (namely those matching the labelSelector - relative to the given namespace(s)) that this pod should be - co-located (affinity) or not co-located (anti-affinity) with, - where co-located is defined as running on a node whose value of - the label with key matches that of any node on which - a pod of the set of pods is running - properties: - labelSelector: - description: A label query over a set of resources, - in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - type: object - podAntiAffinity: - description: Describes pod anti-affinity scheduling rules - (e.g. avoid putting this pod in the same node, zone, etc. - as some other pod(s)). - properties: - preferredDuringSchedulingIgnoredDuringExecution: - description: |- - The scheduler will prefer to schedule pods to nodes that satisfy - the anti-affinity expressions specified by this field, but it may choose - a node that violates one or more of the expressions. The node that is - most preferred is the one with the greatest sum of weights, i.e. - for each node that meets all of the scheduling requirements (resource - request, requiredDuringScheduling anti-affinity expressions, etc.), - compute a sum by iterating through the elements of this field and adding - "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the - node(s) with the highest sum are the most preferred. - items: - description: The weights of all of the matched WeightedPodAffinityTerm - fields are added per-node to find the most preferred - node(s) - properties: - podAffinityTerm: - description: Required. A pod affinity term, associated - with the corresponding weight. - properties: - labelSelector: - description: A label query over a set of resources, - in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list - of label selector requirements. The requirements - are ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key - that the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - weight: - description: |- - weight associated with matching the corresponding podAffinityTerm, - in the range 1-100. - format: int32 - type: integer - required: - - podAffinityTerm - - weight - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - description: |- - If the anti-affinity requirements specified by this field are not met at - scheduling time, the pod will not be scheduled onto the node. - If the anti-affinity requirements specified by this field cease to be met - at some point during pod execution (e.g. due to a pod label update), the - system may or may not try to eventually evict the pod from its node. - When there are multiple elements, the lists of nodes corresponding to each - podAffinityTerm are intersected, i.e. all terms must be satisfied. - items: - description: |- - Defines a set of pods (namely those matching the labelSelector - relative to the given namespace(s)) that this pod should be - co-located (affinity) or not co-located (anti-affinity) with, - where co-located is defined as running on a node whose value of - the label with key matches that of any node on which - a pod of the set of pods is running - properties: - labelSelector: - description: A label query over a set of resources, - in this case pods. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaceSelector: - description: |- - A label query over the set of namespaces that the term applies to. - The term is applied to the union of the namespaces selected by this field - and the ones listed in the namespaces field. - null selector and null or empty namespaces list means "this pod's namespace". - An empty selector ({}) matches all namespaces. - properties: - matchExpressions: - description: matchExpressions is a list of label - selector requirements. The requirements are - ANDed. - items: - description: |- - A label selector requirement is a selector that contains values, a key, and an operator that - relates the key and values. - properties: - key: - description: key is the label key that - the selector applies to. - type: string - operator: - description: |- - operator represents a key's relationship to a set of values. - Valid operators are In, NotIn, Exists and DoesNotExist. - type: string - values: - description: |- - values is an array of string values. If the operator is In or NotIn, - the values array must be non-empty. If the operator is Exists or DoesNotExist, - the values array must be empty. This array is replaced during a strategic - merge patch. - items: - type: string - type: array - required: - - key - - operator - type: object - type: array - matchLabels: - additionalProperties: - type: string - description: |- - matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels - map is equivalent to an element of matchExpressions, whose key field is "key", the - operator is "In", and the values array contains only "value". The requirements are ANDed. - type: object - type: object - x-kubernetes-map-type: atomic - namespaces: - description: |- - namespaces specifies a static list of namespace names that the term applies to. - The term is applied to the union of the namespaces listed in this field - and the ones selected by namespaceSelector. - null or empty namespaces list and null namespaceSelector means "this pod's namespace". - items: - type: string - type: array - topologyKey: - description: |- - This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching - the labelSelector in the specified namespaces, where co-located is defined as running on a node - whose value of the label with key topologyKey matches that of any node on which any of the - selected pods is running. - Empty topologyKey is not allowed. - type: string - required: - - topologyKey - type: object - type: array - type: object - type: object - config: - additionalProperties: - type: string - description: a map holding additional configuration options for - the proxy. - type: object - enable: - description: a boolean indicating whether or not the Redis Proxy - service is enabled. - type: boolean - image: - description: a string representing the Docker image to use for - the proxy. - type: string - nodeSelector: - additionalProperties: - type: string - description: |- - 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/ - type: object - replicas: - description: an integer indicating the number of replicas to create - for the proxy. - format: int32 - type: integer - resources: - description: Resources holds ResourceRequirements for the MySQL - Agent & Server Containers - properties: - claims: - description: |- - Claims lists the names of resources, defined in spec.resourceClaims, - that are used by this container. + appProtocol: + description: |- + The application protocol for this port. + This is used as a hint for implementations to offer richer behavior for protocols that they understand. + This field follows standard Kubernetes label syntax. + Valid values are either: - This is an alpha field and requires enabling the - DynamicResourceAllocation feature gate. + * Un-prefixed protocol names - reserved for IANA standard service names (as per + RFC-6335 and https://www.iana.org/assignments/service-names). - This field is immutable. It can only be set for containers. - items: - description: ResourceClaim references one entry in PodSpec.ResourceClaims. - properties: - name: + * Kubernetes-defined prefixed names: + * 'kubernetes.io/h2c' - HTTP/2 over cleartext as described in https://www.rfc-editor.org/rfc/rfc7540 + * 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455 + * 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455 + + + * Other protocols should use implementation-defined prefixed names such as + mycompany.com/my-custom-protocol. + type: string + name: + description: |- + The name of this port within the service. This must be a DNS_LABEL. + All ports within a ServiceSpec must have unique names. When considering + the endpoints for a Service, this must match the 'name' field in the + EndpointPort. + Optional if only one ServicePort is defined on this service. + type: string + nodePort: + description: |- + The port on each node on which this service is exposed when type is + NodePort or LoadBalancer. Usually assigned by the system. If a value is + specified, in-range, and not in use it will be used, otherwise the + operation will fail. If not specified, a port will be allocated if this + Service requires one. If this field is specified when creating a + Service which does not need it, creation will fail. This field will be + wiped when updating a Service to no longer need it (e.g. changing type + from NodePort to ClusterIP). + More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + format: int32 + type: integer + port: + description: The port that will be exposed by + this service. + format: int32 + type: integer + protocol: + default: TCP + description: |- + The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". + Default is TCP. + type: string + targetPort: + anyOf: + - type: integer + - type: string + description: |- + Number or name of the port to access on the pods targeted by the service. + Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. + If this is a string, it will be looked up as a named port in the + target Pod's container ports. If this is not specified, the value + of the 'port' field is used (an identity map). + This field is ignored for services with clusterIP=None, and should be + omitted or set equal to the 'port' field. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service + x-kubernetes-int-or-string: true + required: + - port + type: object + type: array + x-kubernetes-list-map-keys: + - port + - protocol + x-kubernetes-list-type: map + publishNotReadyAddresses: description: |- - Name must match the name of one entry in pod.spec.resourceClaims of - the Pod where this field is used. It makes that resource available - inside a container. + publishNotReadyAddresses indicates that any agent which deals with endpoints for this + Service should disregard any indications of ready/not-ready. + The primary use case for setting this field is for a StatefulSet's Headless Service to + propagate SRV DNS records for its Pods for the purpose of peer discovery. + The Kubernetes controllers that generate Endpoints and EndpointSlice resources for + Services interpret this to mean that all endpoints are considered "ready" even if the + Pods themselves are not. Agents which consume only Kubernetes generated endpoints + through the Endpoints or EndpointSlice resources can safely assume this behavior. + type: boolean + selector: + additionalProperties: + type: string + description: |- + Route service traffic to pods with label keys and values matching this + selector. If empty or not present, the service is assumed to have an + external process managing its endpoints, which Kubernetes will not + modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. + Ignored if type is ExternalName. + More info: https://kubernetes.io/docs/concepts/services-networking/service/ + type: object + x-kubernetes-map-type: atomic + sessionAffinity: + description: |- + Supports "ClientIP" and "None". Used to maintain session affinity. + Enable client IP based session affinity. + Must be ClientIP or None. + Defaults to None. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies + type: string + sessionAffinityConfig: + description: sessionAffinityConfig contains the configurations + of session affinity. + properties: + clientIP: + description: clientIP contains the configurations + of Client IP based session affinity. + properties: + timeoutSeconds: + description: |- + timeoutSeconds specifies the seconds of ClientIP type session sticky time. + The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". + Default value is 10800(for 3 hours). + format: int32 + type: integer + type: object + type: object + type: + description: |- + type determines how the Service is exposed. Defaults to ClusterIP. Valid + options are ExternalName, ClusterIP, NodePort, and LoadBalancer. + "ClusterIP" allocates a cluster-internal IP address for load-balancing + to endpoints. Endpoints are determined by the selector or if that is not + specified, by manual construction of an Endpoints object or + EndpointSlice objects. If clusterIP is "None", no virtual IP is + allocated and the endpoints are published as a set of endpoints rather + than a virtual IP. + "NodePort" builds on ClusterIP and allocates a port on every node which + routes to the same endpoints as the clusterIP. + "LoadBalancer" builds on NodePort and creates an external load-balancer + (if supported in the current cloud) which routes to the same endpoints + as the clusterIP. + "ExternalName" aliases this service to the specified externalName. + Several other fields do not apply to ExternalName services. + More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types type: string - required: - - name type: object - type: array - x-kubernetes-list-map-keys: - - name - x-kubernetes-list-type: map - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Limits describes the maximum amount of compute resources allowed. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: |- - Requests describes the minimum amount of compute resources required. - If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, - otherwise to an implementation-defined value. Requests cannot exceed Limits. - More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ - type: object - type: object - tolerations: - description: |- - Tolerations allows specifying a list of tolerations for controlling which - set of Nodes a Pod can be scheduled on - items: - description: |- - The pod this Toleration is attached to tolerates any taint that matches - the triple using the matching operator . - properties: - effect: - description: |- - Effect indicates the taint effect to match. Empty means match all taint effects. - When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. - type: string - key: - description: |- - Key is the taint key that the toleration applies to. Empty means match all taint keys. - If the key is empty, operator must be Exists; this combination means to match all values and all keys. - type: string - operator: - description: |- - Operator represents a key's relationship to the value. - Valid operators are Exists and Equal. Defaults to Equal. - Exists is equivalent to wildcard for value, so that a pod can - tolerate all taints of a particular category. - type: string - tolerationSeconds: - description: |- - TolerationSeconds represents the period of time the toleration (which must be - of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, - it is not set, which means tolerate the taint forever (do not evict). Zero and - negative values will be treated as 0 (evict immediately) by the system. - format: int64 - type: integer - value: - description: |- - Value is the taint value the toleration matches to. - If the operator is Exists, the value should be empty, otherwise just a regular string. - type: string type: object type: array type: object + pause: + description: Pause field indicates whether Redis is paused. + type: boolean + persistent: + description: Persistent for Redis + properties: + storageClassName: + description: This field specifies the name of the storage class + that should be used for the persistent storage of Redis + type: string + required: + - storageClassName + type: object + persistentSize: + anyOf: + - type: integer + - type: string + description: PersistentSize set the size of the persistent volume + for the Redis + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + podAnnotations: + additionalProperties: + type: string + description: PodAnnotations holds Kubernetes Pod annotations PodAnnotations + type: object replicas: description: Replicas defines desired number of replicas for Redis properties: @@ -2471,18 +1525,6 @@ spec: More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ type: object type: object - restore: - description: Restore contains information for Redis - properties: - backupName: - type: string - image: - type: string - imagePullPolicy: - description: PullPolicy describes a policy for if/when to pull - a container image - type: string - type: object securityContext: description: SecurityContext sets security attributes for the Pod SecurityContex @@ -3869,12 +2911,6 @@ spec: type: object type: array type: object - sentinelCustomConfig: - additionalProperties: - type: string - description: SentinelCustomConfig defines custom Sentinel configuration - settings - type: object serviceID: description: ServiceID the service id for activeredis format: int32 @@ -4068,14 +3104,6 @@ spec: Ready - All resources is ok. In most cases, Ready means the cluster is ok to use Error - Error found when do resource init type: string - proxyMatchLabels: - additionalProperties: - type: string - description: Matching label selector for Redis proxy. - type: object - proxyServiceName: - description: The name of the kubernetes Service for Redis Proxy - type: string restored: description: |- Restored indicates whether the instance has been restored from a backup. diff --git a/config/samples/backup/backup.yaml b/config/samples/backup/backup.yaml deleted file mode 100644 index c961f71..0000000 --- a/config/samples/backup/backup.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: redis.middleware.alauda.io/v1 -kind: RedisBackup -metadata: - name: redis-backup-demo -spec: - source: - redisFailoverName: redis-sentinel-demo - storageClassName: '' - storage: 1Gi \ No newline at end of file diff --git a/config/samples/cluster/backup.yaml b/config/samples/cluster/backup.yaml deleted file mode 100644 index ed2f01b..0000000 --- a/config/samples/cluster/backup.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: redis.middleware.alauda.io/v1 -kind: RedisClusterBackup -metadata: - name: redis-cluster-backup-demo -spec: - source: - redisClusterName: redis-cluster-demo - storageClassName: '' - storage: 1Gi \ No newline at end of file diff --git a/config/samples/cluster/cluster.yaml b/config/samples/cluster/cluster.yaml deleted file mode 100644 index aa58a29..0000000 --- a/config/samples/cluster/cluster.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: redis.kun/v1alpha1 -kind: DistributedRedisCluster -metadata: - name: redis-cluster-demo -spec: - masterSize: 3 - clusterReplicas: 1 - image: __DEFAULT_REDIS_IMAGE__ - monitor: - image: __DEFAULT_EXPORTER_IMAGE__ diff --git a/config/samples/custom-ssl-secret.yaml b/config/samples/custom-ssl-secret.yaml deleted file mode 100644 index fd67444..0000000 --- a/config/samples/custom-ssl-secret.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: mysql-ssl-secret -type: Opaque -data: - ca.crt: - tls.crt: - tls.key: diff --git a/config/samples/databases_spotahome_com_v1_sentinel.yaml b/config/samples/databases_spotahome_com_v1_sentinel.yaml new file mode 100644 index 0000000..904368e --- /dev/null +++ b/config/samples/databases_spotahome_com_v1_sentinel.yaml @@ -0,0 +1,31 @@ +apiVersion: databases.spotahome.com/v1 +kind: RedisSentinel +metadata: + name: redis-sentinel +spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - sentinel + - key: redissentinels.databases.spotahome.com/name + operator: In + values: + - redis-sentinel + topologyKey: kubernetes.io/hostname + expose: + type: NodePort + image: redis:7.2 + imagePullPolicy: Always + replicas: 3 + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi diff --git a/config/samples/databases_v1_redissentinel.yaml b/config/samples/databases_v1_redissentinel.yaml deleted file mode 100644 index dd9f530..0000000 --- a/config/samples/databases_v1_redissentinel.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: databases/v1 -kind: RedisSentinel -metadata: - labels: - app.kubernetes.io/name: redis-operator - app.kubernetes.io/managed-by: kustomize - name: redissentinel-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml index 6151e97..ea69beb 100644 --- a/config/samples/kustomization.yaml +++ b/config/samples/kustomization.yaml @@ -1,8 +1,7 @@ resources: - - cluster/cluster.yaml - - cluster/backup.yaml - - backup/backup.yaml - - sentinel/sentinel.yaml - - proxy/proxy.yaml - - shake/redisshake.yaml - - redis.middleware.alauda.io_v1_redisuser.yaml + - middleware_v1_redis_cluster.yaml + - middleware_v1_redis_failover.yaml + - middleware_v1_redis_standalone.yaml + - middleware_redis_v1_redisuser_for_cluster.yaml + - middleware_redis_v1_redisuser_for_failover.yaml + - databases_spotahome_com_v1_sentinel.yaml diff --git a/config/samples/middleware_redis_v1_redisuser_for_cluster.yaml b/config/samples/middleware_redis_v1_redisuser_for_cluster.yaml new file mode 100644 index 0000000..3423c86 --- /dev/null +++ b/config/samples/middleware_redis_v1_redisuser_for_cluster.yaml @@ -0,0 +1,12 @@ +apiVersion: redis.middleware.alauda.io/v1 +kind: RedisUser +metadata: + name: redisuser-for-cluster +spec: + accountType: default + aclRules: +@all -acl -flushall -flushdb -keys ~* + arch: cluster + passwordSecrets: + - redis-redis-cluster-7lt69 + redisName: redis-cluster + username: redisuser-for-cluster diff --git a/config/samples/middleware_redis_v1_redisuser_for_failover.yaml b/config/samples/middleware_redis_v1_redisuser_for_failover.yaml new file mode 100644 index 0000000..1929ecd --- /dev/null +++ b/config/samples/middleware_redis_v1_redisuser_for_failover.yaml @@ -0,0 +1,12 @@ +apiVersion: redis.middleware.alauda.io/v1 +kind: RedisUser +metadata: + name: redisuser-for-failover +spec: + accountType: custom + aclRules: +@all -acl -flushall -flushdb -keys ~* + arch: sentinel + passwordSecrets: + - redis-redis-failover-v86ls + redisName: redis-failover + username: redisuser-for-failover diff --git a/config/samples/middleware_v1_redis.yaml b/config/samples/middleware_v1_redis.yaml deleted file mode 100644 index ac8d386..0000000 --- a/config/samples/middleware_v1_redis.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: middleware/v1 -kind: Redis -metadata: - labels: - app.kubernetes.io/name: redis - app.kubernetes.io/instance: redis-sample - app.kubernetes.io/part-of: redis-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: redis-operator - name: redis-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/middleware_v1_redis_cluster.yaml b/config/samples/middleware_v1_redis_cluster.yaml new file mode 100644 index 0000000..88a5e65 --- /dev/null +++ b/config/samples/middleware_v1_redis_cluster.yaml @@ -0,0 +1,121 @@ +apiVersion: middleware.alauda.io/v1 +kind: Redis +metadata: + name: redis-cluster +spec: + affinityPolicy: AntiAffinityInSharding + arch: cluster + backup: {} + customConfig: + acllog-max-len: "128" + active-defrag-cycle-max: "25" + active-defrag-cycle-min: "1" + active-defrag-ignore-bytes: 100mb + active-defrag-max-scan-fields: "1000" + active-defrag-threshold-lower: "10" + active-defrag-threshold-upper: "100" + active-expire-effort: "1" + activedefrag: "no" + activerehashing: "yes" + aof-load-truncated: "yes" + aof-rewrite-incremental-fsync: "yes" + aof-use-rdb-preamble: "yes" + appendfsync: everysec + appendonly: "no" + auto-aof-rewrite-min-size: 64mb + auto-aof-rewrite-percentage: "100" + client-output-buffer-limit: normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 + 8388608 60 + client-query-buffer-limit: 1gb + cluster-migration-barrier: "10" + cluster-node-timeout: "15000" + cluster-replica-validity-factor: "10" + cluster-require-full-coverage: "yes" + dynamic-hz: "yes" + hash-max-ziplist-entries: "512" + hash-max-ziplist-value: "64" + hll-sparse-max-bytes: "3000" + hz: "10" + io-threads: "4" + io-threads-do-reads: "no" + jemalloc-bg-thread: "yes" + latency-monitor-threshold: "0" + lazyfree-lazy-eviction: "no" + lazyfree-lazy-expire: "no" + lazyfree-lazy-server-del: "no" + lazyfree-lazy-user-del: "no" + lfu-decay-time: "1" + lfu-log-factor: "10" + list-compress-depth: "0" + list-max-ziplist-size: "-2" + loglevel: notice + lua-time-limit: "5000" + maxclients: "10000" + maxmemory-policy: noeviction + maxmemory-samples: "5" + min-replicas-max-lag: "10" + min-replicas-to-write: "0" + no-appendfsync-on-rewrite: "no" + oom-score-adj: "no" + oom-score-adj-values: 0 200 800 + proto-max-bulk-len: 512mb + rdb-save-incremental-fsync: "yes" + rdbchecksum: "yes" + rdbcompression: "yes" + repl-backlog-size: "3145728" + repl-backlog-ttl: "3600" + repl-disable-tcp-nodelay: "no" + repl-diskless-load: disabled + repl-diskless-sync: "no" + repl-diskless-sync-delay: "5" + repl-ping-replica-period: "10" + repl-timeout: "60" + replica-ignore-maxmemory: "yes" + replica-lazy-flush: "no" + replica-serve-stale-data: "yes" + save: 60 10000 300 100 600 1 + set-max-intset-entries: "512" + slowlog-log-slower-than: "10000" + slowlog-max-len: "128" + stop-writes-on-bgsave-error: "yes" + stream-node-max-bytes: "4096" + stream-node-max-entries: "100" + tcp-backlog: "511" + tcp-keepalive: "300" + timeout: "0" + tls-ciphers: DEFAULT:!MEDIUM + tls-ciphersuites: TLS_CHACHA20_POLY1305_SHA256 + tls-protocols: TLSv1.2 TLSv1.3 + tls-session-cache-size: "20480" + tls-session-cache-timeout: "300" + tls-session-caching: "no" + tracking-table-max-keys: "1000000" + zset-max-ziplist-entries: "128" + zset-max-ziplist-value: "64" + exporter: + enabled: true + resources: + limits: + cpu: 100m + memory: 384Mi + requests: + cpu: 50m + memory: 128Mi + expose: + type: NodePort + passwordSecret: redis-password-secret + persistent: + storageClassName: sc-topolvm + persistentSize: 1Gi + replicas: + cluster: + shard: 3 + slave: 1 + resources: + limits: + cpu: 300m + memory: 300Mi + requests: + cpu: 300m + memory: 300Mi + version: "6.0" diff --git a/config/samples/middleware_v1_redis_failover.yaml b/config/samples/middleware_v1_redis_failover.yaml new file mode 100644 index 0000000..20ac1e0 --- /dev/null +++ b/config/samples/middleware_v1_redis_failover.yaml @@ -0,0 +1,161 @@ +apiVersion: middleware.alauda.io/v1 +kind: Redis +metadata: + name: redis-failover +spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - redis + - key: redisfailovers.databases.spotahome.com/name + operator: In + values: + - redis-failover + topologyKey: kubernetes.io/hostname + arch: sentinel + backup: {} + customConfig: + acllog-max-len: "128" + active-defrag-cycle-max: "25" + active-defrag-cycle-min: "1" + active-defrag-ignore-bytes: 100mb + active-defrag-max-scan-fields: "1000" + active-defrag-threshold-lower: "10" + active-defrag-threshold-upper: "100" + active-expire-effort: "1" + activedefrag: "no" + activerehashing: "yes" + aof-load-truncated: "yes" + aof-rewrite-incremental-fsync: "yes" + aof-use-rdb-preamble: "yes" + appendfsync: everysec + appendonly: "no" + auto-aof-rewrite-min-size: 64mb + auto-aof-rewrite-percentage: "100" + client-output-buffer-limit: normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 + 8388608 60 + client-query-buffer-limit: 1gb + databases: "16" + dynamic-hz: "yes" + hash-max-ziplist-entries: "512" + hash-max-ziplist-value: "64" + hll-sparse-max-bytes: "3000" + hz: "10" + io-threads: "4" + io-threads-do-reads: "no" + jemalloc-bg-thread: "yes" + latency-monitor-threshold: "0" + lazyfree-lazy-eviction: "no" + lazyfree-lazy-expire: "no" + lazyfree-lazy-server-del: "no" + lazyfree-lazy-user-del: "no" + lfu-decay-time: "1" + lfu-log-factor: "10" + list-compress-depth: "0" + list-max-ziplist-size: "-2" + loglevel: notice + lua-time-limit: "5000" + maxclients: "10000" + maxmemory-policy: noeviction + maxmemory-samples: "5" + min-replicas-max-lag: "10" + min-replicas-to-write: "0" + no-appendfsync-on-rewrite: "no" + oom-score-adj: "no" + oom-score-adj-values: 0 200 800 + proto-max-bulk-len: 512mb + rdb-save-incremental-fsync: "yes" + rdbchecksum: "yes" + rdbcompression: "yes" + repl-backlog-size: "3145728" + repl-backlog-ttl: "3600" + repl-disable-tcp-nodelay: "no" + repl-diskless-load: disabled + repl-diskless-sync: "no" + repl-diskless-sync-delay: "5" + repl-ping-replica-period: "10" + repl-timeout: "60" + replica-ignore-maxmemory: "yes" + replica-lazy-flush: "no" + replica-serve-stale-data: "yes" + save: 60 10000 300 100 600 1 + set-max-intset-entries: "512" + slowlog-log-slower-than: "10000" + slowlog-max-len: "128" + stop-writes-on-bgsave-error: "yes" + stream-node-max-bytes: "4096" + stream-node-max-entries: "100" + tcp-backlog: "511" + tcp-keepalive: "300" + timeout: "0" + tls-ciphers: DEFAULT:!MEDIUM + tls-ciphersuites: TLS_CHACHA20_POLY1305_SHA256 + tls-protocols: TLSv1.2 TLSv1.3 + tls-session-cache-size: "20480" + tls-session-cache-timeout: "300" + tls-session-caching: "no" + tracking-table-max-keys: "1000000" + zset-max-ziplist-entries: "128" + zset-max-ziplist-value: "64" + exporter: + enabled: true + resources: + limits: + cpu: 100m + memory: 384Mi + requests: + cpu: 50m + memory: 128Mi + expose: + type: NodePort + passwordSecret: redis-password + persistent: + storageClassName: sc-topolvm + persistentSize: 1Gi + replicas: + sentinel: + master: 1 + slave: 1 + resources: + limits: + cpu: 300m + memory: 300Mi + requests: + cpu: 300m + memory: 300Mi + restore: {} + sentinel: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - sentinel + - key: redissentinels.databases.spotahome.com/name + operator: In + values: + - redis-failover + topologyKey: kubernetes.io/hostname + expose: + type: NodePort + monitorConfig: + down-after-milliseconds: "30000" + failover-timeout: "180000" + parallel-syncs: "1" + replicas: 3 + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + version: "6.0" diff --git a/config/samples/middleware_v1_redis_standalone.yaml b/config/samples/middleware_v1_redis_standalone.yaml new file mode 100644 index 0000000..faf0c11 --- /dev/null +++ b/config/samples/middleware_v1_redis_standalone.yaml @@ -0,0 +1,129 @@ +apiVersion: middleware.alauda.io/v1 +kind: Redis +metadata: + name: redis-standalone +spec: + affinity: + podAntiAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - redis + - key: redisfailovers.databases.spotahome.com/name + operator: In + values: + - sttt + topologyKey: kubernetes.io/hostname + arch: standalone + customConfig: + acllog-max-len: "128" + active-defrag-cycle-max: "25" + active-defrag-cycle-min: "1" + active-defrag-ignore-bytes: 100mb + active-defrag-max-scan-fields: "1000" + active-defrag-threshold-lower: "10" + active-defrag-threshold-upper: "100" + active-expire-effort: "1" + activedefrag: "no" + activerehashing: "yes" + aof-load-truncated: "yes" + aof-rewrite-incremental-fsync: "yes" + aof-use-rdb-preamble: "yes" + appendfsync: everysec + appendonly: "no" + auto-aof-rewrite-min-size: 64mb + auto-aof-rewrite-percentage: "100" + client-output-buffer-limit: normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 + 8388608 60 + client-query-buffer-limit: 1gb + databases: "16" + dynamic-hz: "yes" + hash-max-ziplist-entries: "512" + hash-max-ziplist-value: "64" + hll-sparse-max-bytes: "3000" + hz: "10" + io-threads: "4" + io-threads-do-reads: "no" + jemalloc-bg-thread: "yes" + latency-monitor-threshold: "0" + lazyfree-lazy-eviction: "no" + lazyfree-lazy-expire: "no" + lazyfree-lazy-server-del: "no" + lazyfree-lazy-user-del: "no" + lfu-decay-time: "1" + lfu-log-factor: "10" + list-compress-depth: "0" + list-max-ziplist-size: "-2" + loglevel: notice + lua-time-limit: "5000" + maxclients: "10000" + maxmemory-policy: noeviction + maxmemory-samples: "5" + min-replicas-max-lag: "10" + min-replicas-to-write: "0" + no-appendfsync-on-rewrite: "no" + oom-score-adj: "no" + oom-score-adj-values: 0 200 800 + proto-max-bulk-len: 512mb + rdb-save-incremental-fsync: "yes" + rdbchecksum: "yes" + rdbcompression: "yes" + repl-backlog-size: "3145728" + repl-backlog-ttl: "3600" + repl-disable-tcp-nodelay: "no" + repl-diskless-load: disabled + repl-diskless-sync: "no" + repl-diskless-sync-delay: "5" + repl-ping-replica-period: "10" + repl-timeout: "60" + replica-ignore-maxmemory: "yes" + replica-lazy-flush: "no" + replica-serve-stale-data: "yes" + save: 60 10000 300 100 600 1 + set-max-intset-entries: "512" + slowlog-log-slower-than: "10000" + slowlog-max-len: "128" + stop-writes-on-bgsave-error: "yes" + stream-node-max-bytes: "4096" + stream-node-max-entries: "100" + tcp-backlog: "511" + tcp-keepalive: "300" + timeout: "0" + tls-ciphers: DEFAULT:!MEDIUM + tls-ciphersuites: TLS_CHACHA20_POLY1305_SHA256 + tls-protocols: TLSv1.2 TLSv1.3 + tls-session-cache-size: "20480" + tls-session-cache-timeout: "300" + tls-session-caching: "no" + tracking-table-max-keys: "1000000" + zset-max-ziplist-entries: "128" + zset-max-ziplist-value: "64" + exporter: + enabled: true + resources: + limits: + cpu: 100m + memory: 384Mi + requests: + cpu: 50m + memory: 128Mi + expose: + type: NodePort + passwordSecret: redis-password + persistent: + storageClassName: sc-topolvm + persistentSize: 1Gi + replicas: + sentinel: + master: 1 + resources: + limits: + cpu: 300m + memory: 300Mi + requests: + cpu: 300m + memory: 300Mi + version: "6.0" diff --git a/config/samples/proxy/proxy.yaml b/config/samples/proxy/proxy.yaml deleted file mode 100644 index 2a3ae01..0000000 --- a/config/samples/proxy/proxy.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: middle.alauda.cn/v1alpha1 -kind: RedisProxy -metadata: - name: redisproxy-sample -spec: - proxyInfo: - architecture: cluster - instanceName: redisproxy-sample - image: __DEFAULT_PROXY_IMAGE__ diff --git a/config/samples/redis.kun_v1alpha1_distributedrediscluster.yaml b/config/samples/redis.kun_v1alpha1_distributedrediscluster.yaml deleted file mode 100644 index 247a37f..0000000 --- a/config/samples/redis.kun_v1alpha1_distributedrediscluster.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: redis.kun/v1alpha1 -kind: DistributedRedisCluster -metadata: - name: distributedrediscluster-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/redis.middleware.alauda.io_v1_redisclusterbackup.yaml b/config/samples/redis.middleware.alauda.io_v1_redisclusterbackup.yaml deleted file mode 100644 index 66d9b4c..0000000 --- a/config/samples/redis.middleware.alauda.io_v1_redisclusterbackup.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: redis.middleware.alauda.io/v1 -kind: RedisClusterBackup -metadata: - name: redisclusterbackup-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/redis.middleware.alauda.io_v1_redisuser.yaml b/config/samples/redis.middleware.alauda.io_v1_redisuser.yaml deleted file mode 100644 index aeb4b8d..0000000 --- a/config/samples/redis.middleware.alauda.io_v1_redisuser.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: redis.middleware.alauda.io/v1 -kind: RedisUser -metadata: - name: redisuser-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/redis.middleware.alauda.io_v1alpha1_activeredis.yaml b/config/samples/redis.middleware.alauda.io_v1alpha1_activeredis.yaml deleted file mode 100644 index e9b2b15..0000000 --- a/config/samples/redis.middleware.alauda.io_v1alpha1_activeredis.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: redis.middleware.alauda.io/v1alpha1 -kind: ActiveRedis -metadata: - labels: - app.kubernetes.io/name: activeredis - app.kubernetes.io/instance: activeredis-sample - app.kubernetes.io/part-of: redis-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: redis-operator - name: activeredis-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/redis.middleware.alauda.io_v1alpha1_activeredisconnection.yaml b/config/samples/redis.middleware.alauda.io_v1alpha1_activeredisconnection.yaml deleted file mode 100644 index b0b2a0e..0000000 --- a/config/samples/redis.middleware.alauda.io_v1alpha1_activeredisconnection.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: redis.middleware.alauda.io/v1alpha1 -kind: ActiveRedisConnection -metadata: - labels: - app.kubernetes.io/name: activeredisconnection - app.kubernetes.io/instance: activeredisconnection-sample - app.kubernetes.io/part-of: redis-operator - app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: redis-operator - name: activeredisconnection-sample -spec: - # TODO(user): Add fields here diff --git a/config/samples/sentinel/sentinel.yaml b/config/samples/sentinel/sentinel.yaml deleted file mode 100644 index 91fb8b4..0000000 --- a/config/samples/sentinel/sentinel.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: databases.spotahome.com/v1 -kind: RedisFailover -metadata: - name: redis-sentinel-demo -spec: {} \ No newline at end of file diff --git a/config/samples/shake/redisshake.yaml b/config/samples/shake/redisshake.yaml deleted file mode 100644 index 5b1291b..0000000 --- a/config/samples/shake/redisshake.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: middle.alauda.cn/v1alpha1 -kind: RedisShake -metadata: - name: redisshake-sample -spec: - # Add fields here - modelType: sync - keyExists: rewrite - image: __DEFAULT_SHAKE_IMAGE__ - resumeFromBreakPoint: true - source: - type: sentinel - clusterName: redis-sentinel-demo - target: - type: sentinel - address: - - mymaster@127.0.0.1:26379 - - - diff --git a/internal/builder/clusterbuilder/redisproxy.go b/internal/builder/clusterbuilder/redisproxy.go index 46c77b4..2fa68b1 100644 --- a/internal/builder/clusterbuilder/redisproxy.go +++ b/internal/builder/clusterbuilder/redisproxy.go @@ -18,36 +18,8 @@ package clusterbuilder import ( "fmt" - - redisv1alpha1 "github.com/alauda/redis-operator/api/cluster/v1alpha1" - "github.com/alauda/redis-operator/internal/util" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" -) - -const ( - DefaultRedisProxyPort = 7777 ) func RedisProxySvcName(clusterName string) string { return fmt.Sprintf("%s-proxy", clusterName) } - -func NewProxySvcForCR(cluster *redisv1alpha1.DistributedRedisCluster, labels map[string]string) *corev1.Service { - svc := &corev1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Labels: labels, - Name: RedisProxySvcName(cluster.Name), - Namespace: cluster.Namespace, - OwnerReferences: util.BuildOwnerReferences(cluster), - }, - Spec: corev1.ServiceSpec{ - Ports: []corev1.ServicePort{ - {Name: "redis", Port: 6379, TargetPort: intstr.FromInt(DefaultRedisProxyPort)}, - }, - Selector: labels, - }, - } - return svc -} diff --git a/internal/controller/middleware/redis/rediscluster.go b/internal/controller/middleware/redis/rediscluster.go index 8cc5c08..d84a15a 100644 --- a/internal/controller/middleware/redis/rediscluster.go +++ b/internal/controller/middleware/redis/rediscluster.go @@ -103,8 +103,6 @@ func GenerateRedisCluster(instance *v1.Redis, bv *vc.BundleVersion) (*v1alpha1.D InstanceAccessBase: *instance.Spec.Expose.InstanceAccessBase.DeepCopy(), IPFamilyPrefer: instance.Spec.IPFamilyPrefer, } - backup = instance.Spec.Backup - restore = instance.Spec.Restore annotations = map[string]string{} ) for key, comp := range bv.Spec.Components { @@ -116,16 +114,6 @@ func GenerateRedisCluster(instance *v1.Redis, bv *vc.BundleVersion) (*v1alpha1.D } access.Image, _ = bv.GetRedisToolsImage() - if len(backup.Schedule) > 0 { - backup.Image, _ = bv.GetRedisToolsImage() - } - if restore.BackupName != "" { - restore.Image, _ = bv.GetRedisToolsImage() - } - if instance.Status.Restored { - restore = core.RedisRestore{} - } - exporterImage, _ := bv.GetRedisExporterImage() monitor := &v1alpha1.Monitor{ Image: exporterImage, @@ -185,8 +173,6 @@ func GenerateRedisCluster(instance *v1.Redis, bv *vc.BundleVersion) (*v1alpha1.D ServiceID: instance.Spec.ServiceID, // with custom images Expose: access, - Backup: backup, - Restore: restore, Monitor: monitor, }, } @@ -259,10 +245,6 @@ func ShouldUpdateCluster(cluster, newCluster *v1alpha1.DistributedRedisCluster, logger.V(3).Info("pod annotations diff") return true } - if diffBackup(&cluster.Spec.Backup, &newCluster.Spec.Backup) { - logger.V(3).Info("redis backup diff") - return true - } if !reflect.DeepEqual(&cluster.Spec.Restore, &newCluster.Spec.Restore) { logger.V(3).Info("redis restore diff") return true @@ -314,8 +296,6 @@ func GenerateClusterRedisByManagerUI(cluster *v1alpha1.DistributedRedisCluster, Slave: &cluster.Spec.ClusterReplicas, }, }, - Backup: cluster.Spec.Backup, - Restore: cluster.Spec.Restore, Affinity: cluster.Spec.Affinity, NodeSelector: cluster.Spec.NodeSelector, Tolerations: cluster.Spec.Tolerations, diff --git a/internal/controller/middleware/redis/redisfailover.go b/internal/controller/middleware/redis/redisfailover.go index 81989a2..ab2512e 100644 --- a/internal/controller/middleware/redis/redisfailover.go +++ b/internal/controller/middleware/redis/redisfailover.go @@ -58,8 +58,6 @@ func GenerateRedisFailover(instance *v1.Redis, bv *vc.BundleVersion) (*redisfail IPFamilyPrefer: instance.Spec.IPFamilyPrefer, } exporter = instance.Spec.Exporter.DeepCopy() - backup = instance.Spec.Backup - restore = instance.Spec.Restore sentinel = instance.Spec.Sentinel annotations = map[string]string{} @@ -95,16 +93,6 @@ func GenerateRedisFailover(instance *v1.Redis, bv *vc.BundleVersion) (*redisfail access.Image, _ = bv.GetExposePodImage() } - if len(backup.Schedule) > 0 { - backup.Image, _ = bv.GetRedisToolsImage() - } - if restore.BackupName != "" { - restore.Image, _ = bv.GetRedisToolsImage() - } - if instance.Status.Restored { - restore = core.RedisRestore{} - } - if sentinel != nil { if sentinel.SentinelReference == nil { sentinel.Image = image @@ -158,8 +146,6 @@ func GenerateRedisFailover(instance *v1.Redis, bv *vc.BundleVersion) (*redisfail CustomConfig: instance.Spec.CustomConfig, PodAnnotations: lo.Assign(instance.Spec.PodAnnotations), Exporter: *exporter, - Backup: backup, - Restore: restore, Expose: access, EnableTLS: instance.Spec.EnableTLS, @@ -281,19 +267,16 @@ func GenerateFailoverRedisByManagerUI(failover *redisfailover.RedisFailover, sts Slave: &slave, }, }, - Backup: failover.Spec.Redis.Backup, - Restore: failover.Spec.Redis.Restore, - Affinity: failover.Spec.Redis.Affinity, - NodeSelector: failover.Spec.Redis.NodeSelector, - Tolerations: failover.Spec.Redis.Tolerations, - SecurityContext: failover.Spec.Redis.SecurityContext, - CustomConfig: failover.Spec.Redis.CustomConfig, - PodAnnotations: failover.Spec.Redis.PodAnnotations, - Sentinel: failover.Spec.Sentinel, - SentinelCustomConfig: failover.Spec.Sentinel.CustomConfig, - Exporter: &failover.Spec.Redis.Exporter, - EnableTLS: failover.Spec.Redis.EnableTLS, - PasswordSecret: failover.Spec.Auth.SecretPath, + Affinity: failover.Spec.Redis.Affinity, + NodeSelector: failover.Spec.Redis.NodeSelector, + Tolerations: failover.Spec.Redis.Tolerations, + SecurityContext: failover.Spec.Redis.SecurityContext, + CustomConfig: failover.Spec.Redis.CustomConfig, + PodAnnotations: failover.Spec.Redis.PodAnnotations, + Sentinel: failover.Spec.Sentinel, + Exporter: &failover.Spec.Redis.Exporter, + EnableTLS: failover.Spec.Redis.EnableTLS, + PasswordSecret: failover.Spec.Auth.SecretPath, }, } @@ -318,48 +301,6 @@ func GenerateFailoverRedisByManagerUI(failover *redisfailover.RedisFailover, sts return instance } -func diffBackup(b1, b2 *core.RedisBackup) bool { - if b1 == nil && b2 == nil { - return false - } - if (b1 == nil && b2 != nil) || (b1 != nil && b2 == nil) { - return true - } - - if b1.Image != b2.Image { - return true - } - if len(b1.Schedule) != len(b2.Schedule) { - return true - } else if len(b1.Schedule) > 0 { - for i, s := range b1.Schedule { - ss := b2.Schedule[i] - if s.Schedule != ss.Schedule { - return true - } - if s.Name != ss.Name { - return true - } - if s.Keep != ss.Keep { - return true - } - if s.KeepAfterDeletion != ss.KeepAfterDeletion { - return true - } - if s.Storage.StorageClassName != ss.Storage.StorageClassName { - return true - } - if s.Storage.Size.Size() != ss.Storage.Size.Size() { - return true - } - if !reflect.DeepEqual(s.Target.S3Option, ss.Target.S3Option) { - return true - } - } - } - return false -} - func resourceDiff(r1 corev1.ResourceRequirements, r2 corev1.ResourceRequirements) bool { if result := r1.Requests.Cpu().Cmp(*r2.Requests.Cpu()); result != 0 { return true diff --git a/internal/ops/cluster/actor/actor_ensure_resource.go b/internal/ops/cluster/actor/actor_ensure_resource.go index 57e7bde..c9bc03c 100644 --- a/internal/ops/cluster/actor/actor_ensure_resource.go +++ b/internal/ops/cluster/actor/actor_ensure_resource.go @@ -688,8 +688,6 @@ func (a *actorEnsureResource) fetchAllPodBindedServices(ctx context.Context, nam return services, nil } -// NOTE: removed proxy ensure, remove proxy ensure to rds - const ( redisRestartAnnotation = "kubectl.kubernetes.io/restartedAt" )