Skip to content

Commit ee7ca5f

Browse files
committed
default to two replicas
1 parent 8c52e6e commit ee7ca5f

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

config/crd/bases/operator.kcp.io_cacheservers.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,8 +1471,9 @@ spec:
14711471
replicas:
14721472
description: |-
14731473
Optional: Replicas configures the replica count for the cache-server Deployment.
1474-
Defaults to a single replica. If configured with more than one replica,
1475-
etcd must be configured too.
1474+
With an embedded etcd, the replica count defafults to one, and users are not allowed
1475+
to set the replica count to more than one.
1476+
With an external etcd, the replica count defaults to two.
14761477
format: int32
14771478
type: integer
14781479
serviceTemplate:

internal/resources/cacheserver/deployment.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ func DeploymentReconciler(server *operatorv1alpha1.CacheServer) reconciling.Name
8585
dep.Spec.Replicas = ptr.To(int32(1))
8686
}
8787
} else {
88-
dep.Spec.Replicas = server.Spec.Replicas
88+
// We are running with an external etcd. Default to 2 replicas.
89+
dep.Spec.Replicas = ptr.To(ptr.Deref(server.Spec.Replicas, 2))
8990
}
9091

9192
dep.Spec.Template.SetLabels(labels)

sdk/apis/operator/v1alpha1/cacheserver_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ type CacheServerSpec struct {
3131
Image *ImageSpec `json:"image,omitempty"`
3232

3333
// Optional: Replicas configures the replica count for the cache-server Deployment.
34-
// Defaults to a single replica. If configured with more than one replica,
35-
// etcd must be configured too.
34+
// With an embedded etcd, the replica count defafults to one, and users are not allowed
35+
// to set the replica count to more than one.
36+
// With an external etcd, the replica count defaults to two.
3637
Replicas *int32 `json:"replicas,omitempty"`
3738

3839
// Optional: Logging configures the logging settings for the cache server.

0 commit comments

Comments
 (0)