Skip to content

Commit

Permalink
Revert code refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <[email protected]>
  • Loading branch information
prudhvigodithi committed Jan 29, 2024
1 parent 6089077 commit 9f6d07f
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 179 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/busybox.yaml

This file was deleted.

88 changes: 0 additions & 88 deletions .github/workflows/prepare-release.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,6 @@ jobs:
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Build and Push operator docker image
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd opensearch-operator
make test
export IMG=public.ecr.aws/opensearch-project/opensearch-operator:$RELEASE_VERSION
echo $IMG
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/opsterio
docker buildx build -t $IMG --platform="linux/amd64,linux/arm,linux/arm64" . -f Dockerfile --push
cd ..
- name: Pull and Push operator busybox docker image
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd opensearch-operator
export IMG=public.ecr.aws/opensearch-project/opensearch-operator-busybox:$RELEASE_VERSION
echo $IMG
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/opsterio
docker buildx build -f Dockerfile-busybox --platform="linux/amd64,linux/arm,linux/arm64" . -t $IMG --push
cd ..
- name: Make sure helm chart has correct versions
run: |
sed -i -e 's/^appVersion:.*/appVersion: '$RELEASE_VERSION'/' charts/opensearch-operator/Chart.yaml
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/opensearch-project/opensearch-k8s-operator) discussing your change before you make it is the best way to smooth the PR process. This will prevent a rejection because someone else is already working on the problem, or because the solution is incompatible with the architectural direction.

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.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![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)
![build](https://github.com/opensearch-project/opensearch-k8s-operator/actions/workflows/docker-build.yaml/badge.svg) ![test](https://github.com/opensearch-project/opensearch-k8s-operator/actions/workflows/testing.yaml/badge.svg) ![release](https://img.shields.io/github/v/release/opster/opensearch-k8s-operator) [![Golang Lint](https://github.com/Opster/opensearch-k8s-operator/actions/workflows/linting.yaml/badge.svg)](https://github.com/Opster/opensearch-k8s-operator/actions/workflows/linting.yaml) [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/opensearch-operator)](https://artifacthub.io/packages/search?repo=opensearch-operator)

# OpenSearch Kubernetes Operator

Expand Down
8 changes: 4 additions & 4 deletions charts/opensearch-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### 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
[Unreleased]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-2.0.0...HEAD
[2.0.0]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-1.0.3...opensearch-operator-2.0.0
[1.0.3]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-1.0.2...opensearch-operator-1.0.3
[1.0.2]: https://github.com/opensearch-project/opensearch-k8s-operator/compare/opensearch-operator-1.0.1...opensearch-operator-1.0.2
10 changes: 3 additions & 7 deletions charts/opensearch-operator/README.md
Original file line number Diff line number Diff line change
@@ -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/opensearch-project/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/opensearch-project/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://opensearch-project.github.io/opensearch-k8s-operator/
helm repo update
```
#### Install Chart
Expand All @@ -27,7 +27,3 @@ 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)

2 changes: 1 addition & 1 deletion docs/userguide/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,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 `public.ecr.aws/opensearch-project/busybox:latest`). 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:
Expand Down
17 changes: 7 additions & 10 deletions jenkins/release.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pipeline {
causeString: 'A commit was pushed on opensearch-project/opensearch-k8s-operator repository main branch causing this workflow to run',
printContributedVariables: false,
printPostContent: false,
regexpFilterText: '$isTag',
)
}
environment {
Expand All @@ -51,11 +50,10 @@ pipeline {
TIMER_BUILD_CAUSE = currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')
}
stages {
stage('OpenSearch Operator Busybox') {
stage('OpenSearch Operator') {
steps {
script {
def ref_final = "${GIT_REFERENCE}"
println("the ref_final was : ${ref_final}")
def ref_url = "${REPO_URL}/commit/${GIT_REFERENCE}"
if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) {
ref_final = "${ref}"
Expand All @@ -78,8 +76,8 @@ pipeline {
checkout scm
sh("git checkout ${ref_final}")

def OPERATOR_PRODUCT = "opensearch-operator-busybox"
def OPERATOR_VERSION = "$ref_final"
def OPERATOR_PRODUCT = "opensearch-operator"
def OPERATOR_VERSION = ref_final.substring(1);

echo("${OPERATOR_PRODUCT}: ${OPERATOR_VERSION}")

Expand All @@ -89,15 +87,14 @@ pipeline {
string(name: 'DOCKER_BUILD_GIT_REPOSITORY', value: "${REPO_URL}"),
string(name: 'DOCKER_BUILD_GIT_REPOSITORY_REFERENCE', value: "${ref_final}"),
string(name: 'DOCKER_BUILD_SCRIPT_WITH_COMMANDS', value: [
'id',
'pwd',
'ls -l',
'cd opensearch-operator',
[
'bash',
'scripts/build-image-multi-arch.sh',
'../scripts/build-image-multi-arch.sh',
"-v ${OPERATOR_VERSION}",
"-a 'x64,arm,arm64'",
"-f opensearch-operator/Dockerfile-busybox",
"-f Dockerfile",
"-p ${OPERATOR_PRODUCT}"
].join(' ')
].join(' && ')),
Expand All @@ -107,7 +104,7 @@ pipeline {
build job: 'docker-promotion',
parameters: [
string(name: 'SOURCE_IMAGES', value: '${OPERATOR_PRODUCT}:${OPERATOR_VERSION}'),
string(name: 'RELEASE_VERSION', value: "${ref_final}"),
string(name: 'RELEASE_VERSION', value: "${OPERATOR_VERSION}"),
string(name: 'DOCKER_HUB_PROMOTE', value: true),
string(name: 'ECR_PROMOTE', value: true),
string(name: 'TAG_LATEST', value: true)
Expand Down
2 changes: 0 additions & 2 deletions opensearch-operator/Dockerfile-busybox

This file was deleted.

6 changes: 3 additions & 3 deletions opensearch-operator/pkg/builders/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ var _ = Describe("Builders", func() {
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"))
Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/busybox:latest"))
})
It("should use InitHelper.Image as InitHelper image if configured", func() {
clusterObject := ClusterDescWithVersion("2.2.1")
Expand All @@ -178,7 +178,7 @@ var _ = Describe("Builders", func() {
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/opensearch-project/opensearch-operator-busybox:latest"))
Expect(result.Spec.Template.Spec.InitContainers[0].Image).To(Equal("docker.io/busybox:latest"))
})
It("should use a custom dns name when env variable is set as cluster url", func() {
customDns := "custom.domain"
Expand Down Expand Up @@ -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"))
Expect(result.Spec.InitContainers[0].Image).To(Equal("mycustomrepo.cr/busybox:latest"))
})

It("should apply the BootstrapNodeConfig to the env variables", func() {
Expand Down
4 changes: 2 additions & 2 deletions opensearch-operator/pkg/helpers/reconcile-helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

func ResolveInitHelperImage(cr *opsterv1.OpenSearchCluster) (result opsterv1.ImageSpec) {
defaultRepo := "public.ecr.aws/opensearch-project"
defaultImage := "opensearch-operator-busybox"
defaultRepo := "docker.io"
defaultImage := "busybox"
defaultVersion := "latest"

// If a custom InitHelper image is specified, use it.
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-image-multi-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ docker ps | grep $BUILDER_NAME

# Build multi-arch images
PLATFORMS=`echo "${ARCHITECTURE_ARRAY[@]/#/linux/}" | sed 's/x64/amd64/g;s/ /,/g'` && echo PLATFORMS $PLATFORMS
docker buildx build --platform $PLATFORMS --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -t pgodithi/opensearchproject/$PRODUCT:${VERSION} -f $DOCKERFILE . --push
docker buildx build --platform $PLATFORMS --build-arg VERSION=$VERSION --build-arg BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` --build-arg NOTES=$NOTES -t opensearchstaging/$PRODUCT:${VERSION} -f $DOCKERFILE . --push

0 comments on commit 9f6d07f

Please sign in to comment.