Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Localities to FoundationDBClusterSpec #1353

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
cb5778a
Add Localities to FDB cluster types
manfontan Sep 8, 2022
88c8be5
Autogenerated deepcopy for localities
manfontan Sep 8, 2022
a01e4ab
Update FDB Cluster CRD
manfontan Sep 8, 2022
6a75107
Merge branch 'FoundationDB:main' into CDF-1816-Add-fdb-cluster-locali…
manfontan Sep 8, 2022
10d2e4a
Merge branch 'FoundationDB:main' into CDF-1816-Add-fdb-cluster-locali…
manfontan Sep 15, 2022
8d6a772
Apply review comments
manfontan Sep 16, 2022
3eb6e7d
Merge branch 'CDF-1816-Add-fdb-cluster-localities' of https://github.…
manfontan Sep 16, 2022
4382b8e
Update v1beta2 resources
manfontan Oct 21, 2022
fe3f1da
Add nodeSelector field to Localities.
manfontan Nov 15, 2022
4ebb5f9
Add validate check for localities when three data hall is enabled
manfontan Nov 15, 2022
ec012e7
Add validate check for localities when three data hall is enabled
manfontan Nov 15, 2022
4fb2dc7
Add TODO comments for initial draft
manfontan Nov 16, 2022
fceb6a1
Merge remote-tracking branch 'origin' into CDF-1816-Add-fdb-cluster-l…
manfontan Nov 16, 2022
2f0b162
Add additional TODO comments for draft implementation
manfontan Nov 17, 2022
fc6166e
Continue with the implementation and update TODO/DONE comments
manfontan Nov 22, 2022
eb7cc09
Merge remote-tracking branch 'upstream/main' into CDF-1816-Add-fdb-cl…
manfontan Nov 22, 2022
aa82180
Remove v1beta1 code. Update comments. Add more code to the draft impl…
manfontan Nov 22, 2022
5349992
lint. Update docs.
manfontan Nov 22, 2022
0290332
lint
manfontan Nov 22, 2022
2e32144
lint
manfontan Nov 22, 2022
a109ac6
lint
manfontan Nov 22, 2022
83e42c9
lint
manfontan Nov 22, 2022
6c809bc
lint
manfontan Nov 22, 2022
6ad5eff
fmt, lint
manfontan Nov 22, 2022
526a3ab
po-docgen
manfontan Nov 22, 2022
5839e7e
po-docgen
manfontan Nov 22, 2022
226f664
typos
manfontan Nov 22, 2022
492ef53
typo
manfontan Nov 22, 2022
2e42fe0
fix controller tests. Add TODO comments to fix internal pacakge tests
manfontan Nov 23, 2022
60f00f7
fix tests: use empty status for internal package GetPod calls
manfontan Nov 23, 2022
d10e1a6
fix test
manfontan Nov 23, 2022
2eaabaa
Enable locality_data_hall for fdbmonitor using zoneID configured by t…
manfontan Nov 24, 2022
a483105
Merge remote-tracking branch 'upstream/main' into CDF-1816-Add-fdb-cl…
manfontan Nov 24, 2022
7be57e0
lint
manfontan Nov 24, 2022
d4263f1
lint
manfontan Nov 24, 2022
12b9cb9
Code review fixes
manfontan Nov 29, 2022
0a082f4
Code Review fixes
manfontan Dec 7, 2022
169f334
bugfix: skip empty process groups with no processes
manfontan Dec 7, 2022
0b670be
Fix upstream build errors
manfontan Dec 7, 2022
6e028c7
update comments
manfontan Dec 14, 2022
eca08c2
Merge remote-tracking branch 'origin/master' into CDF-1816-Add-fdb-cl…
manfontan Feb 1, 2023
e179228
lint
manfontan Feb 1, 2023
d07a503
Merge remote-tracking branch 'upstream/main' into CDF-1816-Add-fdb-cl…
manfontan Feb 16, 2023
1eb8d97
Merge remote-tracking branch 'origin' into CDF-1816-Add-fdb-cluster-l…
manfontan Feb 23, 2023
ebe24b9
typo
manfontan Feb 24, 2023
d6c6c57
minor fixes and remove logic updates
manfontan Mar 9, 2023
6aef3e4
Merge remote-tracking branch 'origin/master' into CDF-1816-Add-fdb-cl…
manfontan Mar 9, 2023
e0e8601
update tests
manfontan Mar 9, 2023
bb87037
bugfix: typo in three data hall flag in replacements.go
manfontan Mar 9, 2023
783d60c
add docs
manfontan Mar 9, 2023
974a61a
simplify logic
manfontan Mar 10, 2023
bfc1cec
Set LocalityDataHall to empty string when three data hall is not conf…
manfontan Mar 14, 2023
f0ecfcd
Merge remote-tracking branch 'origin/master' into CDF-1816-Add-fdb-cl…
manfontan Mar 14, 2023
3a2a36d
Add GetPod unit test
manfontan Mar 14, 2023
06972fa
update getPod unit test. Minor fixes to Get Pod logic when three data…
manfontan Mar 14, 2023
85c6873
lint
manfontan Mar 14, 2023
1ac900a
Add update_status tests.
manfontan Mar 14, 2023
05b1207
remove printf
manfontan Mar 14, 2023
80ca79c
fix typo
manfontan Apr 11, 2023
af004d4
Merge remote-tracking branch 'upstream/main' into CDF-1816-Add-fdb-cl…
manfontan Apr 11, 2023
f32bf80
lint
manfontan Apr 11, 2023
8312fde
fix typo
manfontan Apr 11, 2023
da7001d
fix typo
manfontan Apr 11, 2023
fad17f9
update docs
manfontan Apr 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions api/v1beta1/foundationdbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ type FoundationDBClusterSpec struct {
// UseUnifiedImage determines if we should use the unified image rather than
// separate images for the main container and the sidecar container.
UseUnifiedImage *bool `json:"useUnifiedImage,omitempty"`

// Localities is used to configure the cluster localities for three_data_hall
// and three_data_center deployments
manfontan marked this conversation as resolved.
Show resolved Hide resolved
Localities []Locality `json:"localities,omitempty"`
}

