ansible / awx-operator

An Ansible AWX operator for Kubernetes built with Operator SDK and Ansible. 🤖
https://www.github.com/ansible/awx
Apache License 2.0
1.23k stars 622 forks source link

How to override the numberOfReplicas for PV Longhorn storageclasses #1780

Open craph opened 5 months ago

craph commented 5 months ago

Please confirm the following

Bug Summary

Is there any documentation that explain how to override the numberOfReplicas for the Longhorn storageclasses ? In the documentation, there is only : postgres_storage_class option

spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 8Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: postgres-13-awx-demo-postgres-13-0
    namespace: awx
    resourceVersion: '56730655'
    uid: eac8a8d5-6d74-4d37-819b-ee89154cd60a
  csi:
    driver: driver.longhorn.io
    fsType: ext4
    volumeAttributes:
      dataLocality: disabled
      fromBackup: ''
      fsType: ext4
      numberOfReplicas: '3'
      staleReplicaTimeout: '30'
      storage.kubernetes.io/csiProvisionerIdentity: 1689570108485-8081-driver.longhorn.io
    volumeHandle: pvc-eac8a8d5-6d74-4d37-819b-ee89154cd60a
  persistentVolumeReclaimPolicy: Delete
  storageClassName: longhorn
  volumeMode: Filesystem

Thank you very much for your help

AWX Operator version

2.12.2

AWX version

23.9.0

Kubernetes platform

kubernetes

Kubernetes/Platform version

v1.25.16+rke2r1

Modifications

no

Steps to reproduce

Default installation process

Expected results

Possibility to override the numberOfReplicas for Longhorn storageClasses

Actual results

Possibility to override the numberOfReplicas for Longhorn storageClasses

Additional information

No response

Operator Logs

No response

YaronL16 commented 4 months ago

Hey, Correct me if I'm mistaken, but as far as I know, it isn't possible to define the number of Longhorn replicas in the PVC, only in the StorageClass. Therefore, it's not possible to create an option to override the replica count.

Instead, you should create an additional StorageClass for Longhorn that has a different replica count, and reference it to the AWX resouce.

kastl-ars commented 1 month ago

Hey, Correct me if I'm mistaken, but as far as I know, it isn't possible to define the number of Longhorn replicas in the PVC, only in the StorageClass. Therefore, it's not possible to create an option to override the replica count.

Instead, you should create an additional StorageClass for Longhorn that has a different replica count, and reference it to the AWX resouce.

Yes, that is the right way to do this.

You might also want to check which ReclaimPolicy you use, i.e. 'Retain' instead of 'Delete' to not lose data if the PVC gets delete for $REASONS...