Skip to content

Instantly share code, notes, and snippets.

@isutton
Created June 28, 2021 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isutton/82f9c5ea608f4ec6488d34dcabc06fc9 to your computer and use it in GitHub Desktop.
Save isutton/82f9c5ea608f4ec6488d34dcabc06fc9 to your computer and use it in GitHub Desktop.

Acceptance Tests Locally on Fedora 34

The following procedure has been identified to consistently work.

Installing minikube

The first piece of the puzzle is minikube, which the latest version can be installed using the following commands:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

Minikube can use different drivers to provide its runtime, such as kvm2, docker and others. This document focuses on using the docker backend.

Install Docker

The following recipe installs the Docker CE provided by Docker, and adds the current logged-in user to the docker group created by the package:

sudo dnf config-manager \
    --add-repo \
    https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io
sudo systemctl enable --now docker

# Add the current user to the 'docker' group created above.
sudo usermod -a -G docker ${USER}

Install operator-sdk

export OPERATOR_SDK_VERSION="1.3.0"
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')

export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}
curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
sudo install operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk

Installing skopeo

skopeo is one of the tools required to build the Service Binding Operator bundle, and is available on Fedora's default repositories:

sudo dnf install -y skopeo

Installing umoci

umoci is other of the tools required to build the Service Binding Operator bundle, which can be installed using the recipe below:

export UMOCI_VERSION="0.4.7"
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export UMOCI_DL_URL="https://github.com/opencontainers/umoci/releases/download/v${UMOCI_VERSION}"

curl -LO ${UMOCI_DL_URL}/umoci.${ARCH}
sudo install umoci.${ARCH} /usr/local/bin/umoci

Installing Service Binding Operator

Once all the dependencies are available in the system, the following recipe will:

  • Build the operator's image using Minikube's registry.
  • Build the bundle's image, which requires the operator image to previously exist.
  • Push all the tags present locally to Minikube's registry.
  • Generate the out/release.yaml file with information extracted from the bundle image generated above.
  • Install and wait until cert-manager is rolled out, since it is a dependency for the operator to properly function in a later stage.
  • Install the operator and all its dependencies from the generated file out/release.yaml.
  • Wait for the operator to start and perform the acceptance tests.
rm out/release.yaml

eval $(minikube docker-env)

export KUBECONFIG=$HOME/.kube/config
export OPERATOR_REGISTRY="$(minikube ip):5000"
export TEST_ACCEPTANCE_CLI=kubectl
export TEST_ACCEPTANCE_START_SBO=remote
export SKIP_REGISTRY_LOGIN=true

make image -o push-image 
make bundle-image -o push-image

docker push -a "${OPERATOR_REGISTRY}/redhat-developer/servicebinding-operator"

make release-manifests 

make deploy-cert-manager
kubectl rollout status -n cert-manager deploy/cert-manager -w --timeout=120s

kubectl apply -f out/release.yaml
kubectl rollout status -n service-binding-operator deploy/service-binding-operator -w --timeout=60s

make TEST_ACCEPTANCE_START_SBO=remote test-acceptance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment