FoundationDB / fdb-kubernetes-operator

A kubernetes operator for FoundationDB
Apache License 2.0
241 stars 82 forks source link

Support for new version schema in FDB #1012

Closed johscheuer closed 2 years ago

johscheuer commented 2 years ago

FDB currently has a new version 7.0.0-rc1 which is not directly compatible with the current setup. We need to adjust the current implementation of our version parsing to allow a suffix in: https://github.com/FoundationDB/fdb-kubernetes-operator/blob/master/api/v1beta1/foundationdb_version.go#L33-L42 with that change we should be able to support versions like 7.0.0-rc1 in the operator.

One thing that currently doesn't work is e.g. the copying of the binaries from the respective sidecar which has he version 7.0.0-rc1 in the /var/fdb/version file and therefore copies the binaries under the 7.0.0-rc1 path. The operator cuts the last part with the regex mentioned above and in the initial copy method in our setup code: https://github.com/FoundationDB/fdb-kubernetes-operator/blob/master/setup/setup.go#L228-L287 the operator looks in the directory 7.0.0 which doesn't exist and should be 7.0.0-rc1.

johscheuer commented 2 years ago

One workaround is to overwrite the /var/fdb/version in the init sidecar with 7.0.0 until we have support for the new version schema.

brownleej commented 2 years ago

I think we'll want the CLI handling to work differently with the release candidates, since 7.0.0-rc1 may not be protocol-compatible with 7.0.0-rc2.

johscheuer commented 2 years ago

Fixed in https://github.com/FoundationDB/fdb-kubernetes-operator/pull/1069 just tested with the following changes:

index e8a23d41..eff1a13c 100644
--- a/config/deployment/manager.yaml
+++ b/config/deployment/manager.yaml
@@ -80,6 +80,23 @@ spec:
           volumeMounts:
             - name: fdb-binaries
               mountPath: /var/output-files
+        - name: foundationdb-kubernetes-init-7-0
+          image: foundationdb/foundationdb-kubernetes-sidecar:7.0.0-rc1-1
+          args:
+            - "--copy-library"
+            - "7.0"
+            - "--copy-binary"
+            - "fdbcli"
+            - "--copy-binary"
+            - "fdbbackup"
+            - "--copy-binary"
+            - "fdbrestore"
+            - "--output-dir"
+            - "/var/output-files/7.0.0-rc1"
+            - "--init-mode"
+          volumeMounts:
+            - name: fdb-binaries
+              mountPath: /var/output-files
       containers:
       - command:
         - /manager
diff --git a/config/development/kustomization.yaml b/config/development/kustomization.yaml

and

diff --git a/config/tests/base/cluster.yaml b/config/tests/base/cluster.yaml
index 33436577..4a9faebf 100644
--- a/config/tests/base/cluster.yaml
+++ b/config/tests/base/cluster.yaml
@@ -3,7 +3,7 @@ kind: FoundationDBCluster
 metadata:
   name: test-cluster
 spec:
-  version: 6.3.22
+  version: 7.0.0-rc1
   faultDomain:
     # Use fake fault domains to support running in a single-node Kubernetes
     # cluster.

cluster comes up healthy:

NAME                                                     GENERATION   RECONCILED   AVAILABLE   FULLREPLICATION   VERSION     AGE
foundationdbcluster.apps.foundationdb.org/test-cluster   1            1            true        true              7.0.0-rc1   5m5
0s