Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new olm test #194

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions .github/workflows/nexus-operator-integration-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ jobs:
integration_tests:
name: Integration Tests
# we should wait for an ok from the other two
needs: [golint, unit_test]
runs-on: ubuntu-latest
env:
CLUSTER_NAME: operator-test
Expand Down Expand Up @@ -134,18 +133,11 @@ jobs:
- name: Install Operator SDK
run: |
./hack/ci/install-operator-sdk.sh
- name: Install KIND
run: |
./hack/ci/install-kind.sh
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Start KIND
run: ./hack/ci/start-kind.sh

- name: Generate Manifests
run: make bundle

- name: Build Operator Image
run: make operator-build BUILDER=docker

- name: Run Operator OLM Integration Test
run: make ci-olm-test
- name: Archive test results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: test-logs
path: /tmp/op-test/log.out
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL := /bin/bash
# Current Operator version
VERSION ?= 0.4.0
VERSION ?= 0.5.0
# Default bundle image tag
BUNDLE_IMG ?= controller-bundle:$(VERSION)
# Options for 'bundle-build'
Expand All @@ -18,7 +18,7 @@ IMG ?= controller:latest
CRD_OPTIONS ?= "crd:trivialVersions=true"

# Image URL for the operator final image
OPERATOR_IMG ?= quay.io/m88i/nexus-operator:$(VERSION)
OPERATOR_IMG ?= quay.io/kaitou786/nexus-operator:$(VERSION)
export OP_VERSION = $(VERSION)

BUILDER ?= podman
Expand Down Expand Up @@ -149,7 +149,7 @@ bundle-build:
#################### CUSTOM NEXUS OPERATOR TASKS ######################
# Run the OLM test on CI
ci-olm-test:
./hack/ci/load-operator-image.sh
#./hack/ci/load-operator-image.sh
./hack/ci/operator-olm-test.sh

.PHONY: pr-prep
Expand Down
28 changes: 14 additions & 14 deletions bundle/manifests/nexus-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ metadata:
capabilities: Seamless Upgrades
categories: Developer Tools
certified: "false"
containerImage: quay.io/m88i/nexus-operator:0.4.0
containerImage: quay.io/kaitou786/nexus-operator:0.5.0
createdAt: "2019-11-16T13:12:22Z"
description: Nexus Operator to deploy and manage Nexus 3.x servers
operators.operatorframework.io/builder: operator-sdk-v1.0.1
operators.operatorframework.io/project_layout: go.kubebuilder.io/v2
repository: https://github.com/m88i/nexus-operator
support: m88i Labs
tectonic-visibility: ocs
name: nexus-operator.v0.4.0
name: nexus-operator.v0.5.0
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -214,17 +214,6 @@ spec:
control-plane: controller-manager
spec:
containers:
- args:
- --metrics-addr=127.0.0.1:8080
- --enable-leader-election
command:
- /manager
image: quay.io/m88i/nexus-operator:0.4.0
name: manager
resources:
requests:
cpu: 100m
memory: 20Mi
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
Expand All @@ -236,6 +225,17 @@ spec:
- containerPort: 8443
name: https
resources: {}
- args:
- --metrics-addr=127.0.0.1:8080
- --enable-leader-election
command:
- /manager
image: quay.io/kaitou786/nexus-operator:0.5.0
name: manager
resources:
requests:
cpu: 100m
memory: 20Mi
terminationGracePeriodSeconds: 10
permissions:
- rules:
Expand Down Expand Up @@ -302,4 +302,4 @@ spec:
provider:
name: m88i Labs
replaces: nexus-operator.v0.3.0
version: 0.4.0
version: 0.5.0
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/m88i/nexus-operator
newTag: 0.4.0
newName: quay.io/kaitou786/nexus-operator
newTag: 0.5.0
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Developer Tools
certified: "false"
containerImage: quay.io/m88i/nexus-operator:0.4.0
containerImage: quay.io/kaitou786/nexus-operator:0.5.0
createdAt: "2019-11-16T13:12:22Z"
description: Nexus Operator to deploy and manage Nexus 3.x servers
operators.operatorframework.io/builder: operator-sdk-v1.0.1
Expand Down
14 changes: 7 additions & 7 deletions hack/ci/operator-ensure-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ mkdir -p "${OUTPUT}"
rm -rf ~/operators/
git clone --depth 1 --filter=blob:none https://github.com/operator-framework/community-operators.git ~/operators/

cp -r ~/operators/community-operators/nexus-operator-m88i "${OUTPUT}"
cp -r ~/operators/community-operators/ "${OUTPUT}"
rm -rf ~/operators/

