-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: support parameters api for redis
- Loading branch information
Showing
7 changed files
with
75 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 11 additions & 14 deletions
25
...ates/redis-cluster7-configconstraint.yaml → ...s/templates/paramsdef-redis-cluster7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,34 @@ | ||
{{- $cc := .Files.Get "config/redis7-config-effect-scope.yaml" | fromYaml }} | ||
apiVersion: apps.kubeblocks.io/v1beta1 | ||
kind: ConfigConstraint | ||
{{- $pd := .Files.Get "config/redis7-config-effect-scope.yaml" | fromYaml }} | ||
apiVersion: parameters.kubeblocks.io/v1alpha1 | ||
kind: ParametersDefinition | ||
metadata: | ||
name: {{ include "redisCluster7.configConstraint" . }} | ||
name: {{ include "redisCluster7.paramsDefName" . }} | ||
labels: | ||
{{- include "redis.labels" . | nindent 4 }} | ||
spec: | ||
|
||
fileName: redis.conf | ||
# ConfigurationSchema that impose restrictions on engine parameter's rule | ||
parametersSchema: | ||
topLevelKey: RedisParameter | ||
cue: |- | ||
{{- .Files.Get "config/redis-cluster7-config-constraint.cue" | nindent 6 }} | ||
## require db instance restart | ||
{{- if hasKey $cc "staticParameters" }} | ||
{{- if hasKey $pd "staticParameters" }} | ||
staticParameters: | ||
{{- $params := get $cc "staticParameters" }} | ||
{{- $params := get $pd "staticParameters" }} | ||
{{- range $params }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end}} | ||
|
||
## reload parameters | ||
## dynamicParameters | ||
{{- if hasKey $cc "dynamicParameters" }} | ||
{{- if hasKey $pd "dynamicParameters" }} | ||
dynamicParameters: | ||
{{- $params := get $cc "dynamicParameters" }} | ||
{{- $params := get $pd "dynamicParameters" }} | ||
{{- range $params }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end}} | ||
|
||
|
||
# redis configuration file format | ||
fileFormatConfig: | ||
format: redis | ||
{{- end}} |
24 changes: 10 additions & 14 deletions
24
...is/templates/redis7-configconstraint.yaml → addons/redis/templates/paramsdef-redis7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,34 @@ | ||
{{- $cc := .Files.Get "config/redis7-config-effect-scope.yaml" | fromYaml }} | ||
apiVersion: apps.kubeblocks.io/v1beta1 | ||
kind: ConfigConstraint | ||
{{- $pd := .Files.Get "config/redis7-config-effect-scope.yaml" | fromYaml }} | ||
apiVersion: parameters.kubeblocks.io/v1alpha1 | ||
kind: ParametersDefinition | ||
metadata: | ||
name: {{ include "redis7.configConstraint" . }} | ||
name: {{ include "redis7.paramsDefName" . }} | ||
labels: | ||
{{- include "redis.labels" . | nindent 4 }} | ||
spec: | ||
|
||
fileName: redis.conf | ||
# ConfigurationSchema that impose restrictions on engine parameter's rule | ||
parametersSchema: | ||
topLevelKey: RedisParameter | ||
cue: |- | ||
{{- .Files.Get "config/redis7-config-constraint.cue" | nindent 6 }} | ||
## require db instance restart | ||
{{- if hasKey $cc "staticParameters" }} | ||
{{- if hasKey $pd "staticParameters" }} | ||
staticParameters: | ||
{{- $params := get $cc "staticParameters" }} | ||
{{- $params := get $pd "staticParameters" }} | ||
{{- range $params }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end}} | ||
|
||
## reload parameters | ||
## dynamicParameters | ||
{{- if hasKey $cc "dynamicParameters" }} | ||
{{- if hasKey $pd "dynamicParameters" }} | ||
dynamicParameters: | ||
{{- $params := get $cc "dynamicParameters" }} | ||
{{- $params := get $pd "dynamicParameters" }} | ||
{{- range $params }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end}} | ||
|
||
|
||
# redis configuration file format | ||
fileFormatConfig: | ||
format: redis | ||
{{- end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: parameters.kubeblocks.io/v1alpha1 | ||
kind: ParameterDrivenConfigRender | ||
metadata: | ||
name: {{ include "redisCluster7.pcrName" . }} | ||
labels: | ||
{{- include "redis.labels" . | nindent 4 }} | ||
spec: | ||
componentDef: {{ include "redisCluster7.cmpdName" . }} | ||
parametersDefs: | ||
- {{ include "redisCluster7.paramsDefName" . }} | ||
|
||
configs: | ||
- name: redis.conf | ||
templateName: redis-cluster-config | ||
fileFormatConfig: | ||
format: redis | ||
reRenderResourceTypes: | ||
- vscale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: parameters.kubeblocks.io/v1alpha1 | ||
kind: ParameterDrivenConfigRender | ||
metadata: | ||
name: {{ include "redis7.pcrName" . }} | ||
labels: | ||
{{- include "redis.labels" . | nindent 4 }} | ||
spec: | ||
componentDef: {{ include "redis7.cmpdName" . }} | ||
parametersDefs: | ||
- {{ include "redis7.paramsDefName" . }} | ||
|
||
configs: | ||
- name: redis.conf | ||
templateName: redis-replication-config | ||
fileFormatConfig: | ||
format: redis | ||
reRenderResourceTypes: | ||
- vscale |