OT-CONTAINER-KIT / redis-operator

A golang based redis operator that will make/oversee Redis standalone/cluster/replication/sentinel mode setup on top of the Kubernetes.
https://ot-redis-operator.netlify.app/
Apache License 2.0
772 stars 214 forks source link

ValidationError: unknow field for redisConfig while using latest operator #1030

Closed abdul90082 closed 1 month ago

abdul90082 commented 1 month ago

What version of redis operator are you using?

redis-operator version: 0.18.0

Does this issue reproduce with the latest release? yes

What operating system and processor architecture are you using (kubectl version)? Selfhosted

kubectl version Output
$ kubectl version
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.23.8
**What did you do?** - Downloaded latest version Redis Helm charts from Github - Redis Operator 0.18.0 - Redis Replication 0.16.0 - Redis Sentinel 0.16.1 - deployed Redis Replication helm chart - deployed Redis Sentinel helm chart **What did you expect to see?** - working deployment - deployment without warnings **What did you see instead?** `Error: error validating "": error validating data: ValidationError(RedisReplication.spec.redisExporter): unknown field "redisConfig" in in.opstreelabs.redis.redis.v1beta2.RedisReplication.spec.redisExporter` **Proposed Fix** fixes identation error for external config because these are on wrong level. ` redisConfig: additionalRedisConfig: "{{ .Values.redisReplication.name | default .Release.Name }}-ext-config"`
abdul90082 commented 1 month ago

@shubham-cmyk Can i create PR for this because we just need to remove two indentaion?

drivebyer commented 1 month ago

@abdul90082 Please try Redis Replication 0.16.1

abdul90082 commented 1 month ago

@drivebyer Still getting the same error while using the Redis Replication v0.16.1. Error: error validating "": error validating data: ValidationError(RedisSentinel.spec.redisExporter): unknown field "redisConfig" in in.opstreelabs.redis.redis.v1beta2.RedisSentinel.spec.redisExporter

Here is my reids_sentinel.yaml

redisSentinel:
  resources: 
    requests:
      cpu : 1m
      memory: 1Mi
    limits:
      memory: 256Mi

externalConfig:
  enabled: true

redisExporter:
  enabled: false
  redisConfig:
    enabled: false
nodeSelector:
  deploy/dbs: "true"

Here is my reids_replication.yaml

redisReplication:
  resources: 
     requests:
       cpu : 1m
       memory: 1Mi
     limits:
       memory: ${memory}Gi
     ignoreAnnotations: 
       - "redis.opstreelabs.in/ignore"

externalConfig:
  enabled: true
  data: |
    appendonly ${appendonly}
    save "${save}"
    %{ for key, value in extra_config ~}
    ${key} ${value}
    %{ endfor ~}

nodeSelector:
  deploy/dbs: "true"
drivebyer commented 1 month ago

That's weird. This command works for me: helm install rr-1 ot-helm/redis-replication --version 0.16.1 --set externalConfig.enabled=true @abdul90082.

abdul90082 commented 1 month ago

@drivebyer Redis-replication is also working fine for me, the error is now in redisSentinel, need to fixes identation for redisConfig because this is still on the wrong level here.

drivebyer commented 1 month ago

@drivebyer Redis-replication is also working fine for me, the error is now in redisSentinel, need to fixes identation for redisConfig because this is still on the wrong level here.

I got you. There is not redisConfig field in RedisSentinel spec, we should remove it in chart.

abdul90082 commented 1 month ago

@drivebyer Thanks for your quick response, after using redisSentinel version 0.16.2 and redisReplication version 0.16.1 getting this error. Error: error validating "": error validating data: ValidationError(RedisSentinel.spec.kubernetesConfig): unknown field "minReadySeconds" in in.opstreelabs.redis.redis.v1beta2.RedisSentinel.spec.kubernetesConfig Here is the resis_sentinel.yaml file

redisSentinel:
  resources: 
    requests:
      cpu : 1m
      memory: 1Mi
    limits:
      memory: 256Mi

externalConfig:
  enabled: true

redisExporter:
  enabled: false
drivebyer commented 1 month ago

@abdul90082 Please apply the latest CRD file in your cluster. Also, you can try the latest version of redis replication and redis sentinel.

abdul90082 commented 1 month ago

@drivebyer I am still getting the error in redis-sentinel setup. +sdown master xyz-redis-persistent 10.40.220.24 6379 in the xyz-redis-persistent-sentinel-sentinel-2

k describe pod xyz-redis-persistent-sentinel-sentinel-2 -n xyz-databases Warning Unhealthy 7s (x7 over 4m7s) kubelet Liveness probe failed: command "sh -c redis-cli -h $(hostname) -p ${SENTINEL_PORT} ping" timed out

This is working fine from cli bash-5.1$ redis-cli -h $(hostname) -p ${SENTINEL_PORT} ping PONG here is my redis_sentinel.yaml file

redisSentinel:
  resources: 
    requests:
      cpu : 1m
      memory: 1Mi
    limits:
      memory: 256Mi

nodeSelector:
  deploy/dbs: "true"

externalConfig:
  enabled: false

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
            - key: app
              operator: In
              values:
                - redis-sentinel
        topologyKey: "kubernetes.io/hostname"

storageSpec:
  volumeClaimTemplate:
    spec:
      storageClassName: local-path
      accessModes: ["ReadWriteOnce"]

here is the redis_replication.yaml file

 ---
redisReplication:
  resources: 
    requests:
      cpu : 1m
      memory: 1Mi
    limits:
      memory: ${memory}Gi
  ignoreAnnotations: 
    - "redis.opstreelabs.in/ignore"

externalConfig:
  enabled: true
  data: |
    appendonly ${appendonly}
    save "${save}"
    %{ for key, value in extra_config ~}
    ${key} ${value}
    %{ endfor ~}

nodeSelector:
  deploy/dbs: "true"

affinity:
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
            - key: app
              operator: In
              values:
                - redis-sentinel
        topologyKey: "kubernetes.io/hostname"
storageSpec:
  volumeClaimTemplate:
    spec:
      storageClassName: local-path
      accessModes: ["ReadWriteOnce"]

If you need anything else for further debug i am happy to provide. Thanks

drivebyer commented 1 month ago

k describe pod xyz-redis-persistent-sentinel-sentinel-2 -n xyz-databases Warning Unhealthy 7s (x7 over 4m7s) kubelet Liveness probe failed: command "sh -c redis-cli -h $(hostname) -p ${SENTINEL_PORT} ping" timed out

I suggest you use a custom readiness/liveness probe to set a longer TimeoutSeconds (the default value is 1 second). @abdul90082

abdul90082 commented 1 month ago

@drivebyer Still the same after adding the readiness/liveness probe. master0:name=xyz-redis-persistent,status=sdown,address=10.40.220.24 6379,slaves=0,sentinels=1

1:X 25 Jul 2024 13:51:16.281 # Sentinel ID is 0e6be6d0c584c262a2c2f15b0c37c100a9051baa                                                                     
1:X 25 Jul 2024 13:51:16.281 # +monitor master xyz-redis-persistent 10.40.220.24 6379 quorum 2                                                             
1:X 25 Jul 2024 13:51:46.424 # +sdown master xyz-redis-persistent 10.40.220.24 6379