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 27, 2024
1 parent 6089077 commit eab967b
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 172 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.

33 changes: 2 additions & 31 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Publish Release from tag"
on:
push:
tags:
- 'v*'
- '*'
jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -21,36 +21,7 @@ jobs:
- name: set Env
id: github-ver
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 ..
echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Make sure helm chart has correct versions
run: |
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
77 changes: 71 additions & 6 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 @@ -55,7 +54,6 @@ pipeline {
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 Down Expand Up @@ -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-busybox",
"-p ${OPERATOR_PRODUCT}"
].join(' ')
].join(' && ')),
Expand All @@ -121,5 +118,73 @@ pipeline {
}
}
}
stage('OpenSearch Operator') {
steps {
script {
def ref_final = "${GIT_REFERENCE}"
def ref_url = "${REPO_URL}/commit/${GIT_REFERENCE}"
if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) {
ref_final = "${ref}"
ref_url = "${REPO_URL}/releases/tag/${ref}"
println("Triggered by GitHub: ${ref_url}")

currentBuild.description = """GitHub: <a href="${ref_url}">${ref_url}</a>"""
}
else {
println("Triggered by User/Timer: ${ref_url}")
currentBuild.description = """User/Timer: <a href="${ref_url}">${ref_url}</a>"""
}

if (ref_final == null || ref_final == '') {
currentBuild.result = 'ABORTED'
error("Missing git tag reference.")
}

echo("Git checkout ${REPO_URL} on ${ref_final} for opensearch-operator-busybox release")
checkout scm
sh("git checkout ${ref_final}")

def OPERATOR_PRODUCT = "opensearch-operator"
def OPERATOR_VERSION = "$ref_final"

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

dockerBuild: {
build job: 'docker-build',
parameters: [
string(name: 'DOCKER_BUILD_GIT_REPOSITORY', value: "${REPO_URL}"),
string(name: 'DOCKER_BUILD_GIT_REPOSITORY_REFERENCE', value: "${ref_final}"),
string(name: 'DOCKER_BUILD_SCRIPT_WITH_COMMANDS', value: [
'ls -l',
'cd opensearch-operator',
[
'bash',
'../scripts/build-image-multi-arch.sh',
"-v ${OPERATOR_VERSION}",
"-a 'x64,arm,arm64'",
"-f Dockerfile",
"-p ${OPERATOR_PRODUCT}"
].join(' ')
].join(' && ')),
]
}
dockerPromotion: {
build job: 'docker-promotion',
parameters: [
string(name: 'SOURCE_IMAGES', value: '${OPERATOR_PRODUCT}:${OPERATOR_VERSION}'),
string(name: 'RELEASE_VERSION', value: "${OPERATOR_VERSION}"),
string(name: 'DOCKER_HUB_PROMOTE', value: true),
string(name: 'ECR_PROMOTE', value: true),
string(name: 'TAG_LATEST', value: true)
]
}
}
}
post {
always {
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
}
}
}
}
4 changes: 2 additions & 2 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/opensearch-operator-busybox:latest"))
})
It("should use InitHelper.Image as InitHelper image if configured", func() {
clusterObject := ClusterDescWithVersion("2.2.1")
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/opensearch-operator-busybox:latest"))
})

It("should apply the BootstrapNodeConfig to the env variables", func() {
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 eab967b

Please sign in to comment.