Skip to content

Commit 5fe322c

Browse files
authored
Merge branch 'main' into unblu/feature/pvc-annotation
Signed-off-by: kannonski <[email protected]>
2 parents 905c60e + af798bf commit 5fe322c

File tree

23 files changed

+635
-69
lines changed

23 files changed

+635
-69
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @idanl21 @ido-opster @dbason @swoehrl-mw @prudhvigodithi @jochenkressin @pchmielnik @salyh
1+
* @prudhvigodithi @synhershko

MAINTAINERS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22

33
| Maintainer | GitHub ID | Affiliation |
44
| --------------- | --------- |--------------|
5+
| Prudhvi Godithi | [prudhvigodithi](https://github.com/prudhvigodithi) | Amazon |
6+
| Itamar Syn-Hershko | [synhershko](https://github.com/synhershko) | BigData Boutique |
7+
8+
# Emeritus
9+
| Maintainer | GitHub ID | Affiliation |
10+
| --------------------- | ------------------------------------------------------- | ---------------- |
511
| Idan Levy | [idanl21](https://github.com/idanl21) | Opster |
612
| Ido | [ido-opster](https://github.com/ido-opster) | Opster |
713
| Dan Bason | [dbason](https://github.com/dbason) | SUSE |
814
| Sebastian Woehrl | [swoehrl-mw](https://github.com/swoehrl-mw) | MaibornWolff |
9-
| Prudhvi Godithi | [prudhvigodithi](https://github.com/prudhvigodithi) | Amazon |
1015
| Jochen Kressin | [jochenkressin](https://github.com/jochenkressin) | Eliatra |
1116
| Piotr Chmielnik | [pchmielnik](https://github.com/pchmielnik) | Eliatra |
1217
| Hendrik Saly | [salyh](https://github.com/salyh) | Eliatra |
1318

19+
1420
The following sections explain what maintainers do in this repo, and how they should be doing it. If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
1521

1622
## Release process

charts/opensearch-cluster/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ cluster:
121121
# -- bootstrap pod affinity rules
122122
affinity: {}
123123

124+
# -- bootstrap pod annotations
125+
annotations: {}
126+
124127
# -- 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.
125128
# If jvm is not provided and resources.requests.memory does not exist then value will be -Xmx512M -Xms512M
126129
jvm: ""
@@ -243,6 +246,8 @@ cluster:
243246
# -- Opensearch nodes configuration
244247
nodePools:
245248
- component: masters
249+
# -- node pool pod annotations
250+
annotations: {}
246251
diskSize: "30Gi"
247252
replicas: 3
248253
roles:

charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,10 @@ spec:
987987
x-kubernetes-list-type: atomic
988988
type: object
989989
type: object
990+
annotations:
991+
additionalProperties:
992+
type: string
993+
type: object
990994
jvm:
991995
type: string
992996
keystore:

docs/userguide/main.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,8 @@ The Opensearch pods by default launch an init container to configure the volume.
659659

660660
Note that the bootstrap pod started during initial cluster setup uses the same (pod)securityContext as the Opensearch pods (with the same limitations for the init containers).
661661

662+
The bootstrap pod uses persistent storage (PVC) to maintain cluster state across restarts during initialization. This prevents cluster formation failures when the bootstrap pod restarts after the security configuration update job completes. The bootstrap PVC is automatically created and deleted along with the bootstrap pod.
663+
662664
### Labels or Annotations on OpenSearch nodes
663665

664666
You can add additional labels or annotations on the nodepool configuration. This is useful for integration with other applications such as a service mesh, or configuring a prometheus scrape endpoint:

opensearch-operator/api/v1/opensearch_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ type PersistenceSource struct {
140140
}
141141

142142
type PVCSource struct {
143-
StorageClassName string `json:"storageClass,omitempty"`
143+
StorageClassName *string `json:"storageClass,omitempty"`
144144
AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
145145
Annotations map[string]string `json:"annotations,omitempty"`
146146
Labels map[string]string `json:"labels,omitempty"`
@@ -175,6 +175,7 @@ type BootstrapConfig struct {
175175
Jvm string `json:"jvm,omitempty"`
176176
// Extra items to add to the opensearch.yml, defaults to General.AdditionalConfig
177177
AdditionalConfig map[string]string `json:"additionalConfig,omitempty"`
178+
Annotations map[string]string `json:"annotations,omitempty"`
178179
PluginsList []string `json:"pluginsList,omitempty"`
179180
Keystore []KeystoreValue `json:"keystore,omitempty"`
180181
}

opensearch-operator/api/v1/zz_generated.deepcopy.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,10 @@ spec:
987987
x-kubernetes-list-type: atomic
988988
type: object
989989
type: object
990+
annotations:
991+
additionalProperties:
992+
type: string
993+
type: object
990994
jvm:
991995
type: string
992996
keystore:

opensearch-operator/controllers/cluster_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1"
1212
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers"
13+
"github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers"
1314
. "github.com/kralicky/kmatch"
1415
. "github.com/onsi/ginkgo/v2"
1516
. "github.com/onsi/gomega"
@@ -20,6 +21,7 @@ import (
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
"k8s.io/apimachinery/pkg/types"
2223
"k8s.io/apimachinery/pkg/util/intstr"
24+
"k8s.io/client-go/tools/record"
2325
"sigs.k8s.io/controller-runtime/pkg/client"
2426
//+kubebuilder:scaffold:imports
2527
)
@@ -523,4 +525,27 @@ var _ = Describe("Cluster Reconciler", func() {
523525
wg.Wait()
524526
})
525527
})
528+
529+
When("Deleting cluster resources", func() {
530+
It("should delete bootstrap PVC when cluster is deleted", func() {
531+
// Create a cluster reconciler
532+
reconcilerContext := reconcilers.NewReconcilerContext(record.NewFakeRecorder(1), &OpensearchCluster, OpensearchCluster.Spec.NodePools)
533+
clusterReconciler := reconcilers.NewClusterReconciler(
534+
k8sClient,
535+
context.Background(),
536+
record.NewFakeRecorder(1),
537+
&reconcilerContext,
538+
&OpensearchCluster,
539+
)
540+
541+
// Call DeleteResources
542+
result, err := clusterReconciler.DeleteResources()
543+
Expect(err).NotTo(HaveOccurred())
544+
Expect(result.Requeue).To(BeFalse())
545+
546+
// Verify that the bootstrap PVC would be deleted (StateAbsent)
547+
// The actual deletion would happen in a real cluster, but we can verify
548+
// that the method doesn't error and returns the expected result
549+
})
550+
})
526551
})

opensearch-operator/controllers/opensearchController.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func (r *OpenSearchClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
157157
Owns(&corev1.Service{}).
158158
Owns(&appsv1.Deployment{}).
159159
Owns(&appsv1.StatefulSet{}).
160+
Owns(&corev1.PersistentVolumeClaim{}).
160161
Complete(r)
161162
}
162163

0 commit comments

Comments
 (0)