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

Document the limitation that only custom parameters for fdbserver can be defined #1988

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 25 additions & 3 deletions api/v1beta2/foundationdb_custom_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,29 @@ func (customParameters FoundationDBCustomParameters) GetKnobsForCLI() []string {
return args
}

var (
protectedParameters = map[string]None{
"datadir": {},
}
// See: https://apple.github.io/foundationdb/configuration.html#general-section
fdbMonitorGeneralParameters = map[string]None{
"cluster-file": {},
"delete-envvars": {},
"kill-on-configuration-change": {},
"disable-lifecycle-logging": {},
"restart-delay": {},
"initial-restart-delay": {},
"restart-backoff": {},
"restart-delay-reset-interval": {},
"user": {},
"group": {},
}
)

// ValidateCustomParameters ensures that no duplicate values are set and that no
// protected/forbidden parameters are set. Theoretically we could also check if FDB
// supports the given parameter.
func (customParameters FoundationDBCustomParameters) ValidateCustomParameters() error {
protectedParameters := map[string]None{"datadir": {}}
parameters := make(map[string]None)
violations := make([]string, 0)

Expand All @@ -60,11 +78,15 @@ func (customParameters FoundationDBCustomParameters) ValidateCustomParameters()
if _, ok := parameters[parameterName]; !ok {
parameters[parameterName] = None{}
} else {
violations = append(violations, fmt.Sprintf("found duplicated customParameter: %v", parameterName))
violations = append(violations, fmt.Sprintf("found duplicated customParameter: %s", parameterName))
}

if _, ok := protectedParameters[parameterName]; ok {
violations = append(violations, fmt.Sprintf("found protected customParameter: %v, please remove this parameter from the customParameters list", parameterName))
violations = append(violations, fmt.Sprintf("found protected customParameter: %s, please remove this parameter from the customParameters list", parameterName))
}

if _, ok := fdbMonitorGeneralParameters[parameterName]; ok {
violations = append(violations, fmt.Sprintf("found general or fdbmonitor customParameter: %s, please remove this parameter from the customParameters list as they are not supported", parameterName))
}
}

Expand Down
15 changes: 12 additions & 3 deletions api/v1beta2/foundationdb_custom_parameter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,29 @@ var _ = Describe("FoundationDBCustomParameters", func() {
FoundationDBCustomParameters{
"datadir=test",
},
errors.New("found the following customParameters violations:\nfound protected customParameter: datadir, please remove this parameter from the customParameters list")),
errors.New("found the following customParameters violations:\nfound protected customParameter: datadir, please remove this parameter from the customParameters list"),
),
Entry("duplicate custom parameters",
FoundationDBCustomParameters{
"test=test",
"test=test",
},
errors.New("found the following customParameters violations:\nfound duplicated customParameter: test")),
errors.New("found the following customParameters violations:\nfound duplicated customParameter: test"),
),
Entry("duplicate custom parameters",
FoundationDBCustomParameters{
"test=test",
"datadir=test",
"test=test",
},
errors.New("found the following customParameters violations:\nfound protected customParameter: datadir, please remove this parameter from the customParameters list\nfound duplicated customParameter: test")),
errors.New("found the following customParameters violations:\nfound protected customParameter: datadir, please remove this parameter from the customParameters list\nfound duplicated customParameter: test"),
),
Entry("custom parameters that sets general knob",
FoundationDBCustomParameters{
"restart-delay",
},
errors.New("found the following customParameters violations:\nfound general or fdbmonitor customParameter: restart-delay, please remove this parameter from the customParameters list as they are not supported"),
),
)
})
})
4 changes: 3 additions & 1 deletion api/v1beta2/foundationdbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,9 @@ type ProcessSettings struct {
VolumeClaimTemplate *corev1.PersistentVolumeClaim `json:"volumeClaimTemplate,omitempty"`

// CustomParameters defines additional parameters to pass to the fdbserver
// process.
// process. Only parameters for the [fdbserver] section are supported. Parameters
// from the [general] and [fdbmonitor] section are not supported. For more Information
// see: https://apple.github.io/foundationdb/configuration.html#general-section
CustomParameters FoundationDBCustomParameters `json:"customParameters,omitempty"`
}

Expand Down
2 changes: 1 addition & 1 deletion docs/cluster_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ ProcessSettings defines process-level settings.
| ----- | ----------- | ------ | -------- |
| podTemplate | PodTemplate allows customizing the pod. If a container image with a tag is specified the operator will throw an error and stop processing the cluster. | *[corev1.PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#podtemplatespec-v1-core) | false |
| volumeClaimTemplate | VolumeClaimTemplate allows customizing the persistent volume claim for the pod. This will be ignored by the operator for stateless processes. | *[corev1.PersistentVolumeClaim](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#persistentvolumeclaim-v1-core) | false |
| customParameters | CustomParameters defines additional parameters to pass to the fdbserver process. | FoundationDBCustomParameters | false |
| customParameters | CustomParameters defines additional parameters to pass to the fdbserver process. Only parameters for the [fdbserver] section are supported. Parameters from the [general] and [fdbmonitor] section are not supported. For more Information see: https://apple.github.io/foundationdb/configuration.html#general-section | FoundationDBCustomParameters | false |

[Back to TOC](#table-of-contents)

Expand Down
1 change: 1 addition & 0 deletions docs/manual/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ _NOTE_:

- The custom parameters must be unique and duplicate entries for the same process class will lead to a failure.
- The custom parameters will not be merged together. You have to define the full list of all custom parameters for all process classes.
- Only custom parameters from the `[fdbserver]` section are support. The operator doesn't support changes to the [[fdbmonitor] and [general] section](https://apple.github.io/foundationdb/configuration.html#general-section).

## Upgrading a Cluster

Expand Down
Loading