Skip to content

Commit

Permalink
Update KubeDB api (#577)
Browse files Browse the repository at this point in the history
Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm authored Jan 7, 2021
1 parent d49954d commit 4e216d5
Show file tree
Hide file tree
Showing 17 changed files with 862 additions and 351 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
kmodules.xyz/custom-resources v0.0.0-20201124062543-bd8d35c21b0c
kmodules.xyz/monitoring-agent-api v0.0.0-20201105074044-be7a1044891a
kmodules.xyz/objectstore-api v0.0.0-20201105133858-cbb2af88d50a
kubedb.dev/apimachinery v0.16.0-rc.0.0.20210105043123-31ec37c3e5e7
kubedb.dev/apimachinery v0.16.0-rc.0.0.20210106185329-7a3dd5ee0094
stash.appscode.dev/apimachinery v0.11.8
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,8 @@ kmodules.xyz/openshift v0.0.0-20201105073146-0da509a7d39f/go.mod h1:vFwB/f5rVH5Q
kmodules.xyz/prober v0.0.0-20201105074402-a243b3a27fd8 h1:UJb5lHQVFKbmlgmRLq5IWJGtz3JqYYbyVG+dNdjC9Cc=
kmodules.xyz/prober v0.0.0-20201105074402-a243b3a27fd8/go.mod h1:2eN8X5Wq7/AAgE5AWMAX8T0lE51HZiYEldG2RQuouX4=
kmodules.xyz/webhook-runtime v0.0.0-20201105073856-2dc7382b88c6/go.mod h1:xLgewoOzwR5ZrVOHQ2SR0P4E7tgCyBWbYlUawEXgeF4=
kubedb.dev/apimachinery v0.16.0-rc.0.0.20210105043123-31ec37c3e5e7 h1:6PVlaspImIjoSNhtHJiBa08iJnz7iu7Agnc29Nip0Jw=
kubedb.dev/apimachinery v0.16.0-rc.0.0.20210105043123-31ec37c3e5e7/go.mod h1:jfH9wMWLd+rgDagKSFegJ1OJE8FU3V3rc+0dBCdi1sk=
kubedb.dev/apimachinery v0.16.0-rc.0.0.20210106185329-7a3dd5ee0094 h1:nLZ5i2Z1gTDQdU5ScjiBtb+wZon5nDyy9jXm0uVoDUQ=
kubedb.dev/apimachinery v0.16.0-rc.0.0.20210106185329-7a3dd5ee0094/go.mod h1:jfH9wMWLd+rgDagKSFegJ1OJE8FU3V3rc+0dBCdi1sk=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
Expand Down
5 changes: 5 additions & 0 deletions vendor/kubedb.dev/apimachinery/apis/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ limitations under the License.

package apis

import (
"kmodules.xyz/client-go/apiextensions"
)

const (
Finalizer = "kubedb.com"
)
Expand All @@ -26,4 +30,5 @@ type ResourceInfo interface {
ResourceKind() string
ResourceSingular() string
ResourcePlural() string
CustomResourceDefinition() *apiextensions.CustomResourceDefinition
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ const (
ElasticsearchIngestNodePrefix = "ingest"
ElasticsearchDataNodePrefix = "data"
ElasticsearchMasterNodePrefix = "master"
ElasticsearchNodeRoleMaster = "node.role.master"
ElasticsearchNodeRoleIngest = "node.role.ingest"
ElasticsearchNodeRoleData = "node.role.data"
ElasticsearchNodeRoleMaster = kubedb.GroupName + "/" + "role-master"
ElasticsearchNodeRoleIngest = kubedb.GroupName + "/" + "role-ingest"
ElasticsearchNodeRoleData = kubedb.GroupName + "/" + "role-data"
ElasticsearchNodeRoleSet = "set"
ElasticsearchConfigDir = "/usr/share/elasticsearch/config"
ElasticsearchTempConfigDir = "/elasticsearch/temp-config"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,20 @@ func (e *Elasticsearch) SetDefaults(esVersion *v1alpha1.ElasticsearchVersion, to
setDefaultResourceLimits(&e.Spec.PodTemplate.Spec.Resources, defaultResourceLimits, defaultResourceLimits)
}

// set default kernel settings
// - Ref: https://www.elastic.co/guide/en/elasticsearch/reference/7.9/vm-max-map-count.html
if e.Spec.KernelSettings == nil {
e.Spec.KernelSettings = &KernelSettings{
Privileged: true,
Sysctls: []core.Sysctl{
{
Name: "vm.max_map_count",
Value: "262144",
},
},
}
}

e.setDefaultAffinity(&e.Spec.PodTemplate, e.OffshootSelectors(), topology)
e.SetTLSDefaults(esVersion)
e.Spec.Monitor.SetDefaults()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ type ElasticsearchSpec struct {
// TerminationPolicy controls the delete operation for database
// +optional
TerminationPolicy TerminationPolicy `json:"terminationPolicy,omitempty" protobuf:"bytes,19,opt,name=terminationPolicy,casttype=TerminationPolicy"`

// KernelSettings contains the additional kernel settings.
// +optional
KernelSettings *KernelSettings `json:"kernelSettings,omitempty" protobuf:"bytes,20,opt,name=kernelSettings"`
}

type ElasticsearchClusterTopology struct {
Expand Down
Loading

0 comments on commit 4e216d5

Please sign in to comment.