Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Woehrl <[email protected]>
  • Loading branch information
swoehrl-mw committed Jan 27, 2025
1 parent 1e33530 commit 59110d6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions charts/opensearch-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the opensearch-operator chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.8.0-dev1
version: 2.7.0

# This is the version number of the application being deployed (the operator). This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 2.8.0-dev1
appVersion: 2.7.0
6 changes: 6 additions & 0 deletions docs/userguide/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,9 @@ To support such cases the operator provides a special sidecar added to all Opens

Note that there can still be situations with more than one pod down if a pod crashes or is restarted for some other reason while a node restart is in progress.

> [!WARNING]
> The sidecar feature is still experimential and could have unintended interference with normal cluster operations. Please test it before using it on a production system.

To configure the sidecar you need to do the following:

1. Create a Kubernetes ServiceAccount and give it the permission to perform leader election (find an example manifest below)
Expand Down Expand Up @@ -1136,6 +1139,9 @@ spec:

Keep in mind that this setup could block cluster node restarts/replacements for a long time if Opensearch has a problem, so be sure to choose sensible timeouts / max wait times in your operations tooling (ClusterAPI or cloud provider configuration).

> [!WARNING]
> If you perform an upgrade of Opensearch itself, you should consider disabling the sidecar beforehand. Upgrades can lead to the cluster staying in yellow state during the entire upgrade which the sidecar cannot detect so the upgrade would block. To stay on the safe side it is recommended to disable the sidecar before an upgrade (requires a rolling restart of the opensearch pods) and enable it again afterwards.

## User and role management

An important part of any OpenSearch cluster is the user and role management to give users access to the cluster (via the opensearch-security plugin). By default the operator will use the included demo securityconfig with default users (see [internal_users.yml](https://github.com/opensearch-project/security/blob/main/config/internal_users.yml) for a list of users). For any production installation you should swap that out with your own configuration.
Expand Down
2 changes: 1 addition & 1 deletion opensearch-operator/functionaltests/execute_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ cd functionaltests
go test ./operatortests -timeout 30m
go test ./helmtests -timeout 20m
## Delete k3d cluster
#k3d cluster delete $CLUSTER_NAME
k3d cluster delete $CLUSTER_NAME
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: default
spec:
general:
version: 2.18.0
version: 2.10.0
httpPort: 9200
vendor: opensearch
serviceName: deploy-and-upgrade
Expand All @@ -17,7 +17,7 @@ spec:
confMgmt:
smartScaler: true
dashboards:
version: 2.18.0
version: 2.10.0
enable: true
replicas: 1
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ var _ = Describe("DeployAndUpgrade", Ordered, func() {
cluster.SetGroupVersionKind(schema.GroupVersionKind{Group: "opensearch.opster.io", Version: "v1", Kind: "OpenSearchCluster"})
Get(&cluster, client.ObjectKey{Name: name, Namespace: namespace}, time.Second*5)

SetNestedKey(cluster.Object, "2.3.0", "spec", "general", "version")
SetNestedKey(cluster.Object, "2.3.0", "spec", "dashboards", "version")
SetNestedKey(cluster.Object, "2.11.0", "spec", "general", "version")
SetNestedKey(cluster.Object, "2.11.0", "spec", "dashboards", "version")

Expect(k8sClient.Update(context.Background(), &cluster)).ToNot(HaveOccurred())
})
Expand All @@ -66,7 +66,7 @@ var _ = Describe("DeployAndUpgrade", Ordered, func() {
return sts.Spec.Template.Spec.Containers[0].Image
}
return ""
}, time.Minute*1, time.Second*5).Should(Equal("docker.io/opensearchproject/opensearch:2.3.0"))
}, time.Minute*1, time.Second*5).Should(Equal("docker.io/opensearchproject/opensearch:2.11.0"))

Eventually(func() int32 {
err := k8sClient.Get(context.Background(), client.ObjectKey{Name: name + "-masters", Namespace: namespace}, &sts)
Expand Down Expand Up @@ -105,7 +105,7 @@ var _ = Describe("DeployAndUpgrade", Ordered, func() {
return deployment.Spec.Template.Spec.Containers[0].Image
}
return ""
}, time.Minute*1, time.Second*5).Should(Equal("docker.io/opensearchproject/opensearch-dashboards:2.3.0"))
}, time.Minute*1, time.Second*5).Should(Equal("docker.io/opensearchproject/opensearch-dashboards:2.11.0"))

Eventually(func() int32 {
err := k8sClient.Get(context.Background(), client.ObjectKey{Name: name + "-dashboards", Namespace: namespace}, &deployment)
Expand Down
4 changes: 3 additions & 1 deletion opensearch-operator/pkg/reconcilers/rollingRestart.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ func (r *RollingRestartReconciler) restartStatefulSetPod(sts *appsv1.StatefulSet
return ctrl.Result{}, err
}

return ctrl.Result{}, nil
err = services.ReactivateShardAllocation(r.osClient)

return ctrl.Result{}, err
}

func (r *RollingRestartReconciler) updateStatus(status string) error {
Expand Down
2 changes: 1 addition & 1 deletion opensearch-operator/pkg/reconcilers/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func (r *UpgradeReconciler) doNodePoolUpgrade(pool opsterv1.NodePool) error {
return err
}

return nil
return services.ReactivateShardAllocation(r.osClient)
}

func (r *UpgradeReconciler) setComponentConditions(conditions []string, component string) {
Expand Down

0 comments on commit 59110d6

Please sign in to comment.