Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[redis-operator] APIVersion of PersistentVolumeClaim is hardcoded while the CRD allows specifying other versions #83

Closed
tylergu opened this issue May 8, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@tylergu
Copy link
Member

tylergu commented May 8, 2022

Expected behaviour

redis-operator should allow users to specify the APIVersion to use for PersistentVolumeClaim through the field Spec.Redis.Storage.PersistentVolumeClaim.apiVersion exposed in the CRD.

Actual behaviour

We noticed that although the field Spec.Redis.Storage.PersistentVolumeClaim.apiVersion in the CR allows users to specify different API versions for Persistent Volume Claim, the field does not get used when creating the PVC for the statefulSet. As shown in the code here, the APIVersion is hardcoded as v1.

This may cause problems in the future when PersistentVolumeClaim has other versions than v1.

Steps to reproduce the behaviour

  1. Deploy redis-operator
  2. Deploy redis failover with Spec.Redis.Storage.PersistentVolumeClaim.apiVersion set to v2
apiVersion: databases.spotahome.com/v1
kind: RedisFailover
metadata:
  name: redisfailover
spec:
  redis:
    replicas: 2
    storage:
      persistentVolumeClaim:
        apiVersion: v2
  sentinel:
    replicas: 2

Environment

How are the pieces configured?

  • Redis Operator version quay.io/spotahome/redis-operator:v1.1.0
  • Kubernetes version
client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:41:01Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.15",
 GitCommit:"8f1e5bf0b9729a899b8df86249b56e2c74aebc55", GitTreeState:"clean", BuildDate:"2022-03-07T09:32:18Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}

Fix

A possible improvement is to change the line at https://github.com/spotahome/redis-operator/blob/6e08a31232077f3e32319a7fde109fad005b8772/operator/redisfailover/service/generator.go#L347 to

	TypeMeta: metav1.TypeMeta{
		APIVersion: rf.Spec.Redis.Storage.PersistentVolumeClaim.APIVersion,
		Kind:       "PersistentVolumeClaim",
	},
@tylergu tylergu added the bug Something isn't working label May 8, 2022
@tylergu tylergu changed the title APIVersion of PersistentVolumeClaim is hardcoded while the CRD allows specifying other versions [redis-operator] APIVersion of PersistentVolumeClaim is hardcoded while the CRD allows specifying other versions May 8, 2022
@tylergu
Copy link
Member Author

tylergu commented May 10, 2022

Issued: spotahome/redis-operator#407

@tylergu tylergu closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants