How to update redhat marketplace operators for directpv - cniackz/public GitHub Wiki

Script: /Users/cniackz/minio/olm-scripts/directpv/update-rhmp-directpv.sh

subl /Users/cniackz/minio/olm-scripts/directpv/update-rhmp-directpv.sh
cd /Users/cniackz/minio/olm-scripts/directpv; source update-rhmp-directpv.sh;
  1. Wait for Harsha to complete the release
  2. Clean and Reset your Operator Repository:
cd ~/operator
git clean -fd
git reset --hard HEAD
  1. Update your repository with latest code:
function updateForkedOperatorRepo() {
	git checkout master
	git remote add upstream [email protected]:minio/operator.git
	git fetch upstream
	git checkout master
	git rebase upstream/master
	echo "git push if all goes well"
}
  1. Then run olm.sh and then run olm-post-script.sh
# As a work around get working scripts from your repository
cp ~/minio/olm-scripts/olm.sh ~/operator/olm.sh
cp ~/minio/olm-scripts/olm-post-script.sh ~/operator/olm-post-script.sh

cd ~/operator
RELEASE=4.4.19
source olm.sh
source olm-post-script.sh
  1. Create the branch: update-minio-operator-<version>
cd ~/redhat-marketplace-operators
updateForkedRHMP
git push
git checkout -b update-minio-operator-4-4-19
  1. Copy files under operator/bundles/redhat-marketplace/<version> to create the pull request:
cp -R ~/operator/bundles/redhat-marketplace/<version> ~/redhat-marketplace-operators/operators/minio-operator-rhmp/<version>
  1. Add files:
git add operators/minio-operator-rhmp/4.4.18/
  1. The commit: operator minio-operator-rhmp (4.4.18)
git commit -m 'operator minio-operator-rhmp (4.4.18)'
  1. Push:
git push --set-upstream origin update-minio-operator-4-4-18
  1. Create pull request: https://github.com/redhat-openshift-ecosystem/redhat-marketplace-operators/pull/190

  2. Wait for any issue or PR to be merged

  3. If there is an issue debug, resolve and commit again.

PRs:

We need checklist checked when error in query-publishing-checklist:

Screen Shot 2022-08-17 at 1 03 28 PM

https://connect.redhat.com/projects/61765b6240a2d8e95c82d4d6/overview

Screen Shot 2022-08-17 at 1 02 49 PM

Things I additionally did:

  1. replica 1
  2. no securityContext
  3. v4.11 of Openshift supported
  4. Verify console and operator versions are ok for release (manual)

Errors:

  • get-supported-versions

https://github.com/redhat-openshift-ecosystem/redhat-marketplace-operators/pull/345

due to:

ValueError: OpenShift 4.7 has reached its end of life

File:

#!/bin/bash

# How to run the script:
# cd ~/minio/olm-scripts
# source update-redhat-marketplace-operator.sh
# As a result, the script will give you the URL to create the PR.

echo -n "Enter authorized GitHub user, like (cniackz): "
read GITHUBUSER

echo -n "Enter RELEASE, like (4.5.5): "
read RELEASE
echo "RELEASE: ${RELEASE}"
VERSION="${RELEASE//./-}"
echo "VERSION: ${VERSION}"

echo "Remove old repository"
rm -rf ~/operator
cd ~/
git clone [email protected]:$GITHUBUSER/operator.git

echo " "
echo "Update Forked Operator Repository"
cd ~/operator
git checkout master
git remote add upstream [email protected]:minio/operator.git
git fetch upstream
git checkout master
git rebase upstream/master
git push

echo " "
echo "Execute olm.sh and then olm-post-script.sh"
echo "As a work around get working scripts from your repository"
cp ~/minio/olm-scripts/olm.sh ~/operator/olm.sh
cp ~/minio/olm-scripts/olm-post-script.sh ~/operator/olm-post-script.sh
cd ~/operator
source olm.sh
source olm-post-script.sh

echo " "
echo "Create the branch:"
rm -rf ~/redhat-marketplace-operators
cd ~/
git clone [email protected]:$GITHUBUSER/redhat-marketplace-operators.git
cd ~/redhat-marketplace-operators
git checkout main
git remote add upstream [email protected]:redhat-openshift-ecosystem/redhat-marketplace-operators.git
git fetch upstream
git checkout main
git rebase upstream/main
git push
git checkout -b update-minio-operator-$VERSION

echo " "
echo "Copy the files from Operator Repo to RHMP Repo:"
cp -R ~/operator/bundles/redhat-marketplace/$RELEASE ~/redhat-marketplace-operators/operators/minio-operator-rhmp/$RELEASE






















































echo " "
echo " "
echo "========================================================================="
echo "Removing security context with yq from CSV"
echo "========================================================================="
echo " "
echo " "
yq -i eval 'del(.spec.install.spec.deployments[0].spec.template.spec.containers[0].securityContext)' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i eval 'del(.spec.install.spec.deployments[1].spec.template.spec.containers[0].securityContext)' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml













































































