From 2046d8d4de103134febbfeb8790ec615023c7798 Mon Sep 17 00:00:00 2001 From: Eliatra Date: Sun, 26 Nov 2023 14:50:11 +0100 Subject: [PATCH] Renaming --- .github/workflows/busybox.yaml | 19 ++- .github/workflows/docker-build.yaml | 1 + .github/workflows/functional-tests.yaml | 9 +- .github/workflows/linting.yaml | 2 +- .github/workflows/prepare-release.yaml | 43 ++++-- .github/workflows/release.yaml | 39 ++++-- .github/workflows/testing.yaml | 2 +- CONTRIBUTING.md | 4 +- MAINTAINERS.md | 9 +- NOTICE.txt | 6 + README.md | 40 +++--- charts/opensearch-cluster/Chart.yaml | 4 +- .../opensearch-cluster/templates/_helpers.tpl | 35 ----- .../templates/opensearch-cluster-cr.yaml | 2 +- charts/opensearch-operator/CHANGELOG.md | 61 --------- charts/opensearch-operator/Chart.yaml | 4 +- charts/opensearch-operator/README.md | 9 +- ...ch.eliatra.io_opensearchactiongroups.yaml} | 4 +- ...nsearch.eliatra.io_opensearchclusters.yaml | 4 +- ...iatra.io_opensearchcomponenttemplates.yaml | 4 +- ....eliatra.io_opensearchindextemplates.yaml} | 4 +- ...rch.eliatra.io_opensearchismpolicies.yaml} | 4 +- ...opensearch.eliatra.io_opensearchroles.yaml | 4 +- ...nsearch.eliatra.io_opensearchtenants.yaml} | 4 +- ...eliatra.io_opensearchuserrolebindings.yaml | 4 +- ...pensearch.eliatra.io_opensearchusers.yaml} | 4 +- .../templates/_helpers.tpl | 34 ----- ...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 | 4 +- docs/userguide/cluster-chart.md | 4 +- docs/userguide/main.md | 44 +++--- opensearch-operator/.mockery.yaml | 2 +- opensearch-operator/PROJECT | 44 +++--- .../api/v1/groupversion_info.go | 6 +- ...ch.eliatra.io_opensearchactiongroups.yaml} | 4 +- ...nsearch.eliatra.io_opensearchclusters.yaml | 4 +- ...iatra.io_opensearchcomponenttemplates.yaml | 4 +- ....eliatra.io_opensearchindextemplates.yaml} | 4 +- ...rch.eliatra.io_opensearchismpolicies.yaml} | 4 +- ...opensearch.eliatra.io_opensearchroles.yaml | 4 +- ...nsearch.eliatra.io_opensearchtenants.yaml} | 4 +- ...eliatra.io_opensearchuserrolebindings.yaml | 4 +- ...pensearch.eliatra.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 ++++---- ... => eliatra_v1_opensearchactiongroup.yaml} | 2 +- ...yaml => eliatra_v1_opensearchcluster.yaml} | 2 +- ...le.yaml => eliatra_v1_opensearchrole.yaml} | 2 +- ....yaml => eliatra_v1_opensearchtenant.yaml} | 2 +- ...er.yaml => eliatra_v1_opensearchuser.yaml} | 2 +- ...eliatra_v1_opensearchuserrolebinding.yaml} | 2 +- .../controllers/cluster_test.go | 20 +-- .../controllers/controller_settings.go | 2 +- .../controllers/opensearchController.go | 34 ++--- ...opensearch_componenttemplate_controller.go | 18 +-- .../opensearch_indextemplate_controller.go | 18 +-- .../opensearchactiongroup_controller.go | 20 +-- .../controllers/opensearchism_controller.go | 18 +-- .../controllers/opensearchrole_controller.go | 18 +-- .../opensearchtenant_controller.go | 18 +-- .../controllers/opensearchuser_controller.go | 20 +-- .../opensearchuserrolebinding_controller.go | 18 +-- .../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 +- .../functionaltests/execute_tests.sh | 4 +- opensearch-operator/functionaltests/go.mod | 2 +- .../helmtests/helmcrinstall_test.go | 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 | 16 +-- .../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 | 8 +- 158 files changed, 1173 insertions(+), 1264 deletions(-) create mode 100644 NOTICE.txt delete mode 100644 charts/opensearch-operator/CHANGELOG.md rename charts/opensearch-operator/files/{opensearch.opster.io_opensearchactiongroups.yaml => opensearch.eliatra.io_opensearchactiongroups.yaml} (97%) rename opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml => charts/opensearch-operator/files/opensearch.eliatra.io_opensearchclusters.yaml (99%) rename opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml => charts/opensearch-operator/files/opensearch.eliatra.io_opensearchcomponenttemplates.yaml (98%) rename charts/opensearch-operator/files/{opensearch.opster.io_opensearchindextemplates.yaml => opensearch.eliatra.io_opensearchindextemplates.yaml} (98%) rename charts/opensearch-operator/files/{opensearch.opster.io_opensearchismpolicies.yaml => opensearch.eliatra.io_opensearchismpolicies.yaml} (99%) rename opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml => charts/opensearch-operator/files/opensearch.eliatra.io_opensearchroles.yaml (98%) rename charts/opensearch-operator/files/{opensearch.opster.io_opensearchtenants.yaml => opensearch.eliatra.io_opensearchtenants.yaml} (97%) rename opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml => charts/opensearch-operator/files/opensearch.eliatra.io_opensearchuserrolebindings.yaml (97%) rename charts/opensearch-operator/files/{opensearch.opster.io_opensearchusers.yaml => opensearch.eliatra.io_opensearchusers.yaml} (98%) rename opensearch-operator/config/crd/bases/{opensearch.opster.io_opensearchactiongroups.yaml => opensearch.eliatra.io_opensearchactiongroups.yaml} (97%) rename charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml => opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchclusters.yaml (99%) rename charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml => opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchcomponenttemplates.yaml (98%) rename opensearch-operator/config/crd/bases/{opensearch.opster.io_opensearchindextemplates.yaml => opensearch.eliatra.io_opensearchindextemplates.yaml} (98%) rename opensearch-operator/config/crd/bases/{opensearch.opster.io_opensearchismpolicies.yaml => opensearch.eliatra.io_opensearchismpolicies.yaml} (99%) rename charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml => opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchroles.yaml (98%) rename opensearch-operator/config/crd/bases/{opensearch.opster.io_opensearchtenants.yaml => opensearch.eliatra.io_opensearchtenants.yaml} (97%) rename charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml => opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchuserrolebindings.yaml (97%) rename opensearch-operator/config/crd/bases/{opensearch.opster.io_opensearchusers.yaml => opensearch.eliatra.io_opensearchusers.yaml} (98%) rename opensearch-operator/config/samples/{opster_v1_opensearchactiongroup.yaml => eliatra_v1_opensearchactiongroup.yaml} (88%) rename opensearch-operator/config/samples/{opster_v1_opensearchcluster.yaml => eliatra_v1_opensearchcluster.yaml} (72%) rename opensearch-operator/config/samples/{opster_v1_opensearchrole.yaml => eliatra_v1_opensearchrole.yaml} (68%) rename opensearch-operator/config/samples/{opster_v1_opensearchtenant.yaml => eliatra_v1_opensearchtenant.yaml} (81%) rename opensearch-operator/config/samples/{opster_v1_opensearchuser.yaml => eliatra_v1_opensearchuser.yaml} (68%) rename opensearch-operator/config/samples/{opster_v1_opensearchuserrolebinding.yaml => eliatra_v1_opensearchuserrolebinding.yaml} (72%) rename opensearch-operator/mocks/github.com/{Opster => Eliatra}/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go (99%) diff --git a/.github/workflows/busybox.yaml b/.github/workflows/busybox.yaml index ada1a3d..73bb54e 100644 --- a/.github/workflows/busybox.yaml +++ b/.github/workflows/busybox.yaml @@ -1,30 +1,29 @@ -# A special manual workflow to push a busybox image into our public ecr registry. This image is used for the init helper containers -name: Push busybox image to ecr +# A special manual workflow to push a busybox image into our public registry. This image is used for the init helper containers +name: Push busybox image to docker hub on: workflow_dispatch jobs: release: - name: Push busybox image to ecr + name: Push busybox image to docker hub runs-on: ubuntu-latest - environment: - name: k8s-operator steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Pull and Push 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/opsterio/busybox:1.27.2-buildx + export IMG=docker.io/eliatra/eoko-busybox:1.27.2-buildx 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 .. diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 72963f6..672251a 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -1,5 +1,6 @@ name: "Docker Build" on: + workflow_dispatch: pull_request: branches: - "main" diff --git a/.github/workflows/functional-tests.yaml b/.github/workflows/functional-tests.yaml index 4f6b17f..e6d7022 100644 --- a/.github/workflows/functional-tests.yaml +++ b/.github/workflows/functional-tests.yaml @@ -1,5 +1,6 @@ name: Functional tests -on: [pull_request] +on: [pull_request,workflow_dispatch] + jobs: operator: @@ -35,7 +36,7 @@ jobs: k3d image import -c $CLUSTER_NAME controller:latest ## Install helm chart - helm install opensearch-operator ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent --namespace default --wait + helm install eoko ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent --namespace default --wait cd functionaltests ## Run tests @@ -74,8 +75,8 @@ jobs: k3d image import -c $CLUSTER_NAME controller:latest ## Install helm chart - helm install opensearch-operator ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent --namespace default --wait - helm install opensearch-cluster ../charts/opensearch-cluster --set OpenSearchClusterSpec.enabled=true --wait + helm install eoko ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent --namespace default --wait + helm install eoko-cluster ../charts/opensearch-cluster --set OpenSearchClusterSpec.enabled=true --wait cd functionaltests ## Run tests diff --git a/.github/workflows/linting.yaml b/.github/workflows/linting.yaml index 3fbd720..928f345 100644 --- a/.github/workflows/linting.yaml +++ b/.github/workflows/linting.yaml @@ -1,5 +1,5 @@ name: Golang Lint -on: [pull_request] +on: [pull_request,workflow_dispatch] jobs: golangci: diff --git a/.github/workflows/prepare-release.yaml b/.github/workflows/prepare-release.yaml index f9d791d..155e948 100644 --- a/.github/workflows/prepare-release.yaml +++ b/.github/workflows/prepare-release.yaml @@ -3,7 +3,7 @@ on: workflow_dispatch: inputs: version: - description: 'Version for the release, semver, NO "v" prefix' + description: 'Version for the release, semver, NO "v" prefix, semver x.y.z' required: true type: string @@ -11,8 +11,6 @@ jobs: release: name: Prepare and publish release runs-on: ubuntu-latest - environment: - name: k8s-operator steps: - name: Checkout code uses: actions/checkout@v2 @@ -22,6 +20,11 @@ jobs: go-version: "1.19" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Run tests run: | # Run test suite to make sure we have a functional commit @@ -31,7 +34,7 @@ jobs: - name: Prepare helm chart run: | # Copy CRDs to chart to make sure they are identical - cp opensearch-operator/config/crd/bases/opensearch.opster.io_*.yaml charts/opensearch-operator/files/ + cp opensearch-operator/config/crd/bases/opensearch.eliatra.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 @@ -52,16 +55,12 @@ jobs: - 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 }} - AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_VERSION: ${{ inputs.version }} run: | cd opensearch-operator - export IMG=public.ecr.aws/opsterio/opensearch-operator:$RELEASE_VERSION + export IMG=docker.io/eliatra/eoko:$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 .. @@ -70,11 +69,29 @@ jobs: with: version: v3.8.1 - - name: Publish helm chart - uses: stefanprodan/helm-gh-pages@master + - name: Publish opensearch-cluster helm chart + uses: appany/helm-oci-chart-releaser@v0.4.1 + with: + name: eoko-cluster + path: charts/opensearch-cluster + repository: ${{ secrets.DOCKERHUB_USERNAME }} + tag: ${{ github.ref }} + registry: docker.io + registry_username: ${{ secrets.DOCKERHUB_USERNAME }} + registry_password: ${{ secrets.DOCKERHUB_TOKEN }} + update_dependencies: 'true' # Defaults to false + + - name: Publish opensearch-operator helm chart + uses: appany/helm-oci-chart-releaser@v0.4.1 with: - charts_dir: charts/ - token: ${{ secrets.GITHUB_TOKEN }} + name: eoko + path: charts/opensearch-operator + repository: ${{ secrets.DOCKERHUB_USERNAME }} + tag: ${{ github.ref }} + registry: docker.io + registry_username: ${{ secrets.DOCKERHUB_USERNAME }} + registry_password: ${{ secrets.DOCKERHUB_TOKEN }} + update_dependencies: 'true' # Defaults to false - name: Create Release id: create_release diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d94fc8d..948ee44 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,8 +6,6 @@ on: jobs: release: runs-on: ubuntu-latest - environment: - name: k8s-operator name: Release steps: - name: Checkout @@ -18,6 +16,11 @@ jobs: go-version: '1.19' - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: set Env id: github-ver run: | @@ -25,16 +28,12 @@ jobs: - 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 }} - AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd opensearch-operator make test - export IMG=public.ecr.aws/opsterio/opensearch-operator:$RELEASE_VERSION + export IMG=docker.io/eliatra/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 - name: Make sure helm chart has correct versions @@ -47,11 +46,29 @@ jobs: with: version: v3.8.1 - - name: Publish helm chart - uses: stefanprodan/helm-gh-pages@master + - name: Publish opensearch-cluster helm chart + uses: appany/helm-oci-chart-releaser@v0.4.1 + with: + name: eoko-cluster + path: charts/opensearch-cluster + repository: ${{ secrets.DOCKERHUB_USERNAME }} + tag: ${{ github.ref }} + registry: docker.io + registry_username: ${{ secrets.DOCKERHUB_USERNAME }} + registry_password: ${{ secrets.DOCKERHUB_TOKEN }} + update_dependencies: 'true' # Defaults to false + + - name: Publish opensearch-operator helm chart + uses: appany/helm-oci-chart-releaser@v0.4.1 with: - charts_dir: charts/ - token: ${{ secrets.GITHUB_TOKEN }} + name: eoko + path: charts/opensearch-operator + repository: ${{ secrets.DOCKERHUB_USERNAME }} + tag: ${{ github.ref }} + registry: docker.io + registry_username: ${{ secrets.DOCKERHUB_USERNAME }} + registry_password: ${{ secrets.DOCKERHUB_TOKEN }} + update_dependencies: 'true' # Defaults to false - name: Create Release id: create_release diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 4ecaab5..bd3466c 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -1,5 +1,5 @@ name: Testing -on: [pull_request] +on: [pull_request,workflow_dispatch] jobs: unit-tests: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b684cb0..80da44e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ The OpenSearch K8S Operator is a community project that is built and maintained ## First Things First -1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when in doubt, [open an issue](https://github.com/Opster/opensearch-k8s-operator/issues). +1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when in doubt, [open an issue](https://github.com/Eliatra/opensearch-k8s-operator/issues). 2. **Only submit your own work** (or work you have sufficient rights to submit) - Please make sure that any code or documentation you submit is your work or you have the rights to submit. We respect the intellectual property rights of others, and as part of contributing, we'll ask you to sign your contribution with a "Developer Certificate of Origin" (DCO) that states you have the rights to submit this work and you understand we'll use your contribution. There's more information about this topic in the [DCO section](#developer-certificate-of-origin). @@ -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/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. +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/Eliatra/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/MAINTAINERS.md b/MAINTAINERS.md index 7b9f4dd..786b6a0 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,5 +1,12 @@ # Maintainers + +| Maintainer | GitHub ID | Affiliation | +| --------------- | --------- | ----------- | + + +# Previous Maintainers (Opster) + | Maintainer | GitHub ID | Affiliation | | --------------- | --------- | ----------- | | Idan Levy | [idanl21](https://github.com/idanl21) | Opster | @@ -27,4 +34,4 @@ After the workflow has completed, navigate to releases and edit the new release. In case it is needed you can also manually tag a commit for release, this will trigger a workflow that stars with the "Build and push the docker image" step. Make sure CRDs are up-to-date in the helm chart. -After releasing a new version add it to the compatiblity matrix in the [README](README.md). +After releasing a new version add it to the compatibility matrix in the [README](README.md). diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 0000000..1267806 --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,6 @@ +Eliatra OpenSearch Kubernetes Operator (EOKO) (https://github.com/eliatra/opensearch-k8s-operator) +Copyright Eliatra Contributors + +This product includes software developed by +Opster (https://opster.com/). +Copyright 2019-2023 Opster Ltd. \ No newline at end of file diff --git a/README.md b/README.md index 354f258..2ef02b2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -![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) +# Eliatra OpenSearch Kubernetes Operator (EOKO) -# OpenSearch Kubernetes Operator +This is a fork of https://github.com/Opster/opensearch-k8s-operator. -The Kubernetes OpenSearch Operator is used for automating the deployment, provisioning, management, and orchestration of OpenSearch clusters and OpenSearch dashboards. +The Eliatra OpenSearch Kubernetes Operator is used for automating the deployment, provisioning, management, and orchestration of OpenSearch clusters and OpenSearch dashboards. -To get all the capabilities of the Operator with a UI, you can use the free [Opster Management Console](https://opster.com/opensearch-opster-management-console/). Beyond being able to easily carry out all of the actions provided by the Operator, it also include additional features like monitoring and more. +For more information and commercial support go to [https://eliatra.com/](https://eliatra.com/). ## Getting started @@ -40,31 +40,16 @@ Features: The Operator can be easily installed using Helm: -1. Add the helm repo: `helm repo add opensearch-operator https://opster.github.io/opensearch-k8s-operator/` +1. Add the helm repo: `helm repo add opensearch-operator https://eliatra.github.io/opensearch-k8s-operator/` 2. Install the Operator: `helm install opensearch-operator opensearch-operator/opensearch-operator` -## OpenSearch Kubernetes Operator installation & demo video - -[![Watch the video](https://opster.com/wp-content/uploads/2022/05/Operator-Installation-Tutorial.png)](https://player.vimeo.com/video/708641527) - -## Manage OpenSearch on K8s through a single interface (UI) - -To get all the capabilities of the Operator with a UI, you can use the free [Opster Management Console](https://opster.com/opensearch-opster-management-console/). Beyond being able to easily carry out all of the actions provided by the Operator, it also include additional features like monitoring and more. - -[![Watch the video](https://opster.com/wp-content/uploads/2023/04/Screen-cap-for-omc-video.png)](https://player.vimeo.com/video/767761262) - ## Compatibility The opensearch k8s operator aims to be compatible to all supported opensearch versions. Please check the table below for details: | Operator Version | Min Supported Opensearch Version | Max supported Opensearch version | Comment | |------------------|----------------------------------|----------------------------------|---------| -| 2.3 | 1.0 | 2.8 | | -| 2.2 | 1.0 | 2.5 | | -| 2.1 | 1.0 | 2.3 | | -| 2.0 | 1.0 | 2.3 | | -| 1.x | 1.0 | 1.x | | -| 0.x | 1.0 | 1.x | Beta | +| 2.5 | 1.0 | 2.8 | | This table only lists versions that have been explicitly tested with the operator, the operator will not prevent you from using other versions. Newer minor versions (2.x) not listed here generally also work but you should proceed with caution and test it our in a non-production environment first. @@ -75,3 +60,16 @@ If you want to develop the operator, please see the separate [developer docs](./ ## Contributions We welcome contributions! See how you can get involved by reading [CONTRIBUTING.md](./CONTRIBUTING.md). + +## License + +This project is licensed under the Apache v2.0 License. + +## Copyright + +Copyright Eliatra Contributors. See NOTICE for details. + +## Trademark + +This repo includes certain Apache-licensed Opster code from Opster Ltd. and other source code. +Opster Ltd. is not the source of that other source code. Opster is a registered trademark of Opster Ltd. \ No newline at end of file diff --git a/charts/opensearch-cluster/Chart.yaml b/charts/opensearch-cluster/Chart.yaml index 0e833e8..1b80add 100644 --- a/charts/opensearch-cluster/Chart.yaml +++ b/charts/opensearch-cluster/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: opensearch-cluster -description: A Helm chart for OpenSearch Cluster +name: eoko-cluster +description: A Helm chart for OpenSearch Cluster managed by EOKO type: application version: 2.4.0 appVersion: 2.4.0 diff --git a/charts/opensearch-cluster/templates/_helpers.tpl b/charts/opensearch-cluster/templates/_helpers.tpl index 4e42eea..db0760b 100644 --- a/charts/opensearch-cluster/templates/_helpers.tpl +++ b/charts/opensearch-cluster/templates/_helpers.tpl @@ -1,11 +1,3 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "opensearch-cluster.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -24,33 +16,6 @@ If release name contains chart name it will be used as a full name. {{- end -}} {{- end -}} -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "opensearch-cluster.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "opensearch-cluster.labels" -}} -helm.sh/chart: {{ include "opensearch-cluster.chart" . }} -{{ include "opensearch-cluster.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} - -{{/* -Selector labels -*/}} -{{- define "opensearch-cluster.selectorLabels" -}} -app.kubernetes.io/name: {{ include "opensearch-cluster.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end -}} - {{/* Create the name of the service account to use */}} diff --git a/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml b/charts/opensearch-cluster/templates/opensearch-cluster-cr.yaml index dee8303..60334ca 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.opster.io/v1 +apiVersion: opensearch.eliatra.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 deleted file mode 100644 index a8595e2..0000000 --- a/charts/opensearch-operator/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - ---- -## [Unreleased] -### Added -- Added support for custom image used by `kubeRbacProxy`. -### Changed -### Deprecated -### Removed -### Fixed -### Security - ---- -## [2.0.0] -### Added -### Changed -- Modified `version` to `2.0.0` and `appVersion` to `v2.0`. -- Allow chart image tag to pick from `appVersion`, unless explicitly passed `tag` values in `values.yaml` file. -### Deprecated -### Removed -### Fixed -### Security - ---- -## [1.0.3] -### Added -### Changed -- Added missing spec `dashboards.additionalConfig` -### Deprecated -### Removed -### Fixed -### Security - ---- -## [1.0.2] -### Added -### Changed -- Added README.md file to charts/ folder. -### Deprecated -### Removed -### Fixed -### Security - ---- -## [1.0.1] -### Added -### Changed -- Updated version to 1.0.1 -### Deprecated -### Removed -### Fixed -### Security - -[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/Chart.yaml b/charts/opensearch-operator/Chart.yaml index 645de06..cb63fda 100644 --- a/charts/opensearch-operator/Chart.yaml +++ b/charts/opensearch-operator/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 -name: opensearch-operator -description: The OpenSearch Operator Helm chart for Kubernetes +name: eoko +description: The Eliatra OpenSearch Kubernetes Operator Helm chart # A chart can be either an 'application' or a 'library' chart. # diff --git a/charts/opensearch-operator/README.md b/charts/opensearch-operator/README.md index f29734c..62cf3c3 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/Opster/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/Eliatra/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/Opster/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/Eliatra/opensearch-k8s-operator/blob/main/docs/userguide/main.md) for more information. ### Installation Using Helm #### Get Repo Info ``` -helm repo add opensearch-operator https://opster.github.io/opensearch-k8s-operator/ +helm repo add opensearch-operator https://eliatra.github.io/opensearch-k8s-operator/ helm repo update ``` #### Install Chart @@ -27,7 +27,4 @@ helm repo update helm upgrade [RELEASE_NAME] opensearch-operator/opensearch-operator ``` -## Installation Tutorial and Demo - -[![Watch the video](https://opster.com/wp-content/uploads/2022/05/Operator-Installation-Tutorial.png)](https://player.vimeo.com/video/708641527) diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchactiongroups.yaml similarity index 97% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchactiongroups.yaml index ad84d08..815feba 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchactiongroups.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchactiongroups.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchactiongroups.opensearch.opster.io + name: opensearchactiongroups.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchActionGroup listKind: OpensearchActionGroupList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchclusters.yaml similarity index 99% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchclusters.yaml index e961587..c126626 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchclusters.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchclusters.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchclusters.opensearch.opster.io + name: opensearchclusters.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpenSearchCluster listKind: OpenSearchClusterList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchcomponenttemplates.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchcomponenttemplates.yaml index ef48690..b658a6c 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchcomponenttemplates.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchcomponenttemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchcomponenttemplates.opensearch.opster.io + name: opensearchcomponenttemplates.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchComponentTemplate listKind: OpensearchComponentTemplateList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchindextemplates.yaml similarity index 98% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchindextemplates.yaml index 4cfc668..d61a07f 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchindextemplates.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchindextemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchindextemplates.opensearch.opster.io + name: opensearchindextemplates.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchIndexTemplate listKind: OpensearchIndexTemplateList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchismpolicies.yaml similarity index 99% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchismpolicies.yaml index 9375157..2d6c6ea 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchismpolicies.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchismpolicies.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchismpolicies.opensearch.opster.io + name: opensearchismpolicies.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpenSearchISMPolicy listKind: OpenSearchISMPolicyList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchroles.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchroles.yaml index e105afb..6fcb7fa 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchroles.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchroles.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchroles.opensearch.opster.io + name: opensearchroles.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchRole listKind: OpensearchRoleList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchtenants.yaml similarity index 97% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchtenants.yaml index f52e202..ba1c907 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchtenants.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchtenants.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchtenants.opensearch.opster.io + name: opensearchtenants.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchTenant listKind: OpensearchTenantList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchuserrolebindings.yaml similarity index 97% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchuserrolebindings.yaml index 50a80c0..0c25ec5 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchuserrolebindings.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchuserrolebindings.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchuserrolebindings.opensearch.opster.io + name: opensearchuserrolebindings.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchUserRoleBinding listKind: OpensearchUserRoleBindingList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchusers.yaml similarity index 98% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml rename to charts/opensearch-operator/files/opensearch.eliatra.io_opensearchusers.yaml index 1ea6f82..adb825a 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchusers.yaml +++ b/charts/opensearch-operator/files/opensearch.eliatra.io_opensearchusers.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchusers.opensearch.opster.io + name: opensearchusers.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchUser listKind: OpensearchUserList diff --git a/charts/opensearch-operator/templates/_helpers.tpl b/charts/opensearch-operator/templates/_helpers.tpl index 32f313e..e1f0f3e 100644 --- a/charts/opensearch-operator/templates/_helpers.tpl +++ b/charts/opensearch-operator/templates/_helpers.tpl @@ -1,10 +1,3 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "opensearch-operator.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -23,33 +16,6 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "opensearch-operator.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "opensearch-operator.labels" -}} -helm.sh/chart: {{ include "opensearch-operator.chart" . }} -{{ include "opensearch-operator.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "opensearch-operator.selectorLabels" -}} -app.kubernetes.io/name: {{ include "opensearch-operator.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - {{/* Create the name of the service account to use */}} 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 c2e9a13..20a5d29 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.opster.io + resourceName: a867c7dc.opensearch.eliatra.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 4e1bde3..d2f7c4d 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.opster.io + - opensearch.eliatra.io resources: - events verbs: - create - patch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchactiongroups verbs: @@ -141,13 +141,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchactiongroups/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchactiongroups/status verbs: @@ -155,7 +155,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchclusters verbs: @@ -167,13 +167,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchclusters/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchclusters/status verbs: @@ -181,7 +181,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchcomponenttemplates verbs: @@ -193,13 +193,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchcomponenttemplates/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchcomponenttemplates/status verbs: @@ -207,7 +207,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchindextemplates verbs: @@ -219,13 +219,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchindextemplates/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchindextemplates/status verbs: @@ -233,7 +233,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchroles verbs: @@ -245,13 +245,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchroles/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchroles/status verbs: @@ -259,7 +259,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchtenants verbs: @@ -271,13 +271,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchtenants/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchtenants/status verbs: @@ -285,7 +285,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchuserrolebindings verbs: @@ -297,13 +297,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchuserrolebindings/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchuserrolebindings/status verbs: @@ -311,7 +311,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - ismpolicies/status verbs: @@ -319,13 +319,13 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - ismpolicies/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchusers verbs: @@ -337,7 +337,7 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - ismpolicies verbs: @@ -349,13 +349,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchusers/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchusers/status verbs: diff --git a/charts/opensearch-operator/values.yaml b/charts/opensearch-operator/values.yaml index ea2872b..58199e1 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: docker.io/eliatra/eoko ## 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 1ed516c..24813fd 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.opster.io` and version `v1`. +Our CRD is Defined by kind: `OpenSearchCluster`,group: `opensearch.eliatra.io` and version `v1`. @@ -23,7 +23,7 @@ Our CRD is Defined by kind: `OpenSearchCluster`,group: `opensearch.opster.io` an - + @@ -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 404cf1d..62c2ff5 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.opster.io_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.eliatra.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 2d79f25..de8c818 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -92,7 +92,7 @@ Note that for some features the operator expects to be able to communicate direc * Run `make docker-build` to build the docker image * If needed import the image into your cluster (for k3d run `k3d image import controller:latest`) -* Deploy the operator with helm by running `helm install opensearch-operator ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent` +* Deploy the operator with helm by running `helm install eoko ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent` * Apply your `OpenSearchCluster` YAML To deploy a new version simply rebuild and reimport the docker image and restart the controller (for example by deleting the running pod). @@ -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.opster.io_*.yaml charts/opensearch-operator/files/ + cp opensearch-operator/config/crd/bases/opensearch.eliatra.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/cluster-chart.md b/docs/userguide/cluster-chart.md index f3980c9..d5f458d 100644 --- a/docs/userguide/cluster-chart.md +++ b/docs/userguide/cluster-chart.md @@ -1,9 +1,9 @@ # OpenSearch-k8s-operator -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. +The Kubernetes [OpenSearch Operator](https://github.com/Eliatra/opensearch-k8s-operator) is used for automating the deployment, provisioning, management, and orchestration of OpenSearch clusters and OpenSearch dashboards. ## Install OpenSearchCluster Using Helm -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. +The Operator can be easily installed using helm on any CNCF-certified Kubernetes cluster. Please refer to the [User Guide](https://github.com/Eliatra/opensearch-k8s-operator/blob/main/docs/userguide/main.md) for more information. Once the operator is installed, OpenSearch cluster can be installed using helm in the same CNCF-certified Kubernetes cluster. ### OpenSearchCluster Installation Using Helm diff --git a/docs/userguide/main.md b/docs/userguide/main.md index 99abd64..def1d8e 100644 --- a/docs/userguide/main.md +++ b/docs/userguide/main.md @@ -6,12 +6,8 @@ This guide is intended for users of the Opensearch Operator. If you want to cont The Operator can be easily installed using Helm: -1. Add the helm repo: `helm repo add opensearch-operator https://opster.github.io/opensearch-k8s-operator/` -2. Install the Operator: `helm install opensearch-operator opensearch-operator/opensearch-operator` - -Follow the instructions in this video to install the Operator: - -[![Watch the video](https://opster.com/wp-content/uploads/2022/05/Operator-Installation-Tutorial.png)](https://player.vimeo.com/video/708641527) +1. Add the helm repo: `helm repo add opensearch-operator https://eliatra.github.io/opensearch-k8s-operator/` +2. Install the Operator: `helm install eoko opensearch-operator/opensearch-operator` A few notes on operator releases: @@ -32,7 +28,7 @@ OpenSearch cluster can be easily deployed using Helm. Follow the instructions in Create a file `cluster.yaml` with the following content: ```yaml -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster metadata: name: my-first-cluster @@ -74,7 +70,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 opster.io/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 eliatra.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. @@ -366,7 +362,7 @@ This will configure an init container for each opensearch pod that executes the This feature is Currently in BETA, you can configure the snapshot repo settings for the OpenSearch cluster through the operator. Using `snapshotRepositories` settings you can configure multiple snapshot repos. Once the snapshot repo is configured a user can create custom `_ism` policies through dashboard to backup the in indexes. -Note: BETA flagged Features in a release are experimental. Therefore, we do not recommend the use of configuring snapshot repo in a production environment. For updates on the progress of snapshot/restore, or if you want leave feedback/contribute that could help improve the feature, please refer to the issue on [GitHub](https://github.com/Opster/opensearch-k8s-operator/issues/278). +Note: BETA flagged Features in a release are experimental. Therefore, we do not recommend the use of configuring snapshot repo in a production environment. For updates on the progress of snapshot/restore, or if you want leave feedback/contribute that could help improve the feature, please refer to the issue on [GitHub](https://github.com/Eliatra/opensearch-k8s-operator/issues/278). ```yaml spec: @@ -453,7 +449,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster #... spec: @@ -497,7 +493,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster ... spec: @@ -767,7 +763,7 @@ manager: ### Custom init helper -During cluster initialization the operator uses init containers as helpers. For these containers a busybox image is used ( specifically `public.ecr.aws/opsterio/busybox:1.27.2-buildx`). In case you are working in an offline environment and the cluster cannot access the registry or you want to customize the image, you can override the image used by specifying the `initHelper` image in your cluster spec: +During cluster initialization the operator uses init containers as helpers. For these containers a busybox image is used ( specifically `docker.io/eliatra/eoko-busybox:1.27.2-buildx`). In case you are working in an offline environment and the cluster cannot access the registry or you want to customize the image, you can override the image used by specifying the `initHelper` image in your cluster spec: ```yaml spec: @@ -819,7 +815,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster ... spec: @@ -882,7 +878,7 @@ Supported Service Types When using type LoadBalancer you can optionally set the load balancer source ranges. ```yaml -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster ... spec: @@ -961,7 +957,7 @@ Note that currently a combination of both approaches is not possible. Once you u ### Securityconfig -You can provide your own securityconfig (see the entire [demo securityconfig](https://github.com/Opster/opensearch-k8s-operator/blob/main/opensearch-operator/examples/securityconfig-secret.yaml) as an example and the [Access control documentation](https://opensearch.org/docs/latest/security-plugin/access-control/index/) of the OpenSearch project) with your own users and roles. To do that, you must provide a secret with all the required securityconfig yaml files. +You can provide your own securityconfig (see the entire [demo securityconfig](https://github.com/Eliatra/opensearch-k8s-operator/blob/main/opensearch-operator/examples/securityconfig-secret.yaml) as an example and the [Access control documentation](https://opensearch.org/docs/latest/security-plugin/access-control/index/) of the OpenSearch project) with your own users and roles. To do that, you must provide a secret with all the required securityconfig yaml files. The Operator can be controlled using the following fields in the `OpenSearchCluster` custom resource: @@ -1009,7 +1005,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchUser metadata: name: sample-user @@ -1033,7 +1029,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchRole metadata: name: sample-role @@ -1057,7 +1053,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchUserRoleBinding metadata: name: sample-urb @@ -1078,7 +1074,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchActionGroup metadata: name: sample-action-group @@ -1098,7 +1094,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchTenant metadata: name: sample-tenant @@ -1187,7 +1183,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster metadata: name: my-first-cluster @@ -1212,7 +1208,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchISMPolicy metadata: name: sample-policy @@ -1257,7 +1253,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchComponentTemplate metadata: name: sample-component-template @@ -1287,7 +1283,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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchIndexTemplate metadata: name: sample-index-template diff --git a/opensearch-operator/.mockery.yaml b/opensearch-operator/.mockery.yaml index 8ca471b..7ce5521 100644 --- a/opensearch-operator/.mockery.yaml +++ b/opensearch-operator/.mockery.yaml @@ -1,5 +1,5 @@ with-expecter: true packages: - github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s: + github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s: interfaces: K8sClient: diff --git a/opensearch-operator/PROJECT b/opensearch-operator/PROJECT index 96a9e2c..700a2fa 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.opster.io +domain: opensearch.eliatra.io layout: - go.kubebuilder.io/v3 projectName: opensearch-operator -repo: github.com/Opster/opensearch-k8s-operator/opensearch-operator +repo: github.com/Eliatra/opensearch-k8s-operator/opensearch-operator resources: - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.opster.io - group: opster + domain: opensearch.eliatra.io + group: eliatra kind: OpenSearchCluster - path: opensearch.opster.io/api/v1 + path: opensearch.eliatra.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.opster.io - group: opster + domain: opensearch.eliatra.io + group: eliatra kind: OpensearchUser - path: opensearch.opster.io/api/v1 + path: opensearch.eliatra.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.opster.io - group: opster + domain: opensearch.eliatra.io + group: eliatra kind: OpensearchRole - path: opensearch.opster.io/api/v1 + path: opensearch.eliatra.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.opster.io - group: opster + domain: opensearch.eliatra.io + group: eliatra kind: OpensearchUserRoleBinding - path: opensearch.opster.io/api/v1 + path: opensearch.eliatra.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.opster.io - group: opster + domain: opensearch.eliatra.io + group: eliatra kind: OpensearchIndexTemplate - path: opensearch.opster.io/api/v1 + path: opensearch.eliatra.io/api/v1 version: v1 - api: crdVersion: v1 namespaced: true controller: true - domain: opensearch.opster.io - group: opster + domain: opensearch.eliatra.io + group: eliatra kind: OpensearchComponentTemplate - path: opensearch.opster.io/api/v1 + path: opensearch.eliatra.io/api/v1 version: v1 -- domain: opensearch.opster.io - group: opensearch.opster.io +- domain: opensearch.eliatra.io + group: opensearch.eliatra.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 52e2caa..57871e0 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 opster v1 API group +// Package v1 contains API Schema definitions for the eliatra v1 API group // +kubebuilder:object:generate=true -// +groupName=opensearch.opster.io +// +groupName=opensearch.eliatra.io package v1 import ( @@ -26,7 +26,7 @@ import ( var ( // GroupVersion is group version used to register these objects - GroupVersion = schema.GroupVersion{Group: "opensearch.opster.io", Version: "v1"} + GroupVersion = schema.GroupVersion{Group: "opensearch.eliatra.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.opster.io_opensearchactiongroups.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchactiongroups.yaml similarity index 97% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchactiongroups.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchactiongroups.yaml index ad84d08..815feba 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchactiongroups.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchactiongroups.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchactiongroups.opensearch.opster.io + name: opensearchactiongroups.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchActionGroup listKind: OpensearchActionGroupList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchclusters.yaml similarity index 99% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchclusters.yaml index e961587..c126626 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchclusters.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchclusters.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchclusters.opensearch.opster.io + name: opensearchclusters.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpenSearchCluster listKind: OpenSearchClusterList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchcomponenttemplates.yaml similarity index 98% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchcomponenttemplates.yaml index ef48690..b658a6c 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchcomponenttemplates.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchcomponenttemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchcomponenttemplates.opensearch.opster.io + name: opensearchcomponenttemplates.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchComponentTemplate listKind: OpensearchComponentTemplateList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchindextemplates.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchindextemplates.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchindextemplates.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchindextemplates.yaml index 4cfc668..d61a07f 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchindextemplates.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchindextemplates.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchindextemplates.opensearch.opster.io + name: opensearchindextemplates.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchIndexTemplate listKind: OpensearchIndexTemplateList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchismpolicies.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchismpolicies.yaml similarity index 99% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchismpolicies.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchismpolicies.yaml index 9375157..2d6c6ea 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchismpolicies.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchismpolicies.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchismpolicies.opensearch.opster.io + name: opensearchismpolicies.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpenSearchISMPolicy listKind: OpenSearchISMPolicyList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchroles.yaml similarity index 98% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchroles.yaml index e105afb..6fcb7fa 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchroles.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchroles.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchroles.opensearch.opster.io + name: opensearchroles.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchRole listKind: OpensearchRoleList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchtenants.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchtenants.yaml similarity index 97% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchtenants.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchtenants.yaml index f52e202..ba1c907 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchtenants.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchtenants.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchtenants.opensearch.opster.io + name: opensearchtenants.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchTenant listKind: OpensearchTenantList diff --git a/charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchuserrolebindings.yaml similarity index 97% rename from charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchuserrolebindings.yaml index 50a80c0..0c25ec5 100644 --- a/charts/opensearch-operator/files/opensearch.opster.io_opensearchuserrolebindings.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchuserrolebindings.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchuserrolebindings.opensearch.opster.io + name: opensearchuserrolebindings.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchUserRoleBinding listKind: OpensearchUserRoleBindingList diff --git a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchusers.yaml b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchusers.yaml similarity index 98% rename from opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchusers.yaml rename to opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchusers.yaml index 1ea6f82..adb825a 100644 --- a/opensearch-operator/config/crd/bases/opensearch.opster.io_opensearchusers.yaml +++ b/opensearch-operator/config/crd/bases/opensearch.eliatra.io_opensearchusers.yaml @@ -5,9 +5,9 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.10.0 creationTimestamp: null - name: opensearchusers.opensearch.opster.io + name: opensearchusers.opensearch.eliatra.io spec: - group: opensearch.opster.io + group: opensearch.eliatra.io names: kind: OpensearchUser listKind: OpensearchUserList diff --git a/opensearch-operator/config/crd/kustomization.yaml b/opensearch-operator/config/crd/kustomization.yaml index cdb3327..e4c9869 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.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/opensearch.eliatra.io_opensearchactiongroups.yaml +- bases/opensearch.eliatra.io_opensearchclusters.yaml +- bases/opensearch.eliatra.io_opensearchcomponenttemplates.yaml +- bases/opensearch.eliatra.io_opensearchindextemplates.yaml +- bases/opensearch.eliatra.io_opensearchroles.yaml +- bases/opensearch.eliatra.io_opensearchtenants.yaml +- bases/opensearch.eliatra.io_opensearchuserrolebindings.yaml +- bases/opensearch.eliatra.io_opensearchusers.yaml +- bases/opensearch.eliatra.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 ea9fd31..bdf6bc2 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.opster.io + name: opensearchcluster.opensearch.eliatra.io diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearchroles.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearchroles.yaml index 524ad56..1de4aae 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.opster.opensearch.opster.io + name: opensearchroles.eliatra.opensearch.eliatra.io diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearchuserrolebindings.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearchuserrolebindings.yaml index 6972fcb..81affe4 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.opster.opensearch.opster.io + name: opensearchuserrolebindings.eliatra.opensearch.eliatra.io diff --git a/opensearch-operator/config/crd/patches/cainjection_in_opensearchusers.yaml b/opensearch-operator/config/crd/patches/cainjection_in_opensearchusers.yaml index 1afdfc2..3a53948 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.opster.opensearch.opster.io + name: opensearchusers.eliatra.opensearch.eliatra.io diff --git a/opensearch-operator/config/crd/patches/webhook_in_opensearch.yaml b/opensearch-operator/config/crd/patches/webhook_in_opensearch.yaml index 5e72850..9131358 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.opster.io + name: opensearchcluster.opensearch.eliatra.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 f42bfca..e613d6a 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.opster.opensearch.opster.io + name: opensearchroles.eliatra.opensearch.eliatra.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 18c20e0..ea0bbac 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.opster.opensearch.opster.io + name: opensearchuserrolebindings.eliatra.opensearch.eliatra.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 40485e4..6179fbd 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.opster.opensearch.opster.io + name: opensearchusers.eliatra.opensearch.eliatra.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 7dbb124..28887aa 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.opster.io + resourceName: a867c7dc.opensearch.eliatra.io diff --git a/opensearch-operator/config/rbac/opensearch_editor_role.yaml b/opensearch-operator/config/rbac/opensearch_editor_role.yaml index 147b3ba..34914b0 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.opster.io + - opensearch.eliatra.io resources: - opensearchcluster verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.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 9049a3c..daa2e94 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.opster.io + - opensearch.eliatra.io resources: - opensearchcluster verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.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 46bc8a0..e14baec 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: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchroles verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.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 516b141..7720abd 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: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchroles verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.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 61ebf90..7d3eb08 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: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchusers verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.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 663ec79..bba2f89 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: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchusers verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.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 f204d02..8602bcb 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: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchuserrolebindings verbs: @@ -17,7 +17,7 @@ rules: - update - watch - apiGroups: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.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 3bccd6b..25a60f3 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: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchuserrolebindings verbs: @@ -13,7 +13,7 @@ rules: - list - watch - apiGroups: - - opster.opensearch.opster.io + - eliatra.opensearch.eliatra.io resources: - opensearchuserrolebindings/status verbs: diff --git a/opensearch-operator/config/rbac/role.yaml b/opensearch-operator/config/rbac/role.yaml index f889c8f..0cfd6ae 100644 --- a/opensearch-operator/config/rbac/role.yaml +++ b/opensearch-operator/config/rbac/role.yaml @@ -110,14 +110,14 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - events verbs: - create - patch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - ismpolicies verbs: @@ -129,13 +129,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - ismpolicies/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - ismpolicies/status verbs: @@ -143,7 +143,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchactiongroups verbs: @@ -155,13 +155,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchactiongroups/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchactiongroups/status verbs: @@ -169,7 +169,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchclusters verbs: @@ -181,13 +181,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchclusters/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchclusters/status verbs: @@ -195,7 +195,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchcomponenttemplates verbs: @@ -207,13 +207,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchcomponenttemplates/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchcomponenttemplates/status verbs: @@ -221,7 +221,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchindextemplates verbs: @@ -233,13 +233,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchindextemplates/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchindextemplates/status verbs: @@ -247,7 +247,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchroles verbs: @@ -259,13 +259,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchroles/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchroles/status verbs: @@ -273,7 +273,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchtenants verbs: @@ -285,13 +285,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchtenants/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchtenants/status verbs: @@ -299,7 +299,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchuserrolebindings verbs: @@ -311,13 +311,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchuserrolebindings/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchuserrolebindings/status verbs: @@ -325,7 +325,7 @@ rules: - patch - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchusers verbs: @@ -337,13 +337,13 @@ rules: - update - watch - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchusers/finalizers verbs: - update - apiGroups: - - opensearch.opster.io + - opensearch.eliatra.io resources: - opensearchusers/status verbs: diff --git a/opensearch-operator/config/samples/opster_v1_opensearchactiongroup.yaml b/opensearch-operator/config/samples/eliatra_v1_opensearchactiongroup.yaml similarity index 88% rename from opensearch-operator/config/samples/opster_v1_opensearchactiongroup.yaml rename to opensearch-operator/config/samples/eliatra_v1_opensearchactiongroup.yaml index 509bead..d16a92d 100644 --- a/opensearch-operator/config/samples/opster_v1_opensearchactiongroup.yaml +++ b/opensearch-operator/config/samples/eliatra_v1_opensearchactiongroup.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchActionGroup metadata: name: sample-action-group diff --git a/opensearch-operator/config/samples/opster_v1_opensearchcluster.yaml b/opensearch-operator/config/samples/eliatra_v1_opensearchcluster.yaml similarity index 72% rename from opensearch-operator/config/samples/opster_v1_opensearchcluster.yaml rename to opensearch-operator/config/samples/eliatra_v1_opensearchcluster.yaml index c02ee1f..0efb3b5 100644 --- a/opensearch-operator/config/samples/opster_v1_opensearchcluster.yaml +++ b/opensearch-operator/config/samples/eliatra_v1_opensearchcluster.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster metadata: name: opensearch-sample diff --git a/opensearch-operator/config/samples/opster_v1_opensearchrole.yaml b/opensearch-operator/config/samples/eliatra_v1_opensearchrole.yaml similarity index 68% rename from opensearch-operator/config/samples/opster_v1_opensearchrole.yaml rename to opensearch-operator/config/samples/eliatra_v1_opensearchrole.yaml index d80af7e..63bc592 100644 --- a/opensearch-operator/config/samples/opster_v1_opensearchrole.yaml +++ b/opensearch-operator/config/samples/eliatra_v1_opensearchrole.yaml @@ -1,4 +1,4 @@ -apiVersion: opster.opensearch.opster.io/v1 +apiVersion: eliatra.opensearch.eliatra.io/v1 kind: OpensearchRole metadata: name: opensearchrole-sample diff --git a/opensearch-operator/config/samples/opster_v1_opensearchtenant.yaml b/opensearch-operator/config/samples/eliatra_v1_opensearchtenant.yaml similarity index 81% rename from opensearch-operator/config/samples/opster_v1_opensearchtenant.yaml rename to opensearch-operator/config/samples/eliatra_v1_opensearchtenant.yaml index a7375d0..984258e 100644 --- a/opensearch-operator/config/samples/opster_v1_opensearchtenant.yaml +++ b/opensearch-operator/config/samples/eliatra_v1_opensearchtenant.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpensearchTenant metadata: name: sample-tenant diff --git a/opensearch-operator/config/samples/opster_v1_opensearchuser.yaml b/opensearch-operator/config/samples/eliatra_v1_opensearchuser.yaml similarity index 68% rename from opensearch-operator/config/samples/opster_v1_opensearchuser.yaml rename to opensearch-operator/config/samples/eliatra_v1_opensearchuser.yaml index 323f7ec..70588ae 100644 --- a/opensearch-operator/config/samples/opster_v1_opensearchuser.yaml +++ b/opensearch-operator/config/samples/eliatra_v1_opensearchuser.yaml @@ -1,4 +1,4 @@ -apiVersion: opster.opensearch.opster.io/v1 +apiVersion: eliatra.opensearch.eliatra.io/v1 kind: OpensearchUser metadata: name: opensearchuser-sample diff --git a/opensearch-operator/config/samples/opster_v1_opensearchuserrolebinding.yaml b/opensearch-operator/config/samples/eliatra_v1_opensearchuserrolebinding.yaml similarity index 72% rename from opensearch-operator/config/samples/opster_v1_opensearchuserrolebinding.yaml rename to opensearch-operator/config/samples/eliatra_v1_opensearchuserrolebinding.yaml index 2d0e95f..9c7b615 100644 --- a/opensearch-operator/config/samples/opster_v1_opensearchuserrolebinding.yaml +++ b/opensearch-operator/config/samples/eliatra_v1_opensearchuserrolebinding.yaml @@ -1,4 +1,4 @@ -apiVersion: opster.opensearch.opster.io/v1 +apiVersion: eliatra.opensearch.eliatra.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 56a607a..4208480 100644 --- a/opensearch-operator/controllers/cluster_test.go +++ b/opensearch-operator/controllers/cluster_test.go @@ -8,8 +8,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/kralicky/kmatch" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -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 opsterv1.NodePool) { + go func(nodePool eliatrav1.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 opsterv1.NodePool) { + go func(nodePool eliatrav1.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 opsterv1.NodePool) { + go func(nodePool eliatrav1.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 := opsterv1.ComponentStatus{ + status := eliatrav1.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 := opsterv1.ComponentStatus{ + currentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: "nodes", } - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Status: "Upgraded", Description: "nodes", } - masterComponentStatus := opsterv1.ComponentStatus{ + masterComponentStatus := eliatrav1.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 opsterv1.NodePool) { + go func(nodePool eliatrav1.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 08fd4d5..7eabeea 100644 --- a/opensearch-operator/controllers/controller_settings.go +++ b/opensearch-operator/controllers/controller_settings.go @@ -1,5 +1,5 @@ package controllers const ( - OpensearchFinalizer = "opster.io/opensearch-data" + OpensearchFinalizer = "eliatra.io/opensearch-data" ) diff --git a/opensearch-operator/controllers/opensearchController.go b/opensearch-operator/controllers/opensearchController.go index 69f9b2c..3e46c95 100644 --- a/opensearch-operator/controllers/opensearchController.go +++ b/opensearch-operator/controllers/opensearchController.go @@ -20,9 +20,9 @@ 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/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/client-go/tools/record" @@ -37,7 +37,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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 *opsterv1.OpenSearchCluster + Instance *eliatrav1.OpenSearchCluster logr.Logger } -//+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="opensearch.eliatra.io",resources=events,verbs=create;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchclusters,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchclusters/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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 := "Opster" + myFinalizerName := "Eliatra" - r.Instance = &opsterv1.OpenSearchCluster{} + r.Instance = &eliatrav1.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 = opsterv1.PhasePending + r.Instance.Status.Phase = eliatrav1.PhasePending } switch r.Instance.Status.Phase { - case opsterv1.PhasePending: + case eliatrav1.PhasePending: return r.reconcilePhasePending(ctx) - case opsterv1.PhaseRunning: + case eliatrav1.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(&opsterv1.OpenSearchCluster{}). + For(&eliatrav1.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 = opsterv1.PhaseRunning - r.Instance.Status.ComponentsStatus = make([]opsterv1.ComponentStatus, 0) + r.Instance.Status.Phase = eliatrav1.PhaseRunning + r.Instance.Status.ComponentsStatus = make([]eliatrav1.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 a7ba703..cc07d2f 100644 --- a/opensearch-operator/controllers/opensearch_componenttemplate_controller.go +++ b/opensearch-operator/controllers/opensearch_componenttemplate_controller.go @@ -3,8 +3,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -19,13 +19,13 @@ type OpensearchComponentTemplateReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchComponentTemplate + Instance *eliatrav1.OpensearchComponentTemplate logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchcomponenttemplates,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchcomponenttemplates/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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. @@ -33,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 = &opsterv1.OpensearchComponentTemplate{} + r.Instance = &eliatrav1.OpensearchComponentTemplate{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -70,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(&opsterv1.OpensearchComponentTemplate{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpensearchComponentTemplate{}). + Owns(&eliatrav1.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 10a4916..8e55a82 100644 --- a/opensearch-operator/controllers/opensearch_indextemplate_controller.go +++ b/opensearch-operator/controllers/opensearch_indextemplate_controller.go @@ -3,8 +3,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -19,13 +19,13 @@ type OpensearchIndexTemplateReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchIndexTemplate + Instance *eliatrav1.OpensearchIndexTemplate logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchindextemplates,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchindextemplates/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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. @@ -33,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 = &opsterv1.OpensearchIndexTemplate{} + r.Instance = &eliatrav1.OpensearchIndexTemplate{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -70,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(&opsterv1.OpensearchIndexTemplate{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpensearchIndexTemplate{}). + Owns(&eliatrav1.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 3523f54..5fe6b91 100644 --- a/opensearch-operator/controllers/opensearchactiongroup_controller.go +++ b/opensearch-operator/controllers/opensearchactiongroup_controller.go @@ -3,9 +3,9 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -20,13 +20,13 @@ type OpensearchActionGroupReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchActionGroup + Instance *eliatrav1.OpensearchActionGroup logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchactiongroups,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchactiongroups/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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. @@ -34,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 = &opsterv1.OpensearchActionGroup{} + r.Instance = &eliatrav1.OpensearchActionGroup{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -71,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(&opsterv1.OpensearchActionGroup{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpensearchActionGroup{}). + Owns(&eliatrav1.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 3f77d57..51c2582 100644 --- a/opensearch-operator/controllers/opensearchism_controller.go +++ b/opensearch-operator/controllers/opensearchism_controller.go @@ -3,8 +3,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -19,20 +19,20 @@ type OpensearchISMPolicyReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpenSearchISMPolicy + Instance *eliatrav1.OpenSearchISMPolicy logr.Logger } -//+kubebuilder:rbac:groups=opensearch.opster.io,resources=ismpolicies,verbs=get;list;watch;create;update;patch;delete -//+kubebuilder:rbac:groups=opensearch.opster.io,resources=ismpolicies/status,verbs=get;update;patch -//+kubebuilder:rbac:groups=opensearch.opster.io,resources=ismpolicies/finalizers,verbs=update +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=ismpolicies,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=ismpolicies/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=ismpolicies/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 = &opsterv1.OpenSearchISMPolicy{} + r.Instance = &eliatrav1.OpenSearchISMPolicy{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -67,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(&opsterv1.OpenSearchISMPolicy{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpenSearchISMPolicy{}). + Owns(&eliatrav1.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 7a15fd1..a20202e 100644 --- a/opensearch-operator/controllers/opensearchrole_controller.go +++ b/opensearch-operator/controllers/opensearchrole_controller.go @@ -27,8 +27,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" ) // OpensearchRoleReconciler reconciles a OpensearchRole object @@ -36,13 +36,13 @@ type OpensearchRoleReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchRole + Instance *eliatrav1.OpensearchRole logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchroles,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchroles/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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. @@ -50,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 = &opsterv1.OpensearchRole{} + r.Instance = &eliatrav1.OpensearchRole{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -87,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(&opsterv1.OpensearchRole{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpensearchRole{}). + Owns(&eliatrav1.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 26bc3bb..75598a9 100644 --- a/opensearch-operator/controllers/opensearchtenant_controller.go +++ b/opensearch-operator/controllers/opensearchtenant_controller.go @@ -3,8 +3,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" @@ -19,13 +19,13 @@ type OpensearchTenantReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchTenant + Instance *eliatrav1.OpensearchTenant logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchtenants,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchtenants/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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 = &opsterv1.OpensearchTenant{} + r.Instance = &eliatrav1.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(&opsterv1.OpensearchTenant{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpensearchTenant{}). + Owns(&eliatrav1.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 7bef1a6..30a9154 100644 --- a/opensearch-operator/controllers/opensearchuser_controller.go +++ b/opensearch-operator/controllers/opensearchuser_controller.go @@ -31,9 +31,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/reconcile" - 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" ) // OpensearchUserReconciler reconciles a OpensearchUser object @@ -41,13 +41,13 @@ type OpensearchUserReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchUser + Instance *eliatrav1.OpensearchUser logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchusers,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchusers/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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. @@ -55,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 = &opsterv1.OpensearchUser{} + r.Instance = &eliatrav1.OpensearchUser{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -120,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(&opsterv1.OpensearchUser{}). + For(&eliatrav1.OpensearchUser{}). // Get notified when opensearch clusters change - Owns(&opsterv1.OpenSearchCluster{}). + Owns(&eliatrav1.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 92aabf1..e28e80f 100644 --- a/opensearch-operator/controllers/opensearchuserrolebinding_controller.go +++ b/opensearch-operator/controllers/opensearchuserrolebinding_controller.go @@ -27,8 +27,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/log" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers" ) // OpensearchUserRoleBindingReconciler reconciles a OpensearchUserRoleBinding object @@ -36,13 +36,13 @@ type OpensearchUserRoleBindingReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder - Instance *opsterv1.OpensearchUserRoleBinding + Instance *eliatrav1.OpensearchUserRoleBinding logr.Logger } -//+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 +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchuserrolebindings,verbs=get;list;watch;create;update;patch;delete +//+kubebuilder:rbac:groups=opensearch.eliatra.io,resources=opensearchuserrolebindings/status,verbs=get;update;patch +//+kubebuilder:rbac:groups=opensearch.eliatra.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. @@ -50,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 = &opsterv1.OpensearchUserRoleBinding{} + r.Instance = &eliatrav1.OpensearchUserRoleBinding{} err := r.Get(ctx, req.NamespacedName, r.Instance) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -87,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(&opsterv1.OpensearchUserRoleBinding{}). - Owns(&opsterv1.OpenSearchCluster{}). // Get notified when opensearch clusters change + For(&eliatrav1.OpensearchUserRoleBinding{}). + Owns(&eliatrav1.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 0ec843f..28c0bdf 100644 --- a/opensearch-operator/controllers/scaler_test.go +++ b/opensearch-operator/controllers/scaler_test.go @@ -4,7 +4,7 @@ import ( "context" "time" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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 = opsterv1.OpenSearchCluster{} + cluster2 = eliatrav1.OpenSearchCluster{} ) /// ------- Creation Check phase ------- diff --git a/opensearch-operator/controllers/suite_test.go b/opensearch-operator/controllers/suite_test.go index 175aefc..01f3045 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" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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 = opsterv1.AddToScheme(scheme.Scheme) + err = eliatrav1.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 5051378..2fea6b0 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" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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 *opsterv1.OpenSearchCluster) error { +func CreateNamespace(k8sClient client.Client, cluster *eliatrav1.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 *opsterv1.OpenSearchCluster) bool { +func HasOwnerReference(object client.Object, owner *eliatrav1.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) opsterv1.OpenSearchCluster { - OpensearchCluster := &opsterv1.OpenSearchCluster{ +func ComposeOpensearchCrd(clusterName string, namespace string) eliatrav1.OpenSearchCluster { + OpensearchCluster := &eliatrav1.OpenSearchCluster{ TypeMeta: metav1.TypeMeta{ Kind: "OpenSearchCluster", - APIVersion: "opensearch.opster.io/v1", + APIVersion: "opensearch.eliatra.io/v1", }, ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: namespace, }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ - Monitoring: opsterv1.MonitoringConfig{Enable: true, ScrapeInterval: "35s", TLSConfig: &opsterv1.MonitoringConfigTLS{InsecureSkipVerify: true, ServerName: "foo.bar"}}, + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ + Monitoring: eliatrav1.MonitoringConfig{Enable: true, ScrapeInterval: "35s", TLSConfig: &eliatrav1.MonitoringConfigTLS{InsecureSkipVerify: true, ServerName: "foo.bar"}}, HttpPort: 9200, Vendor: "opensearch", Version: "2.0.0", @@ -115,7 +115,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea AdditionalConfig: map[string]string{ "foo": "bar", }, - AdditionalVolumes: []opsterv1.AdditionalVolume{ + AdditionalVolumes: []eliatrav1.AdditionalVolume{ { Name: "test-secret", Path: "/opt/test-secret", @@ -142,12 +142,12 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea }, }, }, - ConfMgmt: opsterv1.ConfMgmt{ + ConfMgmt: eliatrav1.ConfMgmt{ AutoScaler: false, VerUpdate: false, SmartScaler: false, }, - Bootstrap: opsterv1.BootstrapConfig{ + Bootstrap: eliatrav1.BootstrapConfig{ Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("125m"), @@ -161,7 +161,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea Value: "bar", }}, }, - Dashboards: opsterv1.DashboardsConfig{ + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, Replicas: 3, Version: "2.0.0", @@ -182,9 +182,9 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea }, Affinity: &corev1.Affinity{}, }, - NodePools: []opsterv1.NodePool{{ + NodePools: []eliatrav1.NodePool{{ Component: "master", - Pdb: &opsterv1.PdbConfig{ + Pdb: &eliatrav1.PdbConfig{ Enable: true, MinAvailable: &intstr.IntOrString{ IntVal: 3, @@ -215,7 +215,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea "master", "data", }, - Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &eliatrav1.PersistenceConfig{PersistenceSource: eliatrav1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }, { Component: "nodes", Replicas: 3, @@ -229,7 +229,7 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea Roles: []string{ "data", }, - Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &eliatrav1.PersistenceConfig{PersistenceSource: eliatrav1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }, { Component: "client", Replicas: 3, @@ -254,11 +254,11 @@ func ComposeOpensearchCrd(clusterName string, namespace string) opsterv1.OpenSea {Name: "qux", Value: "qut"}, {Name: "quuxe", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{FieldPath: "metadata.labels['quux']"}}}, }, - Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &eliatrav1.PersistenceConfig{PersistenceSource: eliatrav1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, }}, }, - Status: opsterv1.ClusterStatus{ - ComponentsStatus: []opsterv1.ComponentStatus{ + Status: eliatrav1.ClusterStatus{ + ComponentsStatus: []eliatrav1.ComponentStatus{ { Component: "", Status: "", diff --git a/opensearch-operator/controllers/tls_test.go b/opensearch-operator/controllers/tls_test.go index 338e57c..6d63d34 100644 --- a/opensearch-operator/controllers/tls_test.go +++ b/opensearch-operator/controllers/tls_test.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" @@ -29,28 +29,28 @@ var _ = Describe("TLS Reconciler", func() { interval = time.Second * 1 ) Context("When Creating an OpenSearchCluster with TLS configured", func() { - spec := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: namespace}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: clusterName, Version: "2.0.0", }, - Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{ + Security: &eliatrav1.Security{Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{ Generate: true, PerNode: true, }, - Http: &opsterv1.TlsConfigHttp{ + Http: &eliatrav1.TlsConfigHttp{ Generate: true, }, }}, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.NodePool{ { Component: "masters", Replicas: 3, Roles: []string{"master", "data"}, - Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}}, + Persistence: &eliatrav1.PersistenceConfig{PersistenceSource: eliatrav1.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 de2279d..04db890 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.opster.io/v1 +apiVersion: opensearch.eliatra.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 fa2aa6f..6aa36bf 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.opster.io/v1 +apiVersion: opensearch.eliatra.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 988e5ed..853b2ac 100644 --- a/opensearch-operator/examples/opensearch-cluster-pdb.yaml +++ b/opensearch-operator/examples/opensearch-cluster-pdb.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.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 856f1cc..b8ab81f 100644 --- a/opensearch-operator/examples/opensearch-cluster-securityconfig.yaml +++ b/opensearch-operator/examples/opensearch-cluster-securityconfig.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.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 8aa9f22..745cbd7 100644 --- a/opensearch-operator/examples/opensearch-cluster.yaml +++ b/opensearch-operator/examples/opensearch-cluster.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.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 3d6d141..f87855c 100644 --- a/opensearch-operator/examples/opensearch-component-template.yaml +++ b/opensearch-operator/examples/opensearch-component-template.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.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 3e8f726..64f9ec2 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.opster.io/v1 +apiVersion: opensearch.eliatra.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 60ada70..2f3b4e4 100644 --- a/opensearch-operator/examples/opensearch-index-template.yaml +++ b/opensearch-operator/examples/opensearch-index-template.yaml @@ -1,4 +1,4 @@ -apiVersion: opensearch.opster.io/v1 +apiVersion: opensearch.eliatra.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 48613a1..6f5f64b 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.opster.io/v1 +apiVersion: opensearch.eliatra.io/v1 kind: OpenSearchCluster metadata: name: my-first-cluster diff --git a/opensearch-operator/functionaltests/execute_tests.sh b/opensearch-operator/functionaltests/execute_tests.sh index 3e9d9fd..ff260de 100755 --- a/opensearch-operator/functionaltests/execute_tests.sh +++ b/opensearch-operator/functionaltests/execute_tests.sh @@ -14,8 +14,8 @@ make docker-build k3d image import -c $CLUSTER_NAME controller:latest ## Install helm chart -helm install opensearch-operator ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent --namespace default --wait -helm install opensearch-cluster ../charts/opensearch-cluster --set OpenSearchClusterSpec.enabled=true --wait +helm install eoko ../charts/opensearch-operator --set manager.image.repository=controller --set manager.image.tag=latest --set manager.image.pullPolicy=IfNotPresent --namespace default --wait +helm install eoko-cluster ../charts/opensearch-cluster --set OpenSearchClusterSpec.enabled=true --wait cd functionaltests diff --git a/opensearch-operator/functionaltests/go.mod b/opensearch-operator/functionaltests/go.mod index 32cd132..daba049 100644 --- a/opensearch-operator/functionaltests/go.mod +++ b/opensearch-operator/functionaltests/go.mod @@ -1,4 +1,4 @@ -module github.com/Opster/opensearch-k8s-operator/functionaltests +module github.com/Eliatra/opensearch-k8s-operator/functionaltests go 1.19 diff --git a/opensearch-operator/functionaltests/helmtests/helmcrinstall_test.go b/opensearch-operator/functionaltests/helmtests/helmcrinstall_test.go index 6fafd04..4e9f3bf 100644 --- a/opensearch-operator/functionaltests/helmtests/helmcrinstall_test.go +++ b/opensearch-operator/functionaltests/helmtests/helmcrinstall_test.go @@ -12,7 +12,7 @@ import ( // The cluster has been created using Helm outside of this test. This test verifies the presence of the resources after the cluster is created. var _ = Describe("DeployWithHelm", Ordered, func() { - name := "opensearch-cluster" + name := "eoko-cluster" namespace := "default" When("cluster is created using helm", Ordered, func() { diff --git a/opensearch-operator/functionaltests/operatortests/deploy-and-upgrade.yaml b/opensearch-operator/functionaltests/operatortests/deploy-and-upgrade.yaml index 7d1c64c..a914360 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.opster.io/v1 +apiVersion: opensearch.eliatra.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 59eadd4..ba0364d 100644 --- a/opensearch-operator/functionaltests/operatortests/deploy_and_upgrade_test.go +++ b/opensearch-operator/functionaltests/operatortests/deploy_and_upgrade_test.go @@ -4,7 +4,7 @@ import ( "context" "time" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" appsv1 "k8s.io/api/apps/v1" @@ -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.opster.io", Version: "v1", Kind: "OpenSearchCluster"}) + cluster.SetGroupVersionKind(schema.GroupVersionKind{Group: "opensearch.eliatra.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 := &opsterv1.OpenSearchCluster{} + cluster := &eliatrav1.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 a594dfd..d97505a 100644 --- a/opensearch-operator/functionaltests/operatortests/main_test.go +++ b/opensearch-operator/functionaltests/operatortests/main_test.go @@ -3,7 +3,7 @@ package operatortests import ( "testing" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "k8s.io/apimachinery/pkg/runtime" @@ -22,7 +22,7 @@ func TestAPIs(t *testing.T) { } scheme := runtime.NewScheme() utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - utilruntime.Must(opsterv1.AddToScheme(scheme)) + utilruntime.Must(eliatrav1.AddToScheme(scheme)) k8sClient, err = client.New(config, client.Options{ Scheme: scheme, }) diff --git a/opensearch-operator/go.mod b/opensearch-operator/go.mod index 2bbccba..ba11851 100644 --- a/opensearch-operator/go.mod +++ b/opensearch-operator/go.mod @@ -1,4 +1,4 @@ -module github.com/Opster/opensearch-k8s-operator/opensearch-operator +module github.com/Eliatra/opensearch-k8s-operator/opensearch-operator go 1.19 diff --git a/opensearch-operator/main.go b/opensearch-operator/main.go index 3c898fb..41d751a 100644 --- a/opensearch-operator/main.go +++ b/opensearch-operator/main.go @@ -22,14 +22,14 @@ import ( "os" "strconv" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/controllers" + "github.com/Eliatra/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" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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(opsterv1.AddToScheme(scheme)) + utilruntime.Must(eliatrav1.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.opster.io", + LeaderElectionID: "a867c7dc.opensearch.eliatra.io", Namespace: watchNamespace, }) if err != nil { diff --git a/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go b/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go similarity index 99% rename from opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go rename to opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go index 1d51b8c..e645ca3 100644 --- a/opensearch-operator/mocks/github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go +++ b/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s/mock_K8sClient.go @@ -3,7 +3,7 @@ package k8s import ( - apiv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + apiv1 "github.com/Eliatra/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 753314c..99057e0 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/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" +import "github.com/Eliatra/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 1774494..7769d27 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/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" +import "github.com/Eliatra/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 2ee2597..63cf9f7 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/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" +import "github.com/Eliatra/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 aab7fa7..95b0071 100644 --- a/opensearch-operator/opensearch-gateway/services/os_client.go +++ b/opensearch-operator/opensearch-gateway/services/os_client.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" + "github.com/Eliatra/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" diff --git a/opensearch-operator/opensearch-gateway/services/os_data_service.go b/opensearch-operator/opensearch-gateway/services/os_data_service.go index 2291bef..85a1f8b 100644 --- a/opensearch-operator/opensearch-gateway/services/os_data_service.go +++ b/opensearch-operator/opensearch-gateway/services/os_data_service.go @@ -7,9 +7,9 @@ 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/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/go-logr/logr" "github.com/opensearch-project/opensearch-go/opensearchutil" "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 459e00b..d15b8b6 100644 --- a/opensearch-operator/opensearch-gateway/services/os_ism_service.go +++ b/opensearch-operator/opensearch-gateway/services/os_ism_service.go @@ -7,7 +7,7 @@ import ( "fmt" "reflect" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" "github.com/opensearch-project/opensearch-go/opensearchutil" "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 b740792..e7e2b0a 100644 --- a/opensearch-operator/opensearch-gateway/services/os_security_service.go +++ b/opensearch-operator/opensearch-gateway/services/os_security_service.go @@ -6,8 +6,8 @@ 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/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/opensearch-project/opensearch-go/opensearchutil" "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 7f59527..1f99525 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/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/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 8fc50ad..810e7ce 100644 --- a/opensearch-operator/pkg/builders/cluster.go +++ b/opensearch-operator/pkg/builders/cluster.go @@ -7,8 +7,8 @@ import ( monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/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 = "opster.io/config" + ConfigurationChecksumAnnotation = "eliatra.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 *opsterv1.OpenSearchCluster, - node opsterv1.NodePool, + cr *eliatrav1.OpenSearchCluster, + node eliatrav1.NodePool, configChecksum string, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, @@ -487,7 +487,7 @@ func NewSTSForNodePool( return sts } -func NewHeadlessServiceForNodePool(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) *corev1.Service { +func NewHeadlessServiceForNodePool(cr *eliatrav1.OpenSearchCluster, nodePool *eliatrav1.NodePool) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, helpers.NodePoolLabel: nodePool.Component, @@ -541,7 +541,7 @@ func NewHeadlessServiceForNodePool(cr *opsterv1.OpenSearchCluster, nodePool *ops } } -func NewServiceForCR(cr *opsterv1.OpenSearchCluster) *corev1.Service { +func NewServiceForCR(cr *eliatrav1.OpenSearchCluster) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } @@ -600,7 +600,7 @@ func NewServiceForCR(cr *opsterv1.OpenSearchCluster) *corev1.Service { } } -func NewDiscoveryServiceForCR(cr *opsterv1.OpenSearchCluster) *corev1.Service { +func NewDiscoveryServiceForCR(cr *eliatrav1.OpenSearchCluster) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } @@ -630,7 +630,7 @@ func NewDiscoveryServiceForCR(cr *opsterv1.OpenSearchCluster) *corev1.Service { } } -func NewNodePortService(cr *opsterv1.OpenSearchCluster) *corev1.Service { +func NewNodePortService(cr *eliatrav1.OpenSearchCluster) *corev1.Service { labels := map[string]string{ helpers.ClusterLabel: cr.Name, } @@ -663,7 +663,7 @@ func NewNodePortService(cr *opsterv1.OpenSearchCluster) *corev1.Service { } func NewBootstrapPod( - cr *opsterv1.OpenSearchCluster, + cr *eliatrav1.OpenSearchCluster, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, ) *corev1.Pod { @@ -837,7 +837,7 @@ func NewBootstrapPod( return pod } -func PortForCluster(cr *opsterv1.OpenSearchCluster) int32 { +func PortForCluster(cr *eliatrav1.OpenSearchCluster) int32 { httpPort := int32(9200) if cr.Spec.General.HttpPort > 0 { httpPort = cr.Spec.General.HttpPort @@ -845,12 +845,12 @@ func PortForCluster(cr *opsterv1.OpenSearchCluster) int32 { return httpPort } -func URLForCluster(cr *opsterv1.OpenSearchCluster) string { +func URLForCluster(cr *eliatrav1.OpenSearchCluster) string { httpPort := PortForCluster(cr) return fmt.Sprintf("https://%s.svc.%s:%d", DnsOfService(cr), helpers.ClusterDnsBase(), httpPort) } -func PasswordSecret(cr *opsterv1.OpenSearchCluster, username, password string) *corev1.Secret { +func PasswordSecret(cr *eliatrav1.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 *opsterv1.OpenSearchCluster, username, password string) * } } -func DnsOfService(cr *opsterv1.OpenSearchCluster) string { +func DnsOfService(cr *eliatrav1.OpenSearchCluster) string { return fmt.Sprintf("%s.%s", cr.Spec.General.ServiceName, cr.Namespace) } -func StsName(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) string { +func StsName(cr *eliatrav1.OpenSearchCluster, nodePool *eliatrav1.NodePool) string { return cr.Name + "-" + nodePool.Component } -func DiscoveryServiceName(cr *opsterv1.OpenSearchCluster) string { +func DiscoveryServiceName(cr *eliatrav1.OpenSearchCluster) string { return fmt.Sprintf("%s-discovery", cr.Name) } -func BootstrapPodName(cr *opsterv1.OpenSearchCluster) string { +func BootstrapPodName(cr *eliatrav1.OpenSearchCluster) string { return fmt.Sprintf("%s-bootstrap-0", cr.Name) } -func STSInNodePools(sts appsv1.StatefulSet, nodepools []opsterv1.NodePool) bool { +func STSInNodePools(sts appsv1.StatefulSet, nodepools []eliatrav1.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 []opsterv1.NodePool) bool } func NewSnapshotRepoconfigUpdateJob( - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.OpenSearchCluster, jobName string, namespace string, checksum string, @@ -913,7 +913,7 @@ func NewSnapshotRepoconfigUpdateJob( terminationGracePeriodSeconds := int64(5) backoffLimit := int32(0) - node := opsterv1.NodePool{ + node := eliatrav1.NodePool{ Component: "snapshotconfig", } annotations := map[string]string{ @@ -963,7 +963,7 @@ func NewSnapshotRepoconfigUpdateJob( } func NewSecurityconfigUpdateJob( - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 := opsterv1.NodePool{ + node := eliatrav1.NodePool{ Component: "securityconfig", } @@ -1024,7 +1024,7 @@ func NewSecurityconfigUpdateJob( } } -func AllMastersReady(ctx context.Context, k8sClient client.Client, cr *opsterv1.OpenSearchCluster) bool { +func AllMastersReady(ctx context.Context, k8sClient client.Client, cr *eliatrav1.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 *opsterv1. return true } -func NewServiceMonitor(cr *opsterv1.OpenSearchCluster) *monitoring.ServiceMonitor { +func NewServiceMonitor(cr *eliatrav1.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 b5936fb..56b8e9e 100644 --- a/opensearch-operator/pkg/builders/cluster_test.go +++ b/opensearch-operator/pkg/builders/cluster_test.go @@ -5,8 +5,8 @@ import ( "fmt" "os" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -15,21 +15,21 @@ import ( "k8s.io/utils/pointer" ) -func ClusterDescWithVersion(version string) opsterv1.OpenSearchCluster { - return opsterv1.OpenSearchCluster{ - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ +func ClusterDescWithVersion(version string) eliatrav1.OpenSearchCluster { + return eliatrav1.OpenSearchCluster{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ Version: version, }, }, } } -func ClusterDescWithKeystoreSecret(secretName string, keyMappings map[string]string) opsterv1.OpenSearchCluster { - return opsterv1.OpenSearchCluster{ - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ - Keystore: []opsterv1.KeystoreValue{ +func ClusterDescWithKeystoreSecret(secretName string, keyMappings map[string]string) eliatrav1.OpenSearchCluster { + return eliatrav1.OpenSearchCluster{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ + Keystore: []eliatrav1.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) opsterv1.OpenSearchCluster { - return opsterv1.OpenSearchCluster{ - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ +func ClusterDescWithAdditionalConfigs(addtitionalConfig map[string]string, bootstrapAdditionalConfig map[string]string) eliatrav1.OpenSearchCluster { + return eliatrav1.OpenSearchCluster{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ AdditionalConfig: addtitionalConfig, }, - Bootstrap: opsterv1.BootstrapConfig{ + Bootstrap: eliatrav1.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, opsterv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, eliatrav1.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, opsterv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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, opsterv1.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, eliatrav1.NodePool{}, "foobar", nil, nil, nil) + Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/eoko-busybox:1.27.2-buildx")) }) 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 = opsterv1.InitHelperConfig{ - ImageSpec: &opsterv1.ImageSpec{ + clusterObject.Spec.InitHelper = eliatrav1.InitHelperConfig{ + ImageSpec: &eliatrav1.ImageSpec{ Image: &customImage, }, } - result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, eliatrav1.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, opsterv1.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, eliatrav1.NodePool{}, "foobar", nil, nil, nil) + Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("docker.io/eliatra/eoko-busybox:1.27.2-buildx")) }) 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, opsterv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, } clusterObject.Spec.NodePools = append(clusterObject.Spec.NodePools, nodePool) - result := NewSTSForNodePool("foobar", &clusterObject, opsterv1.NodePool{}, "foobar", nil, nil, nil) + result := NewSTSForNodePool("foobar", &clusterObject, eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, - Persistence: &opsterv1.PersistenceConfig{PersistenceSource: opsterv1.PersistenceSource{ - PVC: &opsterv1.PVCSource{ + Persistence: &eliatrav1.PersistenceConfig{PersistenceSource: eliatrav1.PersistenceSource{ + PVC: &eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{} + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.SnapshotRepoConfig{ + snapshotConfig := eliatrav1.SnapshotRepoConfig{ Name: "os-snap", Type: "s3", Settings: snapshotRepoSettings, } - clusterObject.Spec.General.SnapshotRepositories = []opsterv1.SnapshotRepoConfig{snapshotConfig} + clusterObject.Spec.General.SnapshotRepositories = []eliatrav1.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/eoko-busybox:1.27.2-buildx")) }) 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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.NodePool{ Component: "masters", Roles: []string{"cluster_manager", "foobar", "ingest"}, } @@ -517,7 +517,7 @@ var _ = Describe("Builders", func() { oldKey: newKey, } clusterObject := ClusterDescWithKeystoreSecret(mockSecretName, keyMappings) - nodePool := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.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 := opsterv1.NodePool{ + nodePool := eliatrav1.NodePool{ Replicas: 3, Component: "masters", Roles: []string{"cluster_manager", "data"}, @@ -669,10 +669,10 @@ var _ = Describe("Builders", func() { "testAnnotationKey": "testValue", }, } - spec := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.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 94f2efd..2a41499 100644 --- a/opensearch-operator/pkg/builders/dashboards.go +++ b/opensearch-operator/pkg/builders/dashboards.go @@ -5,8 +5,8 @@ import ( "sort" "strings" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/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 *opsterv1.OpenSearchCluster, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, annotations map[string]string) *appsv1.Deployment { +func NewDashboardsDeploymentForCR(cr *eliatrav1.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 *opsterv1.OpenSearchCluster, volumes []core } } -func NewDashboardsConfigMapForCR(cr *opsterv1.OpenSearchCluster, name string, config map[string]string) *corev1.ConfigMap { +func NewDashboardsConfigMapForCR(cr *eliatrav1.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 *opsterv1.OpenSearchCluster, name string, co } } -func NewDashboardsSvcForCr(cr *opsterv1.OpenSearchCluster) *corev1.Service { +func NewDashboardsSvcForCr(cr *eliatrav1.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 d7ce5dd..f008033 100644 --- a/opensearch-operator/pkg/builders/dashboards_test.go +++ b/opensearch-operator/pkg/builders/dashboards_test.go @@ -5,7 +5,7 @@ import ( "k8s.io/utils/pointer" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, Annotations: map[string]string{ "testAnnotationKey": "testValue", "testAnnotationKey2": "testValue2", }, - Service: opsterv1.DashboardsServiceSpec{ + Service: eliatrav1.DashboardsServiceSpec{ Type: "LoadBalancer", LoadBalancerSourceRanges: sourceRanges, }, @@ -97,11 +97,11 @@ var _ = Describe("Builders", func() { pluginA := "some-plugin" pluginB := "another-plugin" - spec := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: "some-name", Namespace: "some-namespace", UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: "some-name"}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: "some-name"}, + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, PluginsList: []string{pluginA, pluginB}, }, @@ -137,11 +137,11 @@ var _ = Describe("Builders", func() { Privileged: pointer.Bool(false), AllowPrivilegeEscalation: pointer.Bool(false), } - spec := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: "some-name", Namespace: "some-namespace", UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: "some-name"}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: "some-name"}, + Dashboards: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: "some-name", Namespace: "some-namespace", UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "some-name", ServiceAccount: serviceAccountName, }, - Dashboards: opsterv1.DashboardsConfig{ + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, }, }, diff --git a/opensearch-operator/pkg/builders/suite_test.go b/opensearch-operator/pkg/builders/suite_test.go index 4cf0c95..f73018e 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" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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 = opsterv1.AddToScheme(scheme.Scheme) + err = eliatrav1.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 6719656..4129174 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 = "opster.io/opensearch-cluster" - NodePoolLabel = "opster.io/opensearch-nodepool" + ClusterLabel = "eliatra.io/opensearch-cluster" + NodePoolLabel = "eliatra.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 0a8b574..ac3ab92 100644 --- a/opensearch-operator/pkg/helpers/helpers.go +++ b/opensearch-operator/pkg/helpers/helpers.go @@ -9,8 +9,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" version "github.com/hashicorp/go-version" "github.com/samber/lo" appsv1 "k8s.io/api/apps/v1" @@ -44,7 +44,7 @@ func GetField(v *appsv1.StatefulSetSpec, field string) interface{} { return f } -func RemoveIt(ss opsterv1.ComponentStatus, ssSlice []opsterv1.ComponentStatus) []opsterv1.ComponentStatus { +func RemoveIt(ss eliatrav1.ComponentStatus, ssSlice []eliatrav1.ComponentStatus) []eliatrav1.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 opsterv1.ComponentStatus, ssSlice []opsterv1.ComponentStatus) [ return ssSlice } -func Replace(remove opsterv1.ComponentStatus, add opsterv1.ComponentStatus, ssSlice []opsterv1.ComponentStatus) []opsterv1.ComponentStatus { +func Replace(remove eliatrav1.ComponentStatus, add eliatrav1.ComponentStatus, ssSlice []eliatrav1.ComponentStatus) []eliatrav1.ComponentStatus { removedSlice := RemoveIt(remove, ssSlice) fullSliced := append(removedSlice, add) return fullSliced } -func ComponentStatusEqual(left opsterv1.ComponentStatus, right opsterv1.ComponentStatus) bool { +func ComponentStatusEqual(left eliatrav1.ComponentStatus, right eliatrav1.ComponentStatus) bool { return left.Component == right.Component && left.Description == right.Description && left.Status == right.Status } func FindFirstPartial( - arr []opsterv1.ComponentStatus, - item opsterv1.ComponentStatus, - predicator func(opsterv1.ComponentStatus, opsterv1.ComponentStatus) (opsterv1.ComponentStatus, bool), -) (opsterv1.ComponentStatus, bool) { + arr []eliatrav1.ComponentStatus, + item eliatrav1.ComponentStatus, + predicator func(eliatrav1.ComponentStatus, eliatrav1.ComponentStatus) (eliatrav1.ComponentStatus, bool), +) (eliatrav1.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 *opsterv1.OpenSearchCluster) (string, string, error) { +func UsernameAndPassword(k8sClient k8s.K8sClient, cr *eliatrav1.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 *opsterv1.OpenSearchCluster } } -func GetByDescriptionAndGroup(left opsterv1.ComponentStatus, right opsterv1.ComponentStatus) (opsterv1.ComponentStatus, bool) { +func GetByDescriptionAndGroup(left eliatrav1.ComponentStatus, right eliatrav1.ComponentStatus) (eliatrav1.ComponentStatus, bool) { if left.Description == right.Description && left.Component == right.Component { return left, true } return right, false } -func GetByComponent(left opsterv1.ComponentStatus, right opsterv1.ComponentStatus) (opsterv1.ComponentStatus, bool) { +func GetByComponent(left eliatrav1.ComponentStatus, right eliatrav1.ComponentStatus) (eliatrav1.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 *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) (int, error) { +func CountRunningPodsForNodePool(k8sClient k8s.K8sClient, cr *eliatrav1.OpenSearchCluster, nodePool *eliatrav1.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 *opsterv1.OpenSearc } // Count the number of PVCs created for the given NodePool -func CountPVCsForNodePool(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) (int, error) { +func CountPVCsForNodePool(k8sClient k8s.K8sClient, cr *eliatrav1.OpenSearchCluster, nodePool *eliatrav1.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 opsterv1.NodePool, clusterName, clusterNamespace string) (*appsv1.StatefulSet, error) { +func GetSTSForNodePool(k8sClient k8s.K8sClient, nodePool eliatrav1.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 opsterv1.NodePool, clusterName, clusterNamespace string) error { +func DeleteSTSForNodePool(k8sClient k8s.K8sClient, nodePool eliatrav1.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 *opsterv1.NodePool) bool { +func HasDataRole(nodePool *eliatrav1.NodePool) bool { return ContainsString(nodePool.Roles, "data") } -func HasManagerRole(nodePool *opsterv1.NodePool) bool { +func HasManagerRole(nodePool *eliatrav1.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 *opsterv1.OpenSearchCluster, nodepool *opsterv1.NodePool) policyv1.PodDisruptionBudget { +func ComposePDB(cr *eliatrav1.OpenSearchCluster, nodepool *eliatrav1.NodePool) policyv1.PodDisruptionBudget { matchLabels := map[string]string{ ClusterLabel: cr.Name, NodePoolLabel: nodepool.Component, @@ -391,7 +391,7 @@ func ComposePDB(cr *opsterv1.OpenSearchCluster, nodepool *opsterv1.NodePool) pol return newpdb } -func CalculateJvmHeapSize(nodePool *opsterv1.NodePool) string { +func CalculateJvmHeapSize(nodePool *eliatrav1.NodePool) string { jvmHeapSizeTemplate := "-Xmx%s -Xms%s" if nodePool.Jvm == "" { @@ -412,8 +412,8 @@ func CalculateJvmHeapSize(nodePool *opsterv1.NodePool) string { return nodePool.Jvm } -func UpgradeInProgress(status opsterv1.ClusterStatus) bool { - componentStatus := opsterv1.ComponentStatus{ +func UpgradeInProgress(status eliatrav1.ClusterStatus) bool { + componentStatus := eliatrav1.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 5ccaa01..d0010a8 100644 --- a/opensearch-operator/pkg/helpers/reconcile-helpers.go +++ b/opensearch-operator/pkg/helpers/reconcile-helpers.go @@ -5,14 +5,14 @@ import ( "path" "strings" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" "github.com/hashicorp/go-version" "k8s.io/utils/pointer" ) -func ResolveInitHelperImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.ImageSpec) { - defaultRepo := "public.ecr.aws/opsterio" - defaultImage := "busybox" +func ResolveInitHelperImage(cr *eliatrav1.OpenSearchCluster) (result eliatrav1.ImageSpec) { + defaultRepo := "docker.io/eliatra" + defaultImage := "eoko-busybox" defaultVersion := "1.27.2-buildx" // If a custom InitHelper image is specified, use it. @@ -36,7 +36,7 @@ func ResolveInitHelperImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.Ima return } -func ResolveImage(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) (result opsterv1.ImageSpec) { +func ResolveImage(cr *eliatrav1.OpenSearchCluster, nodePool *eliatrav1.NodePool) (result eliatrav1.ImageSpec) { defaultRepo := "docker.io/opensearchproject" defaultImage := "opensearch" @@ -61,7 +61,7 @@ func ResolveImage(cr *opsterv1.OpenSearchCluster, nodePool *opsterv1.NodePool) ( return } -func ResolveDashboardsImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.ImageSpec) { +func ResolveDashboardsImage(cr *eliatrav1.OpenSearchCluster) (result eliatrav1.ImageSpec) { defaultRepo := "docker.io/opensearchproject" defaultImage := "opensearch-dashboards" @@ -83,7 +83,7 @@ func ResolveDashboardsImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.Ima return } -func useCustomImage(customImageSpec *opsterv1.ImageSpec, result *opsterv1.ImageSpec) bool { +func useCustomImage(customImageSpec *eliatrav1.ImageSpec, result *eliatrav1.ImageSpec) bool { if customImageSpec != nil { if customImageSpec.ImagePullPolicy != nil { result.ImagePullPolicy = customImageSpec.ImagePullPolicy @@ -101,7 +101,7 @@ func useCustomImage(customImageSpec *opsterv1.ImageSpec, result *opsterv1.ImageS } // Function to help identify httpPort, securityConfigPort and securityConfigPath for 1.x and 2.x OpenSearch Operator. -func VersionCheck(instance *opsterv1.OpenSearchCluster) (int32, int32, string) { +func VersionCheck(instance *eliatrav1.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 80fd9ab..6f3c8f8 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) var _ = DescribeTable("versionCheck reconciler", func(version string, specifiedHttpPort int32, expectedHttpPort int32, expectedSecurityConfigPort int32, expectedSecurityConfigPath string) { - instance := &opsterv1.OpenSearchCluster{ - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + instance := &eliatrav1.OpenSearchCluster{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ Version: version, HttpPort: specifiedHttpPort, }, diff --git a/opensearch-operator/pkg/helpers/test-helpers.go b/opensearch-operator/pkg/helpers/test-helpers.go index 8bc3af2..1b04cbc 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/Opster/opensearch-k8s-operator/opensearch-operator/pkg/tls" + "github.com/Eliatra/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 b9617b4..d77e8ea 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/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + v1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/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 b174af8..4dc43b8 100644 --- a/opensearch-operator/pkg/reconcilers/actiongroup.go +++ b/opensearch-operator/pkg/reconcilers/actiongroup.go @@ -5,11 +5,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -30,8 +30,8 @@ type ActionGroupReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchActionGroup - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchActionGroup + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -39,7 +39,7 @@ func NewActionGroupReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opsterv1.OpensearchActionGroup, + instance *eliatrav1.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.(*opsterv1.OpensearchActionGroup) + instance := object.(*eliatrav1.OpensearchActionGroup) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opsterv1.OpensearchActionGroupError + instance.Status.State = eliatrav1.OpensearchActionGroupError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchActionGroupPending + instance.Status.State = eliatrav1.OpensearchActionGroupPending } if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opsterv1.OpensearchActionGroupCreated + instance.Status.State = eliatrav1.OpensearchActionGroupCreated } if reason == opensearchActionGroupExists { - instance.Status.State = opsterv1.OpensearchActionGroupIgnored + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchActionGroup) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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.(*opsterv1.OpensearchActionGroup) + instance := object.(*eliatrav1.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 755f2b7..51b1194 100644 --- a/opensearch-operator/pkg/reconcilers/actiongroup_test.go +++ b/opensearch-operator/pkg/reconcilers/actiongroup_test.go @@ -5,10 +5,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,11 +25,11 @@ var _ = Describe("actiongroup reconciler", func() { var ( transport *httpmock.MockTransport reconciler *ActionGroupReconciler - instance *opsterv1.OpensearchActionGroup + instance *eliatrav1.OpensearchActionGroup recorder *record.FakeRecorder // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.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 = &opsterv1.OpensearchActionGroup{ + instance = &eliatrav1.OpensearchActionGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "test-actiongroup", Namespace: "test-actiongroup", UID: "testuid", }, - Spec: opsterv1.OpensearchActionGroupSpec{ + Spec: eliatrav1.OpensearchActionGroupSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -55,17 +55,17 @@ var _ = Describe("actiongroup reconciler", func() { }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-actiongroup", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 cfc7cf8..2318396 100644 --- a/opensearch-operator/pkg/reconcilers/cluster.go +++ b/opensearch-operator/pkg/reconcilers/cluster.go @@ -6,13 +6,13 @@ import ( "fmt" "strings" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/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" @@ -35,7 +35,7 @@ type ClusterReconciler struct { ctx context.Context recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -44,7 +44,7 @@ func NewClusterReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 *opsterv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 opsterv1.NodePool, username string) (*ctrl.Result, error) { +func (r *ClusterReconciler) reconcileNodeStatefulSet(nodePool eliatrav1.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 := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.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 *opsterv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 *opsterv1.NodePool) (*ctrl.Result, error) { +func (r *ClusterReconciler) handlePDB(nodePool *eliatrav1.NodePool) (*ctrl.Result, error) { pdb := policyv1.PodDisruptionBudget{} if nodePool.Pdb != nil && nodePool.Pdb.Enable { @@ -462,7 +462,7 @@ func (r *ClusterReconciler) handlePDB(nodePool *opsterv1.NodePool) (*ctrl.Result } } -func (r *ClusterReconciler) maybeUpdateVolumes(existing *appsv1.StatefulSet, nodePool opsterv1.NodePool) error { +func (r *ClusterReconciler) maybeUpdateVolumes(existing *appsv1.StatefulSet, nodePool eliatrav1.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 *opsterv1.OpenSearchCluster) { + return r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 f005378..24c4d19 100644 --- a/opensearch-operator/pkg/reconcilers/componenttemplate.go +++ b/opensearch-operator/pkg/reconcilers/componenttemplate.go @@ -5,11 +5,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -31,8 +31,8 @@ type ComponentTemplateReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchComponentTemplate - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchComponentTemplate + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -40,7 +40,7 @@ func NewComponentTemplateReconciler( ctx context.Context, client client.Client, recorder record.EventRecorder, - instance *opsterv1.OpensearchComponentTemplate, + instance *eliatrav1.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.(*opsterv1.OpensearchComponentTemplate) + instance := object.(*eliatrav1.OpensearchComponentTemplate) instance.Status.Reason = reason if err != nil { - instance.Status.State = opsterv1.OpensearchComponentTemplateError + instance.Status.State = eliatrav1.OpensearchComponentTemplateError } if result.Requeue && result.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchComponentTemplatePending + instance.Status.State = eliatrav1.OpensearchComponentTemplatePending } if err == nil && result.RequeueAfter == 30*time.Second { - instance.Status.State = opsterv1.OpensearchComponentTemplateCreated + instance.Status.State = eliatrav1.OpensearchComponentTemplateCreated } if reason == opensearchComponentTemplateExists { - instance.Status.State = opsterv1.OpensearchComponentTemplateIgnored + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchComponentTemplate) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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.(*opsterv1.OpensearchComponentTemplate) + instance := object.(*eliatrav1.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 8d1da2a..ee89c7d 100644 --- a/opensearch-operator/pkg/reconcilers/componenttemplate_test.go +++ b/opensearch-operator/pkg/reconcilers/componenttemplate_test.go @@ -5,10 +5,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,12 +26,12 @@ var _ = Describe("componenttemplate reconciler", func() { var ( transport *httpmock.MockTransport reconciler *ComponentTemplateReconciler - instance *opsterv1.OpensearchComponentTemplate + instance *eliatrav1.OpensearchComponentTemplate recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.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 = &opsterv1.OpensearchComponentTemplate{ + instance = &eliatrav1.OpensearchComponentTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-componenttemplate", Namespace: "test-componenttemplate", UID: "testuid", }, - Spec: opsterv1.OpensearchComponentTemplateSpec{ + Spec: eliatrav1.OpensearchComponentTemplateSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, Name: "my-template", - Template: opsterv1.OpensearchIndexSpec{ + Template: eliatrav1.OpensearchIndexSpec{ Settings: &apiextensionsv1.JSON{}, Mappings: &apiextensionsv1.JSON{}, - Aliases: make(map[string]opsterv1.OpensearchIndexAliasSpec), + Aliases: make(map[string]eliatrav1.OpensearchIndexAliasSpec), }, Version: 0, Meta: &apiextensionsv1.JSON{}, }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-componenttemplate", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 a2deaf9..3822bd9 100644 --- a/opensearch-operator/pkg/reconcilers/configuration.go +++ b/opensearch-operator/pkg/reconcilers/configuration.go @@ -9,12 +9,12 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -29,7 +29,7 @@ type ConfigurationReconciler struct { client k8s.K8sClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster } func NewConfigurationReconciler( @@ -37,7 +37,7 @@ func NewConfigurationReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.OpenSearchCluster, opts ...reconciler.ResourceReconcilerOption, ) *ConfigurationReconciler { return &ConfigurationReconciler{ @@ -146,7 +146,7 @@ func (r *ConfigurationReconciler) buildConfigMap(data string) *corev1.ConfigMap } } -func (r *ConfigurationReconciler) createHashForNodePool(nodePool opsterv1.NodePool, data string, volumeData []byte) (*ctrl.Result, error) { +func (r *ConfigurationReconciler) createHashForNodePool(nodePool eliatrav1.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 df69796..eb5567d 100644 --- a/opensearch-operator/pkg/reconcilers/configuration_test.go +++ b/opensearch-operator/pkg/reconcilers/configuration_test.go @@ -4,9 +4,9 @@ import ( "context" "strings" - 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/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 *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: clusterName, UID: "dummyuid", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{}, - NodePools: []opsterv1.NodePool{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{}, + NodePools: []eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: clusterName, UID: "dummyuid", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{}, - NodePools: []opsterv1.NodePool{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{}, + NodePools: []eliatrav1.NodePool{ { Component: "test", Roles: []string{ diff --git a/opensearch-operator/pkg/reconcilers/dashboards.go b/opensearch-operator/pkg/reconcilers/dashboards.go index 295aa84..3182231 100644 --- a/opensearch-operator/pkg/reconcilers/dashboards.go +++ b/opensearch-operator/pkg/reconcilers/dashboards.go @@ -4,12 +4,12 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/tls" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" @@ -24,7 +24,7 @@ type DashboardsReconciler struct { client k8s.K8sClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster logger logr.Logger pki tls.PKI } @@ -34,7 +34,7 @@ func NewDashboardsReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 39e6af4..cbcfc8a 100644 --- a/opensearch-operator/pkg/reconcilers/dashboards_test.go +++ b/opensearch-operator/pkg/reconcilers/dashboards_test.go @@ -4,10 +4,10 @@ import ( "context" "strings" - 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/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 *opsterv1.OpenSearchCluster) (ReconcilerContext, *DashboardsReconciler) { +func newDashboardsReconciler(k8sClient *k8s.MockK8sClient, spec *eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, - Tls: &opsterv1.DashboardsTlsConfig{ + Tls: &eliatrav1.DashboardsTlsConfig{ Enable: true, Generate: false, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{Secret: corev1.LocalObjectReference{Name: secretName}}, + TlsCertificateConfig: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, - Tls: &opsterv1.DashboardsTlsConfig{ + Tls: &eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, - ImageSpec: &opsterv1.ImageSpec{ + ImageSpec: &eliatrav1.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 := &opsterv1.OpenSearchCluster{ + spec := &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ServiceName: clusterName}, - Dashboards: opsterv1.DashboardsConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ServiceName: clusterName}, + Dashboards: eliatrav1.DashboardsConfig{ Enable: true, - AdditionalVolumes: []opsterv1.AdditionalVolume{ + AdditionalVolumes: []eliatrav1.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 1ae6f62..c31a3e3 100644 --- a/opensearch-operator/pkg/reconcilers/indextemplate.go +++ b/opensearch-operator/pkg/reconcilers/indextemplate.go @@ -5,11 +5,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -31,8 +31,8 @@ type IndexTemplateReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchIndexTemplate - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchIndexTemplate + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -40,7 +40,7 @@ func NewIndexTemplateReconciler( ctx context.Context, client client.Client, recorder record.EventRecorder, - instance *opsterv1.OpensearchIndexTemplate, + instance *eliatrav1.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.(*opsterv1.OpensearchIndexTemplate) + instance := object.(*eliatrav1.OpensearchIndexTemplate) instance.Status.Reason = reason if err != nil { - instance.Status.State = opsterv1.OpensearchIndexTemplateError + instance.Status.State = eliatrav1.OpensearchIndexTemplateError } if result.Requeue && result.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchIndexTemplatePending + instance.Status.State = eliatrav1.OpensearchIndexTemplatePending } if err == nil && result.RequeueAfter == 30*time.Second { - instance.Status.State = opsterv1.OpensearchIndexTemplateCreated + instance.Status.State = eliatrav1.OpensearchIndexTemplateCreated instance.Status.IndexTemplateName = templateName } if reason == opensearchIndexTemplateExists { - instance.Status.State = opsterv1.OpensearchIndexTemplateIgnored + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchIndexTemplate) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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.(*opsterv1.OpensearchIndexTemplate) + instance := object.(*eliatrav1.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 2afe490..65193db 100644 --- a/opensearch-operator/pkg/reconcilers/indextemplate_test.go +++ b/opensearch-operator/pkg/reconcilers/indextemplate_test.go @@ -5,10 +5,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,12 +26,12 @@ var _ = Describe("indextemplate reconciler", func() { var ( transport *httpmock.MockTransport reconciler *IndexTemplateReconciler - instance *opsterv1.OpensearchIndexTemplate + instance *eliatrav1.OpensearchIndexTemplate recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.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 = &opsterv1.OpensearchIndexTemplate{ + instance = &eliatrav1.OpensearchIndexTemplate{ ObjectMeta: metav1.ObjectMeta{ Name: "test-indextemplate", Namespace: "test-indextemplate", UID: "testuid", }, - Spec: opsterv1.OpensearchIndexTemplateSpec{ + Spec: eliatrav1.OpensearchIndexTemplateSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, Name: "my-template", IndexPatterns: []string{"my-logs-*"}, - Template: opsterv1.OpensearchIndexSpec{ + Template: eliatrav1.OpensearchIndexSpec{ Settings: &apiextensionsv1.JSON{}, Mappings: &apiextensionsv1.JSON{}, - Aliases: make(map[string]opsterv1.OpensearchIndexAliasSpec), + Aliases: make(map[string]eliatrav1.OpensearchIndexAliasSpec), }, ComposedOf: []string{}, Priority: 0, @@ -63,17 +63,17 @@ var _ = Describe("indextemplate reconciler", func() { }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-indextemplate", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 c70fb0a..ad5967d 100644 --- a/opensearch-operator/pkg/reconcilers/ismpolicy.go +++ b/opensearch-operator/pkg/reconcilers/ismpolicy.go @@ -6,11 +6,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -31,8 +31,8 @@ type IsmPolicyReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpenSearchISMPolicy - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchISMPolicy + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -40,7 +40,7 @@ func NewIsmReconciler( ctx context.Context, client client.Client, recorder record.EventRecorder, - instance *opsterv1.OpenSearchISMPolicy, + instance *eliatrav1.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.(*opsterv1.OpenSearchISMPolicy) + instance := object.(*eliatrav1.OpenSearchISMPolicy) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opsterv1.OpensearchISMPolicyError + instance.Status.State = eliatrav1.OpensearchISMPolicyError } // Requeue after is 10 seconds if waiting for OpenSearch cluster if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchISMPolicyPending + instance.Status.State = eliatrav1.OpensearchISMPolicyPending } // Requeue is after 30 seconds for normal reconciliation after creation/update if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opsterv1.OpensearchISMPolicyCreated + instance.Status.State = eliatrav1.OpensearchISMPolicyCreated instance.Status.PolicyId = policyId } if reason == ismPolicyExists { - instance.Status.State = opsterv1.OpensearchISMPolicyIgnored + instance.Status.State = eliatrav1.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.(*opsterv1.OpenSearchISMPolicy) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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.(*opsterv1.OpenSearchISMPolicy) + instance := object.(*eliatrav1.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 *opsterv1.AliasDetails) { + copyAliasDetails := func(src *eliatrav1.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 2235161..164a08a 100644 --- a/opensearch-operator/pkg/reconcilers/ismpolicy_test.go +++ b/opensearch-operator/pkg/reconcilers/ismpolicy_test.go @@ -5,10 +5,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -26,26 +26,26 @@ var _ = Describe("ism policy reconciler", func() { var ( transport *httpmock.MockTransport reconciler *IsmPolicyReconciler - instance *opsterv1.OpenSearchISMPolicy + instance *eliatrav1.OpenSearchISMPolicy recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opsterv1.OpenSearchISMPolicy{ + instance = &eliatrav1.OpenSearchISMPolicy{ ObjectMeta: metav1.ObjectMeta{ Name: "test-policy", Namespace: "test-policy", UID: types.UID("testuid"), }, - Spec: opsterv1.OpenSearchISMPolicySpec{ + Spec: eliatrav1.OpenSearchISMPolicySpec{ PolicyID: "test-policy", OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", @@ -53,17 +53,17 @@ var _ = Describe("ism policy reconciler", func() { }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-policy", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 4004dc5..cfc8ac0 100644 --- a/opensearch-operator/pkg/reconcilers/k8s/client.go +++ b/opensearch-operator/pkg/reconcilers/k8s/client.go @@ -3,7 +3,7 @@ package k8s import ( "context" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" "github.com/cisco-open/operator-tools/pkg/reconciler" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/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) (opsterv1.OpenSearchCluster, error) - UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*opsterv1.OpenSearchCluster)) error + GetOpenSearchCluster(name, namespace string) (eliatrav1.OpenSearchCluster, error) + UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*eliatrav1.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) (opsterv1.OpenSearchCluster, error) { - cluster := opsterv1.OpenSearchCluster{} +func (c K8sClientImpl) GetOpenSearchCluster(name, namespace string) (eliatrav1.OpenSearchCluster, error) { + cluster := eliatrav1.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(*opsterv1.OpenSearchCluster)) error { +func (c K8sClientImpl) UpdateOpenSearchClusterStatus(key client.ObjectKey, f func(*eliatrav1.OpenSearchCluster)) error { return retry.RetryOnConflict(retry.DefaultRetry, func() error { - instance := opsterv1.OpenSearchCluster{} + instance := eliatrav1.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 6531bc6..eac9dee 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" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" - "github.com/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/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 *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster } type NodePoolHash struct { @@ -65,7 +65,7 @@ type NodePoolHash struct { ConfigHash string } -func NewReconcilerContext(recorder record.EventRecorder, instance *opsterv1.OpenSearchCluster, nodepools []opsterv1.NodePool) ReconcilerContext { +func NewReconcilerContext(recorder record.EventRecorder, instance *eliatrav1.OpenSearchCluster, nodepools []eliatrav1.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 *opsterv1.OpenSearchCluster, - status *opsterv1.ComponentStatus, + cluster *eliatrav1.OpenSearchCluster, + status *eliatrav1.ComponentStatus, ) error { if status != nil { - return k8sClient.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(cluster), func(instance *opsterv1.OpenSearchCluster) { + return k8sClient.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(cluster), func(instance *eliatrav1.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 75ad334..f6e29d9 100644 --- a/opensearch-operator/pkg/reconcilers/role.go +++ b/opensearch-operator/pkg/reconcilers/role.go @@ -5,11 +5,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -30,8 +30,8 @@ type RoleReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchRole - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchRole + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -39,7 +39,7 @@ func NewRoleReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opsterv1.OpensearchRole, + instance *eliatrav1.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.(*opsterv1.OpensearchRole) + instance := object.(*eliatrav1.OpensearchRole) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opsterv1.OpensearchRoleStateError + instance.Status.State = eliatrav1.OpensearchRoleStateError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchRoleStatePending + instance.Status.State = eliatrav1.OpensearchRoleStatePending } if retErr == nil && retResult.Requeue { - instance.Status.State = opsterv1.OpensearchRoleStateCreated + instance.Status.State = eliatrav1.OpensearchRoleStateCreated } if reason == opensearchRoleExists { - instance.Status.State = opsterv1.OpensearchRoleIgnored + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchRole) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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.(*opsterv1.OpensearchRole) + instance := object.(*eliatrav1.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 ebe3c66..4573b95 100644 --- a/opensearch-operator/pkg/reconcilers/role_test.go +++ b/opensearch-operator/pkg/reconcilers/role_test.go @@ -5,10 +5,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,32 +25,32 @@ var _ = Describe("roles reconciler", func() { var ( transport *httpmock.MockTransport reconciler *RoleReconciler - instance *opsterv1.OpensearchRole + instance *eliatrav1.OpensearchRole recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opsterv1.OpensearchRole{ + instance = &eliatrav1.OpensearchRole{ ObjectMeta: metav1.ObjectMeta{ Name: "test-role", Namespace: "test-role", UID: types.UID("testuid"), }, - Spec: opsterv1.OpensearchRoleSpec{ + Spec: eliatrav1.OpensearchRoleSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, ClusterPermissions: []string{ "test_cluster_permission", }, - IndexPermissions: []opsterv1.IndexPermissionSpec{ + IndexPermissions: []eliatrav1.IndexPermissionSpec{ { IndexPatterns: []string{ "test-index", @@ -63,17 +63,17 @@ var _ = Describe("roles reconciler", func() { }, } // Set up prereq-objects - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-role", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 748c06d..f821cb0 100644 --- a/opensearch-operator/pkg/reconcilers/rollingRestart.go +++ b/opensearch-operator/pkg/reconcilers/rollingRestart.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/Opster/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -34,7 +34,7 @@ type RollingRestartReconciler struct { osClient *services.OsClusterClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster } func NewRollingRestartReconciler( @@ -42,7 +42,7 @@ func NewRollingRestartReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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, &opsterv1.ComponentStatus{ + return UpdateComponentStatus(r.client, r.instance, &eliatrav1.ComponentStatus{ Component: componentName, Status: status, Description: "", }) } -func (r *RollingRestartReconciler) findStatus() *opsterv1.ComponentStatus { +func (r *RollingRestartReconciler) findStatus() *eliatrav1.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 8e5d5bd..fcd1aea 100644 --- a/opensearch-operator/pkg/reconcilers/scaler.go +++ b/opensearch-operator/pkg/reconcilers/scaler.go @@ -5,11 +5,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/cisco-open/operator-tools/pkg/reconciler" appsv1 "k8s.io/api/apps/v1" "k8s.io/client-go/tools/record" @@ -24,7 +24,7 @@ type ScalerReconciler struct { ctx context.Context recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster } func NewScalerReconciler( @@ -32,7 +32,7 @@ func NewScalerReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 *opsterv1.NodePool) (bool, error) { +func (r *ScalerReconciler) reconcileNodePool(nodePool *eliatrav1.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 *opsterv1.NodePool) (bool, return false, err } - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.ComponentStatus{ Component: "Scaler", Status: "Running", Description: nodePool.Component, @@ -84,7 +84,7 @@ func (r *ScalerReconciler) reconcileNodePool(nodePool *opsterv1.NodePool) (bool, 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 *opsterv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 *opsterv1.NodePool) (bool, // 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 *opsterv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 opsterv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string, smartDecrease bool) (bool, error) { +func (r *ScalerReconciler) decreaseOneNode(currentStatus eliatrav1.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 opsterv1.ComponentStatu return true, err } lg.Info(fmt.Sprintf("Group: %s, Removed node %s", nodePoolGroupName, lastReplicaNodeName)) - err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.RemoveIt(currentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -207,7 +207,7 @@ func (r *ScalerReconciler) decreaseOneNode(currentStatus opsterv1.ComponentStatu return false, err } -func (r *ScalerReconciler) excludeNode(currentStatus opsterv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string) error { +func (r *ScalerReconciler) excludeNode(currentStatus eliatrav1.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 opsterv1.ComponentStatus, c return err } if excluded { - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.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 *opsterv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.Replace(currentStatus, componentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -249,14 +249,14 @@ func (r *ScalerReconciler) excludeNode(currentStatus opsterv1.ComponentStatus, c return err } - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.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 *opsterv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.OpenSearchCluster) { instance.Status.ComponentsStatus = helpers.Replace(currentStatus, componentStatus, instance.Status.ComponentsStatus) }) if err != nil { @@ -268,7 +268,7 @@ func (r *ScalerReconciler) excludeNode(currentStatus opsterv1.ComponentStatus, c return err } -func (r *ScalerReconciler) drainNode(currentStatus opsterv1.ComponentStatus, currentSts appsv1.StatefulSet, nodePoolGroupName string) error { +func (r *ScalerReconciler) drainNode(currentStatus eliatrav1.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 opsterv1.ComponentStatus, cur return err } - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.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 *opsterv1.OpenSearchCluster) { + err = r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 36e5cca..17b578e 100644 --- a/opensearch-operator/pkg/reconcilers/securityconfig.go +++ b/opensearch-operator/pkg/reconcilers/securityconfig.go @@ -8,10 +8,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" @@ -66,7 +66,7 @@ type SecurityconfigReconciler struct { client k8s.K8sClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -75,7 +75,7 @@ func NewSecurityconfigReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 *opsterv1.OpenSearchCluster, secret *corev1.Secret, log logr.Logger) string { +func BuildCmdArg(instance *eliatrav1.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 *opsterv1.OpenSearchCluster, secret *corev1.Secret) error { +func (r *SecurityconfigReconciler) securityconfigSubpaths(instance *eliatrav1.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 *opsterv1.Ope } // BuildClusterSvcHostName builds the cluster host name as {svc-name}.{namespace}.svc.{dns-base} -func BuildClusterSvcHostName(instance *opsterv1.OpenSearchCluster) string { +func BuildClusterSvcHostName(instance *eliatrav1.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 ae755d4..ae50e62 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" - 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/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 *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{}}, + Spec: eliatrav1.ClusterSpec{General: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{}, - Security: &opsterv1.Security{ - Config: &opsterv1.SecurityConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{}, + Security: &eliatrav1.Security{ + Config: &eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: clusterName, Version: "2.3", }, - Security: &opsterv1.Security{ - Config: &opsterv1.SecurityConfig{ + Security: &eliatrav1.Security{ + Config: &eliatrav1.SecurityConfig{ SecurityconfigSecret: corev1.LocalObjectReference{Name: "securityconfig-secret"}, }, - Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{Generate: true}, + Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{Generate: true}, }, }, }, - Status: opsterv1.ClusterStatus{ + Status: eliatrav1.ClusterStatus{ Initialized: true, }, } @@ -186,14 +186,14 @@ var _ = Describe("Securityconfig Reconciler", func() { return &ctrl.Result{}, nil }) - spec := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ Version: "2.3", }, - Security: &opsterv1.Security{ - Config: &opsterv1.SecurityConfig{ + Security: &eliatrav1.Security{ + Config: &eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{}, - Security: &opsterv1.Security{ - Config: &opsterv1.SecurityConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{}, + Security: &eliatrav1.Security{ + Config: &eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: clusterName, Version: "2.3", }, - Security: &opsterv1.Security{ - Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{Generate: true}, + Security: &eliatrav1.Security{ + Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{Generate: true}, }, }, }, diff --git a/opensearch-operator/pkg/reconcilers/suite_test.go b/opensearch-operator/pkg/reconcilers/suite_test.go index 08795d8..8dbcc23 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" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/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 = opsterv1.AddToScheme(scheme.Scheme) + err = eliatrav1.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 474a380..c847cf6 100644 --- a/opensearch-operator/pkg/reconcilers/tenant.go +++ b/opensearch-operator/pkg/reconcilers/tenant.go @@ -5,11 +5,11 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -30,8 +30,8 @@ type TenantReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchTenant - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchTenant + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -39,7 +39,7 @@ func NewTenantReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opsterv1.OpensearchTenant, + instance *eliatrav1.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.(*opsterv1.OpensearchTenant) + instance := object.(*eliatrav1.OpensearchTenant) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opsterv1.OpensearchTenantError + instance.Status.State = eliatrav1.OpensearchTenantError } // Requeue after is 10 seconds if waiting for OpenSearch cluster if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchTenantPending + instance.Status.State = eliatrav1.OpensearchTenantPending } // Requeue is after 30 seconds for normal reconciliation after creation/update if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opsterv1.OpensearchTenantCreated + instance.Status.State = eliatrav1.OpensearchTenantCreated } if reason == opensearchTenantExists { - instance.Status.State = opsterv1.OpensearchTenantIgnored + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchTenant) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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.(*opsterv1.OpensearchTenant) + instance := object.(*eliatrav1.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 f616895..3d2b275 100644 --- a/opensearch-operator/pkg/reconcilers/tenant_test.go +++ b/opensearch-operator/pkg/reconcilers/tenant_test.go @@ -5,10 +5,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,25 +25,25 @@ var _ = Describe("tenant reconciler", func() { var ( transport *httpmock.MockTransport reconciler *TenantReconciler - instance *opsterv1.OpensearchTenant + instance *eliatrav1.OpensearchTenant recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opsterv1.OpensearchTenant{ + instance = &eliatrav1.OpensearchTenant{ ObjectMeta: metav1.ObjectMeta{ Name: "test-tenant", Namespace: "test-tenant", UID: "testuid", }, - Spec: opsterv1.OpensearchTenantSpec{ + Spec: eliatrav1.OpensearchTenantSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -51,17 +51,17 @@ var _ = Describe("tenant reconciler", func() { }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-tenant", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 944db16..248ea74 100644 --- a/opensearch-operator/pkg/reconcilers/tls.go +++ b/opensearch-operator/pkg/reconcilers/tls.go @@ -7,13 +7,13 @@ import ( "strings" "time" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/tls" "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" "github.com/samber/lo" @@ -29,7 +29,7 @@ import ( type TLSReconciler struct { client k8s.K8sClient reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.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 *opsterv1.OpenSearchCluster, + instance *eliatrav1.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/Opster/opensearch-k8s-operator/issues/569 + // TODO: This should be refactored in the API - https://github.com/Eliatra/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 b31ba33..d36cc57 100644 --- a/opensearch-operator/pkg/reconcilers/tls_test.go +++ b/opensearch-operator/pkg/reconcilers/tls_test.go @@ -4,9 +4,9 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/stretchr/testify/mock" @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" ) -func newTLSReconciler(k8sClient *k8s.MockK8sClient, spec *opsterv1.OpenSearchCluster) (*ReconcilerContext, *TLSReconciler) { +func newTLSReconciler(k8sClient *k8s.MockK8sClient, spec *eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{}, - Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{Generate: true}, - Http: &opsterv1.TlsConfigHttp{Generate: true}, + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{}, + Security: &eliatrav1.Security{Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{Generate: true}, + Http: &eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{}, - Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{Generate: true, PerNode: true}, - Http: &opsterv1.TlsConfigHttp{Generate: true}, + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{}, + Security: &eliatrav1.Security{Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{Generate: true, PerNode: true}, + Http: &eliatrav1.TlsConfigHttp{Generate: true}, }}, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{Version: "2.8.0"}, Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{ + Spec: eliatrav1.ClusterSpec{General: eliatrav1.GeneralConfig{Version: "2.8.0"}, Security: &eliatrav1.Security{Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{ Generate: false, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{ + TlsCertificateConfig: eliatrav1.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: &opsterv1.TlsConfigHttp{ + Http: &eliatrav1.TlsConfigHttp{ Generate: false, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{ + TlsCertificateConfig: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{}, Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{ + Spec: eliatrav1.ClusterSpec{General: eliatrav1.GeneralConfig{}, Security: &eliatrav1.Security{Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{ Generate: false, PerNode: true, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{ + TlsCertificateConfig: eliatrav1.TlsCertificateConfig{ Secret: corev1.LocalObjectReference{Name: "my-transport-certs"}, }, NodesDn: []string{"CN=mycn", "CN=othercn"}, }, - Http: &opsterv1.TlsConfigHttp{ + Http: &eliatrav1.TlsConfigHttp{ Generate: false, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{ + TlsCertificateConfig: eliatrav1.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 := opsterv1.OpenSearchCluster{ + spec := eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: clusterName, UID: "dummyuid"}, - Spec: opsterv1.ClusterSpec{General: opsterv1.GeneralConfig{Version: "2.8.0"}, Security: &opsterv1.Security{Tls: &opsterv1.TlsConfig{ - Transport: &opsterv1.TlsConfigTransport{ + Spec: eliatrav1.ClusterSpec{General: eliatrav1.GeneralConfig{Version: "2.8.0"}, Security: &eliatrav1.Security{Tls: &eliatrav1.TlsConfig{ + Transport: &eliatrav1.TlsConfigTransport{ Generate: true, PerNode: true, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{ + TlsCertificateConfig: eliatrav1.TlsCertificateConfig{ CaSecret: corev1.LocalObjectReference{Name: caSecretName}, }, }, - Http: &opsterv1.TlsConfigHttp{ + Http: &eliatrav1.TlsConfigHttp{ Generate: true, - TlsCertificateConfig: opsterv1.TlsCertificateConfig{ + TlsCertificateConfig: eliatrav1.TlsCertificateConfig{ CaSecret: corev1.LocalObjectReference{Name: caSecretName}, }, }, diff --git a/opensearch-operator/pkg/reconcilers/upgrade.go b/opensearch-operator/pkg/reconcilers/upgrade.go index 9b9d859..2b34b6b 100644 --- a/opensearch-operator/pkg/reconcilers/upgrade.go +++ b/opensearch-operator/pkg/reconcilers/upgrade.go @@ -6,13 +6,13 @@ import ( "fmt" "time" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "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" "github.com/samber/lo" @@ -36,7 +36,7 @@ type UpgradeReconciler struct { osClient *services.OsClusterClient recorder record.EventRecorder reconcilerContext *ReconcilerContext - instance *opsterv1.OpenSearchCluster + instance *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -45,7 +45,7 @@ func NewUpgradeReconciler( ctx context.Context, recorder record.EventRecorder, reconcilerContext *ReconcilerContext, - instance *opsterv1.OpenSearchCluster, + instance *eliatrav1.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 *opsterv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.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 *opsterv1.OpenSearchCluster) { + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.OpenSearchCluster) { instance.Status.Version = instance.Spec.General.Version for _, pool := range instance.Spec.NodePools { - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.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() (opsterv1.NodePool, opsterv1.ComponentStatus) { +func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (eliatrav1.NodePool, eliatrav1.ComponentStatus) { // First sort node pools - var dataNodes, dataAndMasterNodes, otherNodes []opsterv1.NodePool + var dataNodes, dataAndMasterNodes, otherNodes []eliatrav1.NodePool for _, nodePool := range r.instance.Spec.NodePools { if helpers.HasDataRole(&nodePool) { if helpers.HasManagerRole(&nodePool) { @@ -189,7 +189,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops // Complete the in progress node first pool, found := r.findInProgress(dataNodes) if found { - return pool, opsterv1.ComponentStatus{ + return pool, eliatrav1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Upgrading", @@ -198,7 +198,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops // Pick the first unworked on node next pool, found = r.findNextPool(dataNodes) if found { - return pool, opsterv1.ComponentStatus{ + return pool, eliatrav1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Pending", @@ -207,7 +207,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops // Next do the same for any nodes that are data and master pool, found = r.findInProgress(dataAndMasterNodes) if found { - return pool, opsterv1.ComponentStatus{ + return pool, eliatrav1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Upgrading", @@ -215,7 +215,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops } pool, found = r.findNextPool(dataAndMasterNodes) if found { - return pool, opsterv1.ComponentStatus{ + return pool, eliatrav1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Pending", @@ -225,7 +225,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops // Finally do the non data nodes pool, found = r.findInProgress(otherNodes) if found { - return pool, opsterv1.ComponentStatus{ + return pool, eliatrav1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Upgrading", @@ -233,7 +233,7 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops } pool, found = r.findNextPool(otherNodes) if found { - return pool, opsterv1.ComponentStatus{ + return pool, eliatrav1.ComponentStatus{ Component: "Upgrader", Description: pool.Component, Status: "Pending", @@ -241,15 +241,15 @@ func (r *UpgradeReconciler) findNextNodePoolForUpgrade() (opsterv1.NodePool, ops } // If we get here all nodes should be upgraded - return opsterv1.NodePool{}, opsterv1.ComponentStatus{ + return eliatrav1.NodePool{}, eliatrav1.ComponentStatus{ Component: "Upgrade", Status: "Finished", } } -func (r *UpgradeReconciler) findInProgress(pools []opsterv1.NodePool) (opsterv1.NodePool, bool) { +func (r *UpgradeReconciler) findInProgress(pools []eliatrav1.NodePool) (eliatrav1.NodePool, bool) { for _, nodePool := range pools { - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Description: nodePool.Component, } @@ -258,12 +258,12 @@ func (r *UpgradeReconciler) findInProgress(pools []opsterv1.NodePool) (opsterv1. return nodePool, true } } - return opsterv1.NodePool{}, false + return eliatrav1.NodePool{}, false } -func (r *UpgradeReconciler) findNextPool(pools []opsterv1.NodePool) (opsterv1.NodePool, bool) { +func (r *UpgradeReconciler) findNextPool(pools []eliatrav1.NodePool) (eliatrav1.NodePool, bool) { for _, nodePool := range pools { - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Description: nodePool.Component, } @@ -272,10 +272,10 @@ func (r *UpgradeReconciler) findNextPool(pools []opsterv1.NodePool) (opsterv1.No return nodePool, true } } - return opsterv1.NodePool{}, false + return eliatrav1.NodePool{}, false } -func (r *UpgradeReconciler) doNodePoolUpgrade(pool opsterv1.NodePool) error { +func (r *UpgradeReconciler) doNodePoolUpgrade(pool eliatrav1.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 opsterv1.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 *opsterv1.OpenSearchCluster) { - currentStatus := opsterv1.ComponentStatus{ + return r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.OpenSearchCluster) { + currentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: pool.Component, } - componentStatus := opsterv1.ComponentStatus{ + componentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Status: "Upgraded", Description: pool.Component, @@ -381,14 +381,14 @@ func (r *UpgradeReconciler) doNodePoolUpgrade(pool opsterv1.NodePool) error { func (r *UpgradeReconciler) setComponentConditions(conditions []string, component string) { - err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *opsterv1.OpenSearchCluster) { - currentStatus := opsterv1.ComponentStatus{ + err := r.client.UpdateOpenSearchClusterStatus(client.ObjectKeyFromObject(r.instance), func(instance *eliatrav1.OpenSearchCluster) { + currentStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: component, } componentStatus, found := helpers.FindFirstPartial(instance.Status.ComponentsStatus, currentStatus, helpers.GetByDescriptionAndGroup) - newStatus := opsterv1.ComponentStatus{ + newStatus := eliatrav1.ComponentStatus{ Component: "Upgrader", Status: "Upgrading", Description: component, diff --git a/opensearch-operator/pkg/reconcilers/userrolebinding.go b/opensearch-operator/pkg/reconcilers/userrolebinding.go index 899fb84..cbf6335 100644 --- a/opensearch-operator/pkg/reconcilers/userrolebinding.go +++ b/opensearch-operator/pkg/reconcilers/userrolebinding.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/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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -27,8 +27,8 @@ type UserRoleBindingReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchUserRoleBinding - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchUserRoleBinding + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -36,7 +36,7 @@ func NewUserRoleBindingReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opsterv1.OpensearchUserRoleBinding, + instance *eliatrav1.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.(*opsterv1.OpensearchUserRoleBinding) + instance := object.(*eliatrav1.OpensearchUserRoleBinding) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opsterv1.OpensearchUserRoleBindingStateError + instance.Status.State = eliatrav1.OpensearchUserRoleBindingStateError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchUserRoleBindingPending + instance.Status.State = eliatrav1.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 = opsterv1.OpensearchUserRoleBindingStateCreated + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchUserRoleBinding) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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 671cdfd..876837b 100644 --- a/opensearch-operator/pkg/reconcilers/userrolebinding_test.go +++ b/opensearch-operator/pkg/reconcilers/userrolebinding_test.go @@ -6,10 +6,10 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -25,25 +25,25 @@ var _ = Describe("userrolebinding reconciler", func() { var ( transport *httpmock.MockTransport reconciler *UserRoleBindingReconciler - instance *opsterv1.OpensearchUserRoleBinding + instance *eliatrav1.OpensearchUserRoleBinding recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opsterv1.OpensearchUserRoleBinding{ + instance = &eliatrav1.OpensearchUserRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "test-role", Namespace: "test-urb", UID: types.UID("testuid"), }, - Spec: opsterv1.OpensearchUserRoleBindingSpec{ + Spec: eliatrav1.OpensearchUserRoleBindingSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -59,17 +59,17 @@ var _ = Describe("userrolebinding reconciler", func() { }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-urb", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 ba8b50e..c21bc07 100644 --- a/opensearch-operator/pkg/reconcilers/users.go +++ b/opensearch-operator/pkg/reconcilers/users.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/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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/util" "github.com/cisco-open/operator-tools/pkg/reconciler" "github.com/go-logr/logr" "k8s.io/apimachinery/pkg/types" @@ -27,8 +27,8 @@ type UserReconciler struct { ctx context.Context osClient *services.OsClusterClient recorder record.EventRecorder - instance *opsterv1.OpensearchUser - cluster *opsterv1.OpenSearchCluster + instance *eliatrav1.OpensearchUser + cluster *eliatrav1.OpenSearchCluster logger logr.Logger } @@ -36,7 +36,7 @@ func NewUserReconciler( client client.Client, ctx context.Context, recorder record.EventRecorder, - instance *opsterv1.OpensearchUser, + instance *eliatrav1.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.(*opsterv1.OpensearchUser) + instance := object.(*eliatrav1.OpensearchUser) instance.Status.Reason = reason if retErr != nil { - instance.Status.State = opsterv1.OpensearchUserStateError + instance.Status.State = eliatrav1.OpensearchUserStateError } if retResult.Requeue && retResult.RequeueAfter == 10*time.Second { - instance.Status.State = opsterv1.OpensearchUserStatePending + instance.Status.State = eliatrav1.OpensearchUserStatePending } if retErr == nil && retResult.RequeueAfter == 30*time.Second { - instance.Status.State = opsterv1.OpensearchUserStateCreated + instance.Status.State = eliatrav1.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.(*opsterv1.OpensearchUser) + instance := object.(*eliatrav1.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 != opsterv1.PhaseRunning { + if r.cluster.Status.Phase != eliatrav1.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 5afa10e..e7dcfb6 100644 --- a/opensearch-operator/pkg/reconcilers/users_test.go +++ b/opensearch-operator/pkg/reconcilers/users_test.go @@ -5,12 +5,12 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/requests" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/responses" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" "github.com/jarcoal/httpmock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -27,26 +27,26 @@ var _ = Describe("users reconciler", func() { var ( transport *httpmock.MockTransport reconciler *UserReconciler - instance *opsterv1.OpensearchUser + instance *eliatrav1.OpensearchUser recorder *record.FakeRecorder mockClient *k8s.MockK8sClient // Objects password *corev1.Secret - cluster *opsterv1.OpenSearchCluster + cluster *eliatrav1.OpenSearchCluster ) BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) transport = httpmock.NewMockTransport() transport.RegisterNoResponder(httpmock.NewNotFoundResponder(failMessage)) - instance = &opsterv1.OpensearchUser{ + instance = &eliatrav1.OpensearchUser{ ObjectMeta: metav1.ObjectMeta{ Name: "test-user", Namespace: "test-user", UID: types.UID("testuid"), }, - Spec: opsterv1.OpensearchUserSpec{ + Spec: eliatrav1.OpensearchUserSpec{ OpensearchRef: corev1.LocalObjectReference{ Name: "test-cluster", }, @@ -67,17 +67,17 @@ var _ = Describe("users reconciler", func() { "password": []byte("testpassword"), }, } - cluster = &opsterv1.OpenSearchCluster{ + cluster = &eliatrav1.OpenSearchCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster", Namespace: "test-user", }, - Spec: opsterv1.ClusterSpec{ - General: opsterv1.GeneralConfig{ + Spec: eliatrav1.ClusterSpec{ + General: eliatrav1.GeneralConfig{ ServiceName: "test-cluster", HttpPort: 9200, }, - NodePools: []opsterv1.NodePool{ + NodePools: []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 = opsterv1.PhaseRunning - cluster.Status.ComponentsStatus = []opsterv1.ComponentStatus{} + cluster.Status.Phase = eliatrav1.PhaseRunning + cluster.Status.ComponentsStatus = []eliatrav1.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(opsterv1.OpenSearchCluster{}, NotFoundError()) + mockClient.EXPECT().GetOpenSearchCluster(mock.Anything, mock.Anything).Return(eliatrav1.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 f812d40..4394d1e 100644 --- a/opensearch-operator/pkg/reconcilers/util/util.go +++ b/opensearch-operator/pkg/reconcilers/util/util.go @@ -9,12 +9,12 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/opensearch-gateway/services" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/builders" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/helpers" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/tls" "github.com/go-logr/logr" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -58,7 +58,7 @@ func CheckEquels(from_env *appsv1.StatefulSetSpec, from_crd *appsv1.StatefulSetS } } -func ReadOrGenerateCaCert(pki tls.PKI, k8sClient k8s.K8sClient, instance *opsterv1.OpenSearchCluster) (tls.Cert, error) { +func ReadOrGenerateCaCert(pki tls.PKI, k8sClient k8s.K8sClient, instance *eliatrav1.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 *opster func CreateAdditionalVolumes( k8sClient k8s.K8sClient, namespace string, - volumeConfigs []opsterv1.AdditionalVolume, + volumeConfigs []eliatrav1.AdditionalVolume, ) ( retVolumes []corev1.Volume, retVolumeMounts []corev1.VolumeMount, @@ -195,7 +195,7 @@ func CreateAdditionalVolumes( return } -func OpensearchClusterURL(cluster *opsterv1.OpenSearchCluster) string { +func OpensearchClusterURL(cluster *eliatrav1.OpenSearchCluster) string { return fmt.Sprintf( "https://%s.%s.svc.%s:%v", cluster.Spec.General.ServiceName, @@ -208,7 +208,7 @@ func OpensearchClusterURL(cluster *opsterv1.OpenSearchCluster) string { func CreateClientForCluster( k8sClient k8s.K8sClient, ctx context.Context, - cluster *opsterv1.OpenSearchCluster, + cluster *eliatrav1.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, -) (*opsterv1.OpenSearchCluster, error) { +) (*eliatrav1.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 *opsterv1.OpenSearchCluster) int32 { +func DataNodesCount(k8sClient k8s.K8sClient, cr *eliatrav1.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 *opsterv1.OpenSearchCluster) int } // GetClusterHealth returns the health of OpenSearch cluster -func GetClusterHealth(k8sClient k8s.K8sClient, ctx context.Context, cluster *opsterv1.OpenSearchCluster, lg logr.Logger) opsterv1.OpenSearchHealth { +func GetClusterHealth(k8sClient k8s.K8sClient, ctx context.Context, cluster *eliatrav1.OpenSearchCluster, lg logr.Logger) eliatrav1.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 opsterv1.OpenSearchUnknownHealth + return eliatrav1.OpenSearchUnknownHealth } healthResponse, err := osClient.GetClusterHealth() if err != nil { lg.Error(err, "Failed to get OpenSearch health status") - return opsterv1.OpenSearchUnknownHealth + return eliatrav1.OpenSearchUnknownHealth } - return opsterv1.OpenSearchHealth(healthResponse.Status) + return eliatrav1.OpenSearchHealth(healthResponse.Status) } // GetAvailableOpenSearchNodes returns the sum of ready pods for all node pools -func GetAvailableOpenSearchNodes(k8sClient k8s.K8sClient, ctx context.Context, cluster *opsterv1.OpenSearchCluster, lg logr.Logger) int32 { +func GetAvailableOpenSearchNodes(k8sClient k8s.K8sClient, ctx context.Context, cluster *eliatrav1.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 ec02cb6..8257f67 100644 --- a/opensearch-operator/pkg/reconcilers/util/util_suite_test.go +++ b/opensearch-operator/pkg/reconcilers/util/util_suite_test.go @@ -3,7 +3,7 @@ package util import ( "testing" - opsterv1 "github.com/Opster/opensearch-k8s-operator/opensearch-operator/api/v1" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "k8s.io/client-go/kubernetes/scheme" @@ -22,7 +22,7 @@ var _ = BeforeSuite(func() { err := scheme.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = opsterv1.AddToScheme(scheme.Scheme) + err = eliatrav1.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 30620d8..5fe8f44 100644 --- a/opensearch-operator/pkg/reconcilers/util/util_test.go +++ b/opensearch-operator/pkg/reconcilers/util/util_test.go @@ -3,8 +3,8 @@ 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" + eliatrav1 "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/api/v1" + "github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/mocks/github.com/Eliatra/opensearch-k8s-operator/opensearch-operator/pkg/reconcilers/k8s" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" @@ -12,13 +12,13 @@ import ( var _ = Describe("Additional volumes", func() { namespace := "Additional volume test" - var volumeConfigs []opsterv1.AdditionalVolume + var volumeConfigs []eliatrav1.AdditionalVolume var mockClient *k8s.MockK8sClient BeforeEach(func() { mockClient = k8s.NewMockK8sClient(GinkgoT()) mockClient.EXPECT().Context().Return(context.Background()) - volumeConfigs = []opsterv1.AdditionalVolume{ + volumeConfigs = []eliatrav1.AdditionalVolume{ { Name: "myVolume", Path: "myPath/a/b",
apiVersion stringopensearch.opster.io/v1opensearch.eliatra.io/v1 true
Default image repository to use
keystore[]opsterv1.KeystoreValue[]eliatrav1.KeystoreValue List of objects that define secret values that will populate the opensearch keystore. false - -
serviceopsterv1.DashboardsServiceeliatrav1.DashboardsService Customize dashboard service false -string Define InitHelper image falsepublic.ecr.aws/opsterio/busyboxdocker.io/eliatra/eoko-busybox
imagePullPolicy