Skip to content

Commit e72eb4b

Browse files
Merge pull request #127 from numtide/feat/etcd-root-path-and-defaults
feat(api): Ensuring all pods start successfully with default configurations
2 parents ed15682 + b995b83 commit e72eb4b

25 files changed

+752
-154
lines changed

api/v1alpha1/toposerver_types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ type EtcdSpec struct {
100100
// Resources defines the compute resource requirements.
101101
// +optional
102102
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
103+
104+
// RootPath is the etcd prefix for this cluster.
105+
// +optional
106+
// +kubebuilder:validation:MinLength=1
107+
// +kubebuilder:validation:MaxLength=512
108+
RootPath string `json:"rootPath,omitempty"`
103109
}
104110

105111
// GlobalTopoServerSpec defines the configuration for the global topology server.
@@ -138,6 +144,12 @@ type ExternalTopoServerSpec struct {
138144
// +optional
139145
// +kubebuilder:validation:MaxLength=253
140146
ClientCertSecret string `json:"clientCertSecret,omitempty"`
147+
148+
// RootPath is the etcd prefix for this cluster.
149+
// +optional
150+
// +kubebuilder:validation:MinLength=1
151+
// +kubebuilder:validation:MaxLength=512
152+
RootPath string `json:"rootPath,omitempty"`
141153
}
142154

143155
// LocalTopoServerSpec defines configuration for Cell-local topology.

config/crd/bases/multigres.com_cells.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,11 @@ spec:
12061206
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
12071207
type: object
12081208
type: object
1209+
rootPath:
1210+
description: RootPath is the etcd prefix for this cluster.
1211+
maxLength: 512
1212+
minLength: 1
1213+
type: string
12091214
storage:
12101215
description: Storage configuration for Etcd data.
12111216
properties:
@@ -1256,6 +1261,11 @@ spec:
12561261
x-kubernetes-validations:
12571262
- message: endpoints must be valid URLs
12581263
rule: self.all(x, x.matches('^https?://'))
1264+
rootPath:
1265+
description: RootPath is the etcd prefix for this cluster.
1266+
maxLength: 512
1267+
minLength: 1
1268+
type: string
12591269
required:
12601270
- endpoints
12611271
type: object

config/crd/bases/multigres.com_celltemplates.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ spec:
115115
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
116116
type: object
117117
type: object
118+
rootPath:
119+
description: RootPath is the etcd prefix for this cluster.
120+
maxLength: 512
121+
minLength: 1
122+
type: string
118123
storage:
119124
description: Storage configuration for Etcd data.
120125
properties:
@@ -165,6 +170,11 @@ spec:
165170
x-kubernetes-validations:
166171
- message: endpoints must be valid URLs
167172
rule: self.all(x, x.matches('^https?://'))
173+
rootPath:
174+
description: RootPath is the etcd prefix for this cluster.
175+
maxLength: 512
176+
minLength: 1
177+
type: string
168178
required:
169179
- endpoints
170180
type: object

config/crd/bases/multigres.com_coretemplates.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ spec:
117117
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
118118
type: object
119119
type: object
120+
rootPath:
121+
description: RootPath is the etcd prefix for this cluster.
122+
maxLength: 512
123+
minLength: 1
124+
type: string
120125
storage:
121126
description: Storage configuration for Etcd data.
122127
properties:

