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.
- Make sure your system is installing the
v0.3.0
version of the Solr Operator, through the Helm chart, or other means. - Make sure your system is installing the
v0.2.9
version of the Zookeeper Operator. - Make sure the Solr resources you are installing are using the new
solr.apache.org
group and notsolr.bloomberg.com
. - Check if the Solr resources you are managing use any fields deprecated in
v0.2.x
versions, you can check for these in the Upgrade Notes.- If your resources contain these fields, replace them with their new locations.
Otherwise, your
kubectl apply
commands will fail when using thesolr.apache.org
CRDs.
- If your resources contain these fields, replace them with their new locations.
Otherwise, your
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.
- Remove the
v0.2.x
version of the Solr Operator that is running, unless you merely upgraded your existing deployment tov0.3.0
. - Remove any finalizers that the Solr Resources may contain, in all namespaces that you run Solr resources in.
- Remove the
solr.bloomberg.com
CRDs, as they are no longer needed when running thev0.3.0
version of the Solr Operator.
If you manually manage your cluster, then the instructions below will allow you to upgrade in-place.
- Make sure you have the latest Apache Solr Operator helm charts (If you use helm to deploy the Solr Operator)
helm repo add apache-solr https://solr.apache.org/charts helm repo update
- Upgrade to
v0.2.8
, if you are running a version lower.- If your Solr Operator deployment is managed with a Helm chart, merely upgrade your helm chart to version
0.2.8
- If your Solr Operator deployment is managed with a Helm chart, merely upgrade your helm chart to version
- Install the v0.2.8 Solr Operator CRDs
The Upgrade Notes page says to always upgrade CRDs before upgrading the operator, however for this single upgrade case this order is safer.
kubectl replace -f "https://solr.apache.org/operator/downloads/crds/v0.2.8/all.yaml"
- If you are using the ZK Operator
Remove the outdated Zookeeper Operator deployment and other resources. - Install the Apache Solr CRDs
If you are using the ZK Operator
kubectl create -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all.yaml"
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"
- Install the Apache Solr Operator
helm install apache apache-solr/solr-operator --version 0.3.0
- Convert
solr.bloomberg.com
resources intosolr.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 -
- Delete the
v0.2.8
Solr Operator deployment:# If solr-operator is the name of your v0.2.8 Solr Operator deployment helm delete solr-operator
- Remove any finalizers that the Solr Resources may contain, in all namespaces that you run Solr resources in.
- Remove the
solr.bloomberg.com
CRDs, as they are no longer needed when running thev0.3.0
version of the Solr Operator. - Test to make sure that your Solr resources exist as apache resources now and your
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