Skip to content
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
5 changes: 5 additions & 0 deletions charts/opensearch-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ cluster:
# -- bootstrap pod affinity rules
affinity: {}

# -- bootstrap pod annotations
annotations: {}

# -- bootstrap pod jvm options. If jvm is not provided then the java heap size will be set to half of resources.requests.memory which is the recommend value for data nodes.
# If jvm is not provided and resources.requests.memory does not exist then value will be -Xmx512M -Xms512M
jvm: ""
Expand Down Expand Up @@ -243,6 +246,8 @@ cluster:
# -- Opensearch nodes configuration
nodePools:
- component: masters
# -- node pool pod annotations
annotations: {}
diskSize: "30Gi"
replicas: 3
roles:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,10 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
jvm:
type: string
keystore:
Expand Down
1 change: 1 addition & 0 deletions opensearch-operator/api/v1/opensearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ type BootstrapConfig struct {
Jvm string `json:"jvm,omitempty"`
// Extra items to add to the opensearch.yml, defaults to General.AdditionalConfig
AdditionalConfig map[string]string `json:"additionalConfig,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
PluginsList []string `json:"pluginsList,omitempty"`
Keystore []KeystoreValue `json:"keystore,omitempty"`
}
Expand Down
7 changes: 7 additions & 0 deletions opensearch-operator/api/v1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,10 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
annotations:
additionalProperties:
type: string
type: object
jvm:
type: string
keystore:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func NewOsClusterClientFromConfig(config opensearch.Config) (*OsClusterClient, e
client, err := opensearch.NewClient(config)
if err == nil {
service.client = client
} else {
return nil, err
}
pingReq := opensearchapi.PingRequest{}
pingRes, err := pingReq.Do(context.Background(), client)
Expand Down
7 changes: 4 additions & 3 deletions opensearch-operator/pkg/builders/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,9 +990,10 @@ func NewBootstrapPod(
mainCommand := helpers.BuildMainCommand("./bin/opensearch-plugin", pluginslist, true, startUpCommand)
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: BootstrapPodName(cr),
Namespace: cr.Namespace,
Labels: labels,
Name: BootstrapPodName(cr),
Namespace: cr.Namespace,
Labels: labels,
Annotations: cr.Spec.Bootstrap.Annotations,
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
Expand Down
13 changes: 13 additions & 0 deletions opensearch-operator/pkg/builders/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,19 @@ var _ = Describe("Builders", func() {
}))
})

It("should apply bootstrap pod annotations", func() {
clusterObject := ClusterDescWithVersion("2.2.1")
expectedAnnotations := map[string]string{
"custom-annotation": "custom-value",
"another-annotation": "another-value",
}
clusterObject.Spec.Bootstrap.Annotations = expectedAnnotations

result := NewBootstrapPod(&clusterObject, nil, nil)

Expect(result.ObjectMeta.Annotations).To(Equal(expectedAnnotations))
})

It("should overwrite the General.AdditionalConfig with Bootstrap.AdditionalConfig when set", func() {
mockKey1 := "server.basePath"
mockKey2 := "server.rewriteBasePath"
Expand Down