aenix-io / etcd-operator

New generation community-driven etcd-operator!
https://etcd.aenix.io
Apache License 2.0
83 stars 14 forks source link

Unable to create etcd cluster with EmptyDir storage #214

Closed aobort closed 2 months ago

aobort commented 3 months ago

StatefulSet created as a result of EtcdCluster resource reconciliation fails to run pods in case spec.storage is set to EmptyDir:

> kubectl describe sts etcdcluster-sample
...
Events:
  Type     Reason        Age                 From                    Message
  ----     ------        ----                ----                    -------
  Warning  FailedCreate  26s (x12 over 37s)  statefulset-controller  create Pod etcdcluster-sample-0 in StatefulSet etcdcluster-sample failed error: failed to create PVC data-etcdcluster-sample-0: PersistentVolumeClaim "data-etcdcluster-sample-0" is invalid: [spec.accessModes: Required value: at least 1 access mode is required, spec.resources[storage]: Required value]
  Warning  FailedCreate  16s (x13 over 37s)  statefulset-controller  create Claim data-etcdcluster-sample-0 for Pod etcdcluster-sample-0 in StatefulSet etcdcluster-sample failed error: PersistentVolumeClaim "data-etcdcluster-sample-0" is invalid: [spec.accessModes: Required value: at least 1 access mode is required, spec.resources[storage]: Required value]

How to reproduce

  1. Build image from current main branch (at the moment the latest commit is 8157aa3)
    > IMG=ghcr.io/aenix-io/etcd-operator:8157aa3 make docker-build
  2. If using kind cluster, then load image:
    > kind load docker-image ghcr.io/aenix-io/etcd-operator:8157aa3 --name {cluster_name}
  3. Deploy operator:
    > IMG=ghcr.io/aenix-io/etcd-operator:8157aa3 make deploy
  4. Apply sample:
    > kubectl apply -f config/samples/etcd.aenix.io_v1alpha1_etcdcluster.yaml

Expected

Etcd cluster pods are up & running with emptyDir as a storage, stateful set is Ready

Actual

StatefulSet can't create pods due to inability to create PVC without accessMode specified.

Versions

etcd-operator commit 8157aa3 kind v0.20.0 go1.21.1 darwin/arm64 kubernetes v1.29.0