Skip to content

Commit

Permalink
Rename raft config to cluster. Fixes #2731
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Feb 4, 2025
1 parent 15fd986 commit 6a01db9
Show file tree
Hide file tree
Showing 21 changed files with 45 additions and 46 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
* Router Controller Endpoint Change#s
* Bug fixes

## Config Changes

**NOTE:** For HA configuration, the `raft:` config stanza is now named `cluster:`.

Example:

```yaml
cluster:
dataDir: ./data
```
## Event Doc and Consistency
The event types are now exhaustively documented as part of the [OpenZiti Reference Documentation](https://openziti.io/docs/reference/events).
Expand Down
2 changes: 1 addition & 1 deletion controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func LoadConfig(path string) (*Config, error) {
}
}

if value, found := cfgmap["raft"]; found {
if value, found := cfgmap["cluster"]; found {
if submap, ok := value.(map[interface{}]interface{}); ok {
controllerConfig.Raft = &RaftConfig{}

Expand Down
2 changes: 1 addition & 1 deletion doc/ha/ctrl1.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
v: 3
raft:
cluster:
dataDir: ./data/ctrl1
# initialMembers:
# - tls:127.0.0.1:6363
Expand Down
2 changes: 1 addition & 1 deletion doc/ha/ctrl2.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
v: 3

raft:
cluster:
dataDir: ./data/ctrl2

identity:
Expand Down
2 changes: 1 addition & 1 deletion doc/ha/ctrl3.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
v: 3

raft:
cluster:
dataDir: ./data/ctrl3

identity:
Expand Down
7 changes: 3 additions & 4 deletions doc/ha/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ An HA setup will have:
The location of all three is controlled by the raft/dataDir config property.

```yaml
raft:
cluster:
dataDir: /var/ziti/data/
```
Expand All @@ -49,10 +49,9 @@ of 1 is mostly useful for testing and development.
**Config File Example**
```yaml
raft:
cluster:
dataDir: /var/ziti/data/
minClusterSize: 3
bootstrapMembers:
initialMembers:
- tls:192.168.1.100
- tls:192.168.1.101
```
Expand Down
4 changes: 2 additions & 2 deletions doc/ha/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ certificate.

### Updating Configuration

Add a `raft` stanza to the configuration. See the
Add a `cluster` stanza to the configuration. See the
[relevant configuration reference](https://openziti.io/docs/reference/configuration/controller#raft)
for information on other fields.

```yaml
raft:
cluster:
dataDir: /path/to/data/dir
```
Expand Down
3 changes: 1 addition & 2 deletions etc/ctrl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ identity:

trustDomain: usedForLegacyNonHaNetworksWithoutSpiffeIdsInCerts

raft:
minClusterSize: 1
cluster:
advertiseAddress: tcp:localhost:1380
bindAddress: tcp:0.0.0.0:1380
dataDir: /home/plorenz/work/var/data/
Expand Down
3 changes: 1 addition & 2 deletions etc/ctrl2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ identity:

trustDomain: usedForLegacyNonHaNetworksWithoutSpiffeIdsInCerts

raft:
minClusterSize: 3
cluster:
advertiseAddress: tcp:localhost:1381
bindAddress: tcp:0.0.0.0:1381
dataDir: /home/plorenz/work/var/data2/
Expand Down
3 changes: 1 addition & 2 deletions etc/ctrl3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ identity:

trustDomain: usedForLegacyNonHaNetworksWithoutSpiffeIdsInCerts

raft:
minClusterSize: 3
cluster:
advertiseAddress: tcp:localhost:1382
bindAddress: tcp:0.0.0.0:1382
dataDir: /home/plorenz/work/var/data3/
Expand Down
8 changes: 3 additions & 5 deletions ziti/cmd/create/config_templates/controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ v: 3
# path: ctrl.memprof


{{ if .Controller.Ctrl.MinClusterSize }}
raft:
{{ if .Controller.Ctrl.Clustered }}
cluster:
dataDir: "{{ .ZitiHome }}/raft"
minClusterSize: {{ .Controller.Ctrl.MinClusterSize }}
{{ else }}
db: "{{ .Controller.Database.DatabaseFile }}"
# uncomment and configure to enable HA
# raft:
# cluster:
# dataDir: "{{ .ZitiHome }}/raft"
# minClusterSize: 1
{{ end }}

identity:
Expand Down
2 changes: 1 addition & 1 deletion ziti/cmd/create/create_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type CtrlValues struct {
AdvertisedPort string
BindAddress string
AltAdvertisedAddress string
MinClusterSize int
Clustered bool
InstanceId string
}

Expand Down
8 changes: 4 additions & 4 deletions ziti/cmd/create/create_config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
optionCtrlPort = "ctrlPort"
optionEdgeIdentityEnrollmentDuration = "identityEnrollmentDuration"
optionEdgeRouterEnrollmentDuration = "routerEnrollmentDuration"
optionMinCluster = "minCluster"
optionClustered = "clustered"
)

var (
Expand Down Expand Up @@ -74,7 +74,7 @@ type CreateConfigControllerOptions struct {
CtrlPort string
EdgeIdentityEnrollmentDuration time.Duration
EdgeRouterEnrollmentDuration time.Duration
MinCluster int
Clustered bool
}

type CreateControllerConfigCmd struct {
Expand Down Expand Up @@ -109,7 +109,7 @@ func NewCmdCreateConfigController() *CreateControllerConfigCmd {
}

data.PopulateConfigValues()
data.Controller.Ctrl.MinClusterSize = controllerOptions.MinCluster
data.Controller.Ctrl.Clustered = controllerOptions.Clustered

// Update controller specific values with configOptions passed in if the argument was provided or the value is currently blank
if data.Controller.Ctrl.AdvertisedPort == "" || controllerOptions.CtrlPort != constants.DefaultCtrlAdvertisedPort {
Expand Down Expand Up @@ -153,7 +153,7 @@ func (options *CreateConfigControllerOptions) addFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&options.CtrlPort, optionCtrlPort, constants.DefaultCtrlAdvertisedPort, "port used for the router to controller communication")
cmd.Flags().DurationVar(&options.EdgeIdentityEnrollmentDuration, optionEdgeIdentityEnrollmentDuration, edge.DefaultEdgeEnrollmentDuration, "the edge identity enrollment duration, use 0h0m0s format")
cmd.Flags().DurationVar(&options.EdgeRouterEnrollmentDuration, optionEdgeRouterEnrollmentDuration, edge.DefaultEdgeEnrollmentDuration, "the edge router enrollment duration, use 0h0m0s format")
cmd.Flags().IntVar(&options.MinCluster, optionMinCluster, 0, "minimum cluster size. Enables HA mode if > 0")
cmd.Flags().BoolVar(&options.Clustered, optionClustered, false, "Enables HA mode if true")
}

// run implements the command
Expand Down
3 changes: 1 addition & 2 deletions zititest/models/db-sdk-hosting-test/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
v: 3

{{if .Component.GetFlag "ha"}}
raft:
minClusterSize: 3
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata
{{else}}
db: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/ctrl.db
Expand Down
5 changes: 2 additions & 3 deletions zititest/models/dtls-west/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
v: 3

{{if .Component.GetFlag "ha"}}
raft:
minClusterSize: 3
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata
{{else}}
db: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrl.db
Expand Down Expand Up @@ -193,4 +192,4 @@ web:
- binding: fabric
- binding: edge-management
- binding: edge-client
- binding: edge-oidc
- binding: edge-oidc
5 changes: 2 additions & 3 deletions zititest/models/dtls/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
v: 3

{{if .Component.GetFlag "ha"}}
raft:
minClusterSize: 3
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata
{{else}}
db: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrl.db
Expand Down Expand Up @@ -193,4 +192,4 @@ web:
- binding: fabric
- binding: edge-management
- binding: edge-client
- binding: edge-oidc
- binding: edge-oidc
3 changes: 1 addition & 2 deletions zititest/models/links-test/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
v: 3

raft:
minClusterSize: 3
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata

identity:
Expand Down
4 changes: 2 additions & 2 deletions zititest/models/router-data-model-test/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
v: 3

raft:
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata

identity:
Expand Down Expand Up @@ -194,4 +194,4 @@ web:
- binding: fabric
- binding: edge-management
- binding: edge-client
- binding: edge-oidc
- binding: edge-oidc
5 changes: 2 additions & 3 deletions zititest/models/sdk-hosting-test/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
v: 3

{{if .Component.GetFlag "ha"}}
raft:
minClusterSize: 3
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata
{{else}}
db: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/ctrl.db
Expand Down Expand Up @@ -198,4 +197,4 @@ web:
- binding: fabric
- binding: edge-management
- binding: edge-client
- binding: edge-oidc
- binding: edge-oidc
4 changes: 2 additions & 2 deletions zititest/models/sdk-status-test/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
v: 3

raft:
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata

identity:
Expand Down Expand Up @@ -197,4 +197,4 @@ web:
- binding: fabric
- binding: edge-management
- binding: edge-client
- binding: edge-oidc
- binding: edge-oidc
5 changes: 2 additions & 3 deletions zititest/models/smoke/configs/ctrl.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
v: 3

{{if .Component.GetFlag "ha"}}
raft:
minClusterSize: 3
cluster:
dataDir: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrldata
{{else}}
db: /home/{{ .Model.MustVariable "credentials.ssh.username" }}/fablab/ctrl.db
Expand Down Expand Up @@ -195,4 +194,4 @@ web:
- binding: fabric
- binding: edge-management
- binding: edge-client
- binding: edge-oidc
- binding: edge-oidc

0 comments on commit 6a01db9

Please sign in to comment.