From 6472c85258569da854abf0f65a5e95439eab4764 Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Fri, 26 Jan 2024 09:33:54 -0800 Subject: [PATCH] Revert "Code Refactor to update the API's to `opensearch.org` (removing `opster` reference) (#698)" This reverts commit 1c72422c0df973835c77dbf198937a2ea783bea4. --- .github/workflows/prepare-release.yaml | 4 +- .github/workflows/release.yaml | 21 +- CONTRIBUTING.md | 2 +- README.md | 2 +- .../templates/opensearch-cluster-cr.yaml | 2 +- charts/opensearch-operator/CHANGELOG.md | 8 +- charts/opensearch-operator/README.md | 6 +- ...arch.opster.io_opensearchactiongroups.yaml | 4 +- ...ensearch.opster.io_opensearchclusters.yaml | 4 +- ...pster.io_opensearchcomponenttemplates.yaml | 4 +- ...ch.opster.io_opensearchindextemplates.yaml | 4 +- ...earch.opster.io_opensearchismpolicies.yaml | 4 +- .../opensearch.opster.io_opensearchroles.yaml | 4 +- ...pensearch.opster.io_opensearchtenants.yaml | 4 +- ....opster.io_opensearchuserrolebindings.yaml | 4 +- .../opensearch.opster.io_opensearchusers.yaml | 4 +- ...opensearch-operator-manager-config-cm.yaml | 2 +- .../opensearch-operator-manager-role-cr.yaml | 56 ++-- charts/opensearch-operator/values.yaml | 2 +- docs/designs/crd.md | 10 +- docs/designs/high-level.md | 2 +- docs/developing.md | 2 +- docs/userguide/main.md | 30 +- go.work.sum | 257 +----------------- jenkins/release.jenkinsfile | 125 +++++++++ opensearch-operator/.mockery.yaml | 2 +- opensearch-operator/PROJECT | 44 +-- .../api/v1/groupversion_info.go | 6 +- ...rch.opster.io_opensearchactiongroups.yaml} | 4 +- ...nsearch.opster.io_opensearchclusters.yaml} | 4 +- ...ster.io_opensearchcomponenttemplates.yaml} | 4 +- ...h.opster.io_opensearchindextemplates.yaml} | 4 +- ...arch.opster.io_opensearchismpolicies.yaml} | 4 +- ...opensearch.opster.io_opensearchroles.yaml} | 4 +- ...ensearch.opster.io_opensearchtenants.yaml} | 4 +- ...opster.io_opensearchuserrolebindings.yaml} | 4 +- ...opensearch.opster.io_opensearchusers.yaml} | 4 +- .../config/crd/kustomization.yaml | 18 +- .../patches/cainjection_in_opensearch.yaml | 2 +- .../cainjection_in_opensearchroles.yaml | 2 +- ...jection_in_opensearchuserrolebindings.yaml | 2 +- .../cainjection_in_opensearchusers.yaml | 2 +- .../crd/patches/webhook_in_opensearch.yaml | 2 +- .../patches/webhook_in_opensearchroles.yaml | 2 +- ...webhook_in_opensearchuserrolebindings.yaml | 2 +- .../patches/webhook_in_opensearchusers.yaml | 2 +- .../manager/controller_manager_config.yaml | 2 +- .../config/rbac/opensearch_editor_role.yaml | 4 +- .../config/rbac/opensearch_viewer_role.yaml | 4 +- .../rbac/opensearchrole_editor_role.yaml | 4 +- .../rbac/opensearchrole_viewer_role.yaml | 4 +- .../rbac/opensearchuser_editor_role.yaml | 4 +- .../rbac/opensearchuser_viewer_role.yaml | 4 +- ...opensearchuserrolebinding_editor_role.yaml | 4 +- ...opensearchuserrolebinding_viewer_role.yaml | 4 +- opensearch-operator/config/rbac/role.yaml | 56 ++-- ...l => opster_v1_opensearchactiongroup.yaml} | 2 +- ....yaml => opster_v1_opensearchcluster.yaml} | 2 +- ...ole.yaml => opster_v1_opensearchrole.yaml} | 2 +- ...t.yaml => opster_v1_opensearchtenant.yaml} | 2 +- ...ser.yaml => opster_v1_opensearchuser.yaml} | 2 +- ... opster_v1_opensearchuserrolebinding.yaml} | 2 +- .../controllers/cluster_test.go | 20 +- .../controllers/controller_settings.go | 2 +- .../controllers/opensearchController.go | 34 +-- ...opensearch_componenttemplate_controller.go | 19 +- .../opensearch_indextemplate_controller.go | 19 +- .../opensearchactiongroup_controller.go | 21 +- .../controllers/opensearchism_controller.go | 19 +- .../controllers/opensearchrole_controller.go | 19 +- .../opensearchtenant_controller.go | 18 +- .../controllers/opensearchuser_controller.go | 21 +- .../opensearchuserrolebinding_controller.go | 19 +- .../controllers/scaler_test.go | 4 +- opensearch-operator/controllers/suite_test.go | 4 +- .../controllers/suite_test_helpers.go | 40 +-- opensearch-operator/controllers/tls_test.go | 20 +- .../opensearch-cluster-custom-admin-user.yaml | 2 +- ...earch-cluster-initcontainer-resources.yaml | 2 +- .../examples/opensearch-cluster-pdb.yaml | 2 +- .../opensearch-cluster-securityconfig.yaml | 2 +- .../examples/opensearch-cluster.yaml | 2 +- .../opensearch-component-template.yaml | 2 +- .../examples/opensearch-hot-warm-cold.yaml | 2 +- .../examples/opensearch-index-template.yaml | 2 +- .../examples/opensearch-v2-cluster.yaml | 2 +- opensearch-operator/functionaltests/go.mod | 2 +- .../operatortests/deploy-and-upgrade.yaml | 2 +- .../operatortests/deploy_and_upgrade_test.go | 6 +- .../operatortests/main_test.go | 4 +- opensearch-operator/go.mod | 2 +- opensearch-operator/main.go | 8 +- .../pkg/reconcilers/k8s/mock_K8sClient.go | 2 +- .../responses/ISMPolicyResponse.go | 2 +- .../responses/SecurityResponse.go | 2 +- .../opensearch-gateway/responses/Templates.go | 2 +- .../opensearch-gateway/services/os_client.go | 2 +- .../services/os_data_service.go | 6 +- .../services/os_ism_service.go | 2 +- .../services/os_security_service.go | 4 +- .../services/services_suite_test.go | 2 +- opensearch-operator/pkg/builders/cluster.go | 48 ++-- .../pkg/builders/cluster_test.go | 126 ++++----- .../pkg/builders/dashboards.go | 10 +- .../pkg/builders/dashboards_test.go | 52 ++-- .../pkg/builders/suite_test.go | 4 +- opensearch-operator/pkg/helpers/constants.go | 4 +- opensearch-operator/pkg/helpers/helpers.go | 44 +-- .../pkg/helpers/reconcile-helpers.go | 18 +- .../pkg/helpers/reconcile-helpers_test.go | 8 +- .../pkg/helpers/test-helpers.go | 2 +- opensearch-operator/pkg/helpers/translate.go | 4 +- .../pkg/reconcilers/actiongroup.go | 32 +-- .../pkg/reconcilers/actiongroup_test.go | 32 +-- .../pkg/reconcilers/cluster.go | 28 +- .../pkg/reconcilers/componenttemplate.go | 32 +-- .../pkg/reconcilers/componenttemplate_test.go | 36 +-- .../pkg/reconcilers/configuration.go | 18 +- .../pkg/reconcilers/configuration_test.go | 24 +- .../pkg/reconcilers/dashboards.go | 16 +- .../pkg/reconcilers/dashboards_test.go | 76 +++--- .../pkg/reconcilers/indextemplate.go | 32 +-- .../pkg/reconcilers/indextemplate_test.go | 36 +-- .../pkg/reconcilers/ismpolicy.go | 34 +-- .../pkg/reconcilers/ismpolicy_test.go | 32 +-- .../pkg/reconcilers/k8s/client.go | 14 +- .../pkg/reconcilers/reconcilers.go | 14 +- opensearch-operator/pkg/reconcilers/role.go | 32 +-- .../pkg/reconcilers/role_test.go | 34 +-- .../pkg/reconcilers/rollingRestart.go | 20 +- opensearch-operator/pkg/reconcilers/scaler.go | 42 +-- .../pkg/reconcilers/securityconfig.go | 18 +- .../pkg/reconcilers/securityconfig_test.go | 70 ++--- .../pkg/reconcilers/suite_test.go | 4 +- opensearch-operator/pkg/reconcilers/tenant.go | 32 +-- .../pkg/reconcilers/tenant_test.go | 32 +-- opensearch-operator/pkg/reconcilers/tls.go | 18 +- .../pkg/reconcilers/tls_test.go | 70 ++--- .../pkg/reconcilers/upgrade.go | 66 ++--- .../pkg/reconcilers/userrolebinding.go | 30 +- .../pkg/reconcilers/userrolebinding_test.go | 32 +-- opensearch-operator/pkg/reconcilers/users.go | 30 +- .../pkg/reconcilers/users_test.go | 36 +-- .../pkg/reconcilers/util/util.go | 34 +-- .../pkg/reconcilers/util/util_suite_test.go | 4 +- .../pkg/reconcilers/util/util_test.go | 9 +- scripts/build-image-multi-arch.sh | 138 ++++++++++ 147 files changed, 1349 insertions(+), 1314 deletions(-) create mode 100644 jenkins/release.jenkinsfile rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchactiongroups.yaml => opensearch.opster.io_opensearchactiongroups.yaml} (97%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchclusters.yaml => opensearch.opster.io_opensearchclusters.yaml} (99%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchcomponenttemplates.yaml => opensearch.opster.io_opensearchcomponenttemplates.yaml} (98%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchindextemplates.yaml => opensearch.opster.io_opensearchindextemplates.yaml} (98%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchismpolicies.yaml => opensearch.opster.io_opensearchismpolicies.yaml} (99%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchroles.yaml => opensearch.opster.io_opensearchroles.yaml} (98%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchtenants.yaml => opensearch.opster.io_opensearchtenants.yaml} (97%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchuserrolebindings.yaml => opensearch.opster.io_opensearchuserrolebindings.yaml} (97%) rename opensearch-operator/config/crd/bases/{opensearch.org_opensearchusers.yaml => opensearch.opster.io_opensearchusers.yaml} (98%) rename opensearch-operator/config/samples/{opensearch_v1_opensearchactiongroup.yaml => opster_v1_opensearchactiongroup.yaml} (88%) rename opensearch-operator/config/samples/{opensearch_v1_opensearchcluster.yaml => opster_v1_opensearchcluster.yaml} (72%) rename opensearch-operator/config/samples/{opensearch_v1_opensearchrole.yaml => opster_v1_opensearchrole.yaml} (69%) rename opensearch-operator/config/samples/{opensearch_v1_opensearchtenant.yaml => opster_v1_opensearchtenant.yaml} (81%) rename opensearch-operator/config/samples/{opensearch_v1_opensearchuser.yaml => opster_v1_opensearchuser.yaml} (69%) rename opensearch-operator/config/samples/{opensearch_v1_opensearchuserrolebinding.yaml => opster_v1_opensearchuserrolebinding.yaml} (73%) rename opensearch-operator/mocks/github.com/{opensearch-project => Opster}/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go (99%) create mode 100644 scripts/build-image-multi-arch.sh diff --git a/.github/workflows/prepare-release.yaml b/.github/workflows/prepare-release.yaml index ecafed6a1..f9d791d24 100644 --- a/.github/workflows/prepare-release.yaml +++ b/.github/workflows/prepare-release.yaml @@ -31,7 +31,7 @@ jobs: - name: Prepare helm chart run: | # Copy CRDs to chart to make sure they are identical - cp opensearch-operator/config/crd/bases/opensearch.org_*.yaml charts/opensearch-operator/files/ + cp opensearch-operator/config/crd/bases/opensearch.opster.io_*.yaml charts/opensearch-operator/files/ # Set versions in helm chart sed -i -e 's/^appVersion:.*/appVersion: '$RELEASE_VERSION'/' charts/opensearch-operator/Chart.yaml sed -i -e 's/^version:.*/version: '$RELEASE_VERSION'/' charts/opensearch-operator/Chart.yaml @@ -50,7 +50,7 @@ jobs: env: RELEASE_VERSION: ${{ inputs.version }} - - name: Build and Push docker operator image + - name: Build and Push docker image env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d94fc8dd4..295cc77f6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,7 +23,7 @@ jobs: run: | echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV - - name: Build and Push docker image + - name: Build and Push operator docker image env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -32,15 +32,32 @@ jobs: run: | cd opensearch-operator make test - export IMG=public.ecr.aws/opsterio/opensearch-operator:$RELEASE_VERSION + export IMG=public.ecr.aws/opensearch-project/opensearch-operator:$RELEASE_VERSION echo $IMG aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/opsterio docker buildx build -t $IMG --platform="linux/amd64,linux/arm,linux/arm64" . -f Dockerfile --push + cd .. + + - name: Pull and Push operator busybox docker image + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd opensearch-operator + export IMG=public.ecr.aws/opensearch-project/opensearch-operator-busybox:$RELEASE_VERSION + echo $IMG + aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/opsterio + docker buildx build -f Dockerfile-busybox --platform="linux/amd64,linux/arm,linux/arm64" . -t $IMG --push + cd .. - name: Make sure helm chart has correct versions run: | sed -i -e 's/^appVersion:.*/appVersion: '$RELEASE_VERSION'/' charts/opensearch-operator/Chart.yaml sed -i -e 's/^version:.*/version: '$RELEASE_VERSION'/' charts/opensearch-operator/Chart.yaml + sed -i -e 's/^appVersion:.*/appVersion: '$RELEASE_VERSION'/' charts/opensearch-cluster/Chart.yaml + sed -i -e 's/^version:.*/version: '$RELEASE_VERSION'/' charts/opensearch-cluster/Chart.yaml - name: Install Helm uses: azure/setup-helm@v1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75553194a..b563ab3ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,7 +93,7 @@ You may type this line on your own when writing your commit messages. However, i ## Review Process -We deeply appreciate everyone who takes the time to make a contribution. We will review all contributions as quickly as possible. As a reminder, [opening an issue](https://github.com/opensearch-project/opensearch-k8s-operator) discussing your change before you make it is the best way to smooth the PR process. This will prevent a rejection because someone else is already working on the problem, or because the solution is incompatible with the architectural direction. +We deeply appreciate everyone who takes the time to make a contribution. We will review all contributions as quickly as possible. As a reminder, [opening an issue](https://github.com/Opster/opensearch-k8s-operator) discussing your change before you make it is the best way to smooth the PR process. This will prevent a rejection because someone else is already working on the problem, or because the solution is incompatible with the architectural direction. During the PR process, expect that there will be some back-and-forth. Please try to respond to comments in a timely fashion, and if you don't wish to continue with the PR, let us know. If a PR takes too many iterations for its complexity or size, we may reject it. Additionally, if you stop responding we may close the PR as abandoned. In either case, if you feel this was done in error, please add a comment on the PR. diff --git a/README.md b/README.md index 971c13183..a5e81614a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![build](https://github.com/opensearch-project/opensearch-k8s-operator/actions/workflows/docker-build.yaml/badge.svg) ![test](https://github.com/opster/opensearch-k8s-operator/actions/workflows/testing.yaml/badge.svg) ![release](https://img.shields.io/github/v/release/opster/opensearch-k8s-operator) [![Golang Lint](https://github.com/Opster/opensearch-k8s-operator/actions/workflows/linting.yaml/badge.svg)](https://github.com/Opster/opensearch-k8s-operator/actions/workflows/linting.yaml) [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opensearch-operator)](https://artifacthub.io/packages/search?repo=opensearch-operator) +![build](https://github.com/opster/opensearch-k8s-operator/actions/workflows/docker-build.yaml/badge.svg) ![test](https://github.com/opster/opensearch-k8s-operator/actions/workflows/testing.yaml/badge.svg) ![release](https://img.shields.io/github/v/release/opster/opensearch-k8s-operator) [![Golang Lint](https://github.com/Opster/opensearch-k8s-operator/actions/workflows/linting.yaml/badge.svg)](https://github.com/Opster/opensearch-k8s-operator/actions/workflows/linting.yaml) [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opensearch-operator)](https://artifacthub.io/packages/search?repo=opensearch-operator) # OpenSearch Kubernetes Operator diff --git a/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml b/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml index 36a26e221..dee830355 100644 --- a/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml +++ b/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml @@ -1,5 +1,5 @@ {{- if eq .Values.opensearchCluster.enabled true }} -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: {{ .Values.clusterName | default .Release.Name}} diff --git a/charts/opensearch-operator/CHANGELOG.md b/charts/opensearch-operator/CHANGELOG.md index 1866ab55f..a8595e269 100644 --- a/charts/opensearch-operator/CHANGELOG.md +++ b/charts/opensearch-operator/CHANGELOG.md @@ -55,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security -[Unreleased]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-2.0.0...HEAD -[2.0.0]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-1.0.3...opensearch-operator-2.0.0 -[1.0.3]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-1.0.2...opensearch-operator-1.0.3 -[1.0.2]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-1.0.1...opensearch-operator-1.0.2 +[Unreleased]: https://github.com/Opster/opensearch-k8s-operator/compare/opensearch-operator-2.0.0...HEAD +[2.0.0]: https://github.com/Opster/opensearch-k8s-operator/compare/opensearch-operator-1.0.3...opensearch-operator-2.0.0 +[1.0.3]: https://github.com/Opster/opensearch-k8s-operator/compare/opensearch-operator-1.0.2...opensearch-operator-1.0.3 +[1.0.2]: https://github.com/Opster/opensearch-k8s-operator/compare/opensearch-operator-1.0.1...opensearch-operator-1.0.2 diff --git a/charts/opensearch-operator/README.md b/charts/opensearch-operator/README.md index 1e62b147c..f29734ca6 100644 --- a/charts/opensearch-operator/README.md +++ b/charts/opensearch-operator/README.md @@ -1,16 +1,16 @@ # OpenSearch-k8s-operator -The Kubernetes [OpenSearch Operator](https://github.com/opensearch-project/opensearch-k8s-operator) is used for automating the deployment, provisioning, management, and orchestration of OpenSearch clusters and OpenSearch dashboards. +The Kubernetes [OpenSearch Operator](https://github.com/Opster/opensearch-k8s-operator) is used for automating the deployment, provisioning, management, and orchestration of OpenSearch clusters and OpenSearch dashboards. ## Getting started -The Operator can be easily installed using helm on any CNCF-certified Kubernetes cluster. Please refer to the [User Guide](https://github.com/opensearch-project/opensearch-k8s-operator/blob/main/docs/userguide/main.md) for more information. +The Operator can be easily installed using helm on any CNCF-certified Kubernetes cluster. Please refer to the [User Guide](https://github.com/Opster/opensearch-k8s-operator/blob/main/docs/userguide/main.md) for more information. ### Installation Using Helm #### Get Repo Info ``` -helm repo add opensearch-operator helm repo add opensearch-charts https://opensearch-project.github.io/opensearch-k8s-operator +helm repo add opensearch-operator https://opster.github.io/opensearch-k8s-operator/ helm repo update ``` #### Install Chart diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml index b394f5694..ad84d08bd 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchactiongroups.opensearch.org + name: opensearchactiongroups.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchActionGroup listKind: OpensearchActionGroupList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml index de1f8ba84..e96158740 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchclusters.opensearch.org + name: opensearchclusters.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpenSearchCluster listKind: OpenSearchClusterList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml index 7aa2becd6..ef4869049 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchcomponenttemplates.opensearch.org + name: opensearchcomponenttemplates.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchComponentTemplate listKind: OpensearchComponentTemplateList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml index e5489c168..4cfc668a9 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchindextemplates.opensearch.org + name: opensearchindextemplates.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchIndexTemplate listKind: OpensearchIndexTemplateList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml index df31d0fb0..937515755 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchismpolicies.opensearch.org + name: opensearchismpolicies.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpenSearchISMPolicy listKind: OpenSearchISMPolicyList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml index 30623891a..e105afb45 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchroles.opensearch.org + name: opensearchroles.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchRole listKind: OpensearchRoleList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml index aae5b633f..f52e20242 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchtenants.opensearch.org + name: opensearchtenants.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchTenant listKind: OpensearchTenantList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml index aba40b40b..50a80c057 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchuserrolebindings.opensearch.org + name: opensearchuserrolebindings.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchUserRoleBinding listKind: OpensearchUserRoleBindingList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml b/charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml index 807b8b24a..1ea6f825c 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml +++ b/charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchusers.opensearch.org + name: opensearchusers.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchUser listKind: OpensearchUserList diff --git a/charts/opensearch-operator/templates/opensearch-operator-manager-config-cm.yaml b/charts/opensearch-operator/templates/opensearch-operator-manager-config-cm.yaml index a653bc1ed..c2e9a13fd 100755 --- a/charts/opensearch-operator/templates/opensearch-operator-manager-config-cm.yaml +++ b/charts/opensearch-operator/templates/opensearch-operator-manager-config-cm.yaml @@ -11,7 +11,7 @@ data: port: 9443 leaderElection: leaderElect: true - resourceName: a867c7dc.opensearch.org + resourceName: a867c7dc.opensearch.opster.io kind: ConfigMap metadata: name: {{ include "opensearch-operator.fullname" . }}-manager-config diff --git a/charts/opensearch-operator/templates/opensearch-operator-manager-role-cr.yaml b/charts/opensearch-operator/templates/opensearch-operator-manager-role-cr.yaml index 49e70667c..b9826ba56 100755 --- a/charts/opensearch-operator/templates/opensearch-operator-manager-role-cr.yaml +++ b/charts/opensearch-operator/templates/opensearch-operator-manager-role-cr.yaml @@ -122,14 +122,14 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - events verbs: - create - patch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchactiongroups verbs: @@ -141,13 +141,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchactiongroups/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchactiongroups/status verbs: @@ -155,7 +155,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchclusters verbs: @@ -167,13 +167,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchclusters/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchclusters/status verbs: @@ -181,7 +181,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcomponenttemplates verbs: @@ -193,13 +193,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcomponenttemplates/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcomponenttemplates/status verbs: @@ -207,7 +207,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchindextemplates verbs: @@ -219,13 +219,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchindextemplates/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchindextemplates/status verbs: @@ -233,7 +233,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchroles verbs: @@ -245,13 +245,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchroles/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchroles/status verbs: @@ -259,7 +259,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchtenants verbs: @@ -271,13 +271,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchtenants/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchtenants/status verbs: @@ -285,7 +285,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchuserrolebindings verbs: @@ -297,13 +297,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchuserrolebindings/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchuserrolebindings/status verbs: @@ -311,7 +311,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchismpolicies/status verbs: @@ -319,13 +319,13 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchismpolicies/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchusers verbs: @@ -337,7 +337,7 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchismpolicies verbs: @@ -349,13 +349,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchusers/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchusers/status verbs: diff --git a/charts/opensearch-operator/values.yaml b/charts/opensearch-operator/values.yaml index ea2872b05..7c2d409a9 100644 --- a/charts/opensearch-operator/values.yaml +++ b/charts/opensearch-operator/values.yaml @@ -41,7 +41,7 @@ manager: parallelRecoveryEnabled: true image: - repository: public.ecr.aws/opsterio/opensearch-operator + repository: public.ecr.aws/opensearch-project/opensearch-operator ## tag default uses appVersion from Chart.yaml, to override specify tag tag: "v1.1" tag: "" pullPolicy: "Always" diff --git a/docs/designs/crd.md b/docs/designs/crd.md index facffa46f..59ceb7efa 100644 --- a/docs/designs/crd.md +++ b/docs/designs/crd.md @@ -10,7 +10,7 @@ The CustomResourceDefinition API resource allows you to define custom resources. The `OpensearchCLuster` CRD is representing an Opensearch cluster. -Our CRD is Defined by kind: `OpenSearchCluster`,group: `opensearch.org` and version `v1`. +Our CRD is Defined by kind: `OpenSearchCluster`,group: `opensearch.opster.io` and version `v1`. @@ -23,7 +23,7 @@ Our CRD is Defined by kind: `OpenSearchCluster`,group: `opensearch.org` and vers - + @@ -199,7 +199,7 @@ GeneralConfig defines global Opensearch cluster configuration - + @@ -405,7 +405,7 @@ Dashboards defines Opensearch-Dashboard configuration and deployment - + @@ -559,7 +559,7 @@ InitHelperConfig defines global Opensearch InitHelper image configuration - + diff --git a/docs/designs/high-level.md b/docs/designs/high-level.md index ce483a232..404cf1d47 100644 --- a/docs/designs/high-level.md +++ b/docs/designs/high-level.md @@ -13,7 +13,7 @@ The descriptor, provided by the user, is a configuration data structure specifyi * Cluster configuration: Configuration of OpenSearch * Operator Configuration: Security, Monitoring, Auto Scaling, OpenSearch Dashboard, ... -The descriptor is a [Custom Resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) which effectively is a YAML answering to a schema (called a [Custom Resource Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)). The operator is bundled with a [schema](../../opensearch-operator/config/crd/bases/opensearch_opensearchclusters.yaml) for this resource which is deployed when deploying this operator. +The descriptor is a [Custom Resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) which effectively is a YAML answering to a schema (called a [Custom Resource Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/#customresourcedefinitions)). The operator is bundled with a [schema](../../opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml) for this resource which is deployed when deploying this operator. Each custom resource answering to that schema (kind: `OpenSearchCluster`) represents a **single** OpenSearch cluster. diff --git a/docs/developing.md b/docs/developing.md index b779148d1..2d79f254d 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -117,7 +117,7 @@ All PRs must conform to the following rules: * If you make changes to the CRD the CRD YAMLs must be updated (via `make manifests`) and also copied into the helm chart: ```bash - cp opensearch-operator/config/crd/bases/opensearch.org_*.yaml charts/opensearch-operator/files/ + cp opensearch-operator/config/crd/bases/opensearch.opster.io_*.yaml charts/opensearch-operator/files/ ``` * Changes to the CRD must be documented in the [CRD reference](./designs/crd.md) diff --git a/docs/userguide/main.md b/docs/userguide/main.md index 94f7830ba..2ec4e55ad 100644 --- a/docs/userguide/main.md +++ b/docs/userguide/main.md @@ -32,7 +32,7 @@ An OpenSearch cluster can be easily deployed using Helm. Follow the instructions Create a file `cluster.yaml` with the following content: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-first-cluster @@ -74,7 +74,7 @@ Then run `kubectl apply -f cluster.yaml`. If you watch the cluster (e.g. `watch Run `kubectl port-forward svc/my-first-cluster-dashboards 5601`, then open [http://localhost:5601](http://localhost:5601) in your browser and log in with the default demo credentials `admin / admin`. Alternatively, if you want to access the OpenSearch REST API, run: `kubectl port-forward svc/my-first-cluster 9200`. Then open a second terminal and run: `curl -k -u admin:admin https://localhost:9200/_cat/nodes?v`. You should see the three deployed pods listed. -If you'd like to delete your cluster, run: `kubectl delete -f cluster.yaml`. The Operator will then clean up and delete any Kubernetes resources created for the cluster. Note that this will not delete the persistent volumes for the cluster, in most cases. For a complete cleanup, run: `kubectl delete pvc -l opensearch.org/opensearch-cluster=my-first-cluster` to also delete the PVCs. +If you'd like to delete your cluster, run: `kubectl delete -f cluster.yaml`. The Operator will then clean up and delete any Kubernetes resources created for the cluster. Note that this will not delete the persistent volumes for the cluster, in most cases. For a complete cleanup, run: `kubectl delete pvc -l opster.io/opensearch-cluster=my-first-cluster` to also delete the PVCs. The minimal cluster you deployed in this section is only intended for demo purposes. Please see the next sections on how to configure and manage the different aspects of your cluster. @@ -453,7 +453,7 @@ spec: You can customize the OpenSearch Dashboards configuration ([`opensearch_dashboards.yml`](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/config/opensearch_dashboards.yml)) using the `additionalConfig` field in the dashboards section of the `OpenSearchCluster` custom resource: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster #... spec: @@ -497,7 +497,7 @@ Note that changing the value in the secret has no direct influence on the dashbo When using OpenSearch behind a reverse proxy on a subpath (e.g. `/logs`) you have to configure a base path. This can be achieved by setting the base path field in the configuraiton of OpenSearch Dashboards. Behind the scenes the correct configuration options are automatically added to the dashboards configuration. ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster ... spec: @@ -819,7 +819,7 @@ The PDB definition is unique for every nodePool. You must provide either `minAvailable` or `maxUnavailable` to configure PDB, but not both. ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster ... spec: @@ -882,7 +882,7 @@ Supported Service Types When using type LoadBalancer you can optionally set the load balancer source ranges. ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster ... spec: @@ -1009,7 +1009,7 @@ The operator provides custom kubernetes resources that allow you to create/updat It is possible to manage Opensearch users in Kubernetes with the operator. The operator will not modify users that already exist. You can create an example user as follows: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchUser metadata: name: sample-user @@ -1033,7 +1033,7 @@ Note that a secret called `sample-user-password` will need to exist in the `defa It is possible to manage Opensearch roles in Kubernetes with the operator. The operator will not modify roles that already exist. You can create an example role as follows: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchRole metadata: name: sample-role @@ -1057,7 +1057,7 @@ spec: The operator allows you link any number of users, backend roles and roles with a OpensearchUserRoleBinding. Each user in the binding will be granted each role. E.g: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchUserRoleBinding metadata: name: sample-urb @@ -1078,7 +1078,7 @@ spec: It is possible to manage Opensearch action groups in Kubernetes with the operator. The operator will not modify action groups that already exist. You can create an example action group as follows: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchActionGroup metadata: name: sample-action-group @@ -1098,7 +1098,7 @@ spec: It is possible to manage Opensearch tenants in Kubernetes with the operator. The operator will not modify tenants that already exist. You can create an example tenant as follows: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchTenant metadata: name: sample-tenant @@ -1187,7 +1187,7 @@ b. Use Our OpenSearchUser CRD and provide the secret under monitoringUserSecret. To configure monitoring you can add the following fields to your cluster spec: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-first-cluster @@ -1213,7 +1213,7 @@ The operator provides a custom Kubernetes resource that allow you to create/upda It is possible to manage OpenSearch ISM policies in Kubernetes with the operator. Fields in the CRD directly maps to the OpenSearch ISM Policy structure. The operator will not modify policies that already exist. You can create an example policy as follows: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchISMPolicy metadata: name: sample-policy @@ -1257,7 +1257,7 @@ The fields that have been changed, is `index_patterns` to `indexPatterns` (Opens The following example creates a component template for setting the number of shards and replicas, together with specifying a specific time format for documents: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchComponentTemplate metadata: name: sample-component-template @@ -1287,7 +1287,7 @@ spec: The following index template makes use of the above component template (see `composedOf`) for all indices which follows the `logs-2020-01-*` index pattern: ```yaml -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchIndexTemplate metadata: name: sample-index-template diff --git a/go.work.sum b/go.work.sum index 0296d5e50..b174aa320 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= @@ -18,7 +17,6 @@ cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfG cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= cloud.google.com/go/beyondcorp v0.4.0/go.mod h1:3ApA0mbhHx6YImmuubf5pyW8srKnCEPON32/5hj+RmM= -cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA= cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac= cloud.google.com/go/billing v1.12.0/go.mod h1:yKrZio/eu+okO/2McZEbch17O5CB5NpZhhXG6Z766ss= cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= @@ -30,7 +28,6 @@ cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6 cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute/metadata v0.2.0 h1:nBbNSZyDpkNlo3DepaaLKVuO7ClyifSAmNloSCZrHnQ= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= @@ -44,7 +41,6 @@ cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxB cloud.google.com/go/dataplex v1.5.2/go.mod h1:cVMgQHsmfRoI5KFYq4JtIBEUbYwc3c7tXmIDhRmNNVQ= cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= -cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ= cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= cloud.google.com/go/datastream v1.6.0/go.mod h1:6LQSuswqLa7S4rPAOZFVjHIG3wJIjZcZrw8JDEDJuIs= cloud.google.com/go/deploy v1.6.0/go.mod h1:f9PTHehG/DjCom3QH0cntOVRm93uGBDt2vKzAPwpXQI= @@ -57,7 +53,6 @@ cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIh cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= cloud.google.com/go/eventarc v1.10.0/go.mod h1:u3R35tmZ9HvswGRBnF48IlYgYeBcPUCjkr4BTdem2Kw= cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+mUDLupOWEDs= -cloud.google.com/go/firestore v1.1.0 h1:9x7Bx0A9R5/M9jibeJeZWqjeVEIxYW9fZYqB9a70/bY= cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= cloud.google.com/go/functions v1.10.0/go.mod h1:0D3hEOe3DbEvCXtYOZHQZmD+SzYsi1YbI7dGvHfldXw= cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= @@ -95,7 +90,6 @@ cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJ cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= cloud.google.com/go/policytroubleshooter v1.5.0/go.mod h1:Rz1WfV+1oIpPdN2VvvuboLVRsB1Hclg3CKQ53j9l8vw= cloud.google.com/go/privatecatalog v0.7.0/go.mod h1:2s5ssIFO69F5csTXcwBP7NPFTZvps26xGzvQ2PQaBYg= -cloud.google.com/go/pubsub v1.3.1 h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU= cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= cloud.google.com/go/recaptchaenterprise/v2 v2.6.0/go.mod h1:RPauz9jeLtB3JVzg6nCbe12qNoaa8pXc4d/YukAmcnA= @@ -117,7 +111,6 @@ cloud.google.com/go/serviceusage v1.5.0/go.mod h1:w8U1JvqUqwJNPEOTQjrMHkw3IaIFLo cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= cloud.google.com/go/spanner v1.44.0/go.mod h1:G8XIgYdOK+Fbcpbs7p2fiprDw4CaZX63whnSMLVBxjk= cloud.google.com/go/speech v1.14.1/go.mod h1:gEosVRPJ9waG7zqqnsHpYTOoAS4KouMRLDFMekpJ0J0= -cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA= cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= @@ -134,9 +127,6 @@ cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27 cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest/autorest v0.11.12 h1:gI8ytXbxMfI+IVbI9mP2JGCTXIuhHLgRlvQ9X4PsnHE= @@ -145,247 +135,33 @@ github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8K github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk= github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8Pcx+3oqrE= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc= -github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= -github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= -github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= -github.com/Masterminds/squirrel v1.5.3 h1:YPpoceAcxuzIljlr5iWpNKaql7hLeG1KLSrhvdHpkZc= -github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/alecthomas/kingpin/v2 v2.3.1 h1:ANLJcKmQm4nIaog7xdr/id6FM6zm5hHnfZrvtKPxqGg= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= -github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 h1:yL7+Jz0jTC6yykIK/Wh74gnTJnrGr5AyrNMXuA0gves= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 h1:4daAzAu0S6Vi7/lbWECcX0j45yZReDZ56BQsrVBOEEY= github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= -github.com/aws/aws-sdk-go v1.42.27 h1:kxsBXQg3ee6LLbqjp5/oUeDgG7TENFrWYDmEVnd7spU= -github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c h1:+0HFd5KSZ/mm3JmhmrDukiId5iR6w4+BdFtfSy4yWIc= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk= -github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= -github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f h1:WBZRG4aNOuI15bLRrCgN8fCq8E5Xuty6jGbmSNEvSsU= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y= -github.com/containerd/containerd v1.7.0 h1:G/ZQr3gMZs6ZT0qPUZ15znx5QSdQdASW11nXTLTM2Pg= -github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= -github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ= -github.com/coreos/go-oidc v2.1.0+incompatible h1:sdJrfw8akMnCuUlaZU3tE/uYXFgfqom8DBE9so9EBsM= -github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8= -github.com/coreos/go-systemd/v22 v22.4.0 h1:y9YHcjnjynCd/DVbg5j9L/33jQM3MxJlbj/zWskzfGU= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= -github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= -github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= -github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954 h1:RMLoZVzv4GliuWafOuPuQDKSm1SJph7uCRnnS61JAn4= -github.com/docker/cli v20.10.21+incompatible h1:qVkgyYUnOLQ98LtXBrwd/duVqPT2X4SHndOuGsfwyhU= -github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= -github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= -github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= -github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= -github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8= -github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc= github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/go-control-plane v0.9.4 h1:rEvIZUSZ3fx39WIi3JkQqQBitGwpELBIYWeBVh6wn+E= -github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d h1:105gxyaGwCFad8crR9dcMQWvV9Hvulu6hwUh4tWPJnM= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= -github.com/getkin/kin-openapi v0.76.0 h1:j77zg3Ec+k+r+GA3d8hBoXpAc6KX9TbBPrwQGBIy2sY= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I= -github.com/go-gorp/gorp/v3 v3.0.5 h1:PUjzYdYu3HBOh8LE+UUmRG2P0IRDak9XMeGNvaeq4Ow= -github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-openapi/spec v0.19.5 h1:Xm0Ao53uqnk9QE/LlYV5DEU09UAgpliA85QoT9LzqPw= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/cel-go v0.12.6 h1:kjeKudqV0OygrAqA9fX6J55S8gj+Jre2tckIm5RoG4M= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= -github.com/google/martian/v3 v3.0.0 h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs= -github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= -github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= -github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= -github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/hashicorp/consul/api v1.1.0 h1:BNQPM9ytxj6jbjjdRPioQ94T6YXriSopn0i8COv6SRA= -github.com/hashicorp/consul/sdk v0.1.1 h1:LnuDWGNsoajlhGyHJvuWW6FVqRl8JOTPqS6CPTsYjhY= -github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= -github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= -github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= -github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI= -github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= -github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= -github.com/hashicorp/go.net v0.0.1 h1:sNCoNyDEvN1xa+X0baata4RdcpKwcMS6DH+xwfqPgjw= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= -github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= -github.com/hashicorp/mdns v1.0.0 h1:WhIgCr5a7AaVH6jPUwjtRuuE7/RDufnUvzIr48smyxs= -github.com/hashicorp/memberlist v0.1.3 h1:EmmoJme1matNzb+hMpDuR/0sbJSUisxyqBGG676r31M= -github.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI= github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= -github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= -github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= -github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= -github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY= -github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= -github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.5 h1:hyz3dwM5QLc1Rfoz4FuWJQG5BN7tc6K1MndAUnGpQr4= -github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw= -github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA= -github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y= -github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= -github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= -github.com/mitchellh/gox v0.4.0 h1:lfGJxY7ToLJQjHHwi0EX6uYBdK78egf954SQl13PQJc= -github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= -github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= -github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= -github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5 h1:58+kh9C6jJVXYjt8IE48G2eWl6BjwU5Gj0gqY84fy78= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= -github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= -github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b h1:YWuSjZCQAPM8UUBLkYUk1e+rZcvWHJmFb6i6rM44Xs8= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= -github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w= -github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021 h1:0XM1XL/OFFJjXsYXlG30spTkV/E9+gmd5GD1w2HE8xM= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/rubenv/sql-migrate v1.3.1 h1:Vx+n4Du8X8VTYuXbhNxdEUoh6wiJERA0GlWocR5FrbA= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f h1:UFr9zpz4xgTnIE5yIMtWAMngCdZ9p/+q6lTbgelo80M= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= -github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= -github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -github.com/xhit/go-str2duration v1.2.0 h1:BcV5u025cITWxEQKGWr1URRzrcXtu7uk8+luz3Yuhwc= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= -github.com/xlab/treeprint v1.1.0 h1:G/1DjNkPpfZCFt9CSh6b5/nY4VimlbHF3Rh4obvtzDk= -github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 h1:1JFLBqwIgdyHN1ZtgjTBwO+blA6gVOmZurpiMEsETKo= -go.etcd.io/etcd/api/v3 v3.5.7 h1:sbcmosSVesNrWOJ58ZQFitHMdncusIifYcrBfwrlJSY= -go.etcd.io/etcd/client/pkg/v3 v3.5.7 h1:y3kf5Gbp4e4q7egZdn5T7W9TSHUvkClN6u+Rq9mEOmg= -go.etcd.io/etcd/client/v2 v2.305.7 h1:AELPkjNR3/igjbO7CjyF1fPuVPjrblliiKj+Y6xSGOU= -go.etcd.io/etcd/client/v3 v3.5.7 h1:u/OhpiuCgYY8awOHlhIhmGIGpxfBU/GZBUP3m/3/Iz4= -go.etcd.io/etcd/pkg/v3 v3.5.7 h1:obOzeVwerFwZ9trMWapU/VjDcYUJb5OfgC1zqEGWO/0= -go.etcd.io/etcd/raft/v3 v3.5.7 h1:aN79qxLmV3SvIq84aNTliYGmjwsW6NqJSnqmI1HLJKc= -go.etcd.io/etcd/server/v3 v3.5.7 h1:BTBD8IJUV7YFgsczZMHhMTS67XuA4KpRquL0MFOJGRk= -go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.35.0 h1:xFSRQBbXF6VvYRf2lqMJXxoB72XI1K/azav8TekHHSw= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.35.1 h1:sxoY9kG1s1WpSYNyzm24rlwH4lnRYFXUVVBmKMBfRgw= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 h1:TaB+1rQhddO1sF71MpZOZAuSPW1klK2M8XxfrBMfK7Y= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 h1:pDDYmo0QadUPal5fwXoY1pmMpFcdyhXOmL5drCrI3vU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 h1:KtiUEhQmj/Pa874bVYKGNVdq8NPKiacPbaRRtgXi+t4= -go.opentelemetry.io/otel/metric v0.31.0 h1:6SiklT+gfWAwWUR0meEMxQBtihpiEs4c+vL9spDTqUs= -go.opentelemetry.io/otel/sdk v1.10.0 h1:jZ6K7sVn04kk/3DNUdJ4mqRlGDiXAVuIG+MMENpTNdY= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 h1:+FNtrFTmVw0YZGpBGX56XDee331t6JAXeK2bcyhLOOc= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -394,7 +170,6 @@ golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -412,38 +187,10 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/cheggaaa/pb.v1 v1.0.25 h1:Ev7yu1/f6+d+b3pi5vPdRPc6nNtP1umSfcWiEfRqv6I= -gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= -gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= -gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA= -gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= -helm.sh/helm/v3 v3.12.0 h1:rOq2TPVzg5jt4q5ermAZGZFxNW2uQhKjRhBneAutMEM= -honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= -k8s.io/apiserver v0.27.2 h1:p+tjwrcQEZDrEorCZV2/qE8osGTINPuS5ZNqWAvKm5E= -k8s.io/cli-runtime v0.27.1 h1:MMzp5Q/Xmr5L1Lrowuc+Y/r95XINC6c6/fE3aN7JDRM= -k8s.io/code-generator v0.27.2 h1:RmK0CnU5qRaK6WRtSyWNODmfTZNoJbrizpVcsgbtrvI= k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= -k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08= k8s.io/gengo v0.0.0-20220902162205-c0856e24416d/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kms v0.27.2 h1:wCdmPCa3kubcVd3AssOeaVjLQSu45k5g/vruJ3iqwDU= -k8s.io/kubectl v0.27.1 h1:9T5c5KdpburYiW8XKQSH0Uly1kMNE90aGSnbYUZNdcA= k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -oras.land/oras-go v1.2.2 h1:0E9tOHUfrNH7TCDk5KU0jVBEzCqbfdyuVfGmJ7ZeRPE= -rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= -rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY= -rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 h1:trsWhjU5jZrx6UvFu4WzQDrN7Pga4a7Qg+zcfcj64PA= -sigs.k8s.io/kustomize/api v0.13.2 h1:kejWfLeJhUsTGioDoFNJET5LQe/ajzXhJGYoU+pJsiA= -sigs.k8s.io/kustomize/kyaml v0.14.1 h1:c8iibius7l24G2wVAGZn/Va2wNys03GXLjYVIcFVxKA= diff --git a/jenkins/release.jenkinsfile b/jenkins/release.jenkinsfile new file mode 100644 index 000000000..ac397801a --- /dev/null +++ b/jenkins/release.jenkinsfile @@ -0,0 +1,125 @@ +lib = library(identifier: 'jenkins@6.1.1', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +pipeline { + options { + timeout(time: 30, unit: 'MINUTES') + throttleJobProperty( + categories: [], + limitOneJobWithMatchingParams: false, + maxConcurrentPerNode: 0, + maxConcurrentTotal: 1, + paramsToUseForLimit: '', + throttleEnabled: true, + throttleOption: 'project', + ) + } + agent { + docker { + label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' + image 'opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v3' + args '-e JAVA_HOME=/opt/java/openjdk-11' + alwaysPull true + } + } + parameters { + string( + name: 'GIT_REFERENCE', + description: 'Git branch, tag, commitid for reference to checkout commit of OpenSearch core before running the gradle check.', + defaultValue: 'main', + trim: true + ) + } + triggers { + GenericTrigger( + genericVariables: [ + [key: 'ref', value: '$.ref'], + ], + tokenCredentialId: 'jenkins-opensearch-operator-generic-webhook-token', + causeString: 'A commit was pushed on opensearch-project/opensearch-k8s-operator repository main branch causing this workflow to run', + printContributedVariables: false, + printPostContent: false, + regexpFilterText: '$ref', + regexpFilterExpression: '^[0-9.]+' + ) + } + environment { + REPO_URL="https://github.com/prudhvigodithi/opensearch-k8s-operator" + USER_BUILD_CAUSE = currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause') + TIMER_BUILD_CAUSE = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause') + } + stages { + stage('OpenSearch Operator Busybox') { + steps { + script { + def ref_final = "${GIT_REFERENCE}" + println("the ref_final is : ${ref_final}") + def ref_url = "${REPO_URL}/commit/${GIT_REFERENCE}" + if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) { + ref_final = "${ref}" + ref_url = "${REPO_URL}/releases/tag/${ref}" + println("Triggered by GitHub: ${ref_url}") + + currentBuild.description = """GitHub: ${ref_url}""" + } + else { + println("Triggered by User/Timer: ${ref_url}") + currentBuild.description = """User/Timer: ${ref_url}""" + } + + if (ref_final == null || ref_final == '') { + currentBuild.result = 'ABORTED' + error("Missing git tag reference.") + } + + echo("Git checkout ${REPO_URL} on ${ref_final} for opensearch-operator-busybox release") + checkout scm + sh("git checkout ${ref_final}") + + def OPERATOR_PRODUCT = "opensearch-operator-busybox" + def OPERATOR_VERSION = "$ref_final" + + echo("${OPERATOR_PRODUCT}: ${OPERATOR_VERSION}") + + dockerBuild: { + build job: 'docker-build', + parameters: [ + string(name: 'DOCKER_BUILD_GIT_REPOSITORY', value: "${REPO_URL}"), + string(name: 'DOCKER_BUILD_GIT_REPOSITORY_REFERENCE', value: "${ref_final}"), + string(name: 'DOCKER_BUILD_SCRIPT_WITH_COMMANDS', value: [ + 'id', + 'pwd', + 'ls -l', + [ + 'bash', + 'scripts/build-image-multi-arch.sh', + "-v ${OPERATOR_VERSION}", + "-a 'x64,arm,arm64'", + "-f opensearch-operator/Dockerfile-busybox", + "-p ${OPERATOR_PRODUCT}" + ].join(' ') + ].join(' && ')), + ] + } + dockerPromotion: { + build job: 'docker-promotion', + parameters: [ + string(name: 'SOURCE_IMAGES', value: '${OPERATOR_PRODUCT}:${OPERATOR_VERSION}'), + string(name: 'RELEASE_VERSION', value: "${ref_final}"), + string(name: 'DOCKER_HUB_PROMOTE', value: true), + string(name: 'ECR_PROMOTE', value: true), + string(name: 'TAG_LATEST', value: true) + ] + } + } + } + post { + always { + cleanWs disableDeferredWipeout: true, deleteDirs: true + } + } + } + } +} diff --git a/opensearch-operator/.mockery.yaml b/opensearch-operator/.mockery.yaml index cb999212c..8ca471b59 100644 --- a/opensearch-operator/.mockery.yaml +++ b/opensearch-operator/.mockery.yaml @@ -1,5 +1,5 @@ with-expecter: true packages: - github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s: + github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s: interfaces: K8sClient: diff --git a/opensearch-operator/PROJECT b/opensearch-operator/PROJECT index 384a2be08..96a9e2c7f 100644 --- a/opensearch-operator/PROJECT +++ b/opensearch-operator/PROJECT @@ -2,68 +2,68 @@ # This file is used to track the info used to scaffold your project # and allow the plugins properly work. # More info: https://book.kubebuilder.io/reference/project-config.html -domain: opensearch.org +domain: opensearch.opster.io layout: - go.kubebuilder.io/v3 projectName: opensearch-operator -repo: github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator +repo: github.com/Opster/opensearch-k8s-operator/opensearch-operator resources: - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.org - group: opensearch-project + domain: opensearch.opster.io + group: opster kind: OpenSearchCluster - path: opensearch.org/api/v1 + path: opensearch.opster.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.org - group: opensearch-project + domain: opensearch.opster.io + group: opster kind: OpensearchUser - path: opensearch.org/api/v1 + path: opensearch.opster.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.org - group: opensearch-project + domain: opensearch.opster.io + group: opster kind: OpensearchRole - path: opensearch.org/api/v1 + path: opensearch.opster.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.org - group: opensearch-project + domain: opensearch.opster.io + group: opster kind: OpensearchUserRoleBinding - path: opensearch.org/api/v1 + path: opensearch.opster.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.org - group: opensearch-project + domain: opensearch.opster.io + group: opster kind: OpensearchIndexTemplate - path: opensearch.org/api/v1 + path: opensearch.opster.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.org - group: opensearch-project + domain: opensearch.opster.io + group: opster kind: OpensearchComponentTemplate - path: opensearch.org/api/v1 + path: opensearch.opster.io/api/v1 version: v1 -- domain: opensearch.org - group: opensearch.org +- domain: opensearch.opster.io + group: opensearch.opster.io kind: OpensearchISMPolicy version: v1 version: "3" diff --git a/opensearch-operator/api/v1/groupversion_info.go b/opensearch-operator/api/v1/groupversion_info.go index 30379991c..52e2caa48 100644 --- a/opensearch-operator/api/v1/groupversion_info.go +++ b/opensearch-operator/api/v1/groupversion_info.go @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package v1 contains API Schema definitions for the opensearch v1 API group +// Package v1 contains API Schema definitions for the opster v1 API group // +kubebuilder:object:generate=true -// +groupName=opensearch.org +// +groupName=opensearch.opster.io package v1 import ( @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "opensearch.org", Version: "v1"} + GroupVersion = schema.GroupVersion{Group: "opensearch.opster.io", Version: "v1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchactiongroups.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchactiongroups.yaml similarity index 97% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchactiongroups.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchactiongroups.yaml index b394f5694..ad84d08bd 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchactiongroups.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchactiongroups.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchactiongroups.opensearch.org + name: opensearchactiongroups.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchActionGroup listKind: OpensearchActionGroupList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchclusters.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml similarity index 99% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchclusters.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml index de1f8ba84..e96158740 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchclusters.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchclusters.opensearch.org + name: opensearchclusters.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpenSearchCluster listKind: OpenSearchClusterList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchcomponenttemplates.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchcomponenttemplates.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml index 7aa2becd6..ef4869049 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchcomponenttemplates.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchcomponenttemplates.opensearch.org + name: opensearchcomponenttemplates.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchComponentTemplate listKind: OpensearchComponentTemplateList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchindextemplates.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchindextemplates.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchindextemplates.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchindextemplates.yaml index e5489c168..4cfc668a9 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchindextemplates.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchindextemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchindextemplates.opensearch.org + name: opensearchindextemplates.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchIndexTemplate listKind: OpensearchIndexTemplateList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchismpolicies.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchismpolicies.yaml similarity index 99% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchismpolicies.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchismpolicies.yaml index df31d0fb0..937515755 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchismpolicies.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchismpolicies.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchismpolicies.opensearch.org + name: opensearchismpolicies.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpenSearchISMPolicy listKind: OpenSearchISMPolicyList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchroles.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchroles.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml index 30623891a..e105afb45 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchroles.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchroles.opensearch.org + name: opensearchroles.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchRole listKind: OpensearchRoleList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchtenants.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchtenants.yaml similarity index 97% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchtenants.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchtenants.yaml index aae5b633f..f52e20242 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchtenants.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchtenants.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchtenants.opensearch.org + name: opensearchtenants.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchTenant listKind: OpensearchTenantList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchuserrolebindings.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml similarity index 97% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchuserrolebindings.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml index aba40b40b..50a80c057 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchuserrolebindings.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchuserrolebindings.opensearch.org + name: opensearchuserrolebindings.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchUserRoleBinding listKind: OpensearchUserRoleBindingList diff --git a/opensearch-operator/config/crd/bases/opensearch.org_opensearchusers.yaml b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchusers.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.org_opensearchusers.yaml rename to opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchusers.yaml index 807b8b24a..1ea6f825c 100644 --- a/opensearch-operator/config/crd/bases/opensearch.org_opensearchusers.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchusers.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchusers.opensearch.org + name: opensearchusers.opensearch.opster.io spec: - group: opensearch.org + group: opensearch.opster.io names: kind: OpensearchUser listKind: OpensearchUserList diff --git a/opensearch-operator/config/crd/kustomization.yaml b/opensearch-operator/config/crd/kustomization.yaml index 26f1995bd..cdb33271e 100644 --- a/opensearch-operator/config/crd/kustomization.yaml +++ b/opensearch-operator/config/crd/kustomization.yaml @@ -2,15 +2,15 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/opensearch.org_opensearchactiongroups.yaml -- bases/opensearch.org_opensearchclusters.yaml -- bases/opensearch.org_opensearchcomponenttemplates.yaml -- bases/opensearch.org_opensearchindextemplates.yaml -- bases/opensearch.org_opensearchroles.yaml -- bases/opensearch.org_opensearchtenants.yaml -- bases/opensearch.org_opensearchuserrolebindings.yaml -- bases/opensearch.org_opensearchusers.yaml -- bases/opensearch.org_opensearchismpolicies.yaml +- bases/opensearch.opster.io_opensearchactiongroups.yaml +- bases/opensearch.opster.io_opensearchclusters.yaml +- bases/opensearch.opster.io_opensearchcomponenttemplates.yaml +- bases/opensearch.opster.io_opensearchindextemplates.yaml +- bases/opensearch.opster.io_opensearchroles.yaml +- bases/opensearch.opster.io_opensearchtenants.yaml +- bases/opensearch.opster.io_opensearchuserrolebindings.yaml +- bases/opensearch.opster.io_opensearchusers.yaml +- bases/opensearch.opster.io_ismpolicies.yaml - bases/crd-servicemonitor.yaml #+kubebuilder:scaffold:crdkustomizeresource diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearch.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearch.yaml index 320582abb..ea9fd318b 100644 --- a/opensearch-operator/config/crd/patches/cainjection_in_opensearch.yaml +++ b/opensearch-operator/config/crd/patches/cainjection_in_opensearch.yaml @@ -4,4 +4,4 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: opensearchcluster.opensearch.org + name: opensearchcluster.opensearch.opster.io diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearchroles.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearchroles.yaml index 8d77059d1..524ad56a0 100644 --- a/opensearch-operator/config/crd/patches/cainjection_in_opensearchroles.yaml +++ b/opensearch-operator/config/crd/patches/cainjection_in_opensearchroles.yaml @@ -4,4 +4,4 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: opensearchroles.opensearch.org + name: opensearchroles.opster.opensearch.opster.io diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearchuserrolebindings.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearchuserrolebindings.yaml index 160ded65d..6972fcbe4 100644 --- a/opensearch-operator/config/crd/patches/cainjection_in_opensearchuserrolebindings.yaml +++ b/opensearch-operator/config/crd/patches/cainjection_in_opensearchuserrolebindings.yaml @@ -4,4 +4,4 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: opensearchuserrolebindings.opensearch.org + name: opensearchuserrolebindings.opster.opensearch.opster.io diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearchusers.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearchusers.yaml index d6ae6b583..1afdfc2e2 100644 --- a/opensearch-operator/config/crd/patches/cainjection_in_opensearchusers.yaml +++ b/opensearch-operator/config/crd/patches/cainjection_in_opensearchusers.yaml @@ -4,4 +4,4 @@ kind: CustomResourceDefinition metadata: annotations: cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) - name: opensearchusers.opensearch.org + name: opensearchusers.opster.opensearch.opster.io diff --git a/opensearch-operator/config/crd/patches/webhook_in_opensearch.yaml b/opensearch-operator/config/crd/patches/webhook_in_opensearch.yaml index 58421b200..5e72850a9 100644 --- a/opensearch-operator/config/crd/patches/webhook_in_opensearch.yaml +++ b/opensearch-operator/config/crd/patches/webhook_in_opensearch.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: opensearchcluster.opensearch.org + name: opensearchcluster.opensearch.opster.io spec: conversion: strategy: Webhook diff --git a/opensearch-operator/config/crd/patches/webhook_in_opensearchroles.yaml b/opensearch-operator/config/crd/patches/webhook_in_opensearchroles.yaml index 67cab289d..f42bfca42 100644 --- a/opensearch-operator/config/crd/patches/webhook_in_opensearchroles.yaml +++ b/opensearch-operator/config/crd/patches/webhook_in_opensearchroles.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: opensearchroles.opensearch.org + name: opensearchroles.opster.opensearch.opster.io spec: conversion: strategy: Webhook diff --git a/opensearch-operator/config/crd/patches/webhook_in_opensearchuserrolebindings.yaml b/opensearch-operator/config/crd/patches/webhook_in_opensearchuserrolebindings.yaml index aa9fd24ea..18c20e028 100644 --- a/opensearch-operator/config/crd/patches/webhook_in_opensearchuserrolebindings.yaml +++ b/opensearch-operator/config/crd/patches/webhook_in_opensearchuserrolebindings.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: opensearchuserrolebindings.opensearch.org + name: opensearchuserrolebindings.opster.opensearch.opster.io spec: conversion: strategy: Webhook diff --git a/opensearch-operator/config/crd/patches/webhook_in_opensearchusers.yaml b/opensearch-operator/config/crd/patches/webhook_in_opensearchusers.yaml index aa4a2abc0..40485e413 100644 --- a/opensearch-operator/config/crd/patches/webhook_in_opensearchusers.yaml +++ b/opensearch-operator/config/crd/patches/webhook_in_opensearchusers.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: opensearchusers.opensearch.org + name: opensearchusers.opster.opensearch.opster.io spec: conversion: strategy: Webhook diff --git a/opensearch-operator/config/manager/controller_manager_config.yaml b/opensearch-operator/config/manager/controller_manager_config.yaml index 023ff0b7e..7dbb1244b 100644 --- a/opensearch-operator/config/manager/controller_manager_config.yaml +++ b/opensearch-operator/config/manager/controller_manager_config.yaml @@ -8,4 +8,4 @@ webhook: port: 9443 leaderElection: leaderElect: true - resourceName: a867c7dc.opensearch.org + resourceName: a867c7dc.opensearch.opster.io diff --git a/opensearch-operator/config/rbac/opensearch_editor_role.yaml b/opensearch-operator/config/rbac/opensearch_editor_role.yaml index 8f3ac8e2c..147b3ba0a 100644 --- a/opensearch-operator/config/rbac/opensearch_editor_role.yaml +++ b/opensearch-operator/config/rbac/opensearch_editor_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchcluster-editor-role rules: - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcluster verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcluster/status verbs: diff --git a/opensearch-operator/config/rbac/opensearch_viewer_role.yaml b/opensearch-operator/config/rbac/opensearch_viewer_role.yaml index fda31336e..9049a3c42 100644 --- a/opensearch-operator/config/rbac/opensearch_viewer_role.yaml +++ b/opensearch-operator/config/rbac/opensearch_viewer_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchcluster-viewer-role rules: - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcluster verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcluster/status verbs: diff --git a/opensearch-operator/config/rbac/opensearchrole_editor_role.yaml b/opensearch-operator/config/rbac/opensearchrole_editor_role.yaml index 94aea0f3a..46bc8a0bc 100644 --- a/opensearch-operator/config/rbac/opensearchrole_editor_role.yaml +++ b/opensearch-operator/config/rbac/opensearchrole_editor_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchrole-editor-role rules: - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchroles verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchroles/status verbs: diff --git a/opensearch-operator/config/rbac/opensearchrole_viewer_role.yaml b/opensearch-operator/config/rbac/opensearchrole_viewer_role.yaml index efdd69aaa..516b1414b 100644 --- a/opensearch-operator/config/rbac/opensearchrole_viewer_role.yaml +++ b/opensearch-operator/config/rbac/opensearchrole_viewer_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchrole-viewer-role rules: - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchroles verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchroles/status verbs: diff --git a/opensearch-operator/config/rbac/opensearchuser_editor_role.yaml b/opensearch-operator/config/rbac/opensearchuser_editor_role.yaml index 774cded58..61ebf9014 100644 --- a/opensearch-operator/config/rbac/opensearchuser_editor_role.yaml +++ b/opensearch-operator/config/rbac/opensearchuser_editor_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchuser-editor-role rules: - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchusers verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchusers/status verbs: diff --git a/opensearch-operator/config/rbac/opensearchuser_viewer_role.yaml b/opensearch-operator/config/rbac/opensearchuser_viewer_role.yaml index 954fca774..663ec79a3 100644 --- a/opensearch-operator/config/rbac/opensearchuser_viewer_role.yaml +++ b/opensearch-operator/config/rbac/opensearchuser_viewer_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchuser-viewer-role rules: - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchusers verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchusers/status verbs: diff --git a/opensearch-operator/config/rbac/opensearchuserrolebinding_editor_role.yaml b/opensearch-operator/config/rbac/opensearchuserrolebinding_editor_role.yaml index acd1abe68..f204d02c7 100644 --- a/opensearch-operator/config/rbac/opensearchuserrolebinding_editor_role.yaml +++ b/opensearch-operator/config/rbac/opensearchuserrolebinding_editor_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchuserrolebinding-editor-role rules: - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchuserrolebindings verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchuserrolebindings/status verbs: diff --git a/opensearch-operator/config/rbac/opensearchuserrolebinding_viewer_role.yaml b/opensearch-operator/config/rbac/opensearchuserrolebinding_viewer_role.yaml index ab48720fb..3bccd6ba4 100644 --- a/opensearch-operator/config/rbac/opensearchuserrolebinding_viewer_role.yaml +++ b/opensearch-operator/config/rbac/opensearchuserrolebinding_viewer_role.yaml @@ -5,7 +5,7 @@ metadata: name: opensearchuserrolebinding-viewer-role rules: - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchuserrolebindings verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opensearch.org + - opster.opensearch.opster.io resources: - opensearchuserrolebindings/status verbs: diff --git a/opensearch-operator/config/rbac/role.yaml b/opensearch-operator/config/rbac/role.yaml index a6d4cc0d4..487cbaa25 100644 --- a/opensearch-operator/config/rbac/role.yaml +++ b/opensearch-operator/config/rbac/role.yaml @@ -110,14 +110,14 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - events verbs: - create - patch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchactiongroups verbs: @@ -129,13 +129,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchactiongroups/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchactiongroups/status verbs: @@ -143,7 +143,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchclusters verbs: @@ -155,13 +155,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchclusters/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchclusters/status verbs: @@ -169,7 +169,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcomponenttemplates verbs: @@ -181,13 +181,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcomponenttemplates/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchcomponenttemplates/status verbs: @@ -195,7 +195,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchindextemplates verbs: @@ -207,13 +207,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchindextemplates/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchindextemplates/status verbs: @@ -221,7 +221,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchismpolicies verbs: @@ -233,13 +233,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchismpolicies/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchismpolicies/status verbs: @@ -247,7 +247,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchroles verbs: @@ -259,13 +259,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchroles/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchroles/status verbs: @@ -273,7 +273,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchtenants verbs: @@ -285,13 +285,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchtenants/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchtenants/status verbs: @@ -299,7 +299,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchuserrolebindings verbs: @@ -311,13 +311,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchuserrolebindings/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchuserrolebindings/status verbs: @@ -325,7 +325,7 @@ rules: - patch - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchusers verbs: @@ -337,13 +337,13 @@ rules: - update - watch - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchusers/finalizers verbs: - update - apiGroups: - - opensearch.org + - opensearch.opster.io resources: - opensearchusers/status verbs: diff --git a/opensearch-operator/config/samples/opensearch_v1_opensearchactiongroup.yaml b/opensearch-operator/config/samples/opster_v1_opensearchactiongroup.yaml similarity index 88% rename from opensearch-operator/config/samples/opensearch_v1_opensearchactiongroup.yaml rename to opensearch-operator/config/samples/opster_v1_opensearchactiongroup.yaml index 7fc18222b..509bead20 100644 --- a/opensearch-operator/config/samples/opensearch_v1_opensearchactiongroup.yaml +++ b/opensearch-operator/config/samples/opster_v1_opensearchactiongroup.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchActionGroup metadata: name: sample-action-group diff --git a/opensearch-operator/config/samples/opensearch_v1_opensearchcluster.yaml b/opensearch-operator/config/samples/opster_v1_opensearchcluster.yaml similarity index 72% rename from opensearch-operator/config/samples/opensearch_v1_opensearchcluster.yaml rename to opensearch-operator/config/samples/opster_v1_opensearchcluster.yaml index 1f68a5200..c02ee1fcc 100644 --- a/opensearch-operator/config/samples/opensearch_v1_opensearchcluster.yaml +++ b/opensearch-operator/config/samples/opster_v1_opensearchcluster.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: opensearch-sample diff --git a/opensearch-operator/config/samples/opensearch_v1_opensearchrole.yaml b/opensearch-operator/config/samples/opster_v1_opensearchrole.yaml similarity index 69% rename from opensearch-operator/config/samples/opensearch_v1_opensearchrole.yaml rename to opensearch-operator/config/samples/opster_v1_opensearchrole.yaml index ba306c711..d80af7eab 100644 --- a/opensearch-operator/config/samples/opensearch_v1_opensearchrole.yaml +++ b/opensearch-operator/config/samples/opster_v1_opensearchrole.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opster.opensearch.opster.io/v1 kind: OpensearchRole metadata: name: opensearchrole-sample diff --git a/opensearch-operator/config/samples/opensearch_v1_opensearchtenant.yaml b/opensearch-operator/config/samples/opster_v1_opensearchtenant.yaml similarity index 81% rename from opensearch-operator/config/samples/opensearch_v1_opensearchtenant.yaml rename to opensearch-operator/config/samples/opster_v1_opensearchtenant.yaml index ca9ca0707..a7375d008 100644 --- a/opensearch-operator/config/samples/opensearch_v1_opensearchtenant.yaml +++ b/opensearch-operator/config/samples/opster_v1_opensearchtenant.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchTenant metadata: name: sample-tenant diff --git a/opensearch-operator/config/samples/opensearch_v1_opensearchuser.yaml b/opensearch-operator/config/samples/opster_v1_opensearchuser.yaml similarity index 69% rename from opensearch-operator/config/samples/opensearch_v1_opensearchuser.yaml rename to opensearch-operator/config/samples/opster_v1_opensearchuser.yaml index eb4093e39..323f7ece4 100644 --- a/opensearch-operator/config/samples/opensearch_v1_opensearchuser.yaml +++ b/opensearch-operator/config/samples/opster_v1_opensearchuser.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opster.opensearch.opster.io/v1 kind: OpensearchUser metadata: name: opensearchuser-sample diff --git a/opensearch-operator/config/samples/opensearch_v1_opensearchuserrolebinding.yaml b/opensearch-operator/config/samples/opster_v1_opensearchuserrolebinding.yaml similarity index 73% rename from opensearch-operator/config/samples/opensearch_v1_opensearchuserrolebinding.yaml rename to opensearch-operator/config/samples/opster_v1_opensearchuserrolebinding.yaml index 032f19065..2d0e95ff7 100644 --- a/opensearch-operator/config/samples/opensearch_v1_opensearchuserrolebinding.yaml +++ b/opensearch-operator/config/samples/opster_v1_opensearchuserrolebinding.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opster.opensearch.opster.io/v1 kind: OpensearchUserRoleBinding metadata: name: opensearchuserrolebinding-sample diff --git a/opensearch-operator/controllers/cluster_test.go b/opensearch-operator/controllers/cluster_test.go index 3186e8acb..56a607adc 100644 --- a/opensearch-operator/controllers/cluster_test.go +++ b/opensearch-operator/controllers/cluster_test.go @@ -8,11 +8,11 @@ import ( policyv1 "k8s.io/api/policy/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/kralicky/kmatch" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -155,7 +155,7 @@ var _ = Describe("Cluster Reconciler", func() { for _, nodePool := range OpensearchCluster.Spec.NodePools { wg.Add(1) By(fmt.Sprintf("checking %s nodepool", nodePool.Component)) - go func(nodePool opensearchv1.NodePool) { + go func(nodePool opsterv1.NodePool) { defer GinkgoRecover() defer wg.Done() Eventually(Object(&appsv1.StatefulSet{ @@ -263,7 +263,7 @@ var _ = Describe("Cluster Reconciler", func() { for _, nodePool := range OpensearchCluster.Spec.NodePools { wg.Add(1) By(fmt.Sprintf("checking %s nodepool initial master", nodePool.Component)) - go func(nodePool opensearchv1.NodePool) { + go func(nodePool opsterv1.NodePool) { defer GinkgoRecover() defer wg.Done() Eventually(func() []corev1.EnvVar { @@ -313,7 +313,7 @@ var _ = Describe("Cluster Reconciler", func() { for _, nodePool := range OpensearchCluster.Spec.NodePools { wg.Add(1) By(fmt.Sprintf("checking %s nodepool initial master", nodePool.Component)) - go func(nodePool opensearchv1.NodePool) { + go func(nodePool opsterv1.NodePool) { defer GinkgoRecover() defer wg.Done() Eventually(func() []corev1.EnvVar { @@ -403,7 +403,7 @@ var _ = Describe("Cluster Reconciler", func() { When("A node pool is upgrading", func() { Specify("updating the status should succeed", func() { - status := opensearchv1.ComponentStatus{ + status := opsterv1.ComponentStatus{ Component: "Upgrader", Description: "nodes", Status: "Upgrading", @@ -448,17 +448,17 @@ var _ = Describe("Cluster Reconciler", func() { }) When("a cluster is upgraded", func() { Specify("updating the status should succeed", func() { - currentStatus := opensearchv1.ComponentStatus{ + currentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: "nodes", } - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgraded", Description: "nodes", } - masterComponentStatus := opensearchv1.ComponentStatus{ + masterComponentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgraded", Description: "master", @@ -490,7 +490,7 @@ var _ = Describe("Cluster Reconciler", func() { wg := sync.WaitGroup{} for _, nodePool := range OpensearchCluster.Spec.NodePools { wg.Add(1) - go func(nodePool opensearchv1.NodePool) { + go func(nodePool opsterv1.NodePool) { defer GinkgoRecover() defer wg.Done() Eventually(func() bool { diff --git a/opensearch-operator/controllers/controller_settings.go b/opensearch-operator/controllers/controller_settings.go index 2fc283b37..08fd4d572 100644 --- a/opensearch-operator/controllers/controller_settings.go +++ b/opensearch-operator/controllers/controller_settings.go @@ -1,5 +1,5 @@ package controllers const ( - OpensearchFinalizer = "opensearch.org/opensearch-data" + OpensearchFinalizer = "opster.io/opensearch-data" ) diff --git a/opensearch-operator/controllers/opensearchController.go b/opensearch-operator/controllers/opensearchController.go index 8f14b84f6..69f9b2cdb 100644 --- a/opensearch-operator/controllers/opensearchController.go +++ b/opensearch-operator/controllers/opensearchController.go @@ -20,10 +20,10 @@ import ( "context" "time" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/retry" @@ -37,7 +37,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" ) // OpenSearchClusterReconciler reconciles a OpenSearchCluster object @@ -45,14 +45,14 @@ type OpenSearchClusterReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpenSearchCluster + Instance *opsterv1.OpenSearchCluster logr.Logger } -//+kubebuilder:rbac:groups="opensearch.org",resources=events,verbs=create;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchclusters,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchclusters/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchclusters/finalizers,verbs=update +//+kubebuilder:rbac:groups="opensearch.opster.io",resources=events,verbs=create;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchclusters,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchclusters/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchclusters/finalizers,verbs=update //+kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete @@ -76,9 +76,9 @@ type OpenSearchClusterReconciler struct { func (r *OpenSearchClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { r.Logger = log.FromContext(ctx).WithValues("cluster", req.NamespacedName) r.Logger.Info("Reconciling OpenSearchCluster") - myFinalizerName := "OpenSearch" + myFinalizerName := "Opster" - r.Instance = &opensearchv1.OpenSearchCluster{} + r.Instance = &opsterv1.OpenSearchCluster{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { if errors.IsNotFound(err) { @@ -131,13 +131,13 @@ func (r *OpenSearchClusterReconciler) Reconcile(ctx context.Context, req ctrl.Re /// if crd not deleted started phase 1 if r.Instance.Status.Phase == "" { - r.Instance.Status.Phase = opensearchv1.PhasePending + r.Instance.Status.Phase = opsterv1.PhasePending } switch r.Instance.Status.Phase { - case opensearchv1.PhasePending: + case opsterv1.PhasePending: return r.reconcilePhasePending(ctx) - case opensearchv1.PhaseRunning: + case opsterv1.PhaseRunning: return r.reconcilePhaseRunning(ctx) default: // NOTHING WILL HAPPEN - DEFAULT @@ -148,7 +148,7 @@ func (r *OpenSearchClusterReconciler) Reconcile(ctx context.Context, req ctrl.Re // SetupWithManager sets up the controller with the Manager. func (r *OpenSearchClusterReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpenSearchCluster{}). + For(&opsterv1.OpenSearchCluster{}). Owns(&corev1.Pod{}). Owns(&corev1.Secret{}). Owns(&corev1.ConfigMap{}). @@ -222,8 +222,8 @@ func (r *OpenSearchClusterReconciler) reconcilePhasePending(ctx context.Context) if err := r.Get(ctx, client.ObjectKeyFromObject(r.Instance), r.Instance); err != nil { return err } - r.Instance.Status.Phase = opensearchv1.PhaseRunning - r.Instance.Status.ComponentsStatus = make([]opensearchv1.ComponentStatus, 0) + r.Instance.Status.Phase = opsterv1.PhaseRunning + r.Instance.Status.ComponentsStatus = make([]opsterv1.ComponentStatus, 0) return r.Status().Update(ctx, r.Instance) }) if err != nil { diff --git a/opensearch-operator/controllers/opensearch_componenttemplate_controller.go b/opensearch-operator/controllers/opensearch_componenttemplate_controller.go index a378fef88..a7ba703ae 100644 --- a/opensearch-operator/controllers/opensearch_componenttemplate_controller.go +++ b/opensearch-operator/controllers/opensearch_componenttemplate_controller.go @@ -2,9 +2,10 @@ package controllers import ( "context" + + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" @@ -18,13 +19,13 @@ type OpensearchComponentTemplateReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchComponentTemplate + Instance *opsterv1.OpensearchComponentTemplate logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchcomponenttemplates,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchcomponenttemplates/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchcomponenttemplates/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchcomponenttemplates,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchcomponenttemplates/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchcomponenttemplates/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -32,7 +33,7 @@ func (r *OpensearchComponentTemplateReconciler) Reconcile(ctx context.Context, r r.Logger = log.FromContext(ctx).WithValues("componenttemplate", req.NamespacedName) r.Logger.Info("Reconciling OpensearchComponentTemplate") - r.Instance = &opensearchv1.OpensearchComponentTemplate{} + r.Instance = &opsterv1.OpensearchComponentTemplate{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -69,7 +70,7 @@ func (r *OpensearchComponentTemplateReconciler) Reconcile(ctx context.Context, r // SetupWithManager sets up the controller with the Manager. func (r *OpensearchComponentTemplateReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchComponentTemplate{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpensearchComponentTemplate{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/opensearch_indextemplate_controller.go b/opensearch-operator/controllers/opensearch_indextemplate_controller.go index 11ad73e2f..10a4916b2 100644 --- a/opensearch-operator/controllers/opensearch_indextemplate_controller.go +++ b/opensearch-operator/controllers/opensearch_indextemplate_controller.go @@ -2,9 +2,10 @@ package controllers import ( "context" + + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" @@ -18,13 +19,13 @@ type OpensearchIndexTemplateReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchIndexTemplate + Instance *opsterv1.OpensearchIndexTemplate logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchindextemplates,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchindextemplates/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchindextemplates/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchindextemplates,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchindextemplates/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchindextemplates/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -32,7 +33,7 @@ func (r *OpensearchIndexTemplateReconciler) Reconcile(ctx context.Context, req c r.Logger = log.FromContext(ctx).WithValues("indextemplate", req.NamespacedName) r.Logger.Info("Reconciling OpensearchIndexTemplate") - r.Instance = &opensearchv1.OpensearchIndexTemplate{} + r.Instance = &opsterv1.OpensearchIndexTemplate{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -69,7 +70,7 @@ func (r *OpensearchIndexTemplateReconciler) Reconcile(ctx context.Context, req c // SetupWithManager sets up the controller with the Manager. func (r *OpensearchIndexTemplateReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchIndexTemplate{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpensearchIndexTemplate{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/opensearchactiongroup_controller.go b/opensearch-operator/controllers/opensearchactiongroup_controller.go index 095bae9d5..3523f5484 100644 --- a/opensearch-operator/controllers/opensearchactiongroup_controller.go +++ b/opensearch-operator/controllers/opensearchactiongroup_controller.go @@ -2,10 +2,11 @@ package controllers import ( "context" + + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" @@ -19,13 +20,13 @@ type OpensearchActionGroupReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchActionGroup + Instance *opsterv1.OpensearchActionGroup logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchactiongroups,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchactiongroups/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchactiongroups/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchactiongroups,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchactiongroups/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchactiongroups/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -33,7 +34,7 @@ func (r *OpensearchActionGroupReconciler) Reconcile(ctx context.Context, req ctr r.Logger = log.FromContext(ctx).WithValues("actiongroup", req.NamespacedName) r.Logger.Info("Reconciling OpensearchActionGroup") - r.Instance = &opensearchv1.OpensearchActionGroup{} + r.Instance = &opsterv1.OpensearchActionGroup{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -70,7 +71,7 @@ func (r *OpensearchActionGroupReconciler) Reconcile(ctx context.Context, req ctr // SetupWithManager sets up the controller with the Manager. func (r *OpensearchActionGroupReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchActionGroup{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpensearchActionGroup{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/opensearchism_controller.go b/opensearch-operator/controllers/opensearchism_controller.go index 0808e2938..53fe38716 100644 --- a/opensearch-operator/controllers/opensearchism_controller.go +++ b/opensearch-operator/controllers/opensearchism_controller.go @@ -2,9 +2,10 @@ package controllers import ( "context" + + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" @@ -18,20 +19,20 @@ type OpensearchISMPolicyReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpenSearchISMPolicy + Instance *opsterv1.OpenSearchISMPolicy logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchismpolicies,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchismpolicies/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchismpolicies/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchismpolicies,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchismpolicies/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchismpolicies/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. func (r *OpensearchISMPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { r.Logger = log.FromContext(ctx).WithValues("tenant", req.NamespacedName) r.Logger.Info("Reconciling OpensearchISMPolicy") - r.Instance = &opensearchv1.OpenSearchISMPolicy{} + r.Instance = &opsterv1.OpenSearchISMPolicy{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -66,7 +67,7 @@ func (r *OpensearchISMPolicyReconciler) Reconcile(ctx context.Context, req ctrl. // SetupWithManager sets up the controller with the Manager. func (r *OpensearchISMPolicyReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpenSearchISMPolicy{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpenSearchISMPolicy{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/opensearchrole_controller.go b/opensearch-operator/controllers/opensearchrole_controller.go index 426053833..7a15fd169 100644 --- a/opensearch-operator/controllers/opensearchrole_controller.go +++ b/opensearch-operator/controllers/opensearchrole_controller.go @@ -18,6 +18,7 @@ package controllers import ( "context" + "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -26,8 +27,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" ) // OpensearchRoleReconciler reconciles a OpensearchRole object @@ -35,13 +36,13 @@ type OpensearchRoleReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchRole + Instance *opsterv1.OpensearchRole logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchroles,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchroles/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchroles/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchroles,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchroles/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchroles/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -49,7 +50,7 @@ func (r *OpensearchRoleReconciler) Reconcile(ctx context.Context, req ctrl.Reque r.Logger = log.FromContext(ctx).WithValues("role", req.NamespacedName) r.Logger.Info("Reconciling OpensearchRole") - r.Instance = &opensearchv1.OpensearchRole{} + r.Instance = &opsterv1.OpensearchRole{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -86,7 +87,7 @@ func (r *OpensearchRoleReconciler) Reconcile(ctx context.Context, req ctrl.Reque // SetupWithManager sets up the controller with the Manager. func (r *OpensearchRoleReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchRole{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpensearchRole{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/opensearchtenant_controller.go b/opensearch-operator/controllers/opensearchtenant_controller.go index a60b7337a..26bc3bb71 100644 --- a/opensearch-operator/controllers/opensearchtenant_controller.go +++ b/opensearch-operator/controllers/opensearchtenant_controller.go @@ -2,10 +2,10 @@ package controllers import ( "context" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" @@ -19,13 +19,13 @@ type OpensearchTenantReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchTenant + Instance *opsterv1.OpensearchTenant logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchtenants,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchtenants/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchtenants/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchtenants,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchtenants/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchtenants/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -33,7 +33,7 @@ func (r *OpensearchTenantReconciler) Reconcile(ctx context.Context, req ctrl.Req r.Logger = log.FromContext(ctx).WithValues("tenant", req.NamespacedName) r.Logger.Info("Reconciling OpensearchTenant") - r.Instance = &opensearchv1.OpensearchTenant{} + r.Instance = &opsterv1.OpensearchTenant{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -70,7 +70,7 @@ func (r *OpensearchTenantReconciler) Reconcile(ctx context.Context, req ctrl.Req // SetupWithManager sets up the controller with the Manager. func (r *OpensearchTenantReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchTenant{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpensearchTenant{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/opensearchuser_controller.go b/opensearch-operator/controllers/opensearchuser_controller.go index 995c87b9e..7bef1a6ae 100644 --- a/opensearch-operator/controllers/opensearchuser_controller.go +++ b/opensearch-operator/controllers/opensearchuser_controller.go @@ -18,6 +18,7 @@ package controllers import ( "context" + "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" @@ -30,9 +31,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/reconcile" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" ) // OpensearchUserReconciler reconciles a OpensearchUser object @@ -40,13 +41,13 @@ type OpensearchUserReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchUser + Instance *opsterv1.OpensearchUser logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchusers,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchusers/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchusers/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchusers,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchusers/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchusers/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -54,7 +55,7 @@ func (r *OpensearchUserReconciler) Reconcile(ctx context.Context, req ctrl.Reque r.Logger = log.FromContext(ctx).WithValues("user", req.NamespacedName) r.Logger.Info("Reconciling OpensearchUser") - r.Instance = &opensearchv1.OpensearchUser{} + r.Instance = &opsterv1.OpensearchUser{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -119,9 +120,9 @@ func (r *OpensearchUserReconciler) handleSecretEvent(_ context.Context, secret c // SetupWithManager sets up the controller with the Manager. func (r *OpensearchUserReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchUser{}). + For(&opsterv1.OpensearchUser{}). // Get notified when opensearch clusters change - Owns(&opensearchv1.OpenSearchCluster{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when password backing secret changes Watches( &corev1.Secret{}, diff --git a/opensearch-operator/controllers/opensearchuserrolebinding_controller.go b/opensearch-operator/controllers/opensearchuserrolebinding_controller.go index f48f39ece..92aabf19b 100644 --- a/opensearch-operator/controllers/opensearchuserrolebinding_controller.go +++ b/opensearch-operator/controllers/opensearchuserrolebinding_controller.go @@ -18,6 +18,7 @@ package controllers import ( "context" + "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -26,8 +27,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" ) // OpensearchUserRoleBindingReconciler reconciles a OpensearchUserRoleBinding object @@ -35,13 +36,13 @@ type OpensearchUserRoleBindingReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opensearchv1.OpensearchUserRoleBinding + Instance *opsterv1.OpensearchUserRoleBinding logr.Logger } -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchuserrolebindings,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchuserrolebindings/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.org,resources=opensearchuserrolebindings/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchuserrolebindings,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchuserrolebindings/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.opster.io,resources=opensearchuserrolebindings/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -49,7 +50,7 @@ func (r *OpensearchUserRoleBindingReconciler) Reconcile(ctx context.Context, req r.Logger = log.FromContext(ctx).WithValues("userrolebinding", req.NamespacedName) r.Logger.Info("Reconciling OpensearchUserRoleBinding") - r.Instance = &opensearchv1.OpensearchUserRoleBinding{} + r.Instance = &opsterv1.OpensearchUserRoleBinding{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -86,7 +87,7 @@ func (r *OpensearchUserRoleBindingReconciler) Reconcile(ctx context.Context, req // SetupWithManager sets up the controller with the Manager. func (r *OpensearchUserRoleBindingReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&opensearchv1.OpensearchUserRoleBinding{}). - Owns(&opensearchv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&opsterv1.OpensearchUserRoleBinding{}). + Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change Complete(r) } diff --git a/opensearch-operator/controllers/scaler_test.go b/opensearch-operator/controllers/scaler_test.go index 92c41aa8a..0ec843f93 100644 --- a/opensearch-operator/controllers/scaler_test.go +++ b/opensearch-operator/controllers/scaler_test.go @@ -2,9 +2,9 @@ package controllers import ( "context" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" @@ -31,7 +31,7 @@ var _ = Describe("Scaler Reconciler", func() { var ( OpensearchCluster = ComposeOpensearchCrd(clusterName, namespace) nodePool = appsv1.StatefulSet{} - cluster2 = opensearchv1.OpenSearchCluster{} + cluster2 = opsterv1.OpenSearchCluster{} ) /// ------- Creation Check phase ------- diff --git a/opensearch-operator/controllers/suite_test.go b/opensearch-operator/controllers/suite_test.go index 751542540..175aefcc7 100644 --- a/opensearch-operator/controllers/suite_test.go +++ b/opensearch-operator/controllers/suite_test.go @@ -29,7 +29,7 @@ import ( monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" "github.com/phayes/freeport" ctrl "sigs.k8s.io/controller-runtime" @@ -88,7 +88,7 @@ var _ = BeforeSuite(func() { err = scheme.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = opensearchv1.AddToScheme(scheme.Scheme) + err = opsterv1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) diff --git a/opensearch-operator/controllers/suite_test_helpers.go b/opensearch-operator/controllers/suite_test_helpers.go index f499fccaf..5051378a6 100644 --- a/opensearch-operator/controllers/suite_test_helpers.go +++ b/opensearch-operator/controllers/suite_test_helpers.go @@ -6,7 +6,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -14,7 +14,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -func CreateNamespace(k8sClient client.Client, cluster *opensearchv1.OpenSearchCluster) error { +func CreateNamespace(k8sClient client.Client, cluster *opsterv1.OpenSearchCluster) error { ns := corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: cluster.Name}} return k8sClient.Create(context.Background(), &ns) } @@ -76,7 +76,7 @@ func IsConfigMapDeleted(k8sClient client.Client, name string, namespace string) return err != nil } -func HasOwnerReference(object client.Object, owner *opensearchv1.OpenSearchCluster) bool { +func HasOwnerReference(object client.Object, owner *opsterv1.OpenSearchCluster) bool { for _, ownerRef := range object.GetOwnerReferences() { if ownerRef.Name == owner.ObjectMeta.Name { return true @@ -94,19 +94,19 @@ func ArrayElementContains(array []string, content string) bool { return false } -func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.OpenSearchCluster { - OpensearchCluster := &opensearchv1.OpenSearchCluster{ +func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSearchCluster { + OpensearchCluster := &opsterv1.OpenSearchCluster{ TypeMeta: metav1.TypeMeta{ Kind: "OpenSearchCluster", - APIVersion: "opensearch.org/v1", + APIVersion: "opensearch.opster.io/v1", }, ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: namespace, }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ - Monitoring: opensearchv1.MonitoringConfig{Enable: true, ScrapeInterval: "35s", TLSConfig: &opensearchv1.MonitoringConfigTLS{InsecureSkipVerify: true, ServerName: "foo.bar"}}, + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ + Monitoring: opsterv1.MonitoringConfig{Enable: true, ScrapeInterval: "35s", TLSConfig: &opsterv1.MonitoringConfigTLS{InsecureSkipVerify: true, ServerName: "foo.bar"}}, HttpPort: 9200, Vendor: "opensearch", Version: "2.0.0", @@ -115,7 +115,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope AdditionalConfig: map[string]string{ "foo": "bar", }, - AdditionalVolumes: []opensearchv1.AdditionalVolume{ + AdditionalVolumes: []opsterv1.AdditionalVolume{ { Name: "test-secret", Path: "/opt/test-secret", @@ -142,12 +142,12 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope }, }, }, - ConfMgmt: opensearchv1.ConfMgmt{ + ConfMgmt: opsterv1.ConfMgmt{ AutoScaler: false, VerUpdate: false, SmartScaler: false, }, - Bootstrap: opensearchv1.BootstrapConfig{ + Bootstrap: opsterv1.BootstrapConfig{ Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("125m"), @@ -161,7 +161,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope Value: "bar", }}, }, - Dashboards: opensearchv1.DashboardsConfig{ + Dashboards: opsterv1.DashboardsConfig{ Enable: true, Replicas: 3, Version: "2.0.0", @@ -182,9 +182,9 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope }, Affinity: &corev1.Affinity{}, }, - NodePools: []opensearchv1.NodePool{{ + NodePools: []opsterv1.NodePool{{ Component: "master", - Pdb: &opensearchv1.PdbConfig{ + Pdb: &opsterv1.PdbConfig{ Enable: true, MinAvailable: &intstr.IntOrString{ IntVal: 3, @@ -215,7 +215,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope "master", "data", }, - Persistence: &opensearchv1.PersistenceConfig{PersistenceSource: opensearchv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }, { Component: "nodes", Replicas: 3, @@ -229,7 +229,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope Roles: []string{ "data", }, - Persistence: &opensearchv1.PersistenceConfig{PersistenceSource: opensearchv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }, { Component: "client", Replicas: 3, @@ -254,11 +254,11 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opensearchv1.Ope {Name: "qux", Value: "qut"}, {Name: "quuxe", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "metadata.labels['quux']"}}}, }, - Persistence: &opensearchv1.PersistenceConfig{PersistenceSource: opensearchv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }}, }, - Status: opensearchv1.ClusterStatus{ - ComponentsStatus: []opensearchv1.ComponentStatus{ + Status: opsterv1.ClusterStatus{ + ComponentsStatus: []opsterv1.ComponentStatus{ { Component: "", Status: "", diff --git a/opensearch-operator/controllers/tls_test.go b/opensearch-operator/controllers/tls_test.go index b1ef906e5..338e57c61 100644 --- a/opensearch-operator/controllers/tls_test.go +++ b/opensearch-operator/controllers/tls_test.go @@ -5,10 +5,10 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" @@ -29,28 +29,28 @@ var _ = Describe("TLS Reconciler", func() { interval = time.Second * 1 ) Context("When Creating an OpenSearchCluster with TLS configured", func() { - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: namespace}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: clusterName, Version: "2.0.0", }, - Security: &opensearchv1.Security{Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{ + Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{ Generate: true, PerNode: true, }, - Http: &opensearchv1.TlsConfigHttp{ + Http: &opsterv1.TlsConfigHttp{ Generate: true, }, }}, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "masters", Replicas: 3, Roles: []string{"master", "data"}, - Persistence: &opensearchv1.PersistenceConfig{PersistenceSource: opensearchv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }, }, }, diff --git a/opensearch-operator/examples/opensearch-cluster-custom-admin-user.yaml b/opensearch-operator/examples/opensearch-cluster-custom-admin-user.yaml index beeff7db4..de2279db2 100644 --- a/opensearch-operator/examples/opensearch-cluster-custom-admin-user.yaml +++ b/opensearch-operator/examples/opensearch-cluster-custom-admin-user.yaml @@ -1,6 +1,6 @@ ## Use this example in case you want to deploy your cluster with an admin user with a custom password instead of the default (admin). -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-cluster diff --git a/opensearch-operator/examples/opensearch-cluster-initcontainer-resources.yaml b/opensearch-operator/examples/opensearch-cluster-initcontainer-resources.yaml index c8eab7ef2..fa2aa6fbf 100644 --- a/opensearch-operator/examples/opensearch-cluster-initcontainer-resources.yaml +++ b/opensearch-operator/examples/opensearch-cluster-initcontainer-resources.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: test-init-resources diff --git a/opensearch-operator/examples/opensearch-cluster-pdb.yaml b/opensearch-operator/examples/opensearch-cluster-pdb.yaml index 5bcf99ad2..988e5ed85 100644 --- a/opensearch-operator/examples/opensearch-cluster-pdb.yaml +++ b/opensearch-operator/examples/opensearch-cluster-pdb.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-cluster diff --git a/opensearch-operator/examples/opensearch-cluster-securityconfig.yaml b/opensearch-operator/examples/opensearch-cluster-securityconfig.yaml index e80496d5b..856f1cca6 100644 --- a/opensearch-operator/examples/opensearch-cluster-securityconfig.yaml +++ b/opensearch-operator/examples/opensearch-cluster-securityconfig.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-cluster diff --git a/opensearch-operator/examples/opensearch-cluster.yaml b/opensearch-operator/examples/opensearch-cluster.yaml index ade774a55..8aa9f2287 100644 --- a/opensearch-operator/examples/opensearch-cluster.yaml +++ b/opensearch-operator/examples/opensearch-cluster.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-cluster diff --git a/opensearch-operator/examples/opensearch-component-template.yaml b/opensearch-operator/examples/opensearch-component-template.yaml index 9503b10ae..3d6d1413b 100644 --- a/opensearch-operator/examples/opensearch-component-template.yaml +++ b/opensearch-operator/examples/opensearch-component-template.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchComponentTemplate metadata: name: sample-component-template diff --git a/opensearch-operator/examples/opensearch-hot-warm-cold.yaml b/opensearch-operator/examples/opensearch-hot-warm-cold.yaml index c1c42ea69..3e8f72693 100644 --- a/opensearch-operator/examples/opensearch-hot-warm-cold.yaml +++ b/opensearch-operator/examples/opensearch-hot-warm-cold.yaml @@ -1,7 +1,7 @@ #Minimal configuration of a cluster with version 2.6.0 of the operator. #This example will stand up a cluster with managers, hot, warm and cold #nodes to test hot-warm architectures -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-first-hot-warm-cold-cluster diff --git a/opensearch-operator/examples/opensearch-index-template.yaml b/opensearch-operator/examples/opensearch-index-template.yaml index 8b69d4717..60ada70c6 100644 --- a/opensearch-operator/examples/opensearch-index-template.yaml +++ b/opensearch-operator/examples/opensearch-index-template.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpensearchIndexTemplate metadata: name: sample-index-template diff --git a/opensearch-operator/examples/opensearch-v2-cluster.yaml b/opensearch-operator/examples/opensearch-v2-cluster.yaml index b6fb00e89..48613a17e 100644 --- a/opensearch-operator/examples/opensearch-v2-cluster.yaml +++ b/opensearch-operator/examples/opensearch-v2-cluster.yaml @@ -1,6 +1,6 @@ #Minimal configuration of a cluster with version 2.X of the operator. #Note the replacement of 'master' role with 'cluster_manager' on line 49 -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: my-first-cluster diff --git a/opensearch-operator/functionaltests/go.mod b/opensearch-operator/functionaltests/go.mod index a709a2125..32cd1323c 100644 --- a/opensearch-operator/functionaltests/go.mod +++ b/opensearch-operator/functionaltests/go.mod @@ -1,4 +1,4 @@ -module github.com/opensearch-project/opensearch-k8s-operator/functionaltests +module github.com/Opster/opensearch-k8s-operator/functionaltests go 1.19 diff --git a/opensearch-operator/functionaltests/operatortests/deploy-and-upgrade.yaml b/opensearch-operator/functionaltests/operatortests/deploy-and-upgrade.yaml index d648a6022..7d1c64cc9 100644 --- a/opensearch-operator/functionaltests/operatortests/deploy-and-upgrade.yaml +++ b/opensearch-operator/functionaltests/operatortests/deploy-and-upgrade.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.org/v1 +apiVersion: opensearch.opster.io/v1 kind: OpenSearchCluster metadata: name: deploy-and-upgrade diff --git a/opensearch-operator/functionaltests/operatortests/deploy_and_upgrade_test.go b/opensearch-operator/functionaltests/operatortests/deploy_and_upgrade_test.go index a96a29806..59eadd43a 100644 --- a/opensearch-operator/functionaltests/operatortests/deploy_and_upgrade_test.go +++ b/opensearch-operator/functionaltests/operatortests/deploy_and_upgrade_test.go @@ -4,9 +4,9 @@ import ( "context" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -49,7 +49,7 @@ var _ = Describe("DeployAndUpgrade", Ordered, func() { When("Upgrading the cluster", Ordered, func() { It("should accept the version upgrade", func() { cluster := unstructured.Unstructured{} - cluster.SetGroupVersionKind(schema.GroupVersionKind{Group: "opensearch.org", Version: "v1", Kind: "OpenSearchCluster"}) + 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") @@ -86,7 +86,7 @@ var _ = Describe("DeployAndUpgrade", Ordered, func() { } else { GinkgoWriter.Println(err) } - cluster := &opensearchv1.OpenSearchCluster{} + cluster := &opsterv1.OpenSearchCluster{} k8sClient.Get(context.Background(), client.ObjectKey{Name: name, Namespace: namespace}, cluster) GinkgoWriter.Printf("Cluster: %+v\n", cluster.Status) diff --git a/opensearch-operator/functionaltests/operatortests/main_test.go b/opensearch-operator/functionaltests/operatortests/main_test.go index c17606bc1..a594dfd6a 100644 --- a/opensearch-operator/functionaltests/operatortests/main_test.go +++ b/opensearch-operator/functionaltests/operatortests/main_test.go @@ -3,9 +3,9 @@ package operatortests import ( "testing" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -22,7 +22,7 @@ func TestAPIs(t *testing.T) { } scheme := runtime.NewScheme() utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(opensearchv1.AddToScheme(scheme)) + utilruntime.Must(opsterv1.AddToScheme(scheme)) k8sClient, err = client.New(config, client.Options{ Scheme: scheme, }) diff --git a/opensearch-operator/go.mod b/opensearch-operator/go.mod index 2cca7e5e7..2bbccbab9 100644 --- a/opensearch-operator/go.mod +++ b/opensearch-operator/go.mod @@ -1,4 +1,4 @@ -module github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator +module github.com/Opster/opensearch-k8s-operator/opensearch-operator go 1.19 diff --git a/opensearch-operator/main.go b/opensearch-operator/main.go index 0e4224435..3c898fbe2 100644 --- a/opensearch-operator/main.go +++ b/opensearch-operator/main.go @@ -22,14 +22,14 @@ import ( "os" "strconv" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/controllers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/controllers" "go.uber.org/zap/zapcore" // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. _ "k8s.io/client-go/plugin/pkg/client/auth" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -46,7 +46,7 @@ var ( func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(opensearchv1.AddToScheme(scheme)) + utilruntime.Must(opsterv1.AddToScheme(scheme)) utilruntime.Must(monitoring.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } @@ -96,7 +96,7 @@ func main() { Port: 9443, HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, - LeaderElectionID: "a867c7dc.opensearch.org", + LeaderElectionID: "a867c7dc.opensearch.opster.io", Namespace: watchNamespace, }) if err != nil { diff --git a/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go b/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go similarity index 99% rename from opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go rename to opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go index 6e8137be7..1d51b8c16 100644 --- a/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go +++ b/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go @@ -3,7 +3,7 @@ package k8s import ( - apiv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + apiv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" diff --git a/opensearch-operator/opensearch-gateway/responses/ISMPolicyResponse.go b/opensearch-operator/opensearch-gateway/responses/ISMPolicyResponse.go index 1bd972033..753314cc8 100644 --- a/opensearch-operator/opensearch-gateway/responses/ISMPolicyResponse.go +++ b/opensearch-operator/opensearch-gateway/responses/ISMPolicyResponse.go @@ -1,5 +1,5 @@ package responses -import "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" +import "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" type GetISMPoliciesResponse requests.Policy diff --git a/opensearch-operator/opensearch-gateway/responses/SecurityResponse.go b/opensearch-operator/opensearch-gateway/responses/SecurityResponse.go index 48803ba04..17744945a 100644 --- a/opensearch-operator/opensearch-gateway/responses/SecurityResponse.go +++ b/opensearch-operator/opensearch-gateway/responses/SecurityResponse.go @@ -1,6 +1,6 @@ package responses -import "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" +import "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" type GetRoleMappingReponse map[string]requests.RoleMapping diff --git a/opensearch-operator/opensearch-gateway/responses/Templates.go b/opensearch-operator/opensearch-gateway/responses/Templates.go index d06ebec47..2ee259787 100644 --- a/opensearch-operator/opensearch-gateway/responses/Templates.go +++ b/opensearch-operator/opensearch-gateway/responses/Templates.go @@ -1,6 +1,6 @@ package responses -import "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" +import "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" type GetIndexTemplatesResponse struct { IndexTemplates []IndexTemplate `json:"index_templates"` diff --git a/opensearch-operator/opensearch-gateway/services/os_client.go b/opensearch-operator/opensearch-gateway/services/os_client.go index 1578f2071..aab7fa746 100644 --- a/opensearch-operator/opensearch-gateway/services/os_client.go +++ b/opensearch-operator/opensearch-gateway/services/os_client.go @@ -10,10 +10,10 @@ import ( "strings" "time" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/opensearch-project/opensearch-go" "github.com/opensearch-project/opensearch-go/opensearchapi" "github.com/opensearch-project/opensearch-go/opensearchutil" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "k8s.io/utils/pointer" ) diff --git a/opensearch-operator/opensearch-gateway/services/os_data_service.go b/opensearch-operator/opensearch-gateway/services/os_data_service.go index bda675872..2291befd4 100644 --- a/opensearch-operator/opensearch-gateway/services/os_data_service.go +++ b/opensearch-operator/opensearch-gateway/services/os_data_service.go @@ -7,11 +7,11 @@ import ( "reflect" "strings" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/go-logr/logr" "github.com/opensearch-project/opensearch-go/opensearchutil" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/opensearch-operator/opensearch-gateway/services/os_ism_service.go b/opensearch-operator/opensearch-gateway/services/os_ism_service.go index acfbb76be..459e00bcc 100644 --- a/opensearch-operator/opensearch-gateway/services/os_ism_service.go +++ b/opensearch-operator/opensearch-gateway/services/os_ism_service.go @@ -7,8 +7,8 @@ import ( "fmt" "reflect" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" "github.com/opensearch-project/opensearch-go/opensearchutil" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/opensearch-operator/opensearch-gateway/services/os_security_service.go b/opensearch-operator/opensearch-gateway/services/os_security_service.go index 8ac9eaa09..b7407927d 100644 --- a/opensearch-operator/opensearch-gateway/services/os_security_service.go +++ b/opensearch-operator/opensearch-gateway/services/os_security_service.go @@ -6,9 +6,9 @@ import ( "fmt" "reflect" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/opensearch-project/opensearch-go/opensearchutil" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/opensearch-operator/opensearch-gateway/services/services_suite_test.go b/opensearch-operator/opensearch-gateway/services/services_suite_test.go index 7b2c96207..7f595270e 100644 --- a/opensearch-operator/opensearch-gateway/services/services_suite_test.go +++ b/opensearch-operator/opensearch-gateway/services/services_suite_test.go @@ -7,7 +7,7 @@ package services . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "k8s.io/utils/exec" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "path/filepath" "sigs.k8s.io/controller-runtime/pkg/envtest/printer" "testing" diff --git a/opensearch-operator/pkg/builders/cluster.go b/opensearch-operator/pkg/builders/cluster.go index 19d8de8c9..4e4a97d24 100644 --- a/opensearch-operator/pkg/builders/cluster.go +++ b/opensearch-operator/pkg/builders/cluster.go @@ -3,12 +3,12 @@ package builders import ( "context" "fmt" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" "strings" monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" @@ -23,7 +23,7 @@ import ( /// package that declare and build all the resources that related to the OpenSearch cluster /// const ( - ConfigurationChecksumAnnotation = "opensearch.org/config" + ConfigurationChecksumAnnotation = "opster.io/config" DefaultDiskSize = "30Gi" defaultMonitoringPlugin = "https://github.com/aiven/prometheus-exporter-plugin-for-opensearch/releases/download/%s.0/prometheus-exporter-%s.0.zip" securityconfigChecksumAnnotation = "securityconfig/checksum" @@ -32,8 +32,8 @@ const ( func NewSTSForNodePool( username string, - cr *opensearchv1.OpenSearchCluster, - node opensearchv1.NodePool, + cr *opsterv1.OpenSearchCluster, + node opsterv1.NodePool, configChecksum string, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, @@ -487,7 +487,7 @@ func NewSTSForNodePool( return sts } -func NewHeadlessServiceForNodePool(cr *opensearchv1.OpenSearchCluster, nodePool *opensearchv1.NodePool) *corev1.Service { +func NewHeadlessServiceForNodePool(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, helpers.NodePoolLabel: nodePool.Component, @@ -541,7 +541,7 @@ func NewHeadlessServiceForNodePool(cr *opensearchv1.OpenSearchCluster, nodePool } } -func NewServiceForCR(cr *opensearchv1.OpenSearchCluster) *corev1.Service { +func NewServiceForCR(cr *opsterv1.OpenSearchCluster) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } @@ -600,7 +600,7 @@ func NewServiceForCR(cr *opensearchv1.OpenSearchCluster) *corev1.Service { } } -func NewDiscoveryServiceForCR(cr *opensearchv1.OpenSearchCluster) *corev1.Service { +func NewDiscoveryServiceForCR(cr *opsterv1.OpenSearchCluster) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } @@ -630,7 +630,7 @@ func NewDiscoveryServiceForCR(cr *opensearchv1.OpenSearchCluster) *corev1.Servic } } -func NewNodePortService(cr *opensearchv1.OpenSearchCluster) *corev1.Service { +func NewNodePortService(cr *opsterv1.OpenSearchCluster) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } @@ -663,7 +663,7 @@ func NewNodePortService(cr *opensearchv1.OpenSearchCluster) *corev1.Service { } func NewBootstrapPod( - cr *opensearchv1.OpenSearchCluster, + cr *opsterv1.OpenSearchCluster, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, ) *corev1.Pod { @@ -837,7 +837,7 @@ func NewBootstrapPod( return pod } -func PortForCluster(cr *opensearchv1.OpenSearchCluster) int32 { +func PortForCluster(cr *opsterv1.OpenSearchCluster) int32 { httpPort := int32(9200) if cr.Spec.General.HttpPort > 0 { httpPort = cr.Spec.General.HttpPort @@ -845,12 +845,12 @@ func PortForCluster(cr *opensearchv1.OpenSearchCluster) int32 { return httpPort } -func URLForCluster(cr *opensearchv1.OpenSearchCluster) string { +func URLForCluster(cr *opsterv1.OpenSearchCluster) string { httpPort := PortForCluster(cr) return fmt.Sprintf("https://%s.svc.%s:%d", DnsOfService(cr), helpers.ClusterDnsBase(), httpPort) } -func PasswordSecret(cr *opensearchv1.OpenSearchCluster, username, password string) *corev1.Secret { +func PasswordSecret(cr *opsterv1.OpenSearchCluster, username, password string) *corev1.Secret { return &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-admin-password", cr.Name), @@ -863,23 +863,23 @@ func PasswordSecret(cr *opensearchv1.OpenSearchCluster, username, password strin } } -func DnsOfService(cr *opensearchv1.OpenSearchCluster) string { +func DnsOfService(cr *opsterv1.OpenSearchCluster) string { return fmt.Sprintf("%s.%s", cr.Spec.General.ServiceName, cr.Namespace) } -func StsName(cr *opensearchv1.OpenSearchCluster, nodePool *opensearchv1.NodePool) string { +func StsName(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) string { return cr.Name + "-" + nodePool.Component } -func DiscoveryServiceName(cr *opensearchv1.OpenSearchCluster) string { +func DiscoveryServiceName(cr *opsterv1.OpenSearchCluster) string { return fmt.Sprintf("%s-discovery", cr.Name) } -func BootstrapPodName(cr *opensearchv1.OpenSearchCluster) string { +func BootstrapPodName(cr *opsterv1.OpenSearchCluster) string { return fmt.Sprintf("%s-bootstrap-0", cr.Name) } -func STSInNodePools(sts appsv1.StatefulSet, nodepools []opensearchv1.NodePool) bool { +func STSInNodePools(sts appsv1.StatefulSet, nodepools []opsterv1.NodePool) bool { for _, nodepool := range nodepools { if sts.Labels[helpers.NodePoolLabel] == nodepool.Component { return true @@ -889,7 +889,7 @@ func STSInNodePools(sts appsv1.StatefulSet, nodepools []opensearchv1.NodePool) b } func NewSnapshotRepoconfigUpdateJob( - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, jobName string, namespace string, checksum string, @@ -913,7 +913,7 @@ func NewSnapshotRepoconfigUpdateJob( terminationGracePeriodSeconds := int64(5) backoffLimit := int32(0) - node := opensearchv1.NodePool{ + node := opsterv1.NodePool{ Component: "snapshotconfig", } annotations := map[string]string{ @@ -963,7 +963,7 @@ func NewSnapshotRepoconfigUpdateJob( } func NewSecurityconfigUpdateJob( - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, jobName string, namespace string, checksum string, @@ -973,7 +973,7 @@ func NewSecurityconfigUpdateJob( volumeMounts []corev1.VolumeMount, ) batchv1.Job { // Dummy node spec required to resolve image - node := opensearchv1.NodePool{ + node := opsterv1.NodePool{ Component: "securityconfig", } @@ -1024,7 +1024,7 @@ func NewSecurityconfigUpdateJob( } } -func AllMastersReady(ctx context.Context, k8sClient client.Client, cr *opensearchv1.OpenSearchCluster) bool { +func AllMastersReady(ctx context.Context, k8sClient client.Client, cr *opsterv1.OpenSearchCluster) bool { for _, nodePool := range cr.Spec.NodePools { masterRole := helpers.ResolveClusterManagerRole(cr.Spec.General.Version) if helpers.ContainsString(helpers.MapClusterRoles(nodePool.Roles, cr.Spec.General.Version), masterRole) { @@ -1043,7 +1043,7 @@ func AllMastersReady(ctx context.Context, k8sClient client.Client, cr *opensearc return true } -func NewServiceMonitor(cr *opensearchv1.OpenSearchCluster) *monitoring.ServiceMonitor { +func NewServiceMonitor(cr *opsterv1.OpenSearchCluster) *monitoring.ServiceMonitor { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } diff --git a/opensearch-operator/pkg/builders/cluster_test.go b/opensearch-operator/pkg/builders/cluster_test.go index 537e00cd7..ae65e96d9 100644 --- a/opensearch-operator/pkg/builders/cluster_test.go +++ b/opensearch-operator/pkg/builders/cluster_test.go @@ -3,33 +3,33 @@ package builders import ( "context" "fmt" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" "os" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" ) -func ClusterDescWithVersion(version string) opensearchv1.OpenSearchCluster { - return opensearchv1.OpenSearchCluster{ - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ +func ClusterDescWithVersion(version string) opsterv1.OpenSearchCluster { + return opsterv1.OpenSearchCluster{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ Version: version, }, }, } } -func ClusterDescWithKeystoreSecret(secretName string, keyMappings map[string]string) opensearchv1.OpenSearchCluster { - return opensearchv1.OpenSearchCluster{ - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ - Keystore: []opensearchv1.KeystoreValue{ +func ClusterDescWithKeystoreSecret(secretName string, keyMappings map[string]string) opsterv1.OpenSearchCluster { + return opsterv1.OpenSearchCluster{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ + Keystore: []opsterv1.KeystoreValue{ { Secret: corev1.LocalObjectReference{ Name: secretName, @@ -42,13 +42,13 @@ func ClusterDescWithKeystoreSecret(secretName string, keyMappings map[string]str } } -func ClusterDescWithAdditionalConfigs(addtitionalConfig map[string]string, bootstrapAdditionalConfig map[string]string) opensearchv1.OpenSearchCluster { - return opensearchv1.OpenSearchCluster{ - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ +func ClusterDescWithAdditionalConfigs(addtitionalConfig map[string]string, bootstrapAdditionalConfig map[string]string) opsterv1.OpenSearchCluster { + return opsterv1.OpenSearchCluster{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ AdditionalConfig: addtitionalConfig, }, - Bootstrap: opensearchv1.BootstrapConfig{ + Bootstrap: opsterv1.BootstrapConfig{ AdditionalConfig: bootstrapAdditionalConfig, }, }, @@ -59,13 +59,13 @@ var _ = Describe("Builders", func() { When("Constructing a STS for a NodePool", func() { It("should include the init containers as SKIP_INIT_CONTAINER is not set", func() { clusterObject := ClusterDescWithVersion("2.2.1") - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) Expect(len(result.Spec.Template.Spec.InitContainers)).To(Equal(1)) }) It("should skip the init container as SKIP_INIT_CONTAINER is set", func() { _ = os.Setenv(helpers.SkipInitContainerEnvVariable, "true") clusterObject := ClusterDescWithVersion("2.2.1") - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) Expect(len(result.Spec.Template.Spec.InitContainers)).To(Equal(0)) _ = os.Unsetenv(helpers.SkipInitContainerEnvVariable) }) @@ -83,7 +83,7 @@ var _ = Describe("Builders", func() { }) It("should only use valid roles", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager", "foobar", "ingest"}, } @@ -95,7 +95,7 @@ var _ = Describe("Builders", func() { }) It("should convert the master role", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"master"}, } @@ -107,7 +107,7 @@ var _ = Describe("Builders", func() { }) It("should convert the cluster_manager role", func() { clusterObject := ClusterDescWithVersion("1.3.0") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager"}, } @@ -119,7 +119,7 @@ var _ = Describe("Builders", func() { }) It("should have annotations added to node", func() { clusterObject := ClusterDescWithVersion("1.3.0") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager"}, Annotations: map[string]string{ @@ -134,7 +134,7 @@ var _ = Describe("Builders", func() { }) It("should have annotations added to sts", func() { clusterObject := ClusterDescWithVersion("1.3.0") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager"}, Annotations: map[string]string{ @@ -149,7 +149,7 @@ var _ = Describe("Builders", func() { }) It("should have a priority class name added to the node", func() { clusterObject := ClusterDescWithVersion("1.3.0") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager"}, PriorityClassName: "default", @@ -161,24 +161,24 @@ var _ = Describe("Builders", func() { clusterObject := ClusterDescWithVersion("2.2.1") customRepository := "mycustomrepo.cr" clusterObject.Spec.General.DefaultRepo = &customRepository - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) - Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/busybox:1.27.2-buildx")) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) + Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/busybox:1.27.2")) }) It("should use InitHelper.Image as InitHelper image if configured", func() { clusterObject := ClusterDescWithVersion("2.2.1") customImage := "mycustomrepo.cr/custombusybox:1.2.3" - clusterObject.Spec.InitHelper = opensearchv1.InitHelperConfig{ - ImageSpec: &opensearchv1.ImageSpec{ + clusterObject.Spec.InitHelper = opsterv1.InitHelperConfig{ + ImageSpec: &opsterv1.ImageSpec{ Image: &customImage, }, } - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/custombusybox:1.2.3")) }) It("should use defaults when no custom image is configured for InitHelper image", func() { clusterObject := ClusterDescWithVersion("2.2.1") - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) - Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("public.ecr.aws/opsterio/busybox:1.27.2-buildx")) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) + Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("public.ecr.aws/opensearch-project/opensearch-operator-busybox:latest")) }) It("should use a custom dns name when env variable is set as cluster url", func() { customDns := "custom.domain" @@ -205,7 +205,7 @@ var _ = Describe("Builders", func() { pluginB := "another-plugin" clusterObject.Spec.General.PluginsList = []string{pluginA, pluginB} - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) installCmd := fmt.Sprintf( "./bin/opensearch-plugin install --batch '%s' '%s' && ./opensearch-docker-entrypoint.sh", @@ -226,7 +226,7 @@ var _ = Describe("Builders", func() { It("should add experimental flag when the node.roles contains search and the version is below 2.7", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"search"}, } @@ -244,7 +244,7 @@ var _ = Describe("Builders", func() { It("should not add experimental flag when the node.roles contains search and the version is 2.7 or above", func() { clusterObject := ClusterDescWithVersion("2.7.0") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"search"}, } @@ -274,24 +274,24 @@ var _ = Describe("Builders", func() { clusterObject := ClusterDescWithVersion("2.2.1") clusterObject.Spec.General.PodSecurityContext = podSecurityContext clusterObject.Spec.General.SecurityContext = securityContext - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, } clusterObject.Spec.NodePools = append(clusterObject.Spec.NodePools, nodePool) - result := NewSTSForNodePool("foobar", &clusterObject, opensearchv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) Expect(result.Spec.Template.Spec.SecurityContext).To(Equal(podSecurityContext)) Expect(result.Spec.Template.Spec.Containers[0].SecurityContext).To(Equal(securityContext)) }) It("should use default storageclass if not specified", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, - Persistence: &opensearchv1.PersistenceConfig{PersistenceSource: opensearchv1.PersistenceSource{ - PVC: &opensearchv1.PVCSource{ + Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{ + PVC: &opsterv1.PVCSource{ AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, }, }}, @@ -304,7 +304,7 @@ var _ = Describe("Builders", func() { }) It("should set jvm to half of memory request when memory request is set and jvm are not provided", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceMemory: resource.MustParse("2Gi"), @@ -319,7 +319,7 @@ var _ = Describe("Builders", func() { }) It("should set jvm to half of memory request when memory request is fraction and jvm are not provided", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceMemory: resource.MustParse("1.5Gi"), @@ -335,7 +335,7 @@ var _ = Describe("Builders", func() { It("should set jvm to half of memory request when memory request is set in G and jvm are not provided", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ corev1.ResourceMemory: resource.MustParse("2G"), @@ -350,7 +350,7 @@ var _ = Describe("Builders", func() { }) It("should set jvm to default when memory request and jvm are not provided", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{} + nodePool := opsterv1.NodePool{} result := NewSTSForNodePool("foobar", &clusterObject, nodePool, "foobar", nil, nil, nil) Expect(result.Spec.Template.Spec.Containers[0].Env).To(ContainElement(corev1.EnvVar{ Name: "OPENSEARCH_JAVA_OPTS", @@ -359,7 +359,7 @@ var _ = Describe("Builders", func() { }) It("should set NodePool.Jvm as jvm when it jvm is provided", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Jvm: "-Xmx1024M -Xms1024M", } result := NewSTSForNodePool("foobar", &clusterObject, nodePool, "foobar", nil, nil, nil) @@ -370,7 +370,7 @@ var _ = Describe("Builders", func() { }) It("should set NodePool.jvm as jvm when jvm and memory request are provided", func() { clusterObject := ClusterDescWithVersion("2.2.1") - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Jvm: "-Xmx1024M -Xms1024M", Resources: corev1.ResourceRequirements{ Requests: corev1.ResourceList{ @@ -393,12 +393,12 @@ var _ = Describe("Builders", func() { clusterObject.Spec.General.ServiceName = "snapshotservice" snapshotRepoSettings := map[string]string{"bucket": "opensearch-s3-snapshot", "region": "us-east-1", "base_path": "os-snapshot"} - snapshotConfig := opensearchv1.SnapshotRepoConfig{ + snapshotConfig := opsterv1.SnapshotRepoConfig{ Name: "os-snap", Type: "s3", Settings: snapshotRepoSettings, } - clusterObject.Spec.General.SnapshotRepositories = []opensearchv1.SnapshotRepoConfig{snapshotConfig} + clusterObject.Spec.General.SnapshotRepositories = []opsterv1.SnapshotRepoConfig{snapshotConfig} result := NewSnapshotRepoconfigUpdateJob(&clusterObject, "snapshotrepoconfig", "foobar", "snapshotrepoconfig/checksum", nil, nil) Expect(result.Spec.Template.Spec.Containers[0].Name).To(Equal("snapshotrepoconfig")) snapshotCmd := "curl --fail-with-body -s -k -u \"$(cat /mnt/admin-credentials/username):$(cat /mnt/admin-credentials/password)\" -X PUT https://snapshotservice.snapshot.svc.cluster.local:9200/_snapshot/os-snap?pretty -H \"Content-Type: application/json\" -d '{\"type\": \"s3\", \"settings\": {\"base_path\": \"os-snapshot\" , \"bucket\": \"opensearch-s3-snapshot\" , \"region\": \"us-east-1\"}}'; " @@ -412,7 +412,7 @@ var _ = Describe("Builders", func() { customRepository := "mycustomrepo.cr" clusterObject.Spec.General.DefaultRepo = &customRepository result := NewBootstrapPod(&clusterObject, nil, nil) - Expect(result.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/busybox:1.27.2-buildx")) + Expect(result.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/busybox:1.27.2")) }) It("should apply the BootstrapNodeConfig to the env variables", func() { @@ -475,7 +475,7 @@ var _ = Describe("Builders", func() { It("should create a proper initContainer", func() { mockSecretName := "some-secret" clusterObject := ClusterDescWithKeystoreSecret(mockSecretName, nil) - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager", "foobar", "ingest"}, } @@ -496,7 +496,7 @@ var _ = Describe("Builders", func() { It("should mount the prefilled keystore into the opensearch container", func() { mockSecretName := "some-secret" clusterObject := ClusterDescWithKeystoreSecret(mockSecretName, nil) - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager", "foobar", "ingest"}, } @@ -517,7 +517,7 @@ var _ = Describe("Builders", func() { oldKey: newKey, } clusterObject := ClusterDescWithKeystoreSecret(mockSecretName, keyMappings) - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Component: "masters", Roles: []string{"cluster_manager", "foobar", "ingest"}, } @@ -538,7 +538,7 @@ var _ = Describe("Builders", func() { clusterObject.ObjectMeta.Namespace = namespaceName clusterObject.ObjectMeta.Name = "foobar" clusterObject.Spec.General.ServiceName = "foobar" - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, @@ -559,7 +559,7 @@ var _ = Describe("Builders", func() { clusterObject.ObjectMeta.Namespace = namespaceName clusterObject.ObjectMeta.Name = "foobar-v1v2" clusterObject.Spec.General.ServiceName = "foobar-v1v2" - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"master", "data"}, @@ -580,7 +580,7 @@ var _ = Describe("Builders", func() { clusterObject.ObjectMeta.Namespace = namespaceName clusterObject.ObjectMeta.Name = "foobar-v1" clusterObject.Spec.General.ServiceName = "foobar-v1" - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"master", "data"}, @@ -603,7 +603,7 @@ var _ = Describe("Builders", func() { clusterObject.ObjectMeta.Namespace = namespaceName clusterObject.ObjectMeta.Name = "foobar" clusterObject.Spec.General.Command = customCommand - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, @@ -622,7 +622,7 @@ var _ = Describe("Builders", func() { clusterObject.ObjectMeta.Namespace = "foobar" clusterObject.ObjectMeta.Name = "foobar" clusterObject.Spec.General.ServiceAccount = serviceAccount - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, @@ -640,10 +640,10 @@ var _ = Describe("Builders", func() { When("building services with annotations", func() { It("should populate the NewServiceForCR function with ", func() { clusterName := "opensearch" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: clusterName, Annotations: map[string]string{ "testAnnotationKey": "testValue", @@ -661,7 +661,7 @@ var _ = Describe("Builders", func() { It("should populate the NewHeadlessServiceForNodePool function with ", func() { clusterName := "opensearch" - nodePool := opensearchv1.NodePool{ + nodePool := opsterv1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, @@ -669,10 +669,10 @@ var _ = Describe("Builders", func() { "testAnnotationKey": "testValue", }, } - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: clusterName, Annotations: map[string]string{ "testAnnotationKey2": "testValue2", diff --git a/opensearch-operator/pkg/builders/dashboards.go b/opensearch-operator/pkg/builders/dashboards.go index d82544354..94f2efd42 100644 --- a/opensearch-operator/pkg/builders/dashboards.go +++ b/opensearch-operator/pkg/builders/dashboards.go @@ -5,8 +5,8 @@ import ( "sort" "strings" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -15,7 +15,7 @@ import ( /// Package that declare and build all the resources that related to the OpenSearch-Dashboard /// -func NewDashboardsDeploymentForCR(cr *opensearchv1.OpenSearchCluster, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, annotations map[string]string) *appsv1.Deployment { +func NewDashboardsDeploymentForCR(cr *opsterv1.OpenSearchCluster, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, annotations map[string]string) *appsv1.Deployment { var replicas int32 = cr.Spec.Dashboards.Replicas var port int32 = 5601 var mode int32 = 420 @@ -175,7 +175,7 @@ func NewDashboardsDeploymentForCR(cr *opensearchv1.OpenSearchCluster, volumes [] } } -func NewDashboardsConfigMapForCR(cr *opensearchv1.OpenSearchCluster, name string, config map[string]string) *corev1.ConfigMap { +func NewDashboardsConfigMapForCR(cr *opsterv1.OpenSearchCluster, name string, config map[string]string) *corev1.ConfigMap { config["server.name"] = cr.Name + "-dashboards" config["opensearch.ssl.verificationMode"] = "none" @@ -208,7 +208,7 @@ func NewDashboardsConfigMapForCR(cr *opensearchv1.OpenSearchCluster, name string } } -func NewDashboardsSvcForCr(cr *opensearchv1.OpenSearchCluster) *corev1.Service { +func NewDashboardsSvcForCr(cr *opsterv1.OpenSearchCluster) *corev1.Service { var port int32 = 5601 labels := map[string]string{ diff --git a/opensearch-operator/pkg/builders/dashboards_test.go b/opensearch-operator/pkg/builders/dashboards_test.go index 0457a2ae8..d7ce5dd90 100644 --- a/opensearch-operator/pkg/builders/dashboards_test.go +++ b/opensearch-operator/pkg/builders/dashboards_test.go @@ -5,9 +5,9 @@ import ( "k8s.io/utils/pointer" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -16,11 +16,11 @@ var _ = Describe("Builders", func() { When("building the dashboards deployment with annotations supplied", func() { It("should populate the dashboard pod spec with annotations provided", func() { clusterName := "dashboards-add-annotations" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, Annotations: map[string]string{ "testAnnotationKey": "testValue", @@ -39,11 +39,11 @@ var _ = Describe("Builders", func() { When("building the dashboards deployment with labels supplied", func() { It("should populate the dashboard pod spec with labels provided", func() { clusterName := "dashboards-add-labels" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, Labels: map[string]string{ "testLabelKey": "testValue", @@ -65,17 +65,17 @@ var _ = Describe("Builders", func() { It("should populate the service with the correct type and source ranges", func() { clusterName := "dashboards-add-service-type-load-balancer" sourceRanges := []string{"10.0.0.0/24"} - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, Annotations: map[string]string{ "testAnnotationKey": "testValue", "testAnnotationKey2": "testValue2", }, - Service: opensearchv1.DashboardsServiceSpec{ + Service: opsterv1.DashboardsServiceSpec{ Type: "LoadBalancer", LoadBalancerSourceRanges: sourceRanges, }, @@ -97,11 +97,11 @@ var _ = Describe("Builders", func() { pluginA := "some-plugin" pluginB := "another-plugin" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: "some-name", Namespace: "some-namespace", UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: "some-name"}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: "some-name"}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, PluginsList: []string{pluginA, pluginB}, }, @@ -137,11 +137,11 @@ var _ = Describe("Builders", func() { Privileged: pointer.Bool(false), AllowPrivilegeEscalation: pointer.Bool(false), } - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: "some-name", Namespace: "some-namespace", UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: "some-name"}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: "some-name"}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, PodSecurityContext: podSecurityContext, SecurityContext: securityContext, @@ -157,14 +157,14 @@ var _ = Describe("Builders", func() { When("configuring a serviceaccount for the cluster", func() { It("should configure the serviceaccount for the dashboard pods", func() { const serviceAccountName = "my-serviceaccount" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: "some-name", Namespace: "some-namespace", UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "some-name", ServiceAccount: serviceAccountName, }, - Dashboards: opensearchv1.DashboardsConfig{ + Dashboards: opsterv1.DashboardsConfig{ Enable: true, }, }, diff --git a/opensearch-operator/pkg/builders/suite_test.go b/opensearch-operator/pkg/builders/suite_test.go index f06ef4332..4cf0c95f8 100644 --- a/opensearch-operator/pkg/builders/suite_test.go +++ b/opensearch-operator/pkg/builders/suite_test.go @@ -26,7 +26,7 @@ import ( "path/filepath" "testing" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -74,7 +74,7 @@ var _ = BeforeSuite(func() { err = scheme.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = opensearchv1.AddToScheme(scheme.Scheme) + err = opsterv1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) diff --git a/opensearch-operator/pkg/helpers/constants.go b/opensearch-operator/pkg/helpers/constants.go index 9f0db957f..6719656c5 100644 --- a/opensearch-operator/pkg/helpers/constants.go +++ b/opensearch-operator/pkg/helpers/constants.go @@ -8,8 +8,8 @@ import ( const ( DashboardConfigName = "opensearch_dashboards.yml" DashboardChecksumName = "checksum/dashboards.yml" - ClusterLabel = "opensearch.org/opensearch-cluster" - NodePoolLabel = "opensearch.org/opensearch-nodepool" + ClusterLabel = "opster.io/opensearch-cluster" + NodePoolLabel = "opster.io/opensearch-nodepool" OsUserNameAnnotation = "opensearchuser/name" OsUserNamespaceAnnotation = "opensearchuser/namespace" DnsBaseEnvVariable = "DNS_BASE" diff --git a/opensearch-operator/pkg/helpers/helpers.go b/opensearch-operator/pkg/helpers/helpers.go index 7d1c3d232..0a8b57455 100644 --- a/opensearch-operator/pkg/helpers/helpers.go +++ b/opensearch-operator/pkg/helpers/helpers.go @@ -9,9 +9,9 @@ import ( policyv1 "k8s.io/api/policy/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" version "github.com/hashicorp/go-version" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/samber/lo" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -44,7 +44,7 @@ func GetField(v *appsv1.StatefulSetSpec, field string) interface{} { return f } -func RemoveIt(ss opensearchv1.ComponentStatus, ssSlice []opensearchv1.ComponentStatus) []opensearchv1.ComponentStatus { +func RemoveIt(ss opsterv1.ComponentStatus, ssSlice []opsterv1.ComponentStatus) []opsterv1.ComponentStatus { for idx, v := range ssSlice { if ComponentStatusEqual(v, ss) { return append(ssSlice[0:idx], ssSlice[idx+1:]...) @@ -53,21 +53,21 @@ func RemoveIt(ss opensearchv1.ComponentStatus, ssSlice []opensearchv1.ComponentS return ssSlice } -func Replace(remove opensearchv1.ComponentStatus, add opensearchv1.ComponentStatus, ssSlice []opensearchv1.ComponentStatus) []opensearchv1.ComponentStatus { +func Replace(remove opsterv1.ComponentStatus, add opsterv1.ComponentStatus, ssSlice []opsterv1.ComponentStatus) []opsterv1.ComponentStatus { removedSlice := RemoveIt(remove, ssSlice) fullSliced := append(removedSlice, add) return fullSliced } -func ComponentStatusEqual(left opensearchv1.ComponentStatus, right opensearchv1.ComponentStatus) bool { +func ComponentStatusEqual(left opsterv1.ComponentStatus, right opsterv1.ComponentStatus) bool { return left.Component == right.Component && left.Description == right.Description && left.Status == right.Status } func FindFirstPartial( - arr []opensearchv1.ComponentStatus, - item opensearchv1.ComponentStatus, - predicator func(opensearchv1.ComponentStatus, opensearchv1.ComponentStatus) (opensearchv1.ComponentStatus, bool), -) (opensearchv1.ComponentStatus, bool) { + arr []opsterv1.ComponentStatus, + item opsterv1.ComponentStatus, + predicator func(opsterv1.ComponentStatus, opsterv1.ComponentStatus) (opsterv1.ComponentStatus, bool), +) (opsterv1.ComponentStatus, bool) { for i := 0; i < len(arr); i++ { itemInArr, found := predicator(arr[i], item) if found { @@ -95,7 +95,7 @@ func FindByPath(obj interface{}, keys []string) (interface{}, bool) { return val, ok } -func UsernameAndPassword(k8sClient k8s.K8sClient, cr *opensearchv1.OpenSearchCluster) (string, string, error) { +func UsernameAndPassword(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearchCluster) (string, string, error) { if cr.Spec.Security != nil && cr.Spec.Security.Config != nil && cr.Spec.Security.Config.AdminCredentialsSecret.Name != "" { // Read credentials from secret credentialsSecret, err := k8sClient.GetSecret(cr.Spec.Security.Config.AdminCredentialsSecret.Name, cr.Namespace) @@ -114,14 +114,14 @@ func UsernameAndPassword(k8sClient k8s.K8sClient, cr *opensearchv1.OpenSearchClu } } -func GetByDescriptionAndGroup(left opensearchv1.ComponentStatus, right opensearchv1.ComponentStatus) (opensearchv1.ComponentStatus, bool) { +func GetByDescriptionAndGroup(left opsterv1.ComponentStatus, right opsterv1.ComponentStatus) (opsterv1.ComponentStatus, bool) { if left.Description == right.Description && left.Component == right.Component { return left, true } return right, false } -func GetByComponent(left opensearchv1.ComponentStatus, right opensearchv1.ComponentStatus) (opensearchv1.ComponentStatus, bool) { +func GetByComponent(left opsterv1.ComponentStatus, right opsterv1.ComponentStatus) (opsterv1.ComponentStatus, bool) { if left.Component == right.Component { return left, true } @@ -199,7 +199,7 @@ func DiffSlice(leftSlice, rightSlice []string) []string { } // Count the number of pods running and ready and not terminating for a given nodePool -func CountRunningPodsForNodePool(k8sClient k8s.K8sClient, cr *opensearchv1.OpenSearchCluster, nodePool *opensearchv1.NodePool) (int, error) { +func CountRunningPodsForNodePool(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) (int, error) { // Constrict selector from labels clusterReq, err := labels.NewRequirement(ClusterLabel, selection.Equals, []string{cr.ObjectMeta.Name}) if err != nil { @@ -235,7 +235,7 @@ func CountRunningPodsForNodePool(k8sClient k8s.K8sClient, cr *opensearchv1.OpenS } // Count the number of PVCs created for the given NodePool -func CountPVCsForNodePool(k8sClient k8s.K8sClient, cr *opensearchv1.OpenSearchCluster, nodePool *opensearchv1.NodePool) (int, error) { +func CountPVCsForNodePool(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) (int, error) { clusterReq, err := labels.NewRequirement(ClusterLabel, selection.Equals, []string{cr.ObjectMeta.Name}) if err != nil { return 0, err @@ -297,14 +297,14 @@ func WaitForSTSStatus(k8sClient k8s.K8sClient, obj *appsv1.StatefulSet) (*appsv1 } // GetSTSForNodePool returns the corresponding sts for a given nodePool and cluster name -func GetSTSForNodePool(k8sClient k8s.K8sClient, nodePool opensearchv1.NodePool, clusterName, clusterNamespace string) (*appsv1.StatefulSet, error) { +func GetSTSForNodePool(k8sClient k8s.K8sClient, nodePool opsterv1.NodePool, clusterName, clusterNamespace string) (*appsv1.StatefulSet, error) { stsName := clusterName + "-" + nodePool.Component existing, err := k8sClient.GetStatefulSet(stsName, clusterNamespace) return &existing, err } // DeleteSTSForNodePool deletes the sts for the corresponding nodePool -func DeleteSTSForNodePool(k8sClient k8s.K8sClient, nodePool opensearchv1.NodePool, clusterName, clusterNamespace string) error { +func DeleteSTSForNodePool(k8sClient k8s.K8sClient, nodePool opsterv1.NodePool, clusterName, clusterNamespace string) error { sts, err := GetSTSForNodePool(k8sClient, nodePool, clusterName, clusterNamespace) if err != nil { if k8serrors.IsNotFound(err) { @@ -343,11 +343,11 @@ func DeleteSecurityUpdateJob(k8sClient k8s.K8sClient, clusterName, clusterNamesp return k8sClient.DeleteJob(&job) } -func HasDataRole(nodePool *opensearchv1.NodePool) bool { +func HasDataRole(nodePool *opsterv1.NodePool) bool { return ContainsString(nodePool.Roles, "data") } -func HasManagerRole(nodePool *opensearchv1.NodePool) bool { +func HasManagerRole(nodePool *opsterv1.NodePool) bool { return ContainsString(nodePool.Roles, "master") || ContainsString(nodePool.Roles, "cluster_manager") } @@ -370,7 +370,7 @@ func CompareVersions(v1 string, v2 string) bool { return err == nil && ver1.LessThan(ver2) } -func ComposePDB(cr *opensearchv1.OpenSearchCluster, nodepool *opensearchv1.NodePool) policyv1.PodDisruptionBudget { +func ComposePDB(cr *opsterv1.OpenSearchCluster, nodepool *opsterv1.NodePool) policyv1.PodDisruptionBudget { matchLabels := map[string]string{ ClusterLabel: cr.Name, NodePoolLabel: nodepool.Component, @@ -391,7 +391,7 @@ func ComposePDB(cr *opensearchv1.OpenSearchCluster, nodepool *opensearchv1.NodeP return newpdb } -func CalculateJvmHeapSize(nodePool *opensearchv1.NodePool) string { +func CalculateJvmHeapSize(nodePool *opsterv1.NodePool) string { jvmHeapSizeTemplate := "-Xmx%s -Xms%s" if nodePool.Jvm == "" { @@ -412,8 +412,8 @@ func CalculateJvmHeapSize(nodePool *opensearchv1.NodePool) string { return nodePool.Jvm } -func UpgradeInProgress(status opensearchv1.ClusterStatus) bool { - componentStatus := opensearchv1.ComponentStatus{ +func UpgradeInProgress(status opsterv1.ClusterStatus) bool { + componentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", } _, found := FindFirstPartial(status.ComponentsStatus, componentStatus, GetByComponent) diff --git a/opensearch-operator/pkg/helpers/reconcile-helpers.go b/opensearch-operator/pkg/helpers/reconcile-helpers.go index bcf8f040d..41fd42928 100644 --- a/opensearch-operator/pkg/helpers/reconcile-helpers.go +++ b/opensearch-operator/pkg/helpers/reconcile-helpers.go @@ -5,15 +5,15 @@ import ( "path" "strings" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" "github.com/hashicorp/go-version" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" "k8s.io/utils/pointer" ) -func ResolveInitHelperImage(cr *opensearchv1.OpenSearchCluster) (result opensearchv1.ImageSpec) { - defaultRepo := "public.ecr.aws/opsterio" - defaultImage := "busybox" - defaultVersion := "1.27.2-buildx" +func ResolveInitHelperImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.ImageSpec) { + defaultRepo := "public.ecr.aws/opensearch-project" + defaultImage := "opensearch-operator-busybox" + defaultVersion := "latest" // If a custom InitHelper image is specified, use it. if cr.Spec.InitHelper.ImageSpec != nil { @@ -36,7 +36,7 @@ func ResolveInitHelperImage(cr *opensearchv1.OpenSearchCluster) (result opensear return } -func ResolveImage(cr *opensearchv1.OpenSearchCluster, nodePool *opensearchv1.NodePool) (result opensearchv1.ImageSpec) { +func ResolveImage(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) (result opsterv1.ImageSpec) { defaultRepo := "docker.io/opensearchproject" defaultImage := "opensearch" @@ -61,7 +61,7 @@ func ResolveImage(cr *opensearchv1.OpenSearchCluster, nodePool *opensearchv1.Nod return } -func ResolveDashboardsImage(cr *opensearchv1.OpenSearchCluster) (result opensearchv1.ImageSpec) { +func ResolveDashboardsImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.ImageSpec) { defaultRepo := "docker.io/opensearchproject" defaultImage := "opensearch-dashboards" @@ -83,7 +83,7 @@ func ResolveDashboardsImage(cr *opensearchv1.OpenSearchCluster) (result opensear return } -func useCustomImage(customImageSpec *opensearchv1.ImageSpec, result *opensearchv1.ImageSpec) bool { +func useCustomImage(customImageSpec *opsterv1.ImageSpec, result *opsterv1.ImageSpec) bool { if customImageSpec != nil { if customImageSpec.ImagePullPolicy != nil { result.ImagePullPolicy = customImageSpec.ImagePullPolicy @@ -101,7 +101,7 @@ func useCustomImage(customImageSpec *opensearchv1.ImageSpec, result *opensearchv } // Function to help identify httpPort, securityConfigPort and securityConfigPath for 1.x and 2.x OpenSearch Operator. -func VersionCheck(instance *opensearchv1.OpenSearchCluster) (int32, int32, string) { +func VersionCheck(instance *opsterv1.OpenSearchCluster) (int32, int32, string) { var httpPort int32 var securityConfigPort int32 var securityConfigPath string diff --git a/opensearch-operator/pkg/helpers/reconcile-helpers_test.go b/opensearch-operator/pkg/helpers/reconcile-helpers_test.go index 3c6708496..80fd9ab7d 100644 --- a/opensearch-operator/pkg/helpers/reconcile-helpers_test.go +++ b/opensearch-operator/pkg/helpers/reconcile-helpers_test.go @@ -1,16 +1,16 @@ package helpers import ( + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" ) var _ = DescribeTable("versionCheck reconciler", func(version string, specifiedHttpPort int32, expectedHttpPort int32, expectedSecurityConfigPort int32, expectedSecurityConfigPath string) { - instance := &opensearchv1.OpenSearchCluster{ - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + instance := &opsterv1.OpenSearchCluster{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ Version: version, HttpPort: specifiedHttpPort, }, diff --git a/opensearch-operator/pkg/helpers/test-helpers.go b/opensearch-operator/pkg/helpers/test-helpers.go index 3fabab9dd..8bc3af2ca 100644 --- a/opensearch-operator/pkg/helpers/test-helpers.go +++ b/opensearch-operator/pkg/helpers/test-helpers.go @@ -1,7 +1,7 @@ package helpers import ( - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/tls" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/tls" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/opensearch-operator/pkg/helpers/translate.go b/opensearch-operator/pkg/helpers/translate.go index cf0313a2e..b9617b498 100644 --- a/opensearch-operator/pkg/helpers/translate.go +++ b/opensearch-operator/pkg/helpers/translate.go @@ -1,8 +1,8 @@ package helpers import ( - v1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + v1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" ) // TranslateIndexTemplateToRequest rewrites the CRD format to the gateway format diff --git a/opensearch-operator/pkg/reconcilers/actiongroup.go b/opensearch-operator/pkg/reconcilers/actiongroup.go index 4b71ca94d..b174af81d 100644 --- a/opensearch-operator/pkg/reconcilers/actiongroup.go +++ b/opensearch-operator/pkg/reconcilers/actiongroup.go @@ -5,13 +5,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -30,8 +30,8 @@ type ActionGroupReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchActionGroup - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchActionGroup + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -39,7 +39,7 @@ func NewActionGroupReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opensearchv1.OpensearchActionGroup, + instance *opsterv1.OpensearchActionGroup, opts ...ReconcilerOption, ) *ActionGroupReconciler { options := ReconcilerOptions{} @@ -64,19 +64,19 @@ func (r *ActionGroupReconciler) Reconcile() (retResult ctrl.Result, retErr error // When the reconciler is done, figure out what the state of the resource // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchActionGroup) + instance := object.(*opsterv1.OpensearchActionGroup) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opensearchv1.OpensearchActionGroupError + instance.Status.State = opsterv1.OpensearchActionGroupError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchActionGroupPending + instance.Status.State = opsterv1.OpensearchActionGroupPending } if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opensearchv1.OpensearchActionGroupCreated + instance.Status.State = opsterv1.OpensearchActionGroupCreated } if reason == opensearchActionGroupExists { - instance.Status.State = opensearchv1.OpensearchActionGroupIgnored + instance.Status.State = opsterv1.OpensearchActionGroupIgnored } }) if err != nil { @@ -116,7 +116,7 @@ func (r *ActionGroupReconciler) Reconcile() (retResult ctrl.Result, retErr error } else { if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchActionGroup) + instance := object.(*opsterv1.OpensearchActionGroup) instance.Status.ManagedCluster = &r.cluster.UID }) if retErr != nil { @@ -128,7 +128,7 @@ func (r *ActionGroupReconciler) Reconcile() (retResult ctrl.Result, retErr error } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) @@ -158,7 +158,7 @@ func (r *ActionGroupReconciler) Reconcile() (retResult ctrl.Result, retErr error } if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchActionGroup) + instance := object.(*opsterv1.OpensearchActionGroup) instance.Status.ExistingActionGroup = &exists }) if retErr != nil { diff --git a/opensearch-operator/pkg/reconcilers/actiongroup_test.go b/opensearch-operator/pkg/reconcilers/actiongroup_test.go index ce851e818..755f2b752 100644 --- a/opensearch-operator/pkg/reconcilers/actiongroup_test.go +++ b/opensearch-operator/pkg/reconcilers/actiongroup_test.go @@ -5,13 +5,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,11 +25,11 @@ var _ = Describe("actiongroup reconciler", func() { var ( transport *httpmock.MockTransport reconciler *ActionGroupReconciler - instance *opensearchv1.OpensearchActionGroup + instance *opsterv1.OpensearchActionGroup recorder *record.FakeRecorder // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster mockClient *k8s.MockK8sClient ) @@ -37,13 +37,13 @@ var _ = Describe("actiongroup reconciler", func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchActionGroup{ + instance = &opsterv1.OpensearchActionGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "test-actiongroup", Namespace: "test-actiongroup", UID: "testuid", }, - Spec: opensearchv1.OpensearchActionGroupSpec{ + Spec: opsterv1.OpensearchActionGroupSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -55,17 +55,17 @@ var _ = Describe("actiongroup reconciler", func() { }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-actiongroup", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -97,7 +97,7 @@ var _ = Describe("actiongroup reconciler", func() { recorder = record.NewFakeRecorder(1) }) It("should wait for the cluster to exist", func() { - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) go func() { defer GinkgoRecover() defer close(recorder.Events) @@ -162,8 +162,8 @@ var _ = Describe("actiongroup reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -427,7 +427,7 @@ var _ = Describe("actiongroup reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/cluster.go b/opensearch-operator/pkg/reconcilers/cluster.go index 0ea178a1d..cfc7cf8b5 100644 --- a/opensearch-operator/pkg/reconcilers/cluster.go +++ b/opensearch-operator/pkg/reconcilers/cluster.go @@ -6,16 +6,16 @@ import ( "fmt" "strings" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" policyv1 "k8s.io/api/policy/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/cisco-open/k8s-objectmatcher/patch" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/samber/lo" appsv1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -35,7 +35,7 @@ type ClusterReconciler struct { ctx context.Context recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster logger logr.Logger } @@ -44,7 +44,7 @@ func NewClusterReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *ClusterReconciler { return &ClusterReconciler{ @@ -118,7 +118,7 @@ func (r *ClusterReconciler) Reconcile() (ctrl.Result, error) { // if Version isn't set we set it now to check for upgrades later. if r.instance.Status.Version == "" { - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.Version = r.instance.Spec.General.Version }) result.CombineErr(err) @@ -181,7 +181,7 @@ func (r *ClusterReconciler) ReconcileSnapshotRepoConfig(username string) (*ctrl. return r.client.ReconcileResource(&snapshotRepoJob, reconciler.StatePresent) } -func (r *ClusterReconciler) reconcileNodeStatefulSet(nodePool opensearchv1.NodePool, username string) (*ctrl.Result, error) { +func (r *ClusterReconciler) reconcileNodeStatefulSet(nodePool opsterv1.NodePool, username string) (*ctrl.Result, error) { found, nodePoolConfig := r.reconcilerContext.fetchNodePoolHash(nodePool.Component) // If config hasn't been set up for the node pool requeue @@ -347,7 +347,7 @@ func (r *ClusterReconciler) checkForEmptyDirRecovery() (*ctrl.Result, error) { // If any scaling operation is going on, don't do anything for _, nodePool := range r.instance.Spec.NodePools { - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Scaler", Description: nodePool.Component, } @@ -413,7 +413,7 @@ func (r *ClusterReconciler) checkForEmptyDirRecovery() (*ctrl.Result, error) { // Dashboards deployment will be recreated normally through the reconcile cycle } - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.Initialized = false }) if err != nil { @@ -433,7 +433,7 @@ func (r *ClusterReconciler) checkForEmptyDirRecovery() (*ctrl.Result, error) { return &ctrl.Result{}, nil } -func (r *ClusterReconciler) handlePDB(nodePool *opensearchv1.NodePool) (*ctrl.Result, error) { +func (r *ClusterReconciler) handlePDB(nodePool *opsterv1.NodePool) (*ctrl.Result, error) { pdb := policyv1.PodDisruptionBudget{} if nodePool.Pdb != nil && nodePool.Pdb.Enable { @@ -462,7 +462,7 @@ func (r *ClusterReconciler) handlePDB(nodePool *opensearchv1.NodePool) (*ctrl.Re } } -func (r *ClusterReconciler) maybeUpdateVolumes(existing *appsv1.StatefulSet, nodePool opensearchv1.NodePool) error { +func (r *ClusterReconciler) maybeUpdateVolumes(existing *appsv1.StatefulSet, nodePool opsterv1.NodePool) error { if nodePool.DiskSize == "" { // Default case nodePool.DiskSize = builders.DefaultDiskSize } @@ -530,7 +530,7 @@ func (r *ClusterReconciler) UpdateClusterStatus() error { health := util.GetClusterHealth(r.client, r.ctx, r.instance, r.logger) availableNodes := util.GetAvailableOpenSearchNodes(r.client, r.ctx, r.instance, r.logger) - return r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + return r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.Health = health instance.Status.AvailableNodes = availableNodes }) diff --git a/opensearch-operator/pkg/reconcilers/componenttemplate.go b/opensearch-operator/pkg/reconcilers/componenttemplate.go index 2d0d55cbe..f00537805 100644 --- a/opensearch-operator/pkg/reconcilers/componenttemplate.go +++ b/opensearch-operator/pkg/reconcilers/componenttemplate.go @@ -5,13 +5,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -31,8 +31,8 @@ type ComponentTemplateReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchComponentTemplate - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchComponentTemplate + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -40,7 +40,7 @@ func NewComponentTemplateReconciler( ctx context.Context, client client.Client, recorder record.EventRecorder, - instance *opensearchv1.OpensearchComponentTemplate, + instance *opsterv1.OpensearchComponentTemplate, opts ...ReconcilerOption, ) *ComponentTemplateReconciler { options := ReconcilerOptions{} @@ -65,19 +65,19 @@ func (r *ComponentTemplateReconciler) Reconcile() (result ctrl.Result, err error // When the reconciler is done, figure out what the state of the resource // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchComponentTemplate) + instance := object.(*opsterv1.OpensearchComponentTemplate) instance.Status.Reason = reason if err != nil { - instance.Status.State = opensearchv1.OpensearchComponentTemplateError + instance.Status.State = opsterv1.OpensearchComponentTemplateError } if result.Requeue && result.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchComponentTemplatePending + instance.Status.State = opsterv1.OpensearchComponentTemplatePending } if err == nil && result.RequeueAfter == 30*time.Second { - instance.Status.State = opensearchv1.OpensearchComponentTemplateCreated + instance.Status.State = opsterv1.OpensearchComponentTemplateCreated } if reason == opensearchComponentTemplateExists { - instance.Status.State = opensearchv1.OpensearchComponentTemplateIgnored + instance.Status.State = opsterv1.OpensearchComponentTemplateIgnored } }) @@ -119,7 +119,7 @@ func (r *ComponentTemplateReconciler) Reconcile() (result ctrl.Result, err error } else { if pointer.BoolDeref(r.updateStatus, true) { err = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchComponentTemplate) + instance := object.(*opsterv1.OpensearchComponentTemplate) instance.Status.ManagedCluster = &r.cluster.UID }) if err != nil { @@ -131,7 +131,7 @@ func (r *ComponentTemplateReconciler) Reconcile() (result ctrl.Result, err error } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) @@ -166,7 +166,7 @@ func (r *ComponentTemplateReconciler) Reconcile() (result ctrl.Result, err error } if pointer.BoolDeref(r.updateStatus, true) { err = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchComponentTemplate) + instance := object.(*opsterv1.OpensearchComponentTemplate) instance.Status.ExistingComponentTemplate = &exists }) if err != nil { diff --git a/opensearch-operator/pkg/reconcilers/componenttemplate_test.go b/opensearch-operator/pkg/reconcilers/componenttemplate_test.go index 6dd02b574..8d1da2ae9 100644 --- a/opensearch-operator/pkg/reconcilers/componenttemplate_test.go +++ b/opensearch-operator/pkg/reconcilers/componenttemplate_test.go @@ -5,13 +5,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -26,12 +26,12 @@ var _ = Describe("componenttemplate reconciler", func() { var ( transport *httpmock.MockTransport reconciler *ComponentTemplateReconciler - instance *opensearchv1.OpensearchComponentTemplate + instance *opsterv1.OpensearchComponentTemplate recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster clusterUrl string ) @@ -39,38 +39,38 @@ var _ = Describe("componenttemplate reconciler", func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchComponentTemplate{ + instance = &opsterv1.OpensearchComponentTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-componenttemplate", Namespace: "test-componenttemplate", UID: "testuid", }, - Spec: opensearchv1.OpensearchComponentTemplateSpec{ + Spec: opsterv1.OpensearchComponentTemplateSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, Name: "my-template", - Template: opensearchv1.OpensearchIndexSpec{ + Template: opsterv1.OpensearchIndexSpec{ Settings: &apiextensionsv1.JSON{}, Mappings: &apiextensionsv1.JSON{}, - Aliases: make(map[string]opensearchv1.OpensearchIndexAliasSpec), + Aliases: make(map[string]opsterv1.OpensearchIndexAliasSpec), }, Version: 0, Meta: &apiextensionsv1.JSON{}, }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-componenttemplate", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -100,7 +100,7 @@ var _ = Describe("componenttemplate reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) @@ -171,8 +171,8 @@ var _ = Describe("componenttemplate reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -427,7 +427,7 @@ var _ = Describe("componenttemplate reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/configuration.go b/opensearch-operator/pkg/reconcilers/configuration.go index 8c2b13bbd..a2deaf9fe 100644 --- a/opensearch-operator/pkg/reconcilers/configuration.go +++ b/opensearch-operator/pkg/reconcilers/configuration.go @@ -9,13 +9,13 @@ import ( "sort" "strings" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -29,7 +29,7 @@ type ConfigurationReconciler struct { client k8s.K8sClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster } func NewConfigurationReconciler( @@ -37,7 +37,7 @@ func NewConfigurationReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *ConfigurationReconciler { return &ConfigurationReconciler{ @@ -146,7 +146,7 @@ func (r *ConfigurationReconciler) buildConfigMap(data string) *corev1.ConfigMap } } -func (r *ConfigurationReconciler) createHashForNodePool(nodePool opensearchv1.NodePool, data string, volumeData []byte) (*ctrl.Result, error) { +func (r *ConfigurationReconciler) createHashForNodePool(nodePool opsterv1.NodePool, data string, volumeData []byte) (*ctrl.Result, error) { combinedData := append([]byte(data), volumeData...) found, nodePoolHash := r.reconcilerContext.fetchNodePoolHash(nodePool.Component) diff --git a/opensearch-operator/pkg/reconcilers/configuration_test.go b/opensearch-operator/pkg/reconcilers/configuration_test.go index a09d87485..df6979621 100644 --- a/opensearch-operator/pkg/reconcilers/configuration_test.go +++ b/opensearch-operator/pkg/reconcilers/configuration_test.go @@ -4,9 +4,9 @@ import ( "context" "strings" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" @@ -24,7 +24,7 @@ func newConfigurationReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *ConfigurationReconciler { return &ConfigurationReconciler{ @@ -45,15 +45,15 @@ var _ = Describe("Configuration Controller", func() { It("should not create a configmap ", func() { mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: clusterName, UID: "dummyuid", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{}, - NodePools: []opensearchv1.NodePool{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{}, + NodePools: []opsterv1.NodePool{ { Component: "test", Roles: []string{ @@ -83,15 +83,15 @@ var _ = Describe("Configuration Controller", func() { It("should create a configmap ", func() { mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: clusterName, UID: "dummyuid", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{}, - NodePools: []opensearchv1.NodePool{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{}, + NodePools: []opsterv1.NodePool{ { Component: "test", Roles: []string{ diff --git a/opensearch-operator/pkg/reconcilers/dashboards.go b/opensearch-operator/pkg/reconcilers/dashboards.go index 65c40cff0..295aa843c 100644 --- a/opensearch-operator/pkg/reconcilers/dashboards.go +++ b/opensearch-operator/pkg/reconcilers/dashboards.go @@ -4,14 +4,14 @@ import ( "context" "fmt" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/tls" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/tls" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" @@ -24,7 +24,7 @@ type DashboardsReconciler struct { client k8s.K8sClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster logger logr.Logger pki tls.PKI } @@ -34,7 +34,7 @@ func NewDashboardsReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *DashboardsReconciler { return &DashboardsReconciler{ diff --git a/opensearch-operator/pkg/reconcilers/dashboards_test.go b/opensearch-operator/pkg/reconcilers/dashboards_test.go index cb3522388..39e6af43e 100644 --- a/opensearch-operator/pkg/reconcilers/dashboards_test.go +++ b/opensearch-operator/pkg/reconcilers/dashboards_test.go @@ -4,10 +4,10 @@ import ( "context" "strings" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes/scheme" @@ -22,7 +22,7 @@ import ( //+kubebuilder:scaffold:imports ) -func newDashboardsReconciler(k8sClient *k8s.MockK8sClient, spec *opensearchv1.OpenSearchCluster) (ReconcilerContext, *DashboardsReconciler) { +func newDashboardsReconciler(k8sClient *k8s.MockK8sClient, spec *opsterv1.OpenSearchCluster) (ReconcilerContext, *DashboardsReconciler) { reconcilerContext := NewReconcilerContext(&helpers.MockEventRecorder{}, spec, spec.Spec.NodePools) underTest := &DashboardsReconciler{ client: k8sClient, @@ -44,16 +44,16 @@ var _ = Describe("Dashboards Reconciler", func() { secretName := "my-cert" mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, - Tls: &opensearchv1.DashboardsTlsConfig{ + Tls: &opsterv1.DashboardsTlsConfig{ Enable: true, Generate: false, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{Secret: corev1.LocalObjectReference{Name: secretName}}, + TlsCertificateConfig: opsterv1.TlsCertificateConfig{Secret: corev1.LocalObjectReference{Name: secretName}}, }, }, }, @@ -82,13 +82,13 @@ var _ = Describe("Dashboards Reconciler", func() { It("should create a cert", func() { clusterName := "dashboards-test-generate" mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, - Tls: &opensearchv1.DashboardsTlsConfig{ + Tls: &opsterv1.DashboardsTlsConfig{ Enable: true, Generate: true, }, @@ -131,11 +131,11 @@ var _ = Describe("Dashboards Reconciler", func() { clusterName := "dashboards-creds" credentialsSecret := clusterName + "-creds" mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, OpensearchCredentialsSecret: corev1.LocalObjectReference{Name: credentialsSecret}, }, @@ -184,11 +184,11 @@ var _ = Describe("Dashboards Reconciler", func() { testConfig := "some-config-here" mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, AdditionalConfig: map[string]string{ "some-key": testConfig, @@ -229,11 +229,11 @@ var _ = Describe("Dashboards Reconciler", func() { It("should populate the dashboard env vars", func() { clusterName := "dashboards-add-env" mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, Env: []corev1.EnvVar{ { @@ -275,13 +275,13 @@ var _ = Describe("Dashboards Reconciler", func() { image := "docker.io/my-opensearch-dashboards:custom" mockClient := k8s.NewMockK8sClient(GinkgoT()) imagePullPolicy := corev1.PullAlways - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, - ImageSpec: &opensearchv1.ImageSpec{ + ImageSpec: &opsterv1.ImageSpec{ Image: &image, ImagePullPolicy: &imagePullPolicy, }, @@ -313,13 +313,13 @@ var _ = Describe("Dashboards Reconciler", func() { It("should mount the volumes in the deployment", func() { clusterName := "dashboards-add-volumes" mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := &opensearchv1.OpenSearchCluster{ + spec := &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opensearchv1.DashboardsConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ServiceName: clusterName}, + Dashboards: opsterv1.DashboardsConfig{ Enable: true, - AdditionalVolumes: []opensearchv1.AdditionalVolume{ + AdditionalVolumes: []opsterv1.AdditionalVolume{ { Name: "test-secret", Path: "/opt/test-secret", diff --git a/opensearch-operator/pkg/reconcilers/indextemplate.go b/opensearch-operator/pkg/reconcilers/indextemplate.go index d2bf9ae21..1ae6f62a1 100644 --- a/opensearch-operator/pkg/reconcilers/indextemplate.go +++ b/opensearch-operator/pkg/reconcilers/indextemplate.go @@ -5,13 +5,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -31,8 +31,8 @@ type IndexTemplateReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchIndexTemplate - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchIndexTemplate + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -40,7 +40,7 @@ func NewIndexTemplateReconciler( ctx context.Context, client client.Client, recorder record.EventRecorder, - instance *opensearchv1.OpensearchIndexTemplate, + instance *opsterv1.OpensearchIndexTemplate, opts ...ReconcilerOption, ) *IndexTemplateReconciler { options := ReconcilerOptions{} @@ -66,20 +66,20 @@ func (r *IndexTemplateReconciler) Reconcile() (result ctrl.Result, err error) { // When the reconciler is done, figure out what the state of the resource // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchIndexTemplate) + instance := object.(*opsterv1.OpensearchIndexTemplate) instance.Status.Reason = reason if err != nil { - instance.Status.State = opensearchv1.OpensearchIndexTemplateError + instance.Status.State = opsterv1.OpensearchIndexTemplateError } if result.Requeue && result.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchIndexTemplatePending + instance.Status.State = opsterv1.OpensearchIndexTemplatePending } if err == nil && result.RequeueAfter == 30*time.Second { - instance.Status.State = opensearchv1.OpensearchIndexTemplateCreated + instance.Status.State = opsterv1.OpensearchIndexTemplateCreated instance.Status.IndexTemplateName = templateName } if reason == opensearchIndexTemplateExists { - instance.Status.State = opensearchv1.OpensearchIndexTemplateIgnored + instance.Status.State = opsterv1.OpensearchIndexTemplateIgnored } }) @@ -121,7 +121,7 @@ func (r *IndexTemplateReconciler) Reconcile() (result ctrl.Result, err error) { } else { if pointer.BoolDeref(r.updateStatus, true) { err = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchIndexTemplate) + instance := object.(*opsterv1.OpensearchIndexTemplate) instance.Status.ManagedCluster = &r.cluster.UID }) if err != nil { @@ -133,7 +133,7 @@ func (r *IndexTemplateReconciler) Reconcile() (result ctrl.Result, err error) { } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) @@ -168,7 +168,7 @@ func (r *IndexTemplateReconciler) Reconcile() (result ctrl.Result, err error) { } if pointer.BoolDeref(r.updateStatus, true) { err = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchIndexTemplate) + instance := object.(*opsterv1.OpensearchIndexTemplate) instance.Status.ExistingIndexTemplate = &exists }) if err != nil { diff --git a/opensearch-operator/pkg/reconcilers/indextemplate_test.go b/opensearch-operator/pkg/reconcilers/indextemplate_test.go index 54755351d..2afe490d7 100644 --- a/opensearch-operator/pkg/reconcilers/indextemplate_test.go +++ b/opensearch-operator/pkg/reconcilers/indextemplate_test.go @@ -5,13 +5,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -26,12 +26,12 @@ var _ = Describe("indextemplate reconciler", func() { var ( transport *httpmock.MockTransport reconciler *IndexTemplateReconciler - instance *opensearchv1.OpensearchIndexTemplate + instance *opsterv1.OpensearchIndexTemplate recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster clusterUrl string ) @@ -39,22 +39,22 @@ var _ = Describe("indextemplate reconciler", func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchIndexTemplate{ + instance = &opsterv1.OpensearchIndexTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-indextemplate", Namespace: "test-indextemplate", UID: "testuid", }, - Spec: opensearchv1.OpensearchIndexTemplateSpec{ + Spec: opsterv1.OpensearchIndexTemplateSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, Name: "my-template", IndexPatterns: []string{"my-logs-*"}, - Template: opensearchv1.OpensearchIndexSpec{ + Template: opsterv1.OpensearchIndexSpec{ Settings: &apiextensionsv1.JSON{}, Mappings: &apiextensionsv1.JSON{}, - Aliases: make(map[string]opensearchv1.OpensearchIndexAliasSpec), + Aliases: make(map[string]opsterv1.OpensearchIndexAliasSpec), }, ComposedOf: []string{}, Priority: 0, @@ -63,17 +63,17 @@ var _ = Describe("indextemplate reconciler", func() { }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-indextemplate", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -103,7 +103,7 @@ var _ = Describe("indextemplate reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) @@ -174,8 +174,8 @@ var _ = Describe("indextemplate reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -436,7 +436,7 @@ var _ = Describe("indextemplate reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/ismpolicy.go b/opensearch-operator/pkg/reconcilers/ismpolicy.go index 5557617aa..c70fb0a71 100644 --- a/opensearch-operator/pkg/reconcilers/ismpolicy.go +++ b/opensearch-operator/pkg/reconcilers/ismpolicy.go @@ -6,13 +6,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -31,8 +31,8 @@ type IsmPolicyReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpenSearchISMPolicy - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchISMPolicy + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -40,7 +40,7 @@ func NewIsmReconciler( ctx context.Context, client client.Client, recorder record.EventRecorder, - instance *opensearchv1.OpenSearchISMPolicy, + instance *opsterv1.OpenSearchISMPolicy, opts ...ReconcilerOption, ) *IsmPolicyReconciler { options := ReconcilerOptions{} @@ -65,22 +65,22 @@ func (r *IsmPolicyReconciler) Reconcile() (retResult ctrl.Result, retErr error) // When the reconciler is done, figure out what the state of the resource // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpenSearchISMPolicy) + instance := object.(*opsterv1.OpenSearchISMPolicy) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opensearchv1.OpensearchISMPolicyError + instance.Status.State = opsterv1.OpensearchISMPolicyError } // Requeue after is 10 seconds if waiting for OpenSearch cluster if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchISMPolicyPending + instance.Status.State = opsterv1.OpensearchISMPolicyPending } // Requeue is after 30 seconds for normal reconciliation after creation/update if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opensearchv1.OpensearchISMPolicyCreated + instance.Status.State = opsterv1.OpensearchISMPolicyCreated instance.Status.PolicyId = policyId } if reason == ismPolicyExists { - instance.Status.State = opensearchv1.OpensearchISMPolicyIgnored + instance.Status.State = opsterv1.OpensearchISMPolicyIgnored } }) if err != nil { @@ -120,7 +120,7 @@ func (r *IsmPolicyReconciler) Reconcile() (retResult ctrl.Result, retErr error) } else { if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpenSearchISMPolicy) + instance := object.(*opsterv1.OpenSearchISMPolicy) instance.Status.ManagedCluster = &r.cluster.UID }) if retErr != nil { @@ -131,7 +131,7 @@ func (r *IsmPolicyReconciler) Reconcile() (retResult ctrl.Result, retErr error) } } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) @@ -165,7 +165,7 @@ func (r *IsmPolicyReconciler) Reconcile() (retResult ctrl.Result, retErr error) } if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpenSearchISMPolicy) + instance := object.(*opsterv1.OpenSearchISMPolicy) instance.Status.ExistingISMPolicy = &exists }) if retErr != nil { @@ -320,7 +320,7 @@ func (r *IsmPolicyReconciler) CreateISMPolicyRequest() (*requests.Policy, error) newAction := requests.AliasAction{} newAliasDetails := requests.AliasDetails{} - copyAliasDetails := func(src *opensearchv1.AliasDetails) { + copyAliasDetails := func(src *opsterv1.AliasDetails) { newAliasDetails.Aliases = src.Aliases newAliasDetails.Index = src.Index newAliasDetails.IsWriteIndex = src.IsWriteIndex diff --git a/opensearch-operator/pkg/reconcilers/ismpolicy_test.go b/opensearch-operator/pkg/reconcilers/ismpolicy_test.go index 9405557e8..22351613d 100644 --- a/opensearch-operator/pkg/reconcilers/ismpolicy_test.go +++ b/opensearch-operator/pkg/reconcilers/ismpolicy_test.go @@ -5,13 +5,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,26 +26,26 @@ var _ = Describe("ism policy reconciler", func() { var ( transport *httpmock.MockTransport reconciler *IsmPolicyReconciler - instance *opensearchv1.OpenSearchISMPolicy + instance *opsterv1.OpenSearchISMPolicy recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpenSearchISMPolicy{ + instance = &opsterv1.OpenSearchISMPolicy{ ObjectMeta: metav1.ObjectMeta{ Name: "test-policy", Namespace: "test-policy", UID: types.UID("testuid"), }, - Spec: opensearchv1.OpenSearchISMPolicySpec{ + Spec: opsterv1.OpenSearchISMPolicySpec{ PolicyID: "test-policy", OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", @@ -53,17 +53,17 @@ var _ = Describe("ism policy reconciler", func() { }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-policy", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -92,7 +92,7 @@ var _ = Describe("ism policy reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) It("should wait for the cluster to exist", func() { @@ -137,8 +137,8 @@ var _ = Describe("ism policy reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -399,7 +399,7 @@ var _ = Describe("ism policy reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/k8s/client.go b/opensearch-operator/pkg/reconcilers/k8s/client.go index e0d079ecb..4004dc5fb 100644 --- a/opensearch-operator/pkg/reconcilers/k8s/client.go +++ b/opensearch-operator/pkg/reconcilers/k8s/client.go @@ -3,8 +3,8 @@ package k8s import ( "context" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" "github.com/cisco-open/operator-tools/pkg/reconciler" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" @@ -34,8 +34,8 @@ type K8sClient interface { DeleteDeployment(deployment *appsv1.Deployment, orphan bool) error GetService(name, namespace string) (corev1.Service, error) CreateService(svc *corev1.Service) (*ctrl.Result, error) - GetOpenSearchCluster(name, namespace string) (opensearchv1.OpenSearchCluster, error) - UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opensearchv1.OpenSearchCluster)) error + GetOpenSearchCluster(name, namespace string) (opsterv1.OpenSearchCluster, error) + UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opsterv1.OpenSearchCluster)) error UdateObjectStatus(instance client.Object, f func(client.Object)) error ReconcileResource(runtime.Object, reconciler.DesiredState) (*ctrl.Result, error) GetPod(name, namespace string) (corev1.Pod, error) @@ -165,15 +165,15 @@ func (c K8sClientImpl) CreateService(svc *corev1.Service) (*ctrl.Result, error) return c.ReconcileResource(svc, reconciler.StatePresent) } -func (c K8sClientImpl) GetOpenSearchCluster(name, namespace string) (opensearchv1.OpenSearchCluster, error) { - cluster := opensearchv1.OpenSearchCluster{} +func (c K8sClientImpl) GetOpenSearchCluster(name, namespace string) (opsterv1.OpenSearchCluster, error) { + cluster := opsterv1.OpenSearchCluster{} err := c.Get(c.ctx, client.ObjectKey{Name: name, Namespace: namespace}, &cluster) return cluster, err } -func (c K8sClientImpl) UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opensearchv1.OpenSearchCluster)) error { +func (c K8sClientImpl) UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opsterv1.OpenSearchCluster)) error { return retry.RetryOnConflict(retry.DefaultRetry, func() error { - instance := opensearchv1.OpenSearchCluster{} + instance := opsterv1.OpenSearchCluster{} if err := c.Get(c.ctx, key, &instance); err != nil { return err } diff --git a/opensearch-operator/pkg/reconcilers/reconcilers.go b/opensearch-operator/pkg/reconcilers/reconcilers.go index 9a4921b87..6531bc6ff 100644 --- a/opensearch-operator/pkg/reconcilers/reconcilers.go +++ b/opensearch-operator/pkg/reconcilers/reconcilers.go @@ -6,8 +6,8 @@ import ( "k8s.io/client-go/tools/record" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" @@ -57,7 +57,7 @@ type ReconcilerContext struct { DashboardsConfig map[string]string OpenSearchConfig map[string]string recorder record.EventRecorder - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster } type NodePoolHash struct { @@ -65,7 +65,7 @@ type NodePoolHash struct { ConfigHash string } -func NewReconcilerContext(recorder record.EventRecorder, instance *opensearchv1.OpenSearchCluster, nodepools []opensearchv1.NodePool) ReconcilerContext { +func NewReconcilerContext(recorder record.EventRecorder, instance *opsterv1.OpenSearchCluster, nodepools []opsterv1.NodePool) ReconcilerContext { var nodePoolHashes []NodePoolHash for _, nodepool := range nodepools { nodePoolHashes = append(nodePoolHashes, NodePoolHash{ @@ -124,11 +124,11 @@ func (c *ReconcilerContext) replaceNodePoolHash(newConfig NodePoolHash) { func UpdateComponentStatus( k8sClient k8s.K8sClient, - cluster *opensearchv1.OpenSearchCluster, - status *opensearchv1.ComponentStatus, + cluster *opsterv1.OpenSearchCluster, + status *opsterv1.ComponentStatus, ) error { if status != nil { - return k8sClient.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(cluster), func(instance *opensearchv1.OpenSearchCluster) { + return k8sClient.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(cluster), func(instance *opsterv1.OpenSearchCluster) { found := false for idx, value := range instance.Status.ComponentsStatus { if value.Component == status.Component { diff --git a/opensearch-operator/pkg/reconcilers/role.go b/opensearch-operator/pkg/reconcilers/role.go index 20396b864..75ad334e2 100644 --- a/opensearch-operator/pkg/reconcilers/role.go +++ b/opensearch-operator/pkg/reconcilers/role.go @@ -5,13 +5,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -30,8 +30,8 @@ type RoleReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchRole - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchRole + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -39,7 +39,7 @@ func NewRoleReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opensearchv1.OpensearchRole, + instance *opsterv1.OpensearchRole, opts ...ReconcilerOption, ) *RoleReconciler { options := ReconcilerOptions{} @@ -64,19 +64,19 @@ func (r *RoleReconciler) Reconcile() (retResult ctrl.Result, retErr error) { // When the reconciler is done, figure out what the state of the resource is // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchRole) + instance := object.(*opsterv1.OpensearchRole) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opensearchv1.OpensearchRoleStateError + instance.Status.State = opsterv1.OpensearchRoleStateError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchRoleStatePending + instance.Status.State = opsterv1.OpensearchRoleStatePending } if retErr == nil && retResult.Requeue { - instance.Status.State = opensearchv1.OpensearchRoleStateCreated + instance.Status.State = opsterv1.OpensearchRoleStateCreated } if reason == opensearchRoleExists { - instance.Status.State = opensearchv1.OpensearchRoleIgnored + instance.Status.State = opsterv1.OpensearchRoleIgnored } }) if err != nil { @@ -116,7 +116,7 @@ func (r *RoleReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } else { if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchRole) + instance := object.(*opsterv1.OpensearchRole) instance.Status.ManagedCluster = &r.cluster.UID }) if retErr != nil { @@ -128,7 +128,7 @@ func (r *RoleReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) @@ -158,7 +158,7 @@ func (r *RoleReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchRole) + instance := object.(*opsterv1.OpensearchRole) instance.Status.ExistingRole = &exists }) if retErr != nil { diff --git a/opensearch-operator/pkg/reconcilers/role_test.go b/opensearch-operator/pkg/reconcilers/role_test.go index 1965b9d1b..ebe3c66b4 100644 --- a/opensearch-operator/pkg/reconcilers/role_test.go +++ b/opensearch-operator/pkg/reconcilers/role_test.go @@ -5,13 +5,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,32 +25,32 @@ var _ = Describe("roles reconciler", func() { var ( transport *httpmock.MockTransport reconciler *RoleReconciler - instance *opensearchv1.OpensearchRole + instance *opsterv1.OpensearchRole recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchRole{ + instance = &opsterv1.OpensearchRole{ ObjectMeta: metav1.ObjectMeta{ Name: "test-role", Namespace: "test-role", UID: types.UID("testuid"), }, - Spec: opensearchv1.OpensearchRoleSpec{ + Spec: opsterv1.OpensearchRoleSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, ClusterPermissions: []string{ "test_cluster_permission", }, - IndexPermissions: []opensearchv1.IndexPermissionSpec{ + IndexPermissions: []opsterv1.IndexPermissionSpec{ { IndexPatterns: []string{ "test-index", @@ -63,17 +63,17 @@ var _ = Describe("roles reconciler", func() { }, } // Set up prereq-objects - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-role", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -102,7 +102,7 @@ var _ = Describe("roles reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) It("should wait for the cluster to exist", func() { @@ -170,8 +170,8 @@ var _ = Describe("roles reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -462,7 +462,7 @@ var _ = Describe("roles reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/rollingRestart.go b/opensearch-operator/pkg/reconcilers/rollingRestart.go index 5e70dabc8..748c06d8d 100644 --- a/opensearch-operator/pkg/reconcilers/rollingRestart.go +++ b/opensearch-operator/pkg/reconcilers/rollingRestart.go @@ -5,13 +5,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,7 +34,7 @@ type RollingRestartReconciler struct { osClient *services.OsClusterClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster } func NewRollingRestartReconciler( @@ -42,7 +42,7 @@ func NewRollingRestartReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *RollingRestartReconciler { return &RollingRestartReconciler{ @@ -222,14 +222,14 @@ func (r *RollingRestartReconciler) restartStatefulSetPod(sts *appsv1.StatefulSet } func (r *RollingRestartReconciler) updateStatus(status string) error { - return UpdateComponentStatus(r.client, r.instance, &opensearchv1.ComponentStatus{ + return UpdateComponentStatus(r.client, r.instance, &opsterv1.ComponentStatus{ Component: componentName, Status: status, Description: "", }) } -func (r *RollingRestartReconciler) findStatus() *opensearchv1.ComponentStatus { +func (r *RollingRestartReconciler) findStatus() *opsterv1.ComponentStatus { for _, component := range r.instance.Status.ComponentsStatus { if component.Component == componentName { return &component diff --git a/opensearch-operator/pkg/reconcilers/scaler.go b/opensearch-operator/pkg/reconcilers/scaler.go index 5f4e811ef..8e5d5bdea 100644 --- a/opensearch-operator/pkg/reconcilers/scaler.go +++ b/opensearch-operator/pkg/reconcilers/scaler.go @@ -5,12 +5,12 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/cisco-open/operator-tools/pkg/reconciler" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" appsv1 "k8s.io/api/apps/v1" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -24,7 +24,7 @@ type ScalerReconciler struct { ctx context.Context recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster } func NewScalerReconciler( @@ -32,7 +32,7 @@ func NewScalerReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *ScalerReconciler { return &ScalerReconciler{ @@ -62,7 +62,7 @@ func (r *ScalerReconciler) Reconcile() (ctrl.Result, error) { return results.Result, results.Err } -func (r *ScalerReconciler) reconcileNodePool(nodePool *opensearchv1.NodePool) (bool, error) { +func (r *ScalerReconciler) reconcileNodePool(nodePool *opsterv1.NodePool) (bool, error) { lg := log.FromContext(r.ctx) namespace := r.instance.Namespace sts_name := builders.StsName(r.instance, nodePool) @@ -72,7 +72,7 @@ func (r *ScalerReconciler) reconcileNodePool(nodePool *opensearchv1.NodePool) (b return false, err } - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Scaler", Status: "Running", Description: nodePool.Component, @@ -84,7 +84,7 @@ func (r *ScalerReconciler) reconcileNodePool(nodePool *opensearchv1.NodePool) (b if desireReplicaDiff == 0 { // If a scaling operation was started before for this nodePool if found { - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { if currentSts.Status.ReadyReplicas != nodePool.Replicas { // Change the status to waiting while the pods are coming up or getting deleted componentStatus.Status = "Waiting" @@ -106,7 +106,7 @@ func (r *ScalerReconciler) reconcileNodePool(nodePool *opensearchv1.NodePool) (b // Also the status is set to 'Running' if it fails to exclude node for some reason if !found || currentStatus.Status == "Running" { // Change the status to running, to indicate that a scaling operation for this nodePool has started - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.Replace(currentStatus, componentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -163,7 +163,7 @@ func (r *ScalerReconciler) increaseOneNode(currentSts appsv1.StatefulSet, nodePo return false, nil } -func (r *ScalerReconciler) decreaseOneNode(currentStatus opensearchv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string, smartDecrease bool) (bool, error) { +func (r *ScalerReconciler) decreaseOneNode(currentStatus opsterv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string, smartDecrease bool) (bool, error) { lg := log.FromContext(r.ctx) *currentSts.Spec.Replicas-- annotations := map[string]string{"cluster-name": r.instance.GetName()} @@ -176,7 +176,7 @@ func (r *ScalerReconciler) decreaseOneNode(currentStatus opensearchv1.ComponentS return true, err } lg.Info(fmt.Sprintf("Group: %s, Removed node %s", nodePoolGroupName, lastReplicaNodeName)) - err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.RemoveIt(currentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -207,7 +207,7 @@ func (r *ScalerReconciler) decreaseOneNode(currentStatus opensearchv1.ComponentS return false, err } -func (r *ScalerReconciler) excludeNode(currentStatus opensearchv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string) error { +func (r *ScalerReconciler) excludeNode(currentStatus opsterv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string) error { lg := log.FromContext(r.ctx) username, password, err := helpers.UsernameAndPassword(r.client, r.instance) annotations := map[string]string{"cluster-name": r.instance.GetName()} @@ -230,14 +230,14 @@ func (r *ScalerReconciler) excludeNode(currentStatus opensearchv1.ComponentStatu return err } if excluded { - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Scaler", Status: "Excluded", Description: nodePoolGroupName, } r.recorder.AnnotatedEventf(r.instance, annotations, "Normal", "Scaler", "Finished to Exclude %s/%s", r.instance.Namespace, r.instance.Name) lg.Info(fmt.Sprintf("Group: %s, Excluded node: %s", nodePoolGroupName, lastReplicaNodeName)) - err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.Replace(currentStatus, componentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -249,14 +249,14 @@ func (r *ScalerReconciler) excludeNode(currentStatus opensearchv1.ComponentStatu return err } - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Scaler", Status: "Running", Description: nodePoolGroupName, } r.recorder.AnnotatedEventf(r.instance, annotations, "Normal", "Scaler", "Start sacle %s/%s from %d to %d", r.instance.Namespace, r.instance.Name, *currentSts.Spec.Replicas, *currentSts.Spec.Replicas-1) lg.Info(fmt.Sprintf("Group: %s, Failed to exclude node: %s", nodePoolGroupName, lastReplicaNodeName)) - err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.Replace(currentStatus, componentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -268,7 +268,7 @@ func (r *ScalerReconciler) excludeNode(currentStatus opensearchv1.ComponentStatu return err } -func (r *ScalerReconciler) drainNode(currentStatus opensearchv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string) error { +func (r *ScalerReconciler) drainNode(currentStatus opsterv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string) error { lg := log.FromContext(r.ctx) annotations := map[string]string{"cluster-name": r.instance.GetName()} lastReplicaNodeName := helpers.ReplicaHostName(currentSts, *currentSts.Spec.Replicas-1) @@ -287,13 +287,13 @@ func (r *ScalerReconciler) drainNode(currentStatus opensearchv1.ComponentStatus, return err } - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Scaler", Status: "Drained", Description: nodePoolGroupName, } lg.Info(fmt.Sprintf("Group: %s, Node %s is drained", nodePoolGroupName, lastReplicaNodeName)) - err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.Replace(currentStatus, componentStatus, instance.Status.ComponentsStatus) }) if err != nil { diff --git a/opensearch-operator/pkg/reconcilers/securityconfig.go b/opensearch-operator/pkg/reconcilers/securityconfig.go index 4066c4e71..36e5cca27 100644 --- a/opensearch-operator/pkg/reconcilers/securityconfig.go +++ b/opensearch-operator/pkg/reconcilers/securityconfig.go @@ -8,12 +8,12 @@ import ( "sort" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/tools/record" @@ -66,7 +66,7 @@ type SecurityconfigReconciler struct { client k8s.K8sClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster logger logr.Logger } @@ -75,7 +75,7 @@ func NewSecurityconfigReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *SecurityconfigReconciler { return &SecurityconfigReconciler{ @@ -185,7 +185,7 @@ func (r *SecurityconfigReconciler) Reconcile() (ctrl.Result, error) { // BuildCmdArg builds the command for the securityconfig-update job for each individual ymls present in the // securityconfig secret. yml files which are not present in the secret are not applied/updated -func BuildCmdArg(instance *opensearchv1.OpenSearchCluster, secret *corev1.Secret, log logr.Logger) string { +func BuildCmdArg(instance *opsterv1.OpenSearchCluster, secret *corev1.Secret, log logr.Logger) string { clusterHostName := BuildClusterSvcHostName(instance) httpPort, securityConfigPort, securityconfigPath := helpers.VersionCheck(instance) @@ -256,7 +256,7 @@ func (r *SecurityconfigReconciler) DeleteResources() (ctrl.Result, error) { return result.Result, result.Err } -func (r *SecurityconfigReconciler) securityconfigSubpaths(instance *opensearchv1.OpenSearchCluster, secret *corev1.Secret) error { +func (r *SecurityconfigReconciler) securityconfigSubpaths(instance *opsterv1.OpenSearchCluster, secret *corev1.Secret) error { r.reconcilerContext.Volumes = append(r.reconcilerContext.Volumes, corev1.Volume{ Name: "securityconfig", VolumeSource: corev1.VolumeSource{ @@ -285,6 +285,6 @@ func (r *SecurityconfigReconciler) securityconfigSubpaths(instance *opensearchv1 } // BuildClusterSvcHostName builds the cluster host name as {svc-name}.{namespace}.svc.{dns-base} -func BuildClusterSvcHostName(instance *opensearchv1.OpenSearchCluster) string { +func BuildClusterSvcHostName(instance *opsterv1.OpenSearchCluster) string { return fmt.Sprintf("%s.svc.%s", builders.DnsOfService(instance), helpers.ClusterDnsBase()) } diff --git a/opensearch-operator/pkg/reconcilers/securityconfig_test.go b/opensearch-operator/pkg/reconcilers/securityconfig_test.go index 81716ffdf..ae755d467 100644 --- a/opensearch-operator/pkg/reconcilers/securityconfig_test.go +++ b/opensearch-operator/pkg/reconcilers/securityconfig_test.go @@ -6,9 +6,9 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -24,7 +24,7 @@ func newSecurityconfigReconciler( client *k8s.MockK8sClient, ctx context.Context, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, ) *SecurityconfigReconciler { return &SecurityconfigReconciler{ client: client, @@ -44,9 +44,9 @@ var _ = Describe("Securityconfig Reconciler", func() { When("When Reconciling the securityconfig reconciler with no securityconfig provided in the spec", func() { It("should not do anything", func() { mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{General: opensearchv1.GeneralConfig{}}, + Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{}}, } reconcilerContext := NewReconcilerContext(&record.FakeRecorder{}, &spec, spec.Spec.NodePools) @@ -65,12 +65,12 @@ var _ = Describe("Securityconfig Reconciler", func() { When("When Reconciling the securityconfig reconciler with securityconfig secret configured but not available", func() { It("should trigger a requeue", func() { mockClient := k8s.NewMockK8sClient(GinkgoT()) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{}, - Security: &opensearchv1.Security{ - Config: &opensearchv1.SecurityConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{}, + Security: &opsterv1.Security{ + Config: &opsterv1.SecurityConfig{ SecurityconfigSecret: corev1.LocalObjectReference{Name: "foobar"}, AdminSecret: corev1.LocalObjectReference{Name: "admin"}, }, @@ -119,23 +119,23 @@ var _ = Describe("Securityconfig Reconciler", func() { return &ctrl.Result{}, nil }) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: clusterName, Version: "2.3", }, - Security: &opensearchv1.Security{ - Config: &opensearchv1.SecurityConfig{ + Security: &opsterv1.Security{ + Config: &opsterv1.SecurityConfig{ SecurityconfigSecret: corev1.LocalObjectReference{Name: "securityconfig-secret"}, }, - Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{Generate: true}, + Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{Generate: true}, }, }, }, - Status: opensearchv1.ClusterStatus{ + Status: opsterv1.ClusterStatus{ Initialized: true, }, } @@ -186,14 +186,14 @@ var _ = Describe("Securityconfig Reconciler", func() { return &ctrl.Result{}, nil }) - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ Version: "2.3", }, - Security: &opensearchv1.Security{ - Config: &opensearchv1.SecurityConfig{ + Security: &opsterv1.Security{ + Config: &opsterv1.SecurityConfig{ SecurityconfigSecret: corev1.LocalObjectReference{Name: "securityconfig-secret"}, AdminSecret: corev1.LocalObjectReference{Name: "admin-cert"}, }, @@ -219,12 +219,12 @@ var _ = Describe("Securityconfig Reconciler", func() { mockClient := k8s.NewMockK8sClient(GinkgoT()) var clusterName = "securityconfig-noadminsecret" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{}, - Security: &opensearchv1.Security{ - Config: &opensearchv1.SecurityConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{}, + Security: &opsterv1.Security{ + Config: &opsterv1.SecurityConfig{ SecurityconfigSecret: corev1.LocalObjectReference{Name: "securityconfig"}, }, }, @@ -249,16 +249,16 @@ var _ = Describe("Securityconfig Reconciler", func() { mockClient := k8s.NewMockK8sClient(GinkgoT()) var clusterName = "no-securityconfig-tls-configured" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: clusterName, Version: "2.3", }, - Security: &opensearchv1.Security{ - Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{Generate: true}, + Security: &opsterv1.Security{ + Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{Generate: true}, }, }, }, diff --git a/opensearch-operator/pkg/reconcilers/suite_test.go b/opensearch-operator/pkg/reconcilers/suite_test.go index b22f7f718..08795d8f3 100644 --- a/opensearch-operator/pkg/reconcilers/suite_test.go +++ b/opensearch-operator/pkg/reconcilers/suite_test.go @@ -22,7 +22,7 @@ import ( monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -50,7 +50,7 @@ var _ = BeforeSuite(func() { err := scheme.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = opensearchv1.AddToScheme(scheme.Scheme) + err = opsterv1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) err = monitoring.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) diff --git a/opensearch-operator/pkg/reconcilers/tenant.go b/opensearch-operator/pkg/reconcilers/tenant.go index b7bf29a62..474a3801f 100644 --- a/opensearch-operator/pkg/reconcilers/tenant.go +++ b/opensearch-operator/pkg/reconcilers/tenant.go @@ -5,13 +5,13 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -30,8 +30,8 @@ type TenantReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchTenant - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchTenant + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -39,7 +39,7 @@ func NewTenantReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opensearchv1.OpensearchTenant, + instance *opsterv1.OpensearchTenant, opts ...ReconcilerOption, ) *TenantReconciler { options := ReconcilerOptions{} @@ -64,21 +64,21 @@ func (r *TenantReconciler) Reconcile() (retResult ctrl.Result, retErr error) { // When the reconciler is done, figure out what the state of the resource // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchTenant) + instance := object.(*opsterv1.OpensearchTenant) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opensearchv1.OpensearchTenantError + instance.Status.State = opsterv1.OpensearchTenantError } // Requeue after is 10 seconds if waiting for OpenSearch cluster if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchTenantPending + instance.Status.State = opsterv1.OpensearchTenantPending } // Requeue is after 30 seconds for normal reconciliation after creation/update if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opensearchv1.OpensearchTenantCreated + instance.Status.State = opsterv1.OpensearchTenantCreated } if reason == opensearchTenantExists { - instance.Status.State = opensearchv1.OpensearchTenantIgnored + instance.Status.State = opsterv1.OpensearchTenantIgnored } }) if err != nil { @@ -118,7 +118,7 @@ func (r *TenantReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } else { if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchTenant) + instance := object.(*opsterv1.OpensearchTenant) instance.Status.ManagedCluster = &r.cluster.UID }) if retErr != nil { @@ -130,7 +130,7 @@ func (r *TenantReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) @@ -160,7 +160,7 @@ func (r *TenantReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchTenant) + instance := object.(*opsterv1.OpensearchTenant) instance.Status.ExistingTenant = &exists }) if retErr != nil { diff --git a/opensearch-operator/pkg/reconcilers/tenant_test.go b/opensearch-operator/pkg/reconcilers/tenant_test.go index 24b83c0af..f6168957c 100644 --- a/opensearch-operator/pkg/reconcilers/tenant_test.go +++ b/opensearch-operator/pkg/reconcilers/tenant_test.go @@ -5,13 +5,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,25 +25,25 @@ var _ = Describe("tenant reconciler", func() { var ( transport *httpmock.MockTransport reconciler *TenantReconciler - instance *opensearchv1.OpensearchTenant + instance *opsterv1.OpensearchTenant recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchTenant{ + instance = &opsterv1.OpensearchTenant{ ObjectMeta: metav1.ObjectMeta{ Name: "test-tenant", Namespace: "test-tenant", UID: "testuid", }, - Spec: opensearchv1.OpensearchTenantSpec{ + Spec: opsterv1.OpensearchTenantSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -51,17 +51,17 @@ var _ = Describe("tenant reconciler", func() { }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-tenant", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -90,7 +90,7 @@ var _ = Describe("tenant reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) It("should wait for the cluster to exist", func() { @@ -158,8 +158,8 @@ var _ = Describe("tenant reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( http.MethodGet, @@ -413,7 +413,7 @@ var _ = Describe("tenant reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/tls.go b/opensearch-operator/pkg/reconcilers/tls.go index d613438f5..944db16b2 100644 --- a/opensearch-operator/pkg/reconcilers/tls.go +++ b/opensearch-operator/pkg/reconcilers/tls.go @@ -8,14 +8,14 @@ import ( "time" "github.com/Masterminds/semver" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/tls" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/tls" "github.com/samber/lo" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -29,7 +29,7 @@ import ( type TLSReconciler struct { client k8s.K8sClient reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster logger logr.Logger pki tls.PKI recorder record.EventRecorder @@ -39,7 +39,7 @@ func NewTLSReconciler( client client.Client, ctx context.Context, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *TLSReconciler { return &TLSReconciler{ @@ -102,7 +102,7 @@ func (r *TLSReconciler) handleTransport() error { } func (r *TLSReconciler) handleAdminCertificate() (*ctrl.Result, error) { - // TODO: This should be refactored in the API - https://github.com/opensearch-project/opensearch-k8s-operator/issues/569 + // TODO: This should be refactored in the API - https://github.com/Opster/opensearch-k8s-operator/issues/569 tlsConfig := r.instance.Spec.Security.Tls.Transport clusterName := r.instance.Name diff --git a/opensearch-operator/pkg/reconcilers/tls_test.go b/opensearch-operator/pkg/reconcilers/tls_test.go index ec98c05cb..b31ba33f0 100644 --- a/opensearch-operator/pkg/reconcilers/tls_test.go +++ b/opensearch-operator/pkg/reconcilers/tls_test.go @@ -4,11 +4,11 @@ import ( "context" "fmt" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" ) -func newTLSReconciler(k8sClient *k8s.MockK8sClient, spec *opensearchv1.OpenSearchCluster) (*ReconcilerContext, *TLSReconciler) { +func newTLSReconciler(k8sClient *k8s.MockK8sClient, spec *opsterv1.OpenSearchCluster) (*ReconcilerContext, *TLSReconciler) { reconcilerContext := NewReconcilerContext(&helpers.MockEventRecorder{}, spec, spec.Spec.NodePools) underTest := &TLSReconciler{ client: k8sClient, @@ -39,13 +39,13 @@ var _ = Describe("TLS Controller", func() { transportSecretName := clusterName + "-transport-cert" httpSecretName := clusterName + "-http-cert" adminSecretName := clusterName + "-admin-cert" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{}, - Security: &opensearchv1.Security{Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{Generate: true}, - Http: &opensearchv1.TlsConfigHttp{Generate: true}, + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{}, + Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{Generate: true}, + Http: &opsterv1.TlsConfigHttp{Generate: true}, }}, }, } @@ -84,15 +84,15 @@ var _ = Describe("TLS Controller", func() { transportSecretName := clusterName + "-transport-cert" httpSecretName := clusterName + "-http-cert" adminSecretName := clusterName + "-admin-cert" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{}, - Security: &opensearchv1.Security{Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{Generate: true, PerNode: true}, - Http: &opensearchv1.TlsConfigHttp{Generate: true}, + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{}, + Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{Generate: true, PerNode: true}, + Http: &opsterv1.TlsConfigHttp{Generate: true}, }}, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "masters", Replicas: 3, @@ -152,21 +152,21 @@ var _ = Describe("TLS Controller", func() { Context("When Reconciling the TLS configuration with external certificates", func() { It("Should not create secrets but only mount them", func() { clusterName := "tls-test-existingsecrets" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{General: opensearchv1.GeneralConfig{Version: "2.8.0"}, Security: &opensearchv1.Security{Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{ + Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{Version: "2.8.0"}, Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{ Generate: false, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{ + TlsCertificateConfig: opsterv1.TlsCertificateConfig{ Secret: corev1.LocalObjectReference{Name: "cert-transport"}, CaSecret: corev1.LocalObjectReference{Name: "casecret-transport"}, }, NodesDn: []string{"CN=mycn", "CN=othercn"}, AdminDn: []string{"CN=admin1", "CN=admin2"}, }, - Http: &opensearchv1.TlsConfigHttp{ + Http: &opsterv1.TlsConfigHttp{ Generate: false, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{ + TlsCertificateConfig: opsterv1.TlsCertificateConfig{ Secret: corev1.LocalObjectReference{Name: "cert-http"}, CaSecret: corev1.LocalObjectReference{Name: "casecret-http"}, }, @@ -199,20 +199,20 @@ var _ = Describe("TLS Controller", func() { Context("When Reconciling the TLS configuration with external per-node certificates", func() { It("Should not create secrets but only mount them", func() { clusterName := "tls-test-existingsecretspernode" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{General: opensearchv1.GeneralConfig{}, Security: &opensearchv1.Security{Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{ + Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{}, Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{ Generate: false, PerNode: true, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{ + TlsCertificateConfig: opsterv1.TlsCertificateConfig{ Secret: corev1.LocalObjectReference{Name: "my-transport-certs"}, }, NodesDn: []string{"CN=mycn", "CN=othercn"}, }, - Http: &opensearchv1.TlsConfigHttp{ + Http: &opsterv1.TlsConfigHttp{ Generate: false, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{ + TlsCertificateConfig: opsterv1.TlsCertificateConfig{ Secret: corev1.LocalObjectReference{Name: "my-http-certs"}, }, }, @@ -237,19 +237,19 @@ var _ = Describe("TLS Controller", func() { It("Should create certificates using that CA", func() { clusterName := "tls-withca" caSecretName := clusterName + "-myca" - spec := opensearchv1.OpenSearchCluster{ + spec := opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opensearchv1.ClusterSpec{General: opensearchv1.GeneralConfig{Version: "2.8.0"}, Security: &opensearchv1.Security{Tls: &opensearchv1.TlsConfig{ - Transport: &opensearchv1.TlsConfigTransport{ + Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{Version: "2.8.0"}, Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ + Transport: &opsterv1.TlsConfigTransport{ Generate: true, PerNode: true, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{ + TlsCertificateConfig: opsterv1.TlsCertificateConfig{ CaSecret: corev1.LocalObjectReference{Name: caSecretName}, }, }, - Http: &opensearchv1.TlsConfigHttp{ + Http: &opsterv1.TlsConfigHttp{ Generate: true, - TlsCertificateConfig: opensearchv1.TlsCertificateConfig{ + TlsCertificateConfig: opsterv1.TlsCertificateConfig{ CaSecret: corev1.LocalObjectReference{Name: caSecretName}, }, }, diff --git a/opensearch-operator/pkg/reconcilers/upgrade.go b/opensearch-operator/pkg/reconcilers/upgrade.go index 073933aa2..9b9d85995 100644 --- a/opensearch-operator/pkg/reconcilers/upgrade.go +++ b/opensearch-operator/pkg/reconcilers/upgrade.go @@ -7,14 +7,14 @@ import ( "time" "github.com/Masterminds/semver" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/samber/lo" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,7 +36,7 @@ type UpgradeReconciler struct { osClient *services.OsClusterClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opensearchv1.OpenSearchCluster + instance *opsterv1.OpenSearchCluster logger logr.Logger } @@ -45,7 +45,7 @@ func NewUpgradeReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opensearchv1.OpenSearchCluster, + instance *opsterv1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *UpgradeReconciler { return &UpgradeReconciler{ @@ -95,7 +95,7 @@ func (r *UpgradeReconciler) Reconcile() (ctrl.Result, error) { switch currentStatus.Status { case "Pending": // Set it to upgrading and requeue - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { currentStatus.Status = "Upgrading" instance.Status.ComponentsStatus = append(instance.Status.ComponentsStatus, currentStatus) }) @@ -112,10 +112,10 @@ func (r *UpgradeReconciler) Reconcile() (ctrl.Result, error) { }, err case "Finished": // Cleanup status after successful upgrade - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { instance.Status.Version = instance.Spec.General.Version for _, pool := range instance.Spec.NodePools { - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, } @@ -170,9 +170,9 @@ func (r *UpgradeReconciler) validateUpgrade() error { } // Find which nodepool to work on -func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, opensearchv1.ComponentStatus) { +func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, opsterv1.ComponentStatus) { // First sort node pools - var dataNodes, dataAndMasterNodes, otherNodes []opensearchv1.NodePool + var dataNodes, dataAndMasterNodes, otherNodes []opsterv1.NodePool for _, nodePool := range r.instance.Spec.NodePools { if helpers.HasDataRole(&nodePool) { if helpers.HasManagerRole(&nodePool) { @@ -189,7 +189,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, // Complete the in progress node first pool, found := r.findInProgress(dataNodes) if found { - return pool, opensearchv1.ComponentStatus{ + return pool, opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Upgrading", @@ -198,7 +198,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, // Pick the first unworked on node next pool, found = r.findNextPool(dataNodes) if found { - return pool, opensearchv1.ComponentStatus{ + return pool, opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Pending", @@ -207,7 +207,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, // Next do the same for any nodes that are data and master pool, found = r.findInProgress(dataAndMasterNodes) if found { - return pool, opensearchv1.ComponentStatus{ + return pool, opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Upgrading", @@ -215,7 +215,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, } pool, found = r.findNextPool(dataAndMasterNodes) if found { - return pool, opensearchv1.ComponentStatus{ + return pool, opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Pending", @@ -225,7 +225,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, // Finally do the non data nodes pool, found = r.findInProgress(otherNodes) if found { - return pool, opensearchv1.ComponentStatus{ + return pool, opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Upgrading", @@ -233,7 +233,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, } pool, found = r.findNextPool(otherNodes) if found { - return pool, opensearchv1.ComponentStatus{ + return pool, opsterv1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Pending", @@ -241,15 +241,15 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opensearchv1.NodePool, } // If we get here all nodes should be upgraded - return opensearchv1.NodePool{}, opensearchv1.ComponentStatus{ + return opsterv1.NodePool{}, opsterv1.ComponentStatus{ Component: "Upgrade", Status: "Finished", } } -func (r *UpgradeReconciler) findInProgress(pools []opensearchv1.NodePool) (opensearchv1.NodePool, bool) { +func (r *UpgradeReconciler) findInProgress(pools []opsterv1.NodePool) (opsterv1.NodePool, bool) { for _, nodePool := range pools { - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Description: nodePool.Component, } @@ -258,12 +258,12 @@ func (r *UpgradeReconciler) findInProgress(pools []opensearchv1.NodePool) (opens return nodePool, true } } - return opensearchv1.NodePool{}, false + return opsterv1.NodePool{}, false } -func (r *UpgradeReconciler) findNextPool(pools []opensearchv1.NodePool) (opensearchv1.NodePool, bool) { +func (r *UpgradeReconciler) findNextPool(pools []opsterv1.NodePool) (opsterv1.NodePool, bool) { for _, nodePool := range pools { - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Description: nodePool.Component, } @@ -272,10 +272,10 @@ func (r *UpgradeReconciler) findNextPool(pools []opensearchv1.NodePool) (opensea return nodePool, true } } - return opensearchv1.NodePool{}, false + return opsterv1.NodePool{}, false } -func (r *UpgradeReconciler) doNodePoolUpgrade(pool opensearchv1.NodePool) error { +func (r *UpgradeReconciler) doNodePoolUpgrade(pool opsterv1.NodePool) error { var conditions []string annotations := map[string]string{"cluster-name": r.instance.GetName()} // Fetch the STS @@ -321,13 +321,13 @@ func (r *UpgradeReconciler) doNodePoolUpgrade(pool opensearchv1.NodePool) error } r.recorder.AnnotatedEventf(r.instance, annotations, "Normal", "Upgrade", "Finished upgrade of node pool '%s'", pool.Component) - return r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { - currentStatus := opensearchv1.ComponentStatus{ + return r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { + currentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: pool.Component, } - componentStatus := opensearchv1.ComponentStatus{ + componentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgraded", Description: pool.Component, @@ -381,14 +381,14 @@ func (r *UpgradeReconciler) doNodePoolUpgrade(pool opensearchv1.NodePool) error func (r *UpgradeReconciler) setComponentConditions(conditions []string, component string) { - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opensearchv1.OpenSearchCluster) { - currentStatus := opensearchv1.ComponentStatus{ + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { + currentStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: component, } componentStatus, found := helpers.FindFirstPartial(instance.Status.ComponentsStatus, currentStatus, helpers.GetByDescriptionAndGroup) - newStatus := opensearchv1.ComponentStatus{ + newStatus := opsterv1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: component, diff --git a/opensearch-operator/pkg/reconcilers/userrolebinding.go b/opensearch-operator/pkg/reconcilers/userrolebinding.go index 3421fc8d7..899fb849d 100644 --- a/opensearch-operator/pkg/reconcilers/userrolebinding.go +++ b/opensearch-operator/pkg/reconcilers/userrolebinding.go @@ -5,14 +5,14 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -27,8 +27,8 @@ type UserRoleBindingReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchUserRoleBinding - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchUserRoleBinding + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -36,7 +36,7 @@ func NewUserRoleBindingReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opensearchv1.OpensearchUserRoleBinding, + instance *opsterv1.OpensearchUserRoleBinding, opts ...ReconcilerOption, ) *UserRoleBindingReconciler { options := ReconcilerOptions{} @@ -62,19 +62,19 @@ func (r *UserRoleBindingReconciler) Reconcile() (retResult ctrl.Result, retErr e // When the reconciler is done, figure out what the state of the resource is // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchUserRoleBinding) + instance := object.(*opsterv1.OpensearchUserRoleBinding) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opensearchv1.OpensearchUserRoleBindingStateError + instance.Status.State = opsterv1.OpensearchUserRoleBindingStateError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchUserRoleBindingPending + instance.Status.State = opsterv1.OpensearchUserRoleBindingPending } if retErr == nil && retResult.RequeueAfter == 30*time.Second { instance.Status.ProvisionedRoles = instance.Spec.Roles instance.Status.ProvisionedBackendRoles = instance.Spec.BackendRoles instance.Status.ProvisionedUsers = instance.Spec.Users - instance.Status.State = opensearchv1.OpensearchUserRoleBindingStateCreated + instance.Status.State = opsterv1.OpensearchUserRoleBindingStateCreated } }) if err != nil { @@ -114,7 +114,7 @@ func (r *UserRoleBindingReconciler) Reconcile() (retResult ctrl.Result, retErr e } else { if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchUserRoleBinding) + instance := object.(*opsterv1.OpensearchUserRoleBinding) instance.Status.ManagedCluster = &r.cluster.UID }) if retErr != nil { @@ -126,7 +126,7 @@ func (r *UserRoleBindingReconciler) Reconcile() (retResult ctrl.Result, retErr e } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) diff --git a/opensearch-operator/pkg/reconcilers/userrolebinding_test.go b/opensearch-operator/pkg/reconcilers/userrolebinding_test.go index d0c54b528..671cdfdf0 100644 --- a/opensearch-operator/pkg/reconcilers/userrolebinding_test.go +++ b/opensearch-operator/pkg/reconcilers/userrolebinding_test.go @@ -6,13 +6,13 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,25 +25,25 @@ var _ = Describe("userrolebinding reconciler", func() { var ( transport *httpmock.MockTransport reconciler *UserRoleBindingReconciler - instance *opensearchv1.OpensearchUserRoleBinding + instance *opsterv1.OpensearchUserRoleBinding recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchUserRoleBinding{ + instance = &opsterv1.OpensearchUserRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "test-role", Namespace: "test-urb", UID: types.UID("testuid"), }, - Spec: opensearchv1.OpensearchUserRoleBindingSpec{ + Spec: opsterv1.OpensearchUserRoleBindingSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -59,17 +59,17 @@ var _ = Describe("userrolebinding reconciler", func() { }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-urb", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -98,7 +98,7 @@ var _ = Describe("userrolebinding reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) It("should wait for the cluster to exist", func() { @@ -166,8 +166,8 @@ var _ = Describe("userrolebinding reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -846,7 +846,7 @@ var _ = Describe("userrolebinding reconciler", func() { When("cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing and exit", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/users.go b/opensearch-operator/pkg/reconcilers/users.go index 1cbb8384e..ba8b50e8f 100644 --- a/opensearch-operator/pkg/reconcilers/users.go +++ b/opensearch-operator/pkg/reconcilers/users.go @@ -5,14 +5,14 @@ import ( "fmt" "time" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" @@ -27,8 +27,8 @@ type UserReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opensearchv1.OpensearchUser - cluster *opensearchv1.OpenSearchCluster + instance *opsterv1.OpensearchUser + cluster *opsterv1.OpenSearchCluster logger logr.Logger } @@ -36,7 +36,7 @@ func NewUserReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opensearchv1.OpensearchUser, + instance *opsterv1.OpensearchUser, opts ...ReconcilerOption, ) *UserReconciler { options := ReconcilerOptions{} @@ -62,16 +62,16 @@ func (r *UserReconciler) Reconcile() (retResult ctrl.Result, retErr error) { // When the reconciler is done, figure out what the state of the resource is // is and set it in the state field accordingly. err := r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchUser) + instance := object.(*opsterv1.OpensearchUser) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opensearchv1.OpensearchUserStateError + instance.Status.State = opsterv1.OpensearchUserStateError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opensearchv1.OpensearchUserStatePending + instance.Status.State = opsterv1.OpensearchUserStatePending } if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opensearchv1.OpensearchUserStateCreated + instance.Status.State = opsterv1.OpensearchUserStateCreated } }) if err != nil { @@ -111,7 +111,7 @@ func (r *UserReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } else { if pointer.BoolDeref(r.updateStatus, true) { retErr = r.client.UdateObjectStatus(r.instance, func(object client.Object) { - instance := object.(*opensearchv1.OpensearchUser) + instance := object.(*opsterv1.OpensearchUser) instance.Status.ManagedCluster = &r.cluster.UID }) if retErr != nil { @@ -123,7 +123,7 @@ func (r *UserReconciler) Reconcile() (retResult ctrl.Result, retErr error) { } // Check cluster is ready - if r.cluster.Status.Phase != opensearchv1.PhaseRunning { + if r.cluster.Status.Phase != opsterv1.PhaseRunning { r.logger.Info("opensearch cluster is not running, requeueing") reason = "waiting for opensearch cluster status to be running" r.recorder.Event(r.instance, "Normal", opensearchPending, reason) diff --git a/opensearch-operator/pkg/reconcilers/users_test.go b/opensearch-operator/pkg/reconcilers/users_test.go index 03ef91d45..5afa10e57 100644 --- a/opensearch-operator/pkg/reconcilers/users_test.go +++ b/opensearch-operator/pkg/reconcilers/users_test.go @@ -5,15 +5,15 @@ import ( "fmt" "net/http" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/stretchr/testify/mock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -27,26 +27,26 @@ var _ = Describe("users reconciler", func() { var ( transport *httpmock.MockTransport reconciler *UserReconciler - instance *opensearchv1.OpensearchUser + instance *opsterv1.OpensearchUser recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects password *corev1.Secret - cluster *opensearchv1.OpenSearchCluster + cluster *opsterv1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opensearchv1.OpensearchUser{ + instance = &opsterv1.OpensearchUser{ ObjectMeta: metav1.ObjectMeta{ Name: "test-user", Namespace: "test-user", UID: types.UID("testuid"), }, - Spec: opensearchv1.OpensearchUserSpec{ + Spec: opsterv1.OpensearchUserSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -67,17 +67,17 @@ var _ = Describe("users reconciler", func() { "password": []byte("testpassword"), }, } - cluster = &opensearchv1.OpenSearchCluster{ + cluster = &opsterv1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-user", }, - Spec: opensearchv1.ClusterSpec{ - General: opensearchv1.GeneralConfig{ + Spec: opsterv1.ClusterSpec{ + General: opsterv1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opensearchv1.NodePool{ + NodePools: []opsterv1.NodePool{ { Component: "node", Roles: []string{ @@ -106,7 +106,7 @@ var _ = Describe("users reconciler", func() { When("cluster doesn't exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) recorder = record.NewFakeRecorder(1) }) It("should wait for the cluster to exist", func() { @@ -149,8 +149,8 @@ var _ = Describe("users reconciler", func() { Context("cluster is ready", func() { extraContextCalls := 1 BeforeEach(func() { - cluster.Status.Phase = opensearchv1.PhaseRunning - cluster.Status.ComponentsStatus = []opensearchv1.ComponentStatus{} + cluster.Status.Phase = opsterv1.PhaseRunning + cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(*cluster, nil) transport.RegisterResponder( @@ -464,7 +464,7 @@ var _ = Describe("users reconciler", func() { When("the opensearch cluster does not exist", func() { BeforeEach(func() { instance.Spec.OpensearchRef.Name = "doesnotexist" - mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opensearchv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(opsterv1.OpenSearchCluster{}, NotFoundError()) }) It("should do nothing", func() { Expect(reconciler.Delete()).To(Succeed()) diff --git a/opensearch-operator/pkg/reconcilers/util/util.go b/opensearch-operator/pkg/reconcilers/util/util.go index c3e8faad9..f812d4006 100644 --- a/opensearch-operator/pkg/reconcilers/util/util.go +++ b/opensearch-operator/pkg/reconcilers/util/util.go @@ -9,13 +9,13 @@ import ( "sort" "strings" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/tls" "github.com/go-logr/logr" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/builders" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/helpers" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/tls" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -58,7 +58,7 @@ func CheckEquels(from_env *appsv1.StatefulSetSpec, from_crd *appsv1.StatefulSetS } } -func ReadOrGenerateCaCert(pki tls.PKI, k8sClient k8s.K8sClient, instance *opensearchv1.OpenSearchCluster) (tls.Cert, error) { +func ReadOrGenerateCaCert(pki tls.PKI, k8sClient k8s.K8sClient, instance *opsterv1.OpenSearchCluster) (tls.Cert, error) { namespace := instance.Namespace clusterName := instance.Name secretName := clusterName + "-ca" @@ -89,7 +89,7 @@ func ReadOrGenerateCaCert(pki tls.PKI, k8sClient k8s.K8sClient, instance *opense func CreateAdditionalVolumes( k8sClient k8s.K8sClient, namespace string, - volumeConfigs []opensearchv1.AdditionalVolume, + volumeConfigs []opsterv1.AdditionalVolume, ) ( retVolumes []corev1.Volume, retVolumeMounts []corev1.VolumeMount, @@ -195,7 +195,7 @@ func CreateAdditionalVolumes( return } -func OpensearchClusterURL(cluster *opensearchv1.OpenSearchCluster) string { +func OpensearchClusterURL(cluster *opsterv1.OpenSearchCluster) string { return fmt.Sprintf( "https://%s.%s.svc.%s:%v", cluster.Spec.General.ServiceName, @@ -208,7 +208,7 @@ func OpensearchClusterURL(cluster *opensearchv1.OpenSearchCluster) string { func CreateClientForCluster( k8sClient k8s.K8sClient, ctx context.Context, - cluster *opensearchv1.OpenSearchCluster, + cluster *opsterv1.OpenSearchCluster, transport http.RoundTripper, ) (*services.OsClusterClient, error) { lg := log.FromContext(ctx) @@ -242,7 +242,7 @@ func FetchOpensearchCluster( k8sClient k8s.K8sClient, ctx context.Context, ref types.NamespacedName, -) (*opensearchv1.OpenSearchCluster, error) { +) (*opsterv1.OpenSearchCluster, error) { cluster, err := k8sClient.GetOpenSearchCluster(ref.Name, ref.Namespace) if err != nil { if k8serrors.IsNotFound(err) { @@ -264,7 +264,7 @@ func GetSha1Sum(data []byte) (string, error) { return hex.EncodeToString(hasher.Sum(nil)), nil } -func DataNodesCount(k8sClient k8s.K8sClient, cr *opensearchv1.OpenSearchCluster) int32 { +func DataNodesCount(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearchCluster) int32 { count := int32(0) for _, nodePool := range cr.Spec.NodePools { if helpers.HasDataRole(&nodePool) { @@ -278,24 +278,24 @@ func DataNodesCount(k8sClient k8s.K8sClient, cr *opensearchv1.OpenSearchCluster) } // GetClusterHealth returns the health of OpenSearch cluster -func GetClusterHealth(k8sClient k8s.K8sClient, ctx context.Context, cluster *opensearchv1.OpenSearchCluster, lg logr.Logger) opensearchv1.OpenSearchHealth { +func GetClusterHealth(k8sClient k8s.K8sClient, ctx context.Context, cluster *opsterv1.OpenSearchCluster, lg logr.Logger) opsterv1.OpenSearchHealth { osClient, err := CreateClientForCluster(k8sClient, ctx, cluster, nil) if err != nil { lg.V(1).Info(fmt.Sprintf("Failed to create OS client while checking cluster health: %v", err)) - return opensearchv1.OpenSearchUnknownHealth + return opsterv1.OpenSearchUnknownHealth } healthResponse, err := osClient.GetClusterHealth() if err != nil { lg.Error(err, "Failed to get OpenSearch health status") - return opensearchv1.OpenSearchUnknownHealth + return opsterv1.OpenSearchUnknownHealth } - return opensearchv1.OpenSearchHealth(healthResponse.Status) + return opsterv1.OpenSearchHealth(healthResponse.Status) } // GetAvailableOpenSearchNodes returns the sum of ready pods for all node pools -func GetAvailableOpenSearchNodes(k8sClient k8s.K8sClient, ctx context.Context, cluster *opensearchv1.OpenSearchCluster, lg logr.Logger) int32 { +func GetAvailableOpenSearchNodes(k8sClient k8s.K8sClient, ctx context.Context, cluster *opsterv1.OpenSearchCluster, lg logr.Logger) int32 { clusterName := cluster.Name clusterNamespace := cluster.Namespace diff --git a/opensearch-operator/pkg/reconcilers/util/util_suite_test.go b/opensearch-operator/pkg/reconcilers/util/util_suite_test.go index 6b59f3504..ec02cb6a3 100644 --- a/opensearch-operator/pkg/reconcilers/util/util_suite_test.go +++ b/opensearch-operator/pkg/reconcilers/util/util_suite_test.go @@ -3,9 +3,9 @@ package util import ( "testing" + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" "k8s.io/client-go/kubernetes/scheme" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -22,7 +22,7 @@ var _ = BeforeSuite(func() { err := scheme.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = opensearchv1.AddToScheme(scheme.Scheme) + err = opsterv1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) }) diff --git a/opensearch-operator/pkg/reconcilers/util/util_test.go b/opensearch-operator/pkg/reconcilers/util/util_test.go index 892dd0332..30620d8f3 100644 --- a/opensearch-operator/pkg/reconcilers/util/util_test.go +++ b/opensearch-operator/pkg/reconcilers/util/util_test.go @@ -2,22 +2,23 @@ package util import ( "context" + + opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Opster/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - opensearchv1 "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/mocks/github.com/opensearch-project/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" v1 "k8s.io/api/core/v1" ) var _ = Describe("Additional volumes", func() { namespace := "Additional volume test" - var volumeConfigs []opensearchv1.AdditionalVolume + var volumeConfigs []opsterv1.AdditionalVolume var mockClient *k8s.MockK8sClient BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) mockClient.EXPECT().Context().Return(context.Background()) - volumeConfigs = []opensearchv1.AdditionalVolume{ + volumeConfigs = []opsterv1.AdditionalVolume{ { Name: "myVolume", Path: "myPath/a/b", diff --git a/scripts/build-image-multi-arch.sh b/scripts/build-image-multi-arch.sh new file mode 100644 index 000000000..1aff0188f --- /dev/null +++ b/scripts/build-image-multi-arch.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +# Copyright OpenSearch Contributors +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. + + +set -e + +# Variable +OLDIFS=$IFS +BUILDER_NUM=`date +%s` +BUILDER_NAME="multiarch_${BUILDER_NUM}" + +function usage() { + echo "" + echo "This script is used to build the OpenSearch Docker image with multi architecture (x64 + arm64). It prepares the files required by the Dockerfile in a temporary directory, then builds and tags the Docker image." + echo "--------------------------------------------------------------------------" + echo "Usage: $0 [args]" + echo "" + echo "Required arguments:" + echo -e "-v VERSION\tSpecify the OpenSearch version number that you are building, e.g. '1.0.0' or '1.0.0-beta1'. This will be used to label the Docker image. If you do not use the '-o' option then this tool will download a public OPENSEARCH release matching this version." + echo -e "-f DOCKERFILE\tSpecify the dockerfile full path, e.g. dockerfile/opensearch.al2.dockerfile." + echo -e "-a ARCHITECTURE\tSpecify the multiple architecture you want to add to the multi-arch image, separate by comma, e.g. 'x64,arm64'." + echo -e "-r REPOSITORY\tSpecify the docker repository name in the format of '/', due to multi-arch image either save in cache or directly upload to Docker Hub Repo, no local copies. The tag name will be pointed to '-v' value and 'latest'" + echo -e "-p PRODUCT\tSpecify the product, e.g. opensearch-operator-busybox or opensearch-operator, make sure this is the name of your config folder and the name of your .tgz defined in dockerfile." + echo "" + echo "Optional arguments:" + echo -e "-t TARBALL\tSpecify multiple opensearch or opensearch-dashboards tarballs, use the same order as the input for '-a' param, e.g. 'opensearch-1.0.0-linux-x64.tar.gz,opensearch-1.0.0-linux-arm64.tar.gz'. You still need to specify the version - this tool does not attempt to parse the filename." + echo -e "-n NOTES\tSpecify Pipeline Notes of the run, defaults to None." + echo -e "-h\t\tPrint this message." + echo "--------------------------------------------------------------------------" +} + +function cleanup_docker_buildx() { + # Cleanup docker buildx + echo -e "\n* Cleanup docker buildx" + docker buildx use default + docker buildx rm $BUILDER_NAME > /dev/null 2>&1 +} + +while getopts ":ht:n:v:f:p:a:r:" arg; do + case $arg in + h) + usage + exit 1 + ;; + t) + TARBALL=`realpath $OPTARG` + ;; + n) + NOTES=$OPTARG + ;; + v) + VERSION=$OPTARG + ;; + f) + DOCKERFILE=$OPTARG + ;; + p) + PRODUCT=$OPTARG + ;; + a) + ARCHITECTURE=$OPTARG + ;; + :) + echo "-${OPTARG} requires an argument" + usage + exit 1 + ;; + ?) + echo "Invalid option: -${OPTARG}" + exit 1 + ;; + esac +done + +# Validate the required parameters to present +if [ -z "$VERSION" ] || [ -z "$DOCKERFILE" ] || [ -z "$ARCHITECTURE" ] || [ -z "$PRODUCT" ]; then + echo "You must specify '-v VERSION', '-f DOCKERFILE', '-p PRODUCT', '-a ARCHITECTURE''" + usage + exit 1 +else + echo $VERSION $DOCKERFILE $PRODUCT $ARCHITECTURE + IFS=', ' read -r -a ARCHITECTURE_ARRAY <<< "$ARCHITECTURE" + IFS=', ' read -r -a TARBALL_ARRAY <<< "$TARBALL" +fi + +if [ "$PRODUCT" != "opensearch-operator-busybox" ] && [ "$PRODUCT" != "opensearch-operator" ] +then + echo "Enter either 'opensearch-operator' or 'opensearch-operator-busybox' as product name for -p parameter" + exit 1 +else + PRODUCT_ALT=`echo $PRODUCT | sed 's@-@_@g'` + echo $PRODUCT $PRODUCT_ALT.yml +fi + +for ARCH in $ARCHITECTURE_ARRAY +do + if [ "$ARCH" != "x64" ] && [ "$ARCH" != "arm64" ] + then + echo "We only support 'x64' and 'arm64' as architecture name for -a parameter" + exit 1 + fi +done + +if [ -z "$NOTES" ] +then + NOTES="None" +fi + +# Warning docker desktop +if (! docker buildx version) +then + echo -e "\n* You MUST have Docker Desktop to use buildx for multi-arch images." + exit 1 +fi + +# Prepare docker buildx +echo -e "\n* Prepare docker buildx" +docker buildx rm --all-inactive --force +docker buildx prune --all --force +docker buildx use default +docker buildx create --name $BUILDER_NAME --use +docker buildx inspect --bootstrap + +# Check buildx status +echo -e "\n* Check buildx status" +docker buildx ls | grep $BUILDER_NAME +docker ps | grep $BUILDER_NAME + + +# Build multi-arch images +PLATFORMS=`echo "${ARCHITECTURE_ARRAY[@]/#/linux/}" | sed 's/x64/amd64/g;s/ /,/g'` && echo PLATFORMS $PLATFORMS +docker buildx build --platform $PLATFORMS --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -t opensearchstaging/$PRODUCT:${VERSION} -f $DOCKERFILE --push
apiVersion stringopensearch.org/v1opensearch.opster.io/v1 true
Default image repository to use
keystore[]opensearchv1.KeystoreValue[]opsterv1.KeystoreValue List of objects that define secret values that will populate the opensearch keystore. false - -
serviceopensearchv1.DashboardsServiceopsterv1.DashboardsService Customize dashboard service false -string Define InitHelper image falsepublic.ecr.aws/opsterio/busyboxpublic.ecr.aws/opensearch-project/opensearch-operator-busybox
imagePullPolicy