config/crd/bases/multigres.com_multigresclusters.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,12 @@ spec:
11811181
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
11821182
type: object
11831183
type: object
1184+
rootPath:
1185+
description: RootPath is the etcd prefix for this
1186+
cluster.
1187+
maxLength: 512
1188+
minLength: 1
1189+
type: string
11841190
storage:
11851191
description: Storage configuration for Etcd data.
11861192
properties:
@@ -1231,6 +1237,12 @@ spec:
12311237
x-kubernetes-validations:
12321238
- message: endpoints must be valid URLs
12331239
rule: self.all(x, x.matches('^https?://'))
1240+
rootPath:
1241+
description: RootPath is the etcd prefix for this
1242+
cluster.
1243+
maxLength: 512
1244+
minLength: 1
1245+
type: string
12341246
required:
12351247
- endpoints
12361248
type: object
@@ -7037,6 +7049,11 @@ spec:
70377049
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
70387050
type: object
70397051
type: object
7052+
rootPath:
7053+
description: RootPath is the etcd prefix for this cluster.
7054+
maxLength: 512
7055+
minLength: 1
7056+
type: string
70407057
storage:
70417058
description: Storage configuration for Etcd data.
70427059
properties:
@@ -7087,6 +7104,11 @@ spec:
70877104
x-kubernetes-validations:
70887105
- message: endpoints must be valid URLs
70897106
rule: self.all(x, x.matches('^https?://'))
7107+
rootPath:
7108+
description: RootPath is the etcd prefix for this cluster.
7109+
maxLength: 512
7110+
minLength: 1
7111+
type: string
70907112
required:
70917113
- endpoints
70927114
type: object

config/crd/bases/multigres.com_toposervers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ spec:
116116
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
117117
type: object
118118
type: object
119+
rootPath:
120+
description: RootPath is the etcd prefix for this cluster.
121+
maxLength: 512
122+
minLength: 1
123+
type: string
119124
storage:
120125
description: Storage configuration for Etcd data.
121126
properties:

config/samples/external-etcd.yaml

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
apiVersion: multigres.com/v1alpha1
22
kind: MultigresCluster
33
metadata:
4-
name: external-etcd-cluster
4+
name: ext-etcd
55
namespace: default
66
spec:
77
# ----------------------------------------------------------------
88
# 1. Global Topology (External)
99
# ----------------------------------------------------------------
10-
# Connects to an existing, external Etcd cluster (e.g. cloud managed).
10+
# Connects to the external Etcd cluster defined below.
11+
# This demonstrates how to connect to an existing Etcd cluster.
1112
globalTopoServer:
1213
external:
1314
endpoints:
14-
- "https://etcd-1.infra.local:2379"
15-
- "https://etcd-2.infra.local:2379"
16-
caSecret: "etcd-ca-secret"
17-
clientCertSecret: "etcd-client-cert-secret"
15+
- "http://external-etcd-service.default.svc:2379"
16+
# TLS is optional. For this sample we use HTTP (no secrets required).
17+
# caSecret: "etcd-ca-secret"
18+
# clientCertSecret: "etcd-client-cert-secret"
1819
rootPath: "/multigres/global"
1920

2021
# ----------------------------------------------------------------
@@ -28,19 +29,60 @@ spec:
2829

2930
# Cell B: High-Isolation Configuration
3031
# This cell has its own dedicated, Operator-managed Etcd cluster.
31-
# It does NOT use the global etcd for cell-level data.
32-
# Benefit: If the external global etcd has an outage, this cell
33-
# remains fully functional for intra-cell traffic.
3432
- name: "zone-b-isolated"
3533
zone: "us-east-1b"
3634
spec:
3735
localTopoServer:
3836
etcd:
39-
image: "quay.io/coreos/etcd:v3.5"
37+
image: "gcr.io/etcd-development/etcd:v3.6.7"
4038
replicas: 3
4139
storage:
42-
size: "5Gi"
40+
size: "1Gi"
4341
class: "standard-gp3"
44-
# Since we are defining 'spec', we must also define the gateway
4542
multigateway:
4643
replicas: 2
44+
---
45+
# ----------------------------------------------------------------
46+
# External Etcd Cluster Resource (For Demonstration)
47+
# ----------------------------------------------------------------
48+
apiVersion: apps/v1
49+
kind: Deployment
50+
metadata:
51+
name: external-etcd
52+
namespace: default
53+
labels:
54+
app: external-etcd
55+
spec:
56+
replicas: 1
57+
selector:
58+
matchLabels:
59+
app: external-etcd
60+
template:
61+
metadata:
62+
labels:
63+
app: external-etcd
64+
spec:
65+
containers:
66+
- name: etcd
67+
image: "gcr.io/etcd-development/etcd:v3.6.7"
68+
imagePullPolicy: IfNotPresent
69+
command:
70+
- /usr/local/bin/etcd
71+
- "--advertise-client-urls=http://0.0.0.0:2379"
72+
- "--listen-client-urls=http://0.0.0.0:2379"
73+
ports:
74+
- containerPort: 2379
75+
name: client
76+
---
77+
apiVersion: v1
78+
kind: Service
79+
metadata:
80+
name: external-etcd-service
81+
namespace: default
82+
spec:
83+
selector:
84+
app: external-etcd
85+
ports:
86+
- protocol: TCP
87+
port: 2379
88+
targetPort: 2379