mkdir -p "${OUTPUT}/nexus-operator-m88i/${OP_VERSION}"
cp -v "./bundle/manifests/apps.m88i.io_nexus.yaml" "${OUTPUT}/nexus-operator-m88i/${OP_VERSION}/apps.m88i.io_nexus_crd.yaml"
cp -v "./bundle/manifests/nexus-operator.clusterserviceversion.yaml" "${OUTPUT}/nexus-operator-m88i/${OP_VERSION}/nexus-operator.v${OP_VERSION}.clusterserviceversion.yaml"
cp -v "./bundle/nexus-operator-m88i.package.yaml" "${OUTPUT}/nexus-operator-m88i/"
mkdir -p "${OUTPUT}/community-operators/nexus-operator-m88i/${OP_VERSION}"
cp -v "./bundle/manifests/apps.m88i.io_nexus.yaml" "${OUTPUT}/community-operators/nexus-operator-m88i/${OP_VERSION}/apps.m88i.io_nexus_crd.yaml"
cp -v "./bundle/manifests/nexus-operator.clusterserviceversion.yaml" "${OUTPUT}/community-operators/nexus-operator-m88i/${OP_VERSION}/nexus-operator.v${OP_VERSION}.clusterserviceversion.yaml"
cp -v "./bundle/nexus-operator-m88i.package.yaml" "${OUTPUT}/community-operators/nexus-operator-m88i/"

sed -i "s/{version}/${OP_VERSION}/g" "${OUTPUT}/nexus-operator-m88i/nexus-operator-m88i.package.yaml"
sed -i "s/{version}/${OP_VERSION}/g" "${OUTPUT}/community-operators/nexus-operator-m88i/nexus-operator-m88i.package.yaml"

echo "---> Manifest files in the output directory for OLM verification"
ls -la "${OUTPUT}/nexus-operator-m88i/"
ls -la "${OUTPUT}/community-operators/nexus-operator-m88i/"
35 changes: 7 additions & 28 deletions hack/ci/operator-olm-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,11 @@
source ./hack/verify-version.sh
source ./hack/ci/operator-ensure-manifest.sh

CATALOG_IMAGE="operatorhubio-catalog:temp"
OP_PATH="community-operators/nexus-operator-m88i"
INSTALL_MODE="SingleNamespace"
OPERATOR_TESTING_IMAGE="quay.io/operator-framework/operator-testing:latest"

if [ -z ${KUBECONFIG} ]; then
KUBECONFIG=${HOME}/.kube/config
echo "---> KUBECONFIG environment variable not set, defining to:"
ls -la ${KUBECONFIG}
fi

csv_file=${OUTPUT}/nexus-operator-m88i/${OP_VERSION}/nexus-operator.v${OP_VERSION}.clusterserviceversion.yaml
echo "---> Updating CSV file '${csv_file}' to imagePullPolicy: Never"
sed -i 's/imagePullPolicy: Always/imagePullPolicy: Never/g' ${csv_file}
echo "---> Resulting imagePullPolicy on manifest files"
grep -rn imagePullPolicy ${OUTPUT}/nexus-operator-m88i

echo "---> Building temporary catalog Image"
docker build --build-arg PERMISSIVE_LOAD=false -f ./hack/ci/operatorhubio-catalog.Dockerfile -t ${CATALOG_IMAGE} .
echo "---> Loading Catalog Image into Kind"
kind load docker-image ${CATALOG_IMAGE} --name ${CLUSTER_NAME}

# running tests
docker pull ${OPERATOR_TESTING_IMAGE}
docker run --network=host --rm \
-v ${KUBECONFIG}:/root/.kube/config:z \
-v ${OUTPUT}:/community-operators:z ${OPERATOR_TESTING_IMAGE} \
operator.test --no-print-directory \
OP_PATH=${OP_PATH} VERBOSE=true NO_KIND=0 CATALOG_IMAGE=${CATALOG_IMAGE} INSTALL_MODE=${INSTALL_MODE}
OP_TEST_DEBUG=2
echo "===============>"
echo ${OUTPUT}/community-operators/nexus-operator-m88i/${OP_VERSION}
ls -l ${OUTPUT}/community-operators/nexus-operator-m88i/${OP_VERSION}
bash <(curl -sL https://cutt.ly/operator-test) \
lemon \
${OUTPUT}/community-operators/nexus-operator-m88i/${OP_VERSION}
2 changes: 1 addition & 1 deletion hack/verify-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.


if [ -z "${OP_VERSION}"]; then
if [ -z "${OP_VERSION}" ]; then
echo "---> Operator version not defined. Export OP_VERSION variable or call this script from the Makefile"
exit 1
fi