Skip to content

Commit

Permalink
Add support for reconfigure Elasticsearch (#793)
Browse files Browse the repository at this point in the history
* Add support for reconfigure Elasticsearch

Signed-off-by: kamolhasan <[email protected]>

* Change applyConfig to map

Signed-off-by: kamolhasan <[email protected]>

* Remove deprecation message

Signed-off-by: kamolhasan <[email protected]>
  • Loading branch information
Md Kamol Hasan authored Oct 26, 2021
1 parent 997836d commit 73f09b6
Show file tree
Hide file tree
Showing 11 changed files with 796 additions and 277 deletions.
1 change: 0 additions & 1 deletion apis/catalog/v1alpha1/elasticsearch_version_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type ElasticsearchVersionSpec struct {
// Distribution
Distribution ElasticsearchDistro `json:"distribution,omitempty" protobuf:"bytes,2,opt,name=distribution,casttype=ElasticsearchDistro"`
// Authentication plugin used by Elasticsearch cluster
// Deprecated
AuthPlugin ElasticsearchAuthPlugin `json:"authPlugin" protobuf:"bytes,3,opt,name=authPlugin,casttype=ElasticsearchAuthPlugin"`
// Database Image
DB ElasticsearchVersionDatabase `json:"db" protobuf:"bytes,4,opt,name=db"`
Expand Down
1 change: 0 additions & 1 deletion apis/catalog/v1alpha1/generated.proto

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

2 changes: 1 addition & 1 deletion apis/catalog/v1alpha1/openapi_generated.go

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

30 changes: 30 additions & 0 deletions apis/ops/v1alpha1/elasticsearch_ops_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,37 @@ type ElasticsearchVolumeExpansionTopologySpec struct {
Coordinating *resource.Quantity `json:"coordinating,omitempty" protobuf:"bytes,11,opt,name=coordinating"`
}

// ElasticsearchCustomConfigurationSpec is the spec for Reconfiguring the Elasticsearch Settings
type ElasticsearchCustomConfigurationSpec struct {
// ConfigSecret is an optional field to provide custom configuration file for database.
// +optional
ConfigSecret *core.LocalObjectReference `json:"configSecret,omitempty" protobuf:"bytes,1,opt,name=configSecret"`
// SecureConfigSecret is an optional field to provide secure settings for database.
// - Ref: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/secure-settings.html
// +optional
SecureConfigSecret *core.LocalObjectReference `json:"secureConfigSecret,omitempty" protobuf:"bytes,2,opt,name=secureConfigSecret"`
// ApplyConfig is an optional field to provide Elasticsearch configuration.
// Provided configuration will be applied to config files stored in ConfigSecret.
// If the ConfigSecret is missing, the operator will create a new k8s secret by the
// following naming convention: {db-name}-user-config .
// Expected input format:
// applyConfig:
// file-name.yml: |
// key: value
// elasticsearch.yml: |
// thread_pool:
// write:
// size: 30
// +optional
ApplyConfig map[string]string `json:"applyConfig,omitempty" protobuf:"bytes,3,rep,name=applyConfig"`
// If set to "true", the user provided configuration will be removed.
// The Elasticsearch cluster will start will default configuration that is generated by the operator.
// +optional
RemoveCustomConfig bool `json:"removeCustomConfig,omitempty" protobuf:"varint,4,opt,name=removeCustomConfig"`
// If set to "true", the user provided secure settings will be removed.
// The elasticsearch.keystore will start will default password (i.e. "").
// +optional
RemoveSecureCustomConfig bool `json:"removeSecureCustomConfig,omitempty" protobuf:"varint,5,opt,name=removeSecureCustomConfig"`
}

type ElasticsearchCustomConfiguration struct {
Expand Down
884 changes: 614 additions & 270 deletions apis/ops/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions apis/ops/v1alpha1/generated.proto

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

49 changes: 48 additions & 1 deletion apis/ops/v1alpha1/openapi_generated.go

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

3 changes: 3 additions & 0 deletions apis/ops/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ const (
UpdateDataNodeResources = "UpdateDataNodeResources"
UpdateIngestNodeResources = "UpdateIngestNodeResources"
UpdateCombinedNodeResources = "UpdateCombinedNodeResources"
PrepareCustomConfig = "PrepareCustomConfig"
PrepareSecureCustomConfig = "PrepareSecureCustomConfig"
ReconfigureSecurityAdmin = "ReconfigureSecurityAdmin"

//Redis Constants
PatchedSecret = "patchedSecret"
Expand Down
19 changes: 18 additions & 1 deletion apis/ops/v1alpha1/zz_generated.deepcopy.go

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

19 changes: 19 additions & 0 deletions crds/ops.kubedb.com_elasticsearchopsrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ spec:
spec:
properties:
configuration:
properties:
applyConfig:
additionalProperties:
type: string
type: object
configSecret:
properties:
name:
type: string
type: object
removeCustomConfig:
type: boolean
removeSecureCustomConfig:
type: boolean
secureConfigSecret:
properties:
name:
type: string
type: object
type: object
databaseRef:
properties:
Expand Down
31 changes: 29 additions & 2 deletions openapi/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -27820,7 +27820,7 @@
],
"properties": {
"authPlugin": {
"description": "Authentication plugin used by Elasticsearch cluster Deprecated",
"description": "Authentication plugin used by Elasticsearch cluster",
"type": "string",
"default": ""
},
Expand Down Expand Up @@ -31784,7 +31784,34 @@
}
},
"dev.kubedb.apimachinery.apis.ops.v1alpha1.ElasticsearchCustomConfigurationSpec": {
"type": "object"
"description": "ElasticsearchCustomConfigurationSpec is the spec for Reconfiguring the Elasticsearch Settings",
"type": "object",
"properties": {
"applyConfig": {
"description": "ApplyConfig is an optional field to provide Elasticsearch configuration. Provided configuration will be applied to config files stored in ConfigSecret. If the ConfigSecret is missing, the operator will create a new k8s secret by the following naming convention: {db-name}-user-config . Expected input format:\n\tapplyConfig:\n\t\tfile-name.yml: |\n\t\t\tkey: value\n\t\telasticsearch.yml: |\n\t\t\tthread_pool:\n\t\t\t\twrite:\n\t\t\t\t\tsize: 30",
"type": "object",
"additionalProperties": {
"type": "string",
"default": ""
}
},
"configSecret": {
"description": "ConfigSecret is an optional field to provide custom configuration file for database.",
"$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference"
},
"removeCustomConfig": {
"description": "If set to \"true\", the user provided configuration will be removed. The Elasticsearch cluster will start will default configuration that is generated by the operator.",
"type": "boolean"
},
"removeSecureCustomConfig": {
"description": "If set to \"true\", the user provided secure settings will be removed. The elasticsearch.keystore will start will default password (i.e. \"\").",
"type": "boolean"
},
"secureConfigSecret": {
"description": "SecureConfigSecret is an optional field to provide secure settings for database.\n\t- Ref: https://www.elastic.co/guide/en/elasticsearch/reference/7.14/secure-settings.html",
"$ref": "#/definitions/io.k8s.api.core.v1.LocalObjectReference"
}
}
},
"dev.kubedb.apimachinery.apis.ops.v1alpha1.ElasticsearchHorizontalScalingSpec": {
"description": "ElasticsearchHorizontalScalingSpec contains the horizontal scaling information of an Elasticsearch cluster",
Expand Down

0 comments on commit 73f09b6

Please sign in to comment.