config/samples/no-templates.yaml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,46 @@ spec:
99
# ----------------------------------------------------------------
1010
globalTopoServer:
1111
etcd:
12-
image: "quay.io/coreos/etcd:v3.5"
12+
image: "gcr.io/etcd-development/etcd:v3.6.7"
1313
replicas: 3
1414
storage:
1515
size: "10Gi"
16-
class: "standard-gp3"
16+
class: "standard"
1717
resources:
1818
requests:
19-
cpu: "500m"
20-
memory: "1Gi"
19+
cpu: "100m"
20+
memory: "256Mi"
2121
limits:
22-
cpu: "1"
23-
memory: "2Gi"
22+
cpu: "200m"
23+
memory: "512Mi"
2424

2525
multiadmin:
2626
spec:
2727
replicas: 2
2828
resources:
2929
requests:
30+
cpu: "100m"
31+
memory: "128Mi"
32+
limits:
3033
cpu: "200m"
3134
memory: "256Mi"
32-
limits:
33-
cpu: "500m"
34-
memory: "512Mi"
3535

3636
# ----------------------------------------------------------------
3737
# 2. Cell Definitions (Inline)
3838
# ----------------------------------------------------------------
3939
cells:
40-
- name: "us-east-1a"
41-
zone: "us-east-1a"
40+
- name: "z1"
41+
zone: "z1"
4242
spec:
4343
multigateway:
4444
replicas: 2
4545
resources:
4646
requests:
47-
cpu: "1"
48-
memory: "2Gi"
47+
cpu: "100m"
48+
memory: "128Mi"
4949
limits:
50-
cpu: "2"
51-
memory: "4Gi"
50+
cpu: "200m"
51+
memory: "256Mi"
5252

5353
# ----------------------------------------------------------------
5454
# 3. Database Topology (Inline)
@@ -60,41 +60,41 @@ spec:
6060
- name: "default" # Gateway requires this name at the moment.
6161
default: true
6262
shards:
63-
- name: "0"
63+
- name: "0-inf"
6464
spec:
6565
multiorch:
6666
cells:
67-
- "us-east-1a"
67+
- "z1"
6868
resources:
6969
requests:
70-
cpu: "200m"
71-
memory: "256Mi"
70+
cpu: "50m"
71+
memory: "64Mi"
7272
limits:
73-
cpu: "500m"
74-
memory: "512Mi"
73+
cpu: "100m"
74+
memory: "128Mi"
7575

7676
pools:
77-
main-app:
77+
main:
7878
type: "readWrite"
7979
cells:
80-
- "us-east-1a"
80+
- "z1"
8181
replicasPerCell: 2
8282
storage:
83-
class: "gp3"
83+
class: "standard"
8484
size: "100Gi"
8585
postgres:
8686
resources:
87-
requests:
88-
cpu: "2"
89-
memory: "4Gi"
90-
limits:
91-
cpu: "4"
92-
memory: "8Gi"
87+
requests:
88+
cpu: "100m"
89+
memory: "256Mi"
90+
limits:
91+
cpu: "500m"
92+
memory: "512Mi"
9393
multipooler:
9494
resources:
9595
requests:
96-
cpu: "500m"
97-
memory: "1Gi"
96+
cpu: "50m"
97+
memory: "64Mi"
9898
limits:
99-
cpu: "1"
100-
memory: "2Gi"
99+
cpu: "200m"
100+
memory: "128Mi"

0 commit comments

Comments
 (0)