// ImageType defines a single kind of images used in the cluster.
Expand Down Expand Up @@ -2278,3 +2282,20 @@ func (cluster *FoundationDBCluster) GetProcessClassLabels() []string {

return []string{FDBProcessClassLabel}
}

// Locality represents the locality for the cluster.
type Locality struct {
Key string `json:"key,omitempty"`
Value string `json:"value,omitempty"`
EnvValue string `json:"envValue,omitempty"`
TopologyKey string `json:"topologyKey,omitempty"`
}

// GetLocalities returns the cluster localities
func (cluster *FoundationDBCluster) GetLocalities() []Locality {
result := make([]Locality, 0)

result = append(result, cluster.Spec.Localities...)

return result
manfontan marked this conversation as resolved.
Show resolved Hide resolved
}
43 changes: 43 additions & 0 deletions api/v1beta1/foundationdbcluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3735,4 +3735,47 @@ var _ = Describe("[api] FoundationDBCluster", func() {
),
)
})

When("getting cluster localities", func() {
It("should return the localities", func() {
cluster := &FoundationDBCluster{
ObjectMeta: metav1.ObjectMeta{
Name: "foo",
Namespace: "default",
},
Spec: FoundationDBClusterSpec{
Version: Versions.Default.String(),
Localities: []Locality{
{
Key: "data_hall",
Value: "",
EnvValue: "",
TopologyKey: "topology.kubernetes.io/zone",
},
{
Key: "zone",
Value: "",
EnvValue: "MyFancyZone",
TopologyKey: "kubernetes.io/hostname",
},
},
},
}

Expect(cluster.GetLocalities()).To(Equal([]Locality{
{
Key: "data_hall",
Value: "",
EnvValue: "",
TopologyKey: "topology.kubernetes.io/zone",
},
{
Key: "zone",
Value: "",
EnvValue: "MyFancyZone",
TopologyKey: "kubernetes.io/hostname",
},
}))
})
})
})
20 changes: 20 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/v1beta2/foundationdb_database_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ func (configuration DatabaseConfiguration) AreSeparatedProxiesConfigured() bool
// AreSeparatedProxiesConfigured(), then this function will return the
// string "commit_proxies=%d grv_proxies=%d", otherwise just
// "proxies=%d" using the correct counts of the configuration object.
//
func (configuration DatabaseConfiguration) GetProxiesString(version Version) string {
counts := configuration.GetRoleCountsWithDefaults(version, DesiredFaultTolerance(configuration.RedundancyMode))
if version.HasSeparatedProxies() && configuration.AreSeparatedProxiesConfigured() {
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta2/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ limitations under the License.
*/

// Package v1beta2 contains API Schema definitions for the apps v1beta2 API group
//+kubebuilder:object:generate=true
//+groupName=apps.foundationdb.org
// +kubebuilder:object:generate=true
// +groupName=apps.foundationdb.org
package v1beta2

import (
Expand Down
13 changes: 13 additions & 0 deletions config/crd/bases/apps.foundationdb.org_foundationdbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,19 @@ spec:
type: string
type: object
type: object
localities:
items:
properties:
envValue:
type: string
key:
type: string
topologyKey:
type: string
value:
type: string
type: object
type: array
lockOptions:
properties:
denyList:
Expand Down