Please read the guide fully before attempting to upgrade your system.
There are many ways of managing what runs in your Kubernetes cluster. Therefore, we cannot give one definitive way of upgrading the Solr Operator and the Solr resources in your Cluster.
Below are guides based on how to upgrade, depending on the type of management that you use. Please look through all the instructions to see what will work best for your setup.
If you have an external system managing your cluster (e.g. Ansible, Helm, etc), then the steps you take to upgrade the Solr Operator may be very different.
v0.3.0
version of the Solr Operator, through the Helm chart, or other means.v0.2.9
version of the Zookeeper Operator.solr.apache.org
group and not solr.bloomberg.com
.v0.2.x
versions, you can check for these in the Upgrade Notes.
kubectl apply
commands will fail when using the solr.apache.org
CRDs.Once you have made sure that your declarative system is checked for the above points, you can run it to install the new version of the Solr Operator and all of your new CRDs.
Now you need to delete all the old solr.bloomberg.com
resources & operator.
v0.2.x
version of the Solr Operator that is running, unless you merely upgraded your existing deployment to v0.3.0
.solr.bloomberg.com
CRDs, as they are no longer needed when running the v0.3.0
version of the Solr Operator.If you manually manage your cluster, then the instructions below will allow you to upgrade in-place.
helm repo add apache-solr https://solr.apache.org/charts
helm repo update
v0.2.8
, if you are running a version lower.
0.2.8
kubectl replace -f "https://solr.apache.org/operator/downloads/crds/v0.2.8/all.yaml"
The Upgrade Notes page says to always upgrade CRDs before upgrading the operator, however for this single upgrade case this order is safer.
kubectl create -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all.yaml"
If you are using the ZK Operator
kubectl create -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all-with-dependencies.yaml" || \
kubectl replace -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all-with-dependencies.yaml"
helm install apache apache-solr/solr-operator --version 0.3.0
solr.bloomberg.com
resources into solr.apache.org
resources:
# First make sure that "yq" is installed
kubectl get solrclouds.solr.bloomberg.com --all-namespaces -o yaml | \
sed "s#solr.bloomberg.com#solr.apache.org#g" | \
yq eval 'del(.items.[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration", .items.[].metadata.managedFields, .items.[].metadata.resourceVersion, .items.[].metadata.creationTimestamp, .items.[].metadata.generation, .items.[].metadata.selfLink, .items.[].metadata.uid, .items.[].spec.solrPodPolicy, .items.[].spec.zookeeperRef.provided.image.tag, .items.[].status)' - \
| kubectl apply -f -
kubectl get solrprometheusexporters.solr.bloomberg.com --all-namespaces -o yaml | \
sed "s#solr.bloomberg.com#solr.apache.org#g" | \
yq eval 'del(.items.[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration", .items.[].metadata.managedFields, .items.[].metadata.resourceVersion, .items.[].metadata.creationTimestamp, .items.[].metadata.generation, .items.[].metadata.selfLink, .items.[].metadata.uid, .items.[].spec.podPolicy, .items.[].status)' - \
| kubectl apply -f -
kubectl get solrbackups.solr.bloomberg.com --all-namespaces -o yaml | \
sed "s#solr.bloomberg.com#solr.apache.org#g" | \
yq eval 'del(.items.[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration", .items.[].metadata.managedFields, .items.[].metadata.resourceVersion, .items.[].metadata.creationTimestamp, .items.[].metadata.generation, .items.[].metadata.selfLink, .items.[].metadata.uid, .items.[].status)' - \
| kubectl apply -f -
v0.2.8
Solr Operator deployment:
# If solr-operator is the name of your v0.2.8 Solr Operator deployment
helm delete solr-operator
solr.bloomberg.com
CRDs, as they are no longer needed when running the v0.3.0
version of the Solr Operator.StatefulSets
/Deployments
are still running correctly.The Zookeeper Operator version that the Solr Operator requires has changed between v0.2.6
and v0.3.0
.
Therefore, the Zookeeper Operator needs to be upgraded to v0.2.9
when the Solr Operator is upgraded to v0.3.0
.
If you use the Solr Operator Helm chart, then the correct version of the Zookeeper Operator will be deployed when upgrading. However, you will need to pre-emptively delete some Kubernetes resources so that they can be managed by Helm.
Only use the below kubectl
commands if you installed the Zookeeper Operator using the URL provided in the Solr Operator repository.
If you already have a v0.2.9
Zookeeper Operator running, ignore this and pass the following options when installing the Solr Operator:
--set zookeeper-operator.install=false --set zookeeper-operator.use=true
kubectl delete deployment zk-operator
kubectl delete clusterrolebinding zookeeper-operator-cluster-role-binding
kubectl delete clusterrole zookeeper-operator
kubectl delete serviceaccount zookeeper-operator
You will then be able to install the Solr Operator & dependency CRDs, and the Solr Operator Helm Chart.
It is necessary to remove any finalizers that the old solr.bloomberg.com
resources may have, otherwise they will not be able to be deleted.
You should do this for all namespaces that you are running solr resources in.
Only run these after stopping any v0.2.x
Solr Operator that may be running in the Kubernetes cluster.
kubectl get solrcollections.solr.bloomberg.com -o name | sed -e 's/.*\///g' | xargs -I {} kubectl patch solrcollections.solr.bloomberg.com {} --type='json' -p='[{"op": "remove", "path": "/metadata/finalizers/0"}]'
kubectl get solrcollectionaliases.solr.bloomberg.com -o name | sed -e 's/.*\///g' | xargs -I {} kubectl patch solrcollectionaliases.solr.bloomberg.com {} --type='json' -p='[{"op": "remove", "path": "/metadata/finalizers/0"}]'
kubectl get solrclouds.solr.bloomberg.com -o name | sed -e 's/.*\///g' | xargs -I {} kubectl patch solrclouds.solr.bloomberg.com {} --type='json' -p='[{"op": "remove", "path": "/metadata/finalizers/0"}]'
After you have removed all finalizers on Solr resources, you can remove all solr.bloomberg.com
CRDs.
If you don’t want to disrupt any Solr service that is running, make sure that all Solr resources have been upgraded from solr.bloomberg.com
CRDs to solr.apache.org
CRDs.
This command will delete all solr.bloomberg.com
resources, which means that only resources that exist as solr.apache.org
will continue to run afterwards.
kubectl delete crd solrclouds.solr.bloomberg.com solrprometheusexporters.solr.bloomberg.com solrbackups.solr.bloomberg.com solrcollections.solr.bloomberg.com solrcollectionaliases.solr.bloomberg.com