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

APIVersion of PersistentVolumeClaim is hardcoded while the CRD allows specifying other versions #407

Closed
hoyhbx opened this issue May 10, 2022 · 3 comments
Labels

Comments

@hoyhbx
Copy link

hoyhbx commented May 10, 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

to

	TypeMeta: metav1.TypeMeta{
		APIVersion: rf.Spec.Redis.Storage.PersistentVolumeClaim.APIVersion,
		Kind:       "PersistentVolumeClaim",
	},
@lucming
Copy link
Contributor

lucming commented Jun 18, 2022

there is no other apiversion for pvc, so there's no problem writing it this way

@github-actions
Copy link

github-actions bot commented Aug 3, 2022

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Aug 3, 2022
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants