| //// |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| //// |
| |
| = OptaPlanner Operator (experimental) |
| |
| The OptaPlanner solver operator enables running OptaPlanner workloads on Kubernetes. |
| |
| *Please note that the OptaPlanner Operator is experimental. As such, it provides no guarantees |
| in terms of maturity and backward compatibility.* |
| |
| == Prerequisites |
| |
| === Get your environment running |
| |
| Use an existing OpenShift cluster or download and start either https://developers.redhat.com/products/codeready-containers/overview[RedHat CodeReady Containers] or https://minikube.sigs.k8s.io/docs/start/[Minikube] for a local development. |
| |
| === Install ArtemisCloud |
| |
| The OptaPlanner solver operator depends on ArtemisCloud for creating ActiveMQ queues. To install ArtemisCloud to Minikube or OpenShift and to create a new broker, follow the https://artemiscloud.io/docs/help/operator/[documentation]. |
| |
| NOTE: The ArtemisCloud operator by default watches for ActiveMQ broker and queue resources in the namespace it has been installed to. |
| |
| == Local development with Minikube |
| |
| . Run `mvn quarkus:dev` to start the solver operator locally. The operator will connect to the Kubernetes cluster you are logged in. |
| |
| [#deployToOpenShift] |
| == Deployment to OpenShift |
| |
| Login as a user with the `cluster-admin` role. |
| |
| [#deployOperator] |
| === Deploy the OptaPlanner Operator |
| |
| . Create the `optaplanner-operator` project by running `oc new-project optaplanner-operator`. |
| . Download the https://download.jboss.org/optaplanner/release/latestFinal[optaplanner-distribution]. |
| . Extract the archive and change directory to `extra/optaplanner-operator`. |
| . Apply the CRD by running `oc apply -f crd-solver.yml`. |
| . Apply the prepared deployment template by running `oc apply -f optaplanner-operator.yml`. |
| |
| == Try the OptaPlanner Operator |
| |
| === Create a solver custom resource |
| |
| The Solver custom resource describes the problem to be solved on Kubernetes and the infrastructure it requires. |
| |
| There is an example you can use by running either `kubectl apply -f src/k8s/school-timetabling-solver.yml -n <namespace>` (Minikube) or `oc apply -f src/k8s/school-timetabling-solver.yml` (OpenShift). |
| |
| To check the created resource, run `kubectl get solver -n <namespace>` (Minikube) or `oc get solver` (OpenShift). |