echo " "
echo " "
echo "========================================================================="
echo "To support Proper OpenShift Versions"
echo "========================================================================="
echo " "
echo " "
yq -i e '.annotations."com.redhat.openshift.versions" |= "v4.8-v4.12"' operators/minio-operator-rhmp/$RELEASE/metadata/annotations.yaml





















































































echo " "
echo " "
echo "========================================================================="
echo "One replica only for Code Ready Containers with one node"
echo "========================================================================="
echo " "
echo " "
yq -i e '.spec.install.spec.deployments[1].spec.replicas |= 1' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml





























echo " "
echo " "
echo "========================================================================="
echo "Use proper annotation"
echo "========================================================================="
echo " "
echo " "
yq -i eval 'del(.metadata.annotations."service.alpha.openshift.io/serving-cert-secret-name")' operators/minio-operator-rhmp/$RELEASE/manifests/operator_v1_service.yaml
yq -i eval '.metadata.annotations."service.beta.openshift.io/serving-cert-secret-name" |= "operator-tls"' operators/minio-operator-rhmp/$RELEASE/manifests/operator_v1_service.yaml











































































echo " "
echo " "
echo "========================================================================="
echo "Provide channel for upgrade:"
echo "========================================================================="
echo " "
echo " "
# Replacing multiple Operators
# https://access.redhat.com/documentation/en-us/openshift_container_platform/4.2/html/operators/understanding-the-operator-lifecycle-manager-olm#olm-upgrades_olm-understanding-olm
yq -i e '.metadata.annotations."olm.skipRange" |= "putversionrangehere"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
rm -rf ~/tmp
sed "s/putversionrangehere/'>=4.4.16 <${RELEASE}'/g" operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml > ~/tmp.yaml
rm operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
mv ~/tmp.yaml operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml





































































































echo " "
echo " "
echo "========================================================================="
echo "Support all architectures and OSes:"
echo "========================================================================="
echo " "
echo " "
# 24 architectures:
yq -i e '.spec.labels."operatorframework.io/arch.386" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.amd64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.amd64p32" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.arm" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.armbe" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.arm64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.arm64be" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.loong64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.mips" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.mipsle" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.mips64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.mips64le" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.mips64p32" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.mips64p32le" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.ppc" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.ppc64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.ppc64le" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.riscv" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.riscv64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.s390" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.s390x" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.sparc" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.sparc64" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/arch.wasm" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
# 17 OSes:
yq -i e '.spec.labels."operatorframework.io/os.aix" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.android" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.darwin" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.dragonfly" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.freebsd" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.hurd" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.illumos" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.ios" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.js" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.linux" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.nacl" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.netbsd" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.openbsd" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.plan9" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.solaris" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.windows" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml
yq -i e '.spec.labels."operatorframework.io/os.zos" |= "supported"' operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml












































































echo " "
echo " "
echo "========================================================================="
echo "Add files to Repo"
echo "========================================================================="
echo " "
echo " "
git add operators/minio-operator-rhmp/$RELEASE
git restore --staged operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml-e
git restore --staged operators/minio-operator-rhmp/$RELEASE/metadata/annotations.yaml-e
rm operators/minio-operator-rhmp/$RELEASE/manifests/minio-operator-rhmp.clusterserviceversion.yaml-e
rm operators/minio-operator-rhmp/$RELEASE/metadata/annotations.yaml-e





















































































































































































echo " "
echo "========================================================================="
echo "Review the Console vs Operator Version by looking at the repo and then at the yamls, they should match and this is manual"
echo "========================================================================="
echo "    b84261a847684e10f26f9d526b6ca71df9393c68656d4b60eb1cd934a7464450 <---------- Para consola en Operador 4.4.26/v0.19.1"
echo "    9dfef70fd62dfcdf4763d975943060f511853a1d0f2757cfda3117e1013fb139 <---------- Para consola en Operador 4.4.27/v0.19.3"
echo "    148331d40fd34a6b96a5f70acfd71e1d870b588a7b3ff6b646a0056d55ad5e9b <---------- Para consola en Operador 4.4.28/v0.19.4"
echo "    minio/console:v0.20.3 -> operator:v4.5.1"
echo " "





















































































echo " "
echo " "
echo "========================================================================="
echo "Commit the changes"
echo "========================================================================="
echo " "
echo " "
echo "git commit -m \"operator minio-operator-rhmp (${RELEASE})\""


















































































































echo " "
echo " "
echo "========================================================================="
echo "Push the changes"
echo "========================================================================="
echo " "
echo " "
echo "git push --set-upstream origin update-minio-operator-$VERSION"
echo " "
echo " "
echo " "
echo " "
echo " "
echo " "



























































































⚠️ **GitHub.com Fallback** ⚠️