diff --git a/optaplanner-operator/.gitignore b/optaplanner-operator/.gitignore deleted file mode 100644 index 701bc2cf636..00000000000 --- a/optaplanner-operator/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -/target -/local - -# Eclipse, Netbeans and IntelliJ files -/.* -!.gitignore -/nbproject -/*.ipr -/*.iws -/*.iml diff --git a/optaplanner-operator/README.adoc b/optaplanner-operator/README.adoc deleted file mode 100644 index c70561523ef..00000000000 --- a/optaplanner-operator/README.adoc +++ /dev/null @@ -1,65 +0,0 @@ -//// -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 ` (Minikube) or `oc apply -f src/k8s/school-timetabling-solver.yml` (OpenShift). - -To check the created resource, run `kubectl get solver -n ` (Minikube) or `oc get solver` (OpenShift). diff --git a/optaplanner-operator/pom.xml b/optaplanner-operator/pom.xml deleted file mode 100644 index beadd0623b8..00000000000 --- a/optaplanner-operator/pom.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - org.optaplanner - optaplanner-build-parent - 10.0.999-SNAPSHOT - ../build/optaplanner-build-parent/pom.xml - - 4.0.0 - - optaplanner-operator - [Experimental] OptaPlanner Operator - - OptaPlanner solves planning problems. - This lightweight, embeddable planning engine implements powerful and scalable algorithms - to optimize business resource scheduling and planning. - - This module contains an operator that enables running OptaPlanner workloads on Kubernetes. - - https://www.optaplanner.org - - - org.optaplanner.operator - - - - - io.quarkiverse.operatorsdk - quarkus-operator-sdk - - - io.quarkus - quarkus-container-image-jib - - - - - - - io.quarkus - quarkus-junit5 - test - - - io.quarkus - quarkus-junit5-mockito - test - - - io.quarkus - quarkus-test-kubernetes-client - test - - - org.awaitility - awaitility - test - - - org.assertj - assertj-core - test - - - - - - - src/main/resources - true - - **/application.properties - - - - src/k8s - true - - crd-solver.yml - optaplanner-operator.yml - - ${project.build.directory}/install - - - - - - io.quarkus - quarkus-maven-plugin - ${version.io.quarkus} - true - - - - build - generate-code - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-dependency-plugin - - - - analyze-only - - false - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - org.jboss.logmanager.LogManager - - - - - - - - native - - - native - - - - - - maven-failsafe-plugin - - - - integration-test - verify - - - - ${project.build.directory}/${project.build.finalName}-runner - - - - - - - - - native - - - - - openshift - - - openshift - - - - openshift - - - - io.quarkus - quarkus-openshift - - - - - - image - - - operator.image.build - - - - image - - - - io.quarkus - quarkus-container-image-jib - - - - - - diff --git a/optaplanner-operator/src/k8s/crd-solver.yml b/optaplanner-operator/src/k8s/crd-solver.yml deleted file mode 100644 index d2317401a84..00000000000 --- a/optaplanner-operator/src/k8s/crd-solver.yml +++ /dev/null @@ -1,2798 +0,0 @@ -# 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. -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: solvers.org.optaplanner.solver -spec: - group: org.optaplanner.solver - names: - kind: Solver - plural: solvers - singular: solver - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - template: - properties: - metadata: - properties: - generateName: - type: string - deletionGracePeriodSeconds: - type: integer - deletionTimestamp: - type: string - clusterName: - type: string - resourceVersion: - type: string - annotations: - additionalProperties: - type: string - type: object - selfLink: - type: string - creationTimestamp: - type: string - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - ownerReferences: - items: - properties: - blockOwnerDeletion: - type: boolean - uid: - type: string - apiVersion: - type: string - name: - type: string - kind: - type: string - controller: - type: boolean - type: object - type: array - uid: - type: string - generation: - type: integer - name: - type: string - managedFields: - items: - properties: - time: - type: string - apiVersion: - type: string - fieldsV1: - type: object - fieldsType: - type: string - manager: - type: string - operation: - type: string - subresource: - type: string - type: object - type: array - namespace: - type: string - type: object - spec: - properties: - volumes: - items: - properties: - hostPath: - properties: - path: - type: string - type: - type: string - type: object - flexVolume: - properties: - readOnly: - type: boolean - options: - additionalProperties: - type: string - type: object - secretRef: - properties: - name: - type: string - type: object - fsType: - type: string - driver: - type: string - type: object - gcePersistentDisk: - properties: - readOnly: - type: boolean - pdName: - type: string - partition: - type: integer - fsType: - type: string - type: object - ephemeral: - properties: - volumeClaimTemplate: - properties: - metadata: - properties: - generateName: - type: string - deletionGracePeriodSeconds: - type: integer - deletionTimestamp: - type: string - clusterName: - type: string - resourceVersion: - type: string - annotations: - additionalProperties: - type: string - type: object - selfLink: - type: string - creationTimestamp: - type: string - finalizers: - items: - type: string - type: array - labels: - additionalProperties: - type: string - type: object - ownerReferences: - items: - properties: - blockOwnerDeletion: - type: boolean - uid: - type: string - apiVersion: - type: string - name: - type: string - kind: - type: string - controller: - type: boolean - type: object - type: array - uid: - type: string - generation: - type: integer - name: - type: string - managedFields: - items: - properties: - time: - type: string - apiVersion: - type: string - fieldsV1: - type: object - fieldsType: - type: string - manager: - type: string - operation: - type: string - subresource: - type: string - type: object - type: array - namespace: - type: string - type: object - spec: - properties: - selector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - storageClassName: - type: string - dataSource: - properties: - name: - type: string - kind: - type: string - apiGroup: - type: string - type: object - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - dataSourceRef: - properties: - name: - type: string - kind: - type: string - apiGroup: - type: string - type: object - accessModes: - items: - type: string - type: array - volumeMode: - type: string - volumeName: - type: string - type: object - type: object - type: object - scaleIO: - properties: - readOnly: - type: boolean - storageMode: - type: string - storagePool: - type: string - system: - type: string - gateway: - type: string - secretRef: - properties: - name: - type: string - type: object - fsType: - type: string - sslEnabled: - type: boolean - volumeName: - type: string - protectionDomain: - type: string - type: object - csi: - properties: - nodePublishSecretRef: - properties: - name: - type: string - type: object - readOnly: - type: boolean - volumeAttributes: - additionalProperties: - type: string - type: object - fsType: - type: string - driver: - type: string - type: object - secret: - properties: - optional: - type: boolean - secretName: - type: string - items: - items: - properties: - path: - type: string - key: - type: string - mode: - type: integer - type: object - type: array - defaultMode: - type: integer - type: object - name: - type: string - vsphereVolume: - properties: - storagePolicyName: - type: string - storagePolicyID: - type: string - volumePath: - type: string - fsType: - type: string - type: object - gitRepo: - properties: - revision: - type: string - repository: - type: string - directory: - type: string - type: object - glusterfs: - properties: - path: - type: string - readOnly: - type: boolean - endpoints: - type: string - type: object - nfs: - properties: - path: - type: string - readOnly: - type: boolean - server: - type: string - type: object - cinder: - properties: - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - fsType: - type: string - volumeID: - type: string - type: object - flocker: - properties: - datasetUUID: - type: string - datasetName: - type: string - type: object - quobyte: - properties: - group: - type: string - readOnly: - type: boolean - volume: - type: string - user: - type: string - registry: - type: string - tenant: - type: string - type: object - photonPersistentDisk: - properties: - pdID: - type: string - fsType: - type: string - type: object - persistentVolumeClaim: - properties: - readOnly: - type: boolean - claimName: - type: string - type: object - awsElasticBlockStore: - properties: - readOnly: - type: boolean - partition: - type: integer - fsType: - type: string - volumeID: - type: string - type: object - configMap: - properties: - optional: - type: boolean - items: - items: - properties: - path: - type: string - key: - type: string - mode: - type: integer - type: object - type: array - defaultMode: - type: integer - name: - type: string - type: object - storageos: - properties: - readOnly: - type: boolean - volumeNamespace: - type: string - secretRef: - properties: - name: - type: string - type: object - fsType: - type: string - volumeName: - type: string - type: object - portworxVolume: - properties: - readOnly: - type: boolean - fsType: - type: string - volumeID: - type: string - type: object - iscsi: - properties: - readOnly: - type: boolean - chapAuthSession: - type: boolean - lun: - type: integer - targetPortal: - type: string - iscsiInterface: - type: string - portals: - items: - type: string - type: array - initiatorName: - type: string - secretRef: - properties: - name: - type: string - type: object - fsType: - type: string - iqn: - type: string - chapAuthDiscovery: - type: boolean - type: object - rbd: - properties: - readOnly: - type: boolean - pool: - type: string - keyring: - type: string - image: - type: string - secretRef: - properties: - name: - type: string - type: object - monitors: - items: - type: string - type: array - fsType: - type: string - user: - type: string - type: object - azureFile: - properties: - readOnly: - type: boolean - secretName: - type: string - shareName: - type: string - type: object - downwardAPI: - properties: - items: - items: - properties: - path: - type: string - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - resource: - type: string - type: object - mode: - type: integer - type: object - type: array - defaultMode: - type: integer - type: object - projected: - properties: - defaultMode: - type: integer - sources: - items: - properties: - secret: - properties: - optional: - type: boolean - items: - items: - properties: - path: - type: string - key: - type: string - mode: - type: integer - type: object - type: array - name: - type: string - type: object - configMap: - properties: - optional: - type: boolean - items: - items: - properties: - path: - type: string - key: - type: string - mode: - type: integer - type: object - type: array - name: - type: string - type: object - serviceAccountToken: - properties: - path: - type: string - audience: - type: string - expirationSeconds: - type: integer - type: object - downwardAPI: - properties: - items: - items: - properties: - path: - type: string - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - resource: - type: string - type: object - mode: - type: integer - type: object - type: array - type: object - type: object - type: array - type: object - azureDisk: - properties: - readOnly: - type: boolean - diskName: - type: string - cachingMode: - type: string - fsType: - type: string - kind: - type: string - diskURI: - type: string - type: object - cephfs: - properties: - path: - type: string - readOnly: - type: boolean - secretRef: - properties: - name: - type: string - type: object - monitors: - items: - type: string - type: array - secretFile: - type: string - user: - type: string - type: object - emptyDir: - properties: - sizeLimit: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - medium: - type: string - type: object - fc: - properties: - readOnly: - type: boolean - lun: - type: integer - wwids: - items: - type: string - type: array - targetWWNs: - items: - type: string - type: array - fsType: - type: string - type: object - type: object - type: array - restartPolicy: - type: string - terminationGracePeriodSeconds: - type: integer - setHostnameAsFQDN: - type: boolean - dnsConfig: - properties: - nameservers: - items: - type: string - type: array - searches: - items: - type: string - type: array - options: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - type: object - securityContext: - properties: - runAsGroup: - type: integer - runAsNonRoot: - type: boolean - windowsOptions: - properties: - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - gmsaCredentialSpec: - type: string - runAsUserName: - type: string - type: object - sysctls: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - fsGroupChangePolicy: - type: string - seLinuxOptions: - properties: - role: - type: string - type: - type: string - user: - type: string - level: - type: string - type: object - fsGroup: - type: integer - supplementalGroups: - items: - type: integer - type: array - runAsUser: - type: integer - seccompProfile: - properties: - type: - type: string - localhostProfile: - type: string - type: object - type: object - imagePullSecrets: - items: - properties: - name: - type: string - type: object - type: array - subdomain: - type: string - serviceAccount: - type: string - activeDeadlineSeconds: - type: integer - priority: - type: integer - ephemeralContainers: - items: - properties: - lifecycle: - properties: - postStart: - properties: - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - preStop: - properties: - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - type: object - command: - items: - type: string - type: array - livenessProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - stdin: - type: boolean - image: - type: string - targetContainerName: - type: string - terminationMessagePolicy: - type: string - readinessProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - terminationMessagePath: - type: string - env: - items: - properties: - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - resource: - type: string - type: object - secretKeyRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - type: object - name: - type: string - type: object - type: array - tty: - type: boolean - args: - items: - type: string - type: array - startupProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - stdinOnce: - type: boolean - ports: - items: - properties: - containerPort: - type: integer - hostPort: - type: integer - name: - type: string - protocol: - type: string - hostIP: - type: string - type: object - type: array - workingDir: - type: string - envFrom: - items: - properties: - prefix: - type: string - configMapRef: - properties: - optional: - type: boolean - name: - type: string - type: object - secretRef: - properties: - optional: - type: boolean - name: - type: string - type: object - type: object - type: array - volumeMounts: - items: - properties: - readOnly: - type: boolean - subPathExpr: - type: string - mountPath: - type: string - mountPropagation: - type: string - subPath: - type: string - name: - type: string - type: object - type: array - securityContext: - properties: - runAsGroup: - type: integer - runAsNonRoot: - type: boolean - windowsOptions: - properties: - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - gmsaCredentialSpec: - type: string - runAsUserName: - type: string - type: object - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - seLinuxOptions: - properties: - role: - type: string - type: - type: string - user: - type: string - level: - type: string - type: object - readOnlyRootFilesystem: - type: boolean - privileged: - type: boolean - runAsUser: - type: integer - procMount: - type: string - seccompProfile: - properties: - type: - type: string - localhostProfile: - type: string - type: object - type: object - name: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - imagePullPolicy: - type: string - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - type: object - type: array - type: object - type: array - automountServiceAccountToken: - type: boolean - containers: - items: - properties: - lifecycle: - properties: - postStart: - properties: - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - preStop: - properties: - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - type: object - command: - items: - type: string - type: array - livenessProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - stdin: - type: boolean - image: - type: string - terminationMessagePolicy: - type: string - readinessProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - terminationMessagePath: - type: string - env: - items: - properties: - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - resource: - type: string - type: object - secretKeyRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - type: object - name: - type: string - type: object - type: array - tty: - type: boolean - args: - items: - type: string - type: array - startupProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - stdinOnce: - type: boolean - ports: - items: - properties: - containerPort: - type: integer - hostPort: - type: integer - name: - type: string - protocol: - type: string - hostIP: - type: string - type: object - type: array - workingDir: - type: string - envFrom: - items: - properties: - prefix: - type: string - configMapRef: - properties: - optional: - type: boolean - name: - type: string - type: object - secretRef: - properties: - optional: - type: boolean - name: - type: string - type: object - type: object - type: array - volumeMounts: - items: - properties: - readOnly: - type: boolean - subPathExpr: - type: string - mountPath: - type: string - mountPropagation: - type: string - subPath: - type: string - name: - type: string - type: object - type: array - securityContext: - properties: - runAsGroup: - type: integer - runAsNonRoot: - type: boolean - windowsOptions: - properties: - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - gmsaCredentialSpec: - type: string - runAsUserName: - type: string - type: object - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - seLinuxOptions: - properties: - role: - type: string - type: - type: string - user: - type: string - level: - type: string - type: object - readOnlyRootFilesystem: - type: boolean - privileged: - type: boolean - runAsUser: - type: integer - procMount: - type: string - seccompProfile: - properties: - type: - type: string - localhostProfile: - type: string - type: object - type: object - name: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - imagePullPolicy: - type: string - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - type: object - type: array - type: object - type: array - initContainers: - items: - properties: - lifecycle: - properties: - postStart: - properties: - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - preStop: - properties: - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - type: object - command: - items: - type: string - type: array - livenessProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - stdin: - type: boolean - image: - type: string - terminationMessagePolicy: - type: string - readinessProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - terminationMessagePath: - type: string - env: - items: - properties: - value: - type: string - valueFrom: - properties: - configMapKeyRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - fieldRef: - properties: - apiVersion: - type: string - fieldPath: - type: string - type: object - resourceFieldRef: - properties: - containerName: - type: string - divisor: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - resource: - type: string - type: object - secretKeyRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - type: object - name: - type: string - type: object - type: array - tty: - type: boolean - args: - items: - type: string - type: array - startupProbe: - properties: - periodSeconds: - type: integer - failureThreshold: - type: integer - initialDelaySeconds: - type: integer - grpc: - properties: - port: - type: integer - service: - type: string - type: object - successThreshold: - type: integer - terminationGracePeriodSeconds: - type: integer - tcpSocket: - properties: - host: - type: string - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - timeoutSeconds: - type: integer - exec: - properties: - command: - items: - type: string - type: array - type: object - httpGet: - properties: - path: - type: string - scheme: - type: string - host: - type: string - httpHeaders: - items: - properties: - value: - type: string - name: - type: string - type: object - type: array - port: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - stdinOnce: - type: boolean - ports: - items: - properties: - containerPort: - type: integer - hostPort: - type: integer - name: - type: string - protocol: - type: string - hostIP: - type: string - type: object - type: array - workingDir: - type: string - envFrom: - items: - properties: - prefix: - type: string - configMapRef: - properties: - optional: - type: boolean - name: - type: string - type: object - secretRef: - properties: - optional: - type: boolean - name: - type: string - type: object - type: object - type: array - volumeMounts: - items: - properties: - readOnly: - type: boolean - subPathExpr: - type: string - mountPath: - type: string - mountPropagation: - type: string - subPath: - type: string - name: - type: string - type: object - type: array - securityContext: - properties: - runAsGroup: - type: integer - runAsNonRoot: - type: boolean - windowsOptions: - properties: - gmsaCredentialSpecName: - type: string - hostProcess: - type: boolean - gmsaCredentialSpec: - type: string - runAsUserName: - type: string - type: object - allowPrivilegeEscalation: - type: boolean - capabilities: - properties: - add: - items: - type: string - type: array - drop: - items: - type: string - type: array - type: object - seLinuxOptions: - properties: - role: - type: string - type: - type: string - user: - type: string - level: - type: string - type: object - readOnlyRootFilesystem: - type: boolean - privileged: - type: boolean - runAsUser: - type: integer - procMount: - type: string - seccompProfile: - properties: - type: - type: string - localhostProfile: - type: string - type: object - type: object - name: - type: string - resources: - properties: - limits: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - type: object - imagePullPolicy: - type: string - volumeDevices: - items: - properties: - devicePath: - type: string - name: - type: string - type: object - type: array - type: object - type: array - priorityClassName: - type: string - tolerations: - items: - properties: - key: - type: string - operator: - type: string - tolerationSeconds: - type: integer - value: - type: string - effect: - type: string - type: object - type: array - hostPID: - type: boolean - os: - properties: - name: - type: string - type: object - serviceAccountName: - type: string - shareProcessNamespace: - type: boolean - hostNetwork: - type: boolean - hostname: - type: string - nodeSelector: - additionalProperties: - type: string - type: object - enableServiceLinks: - type: boolean - affinity: - properties: - podAntiAffinity: - properties: - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - namespaces: - items: - type: string - type: array - topologyKey: - type: string - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - type: object - type: array - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - namespaces: - items: - type: string - type: array - topologyKey: - type: string - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - type: object - weight: - type: integer - type: object - type: array - type: object - nodeAffinity: - properties: - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - weight: - type: integer - preference: - properties: - matchFields: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - type: object - type: object - type: array - requiredDuringSchedulingIgnoredDuringExecution: - properties: - nodeSelectorTerms: - items: - properties: - matchFields: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - type: object - type: array - type: object - type: object - podAffinity: - properties: - requiredDuringSchedulingIgnoredDuringExecution: - items: - properties: - namespaces: - items: - type: string - type: array - topologyKey: - type: string - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - type: object - type: array - preferredDuringSchedulingIgnoredDuringExecution: - items: - properties: - podAffinityTerm: - properties: - namespaces: - items: - type: string - type: array - topologyKey: - type: string - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - namespaceSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - type: object - weight: - type: integer - type: object - type: array - type: object - type: object - readinessGates: - items: - properties: - conditionType: - type: string - type: object - type: array - dnsPolicy: - type: string - hostIPC: - type: boolean - topologySpreadConstraints: - items: - properties: - topologyKey: - type: string - maxSkew: - type: integer - whenUnsatisfiable: - type: string - labelSelector: - properties: - matchExpressions: - items: - properties: - key: - type: string - values: - items: - type: string - type: array - operator: - type: string - type: object - type: array - matchLabels: - additionalProperties: - type: string - type: object - type: object - type: object - type: array - overhead: - additionalProperties: - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - type: object - schedulerName: - type: string - nodeName: - type: string - preemptionPolicy: - type: string - hostAliases: - items: - properties: - hostnames: - items: - type: string - type: array - ip: - type: string - type: object - type: array - runtimeClassName: - type: string - type: object - type: object - amqBroker: - properties: - port: - type: integer - managementHost: - type: string - host: - type: string - usernameSecretRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - managementPort: - type: integer - passwordSecretRef: - properties: - optional: - type: boolean - key: - type: string - name: - type: string - type: object - brokerName: - type: string - type: object - scaling: - properties: - dynamic: - type: boolean - replicas: - type: integer - type: object - type: object - status: - properties: - outputMessageAddress: - type: string - inputMessageAddress: - type: string - conditions: - items: - properties: - status: - type: string - reason: - type: string - lastTransitionTime: - type: string - observedGeneration: - type: integer - type: - type: string - message: - type: string - type: object - type: array - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/optaplanner-operator/src/k8s/openshift.yml b/optaplanner-operator/src/k8s/openshift.yml deleted file mode 100644 index 9f277c402d0..00000000000 --- a/optaplanner-operator/src/k8s/openshift.yml +++ /dev/null @@ -1,322 +0,0 @@ -# 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. ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - annotations: - app.openshift.io/vcs-url: <> - app.quarkus.io/commit-id: 9d9d867ae972619cd29012a4a8ffb5e5c4fdb368 - app.quarkus.io/build-timestamp: 2022-05-03 - 17:27:05 +0000 - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - app.openshift.io/runtime: quarkus - name: optaplanner-operator ---- -apiVersion: v1 -kind: Service -metadata: - annotations: - app.openshift.io/vcs-url: <> - app.quarkus.io/commit-id: 9d9d867ae972619cd29012a4a8ffb5e5c4fdb368 - app.quarkus.io/build-timestamp: 2022-05-03 - 17:27:05 +0000 - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - app.openshift.io/runtime: quarkus - name: optaplanner-operator -spec: - ports: - - name: http - port: 80 - targetPort: 8080 - selector: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - type: ClusterIP ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - name: optaplanner-operator-view -roleRef: - kind: ClusterRole - apiGroup: rbac.authorization.k8s.io - name: view -subjects: - - kind: ServiceAccount - name: optaplanner-operator ---- -apiVersion: image.openshift.io/v1 -kind: ImageStream -metadata: - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - name: openjdk-17 -spec: - dockerImageRepository: registry.access.redhat.com/ubi8/openjdk-17 ---- -apiVersion: image.openshift.io/v1 -kind: ImageStream -metadata: - annotations: - app.openshift.io/vcs-url: <> - app.quarkus.io/commit-id: 9d9d867ae972619cd29012a4a8ffb5e5c4fdb368 - app.quarkus.io/build-timestamp: 2022-05-03 - 17:27:05 +0000 - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - app.openshift.io/runtime: quarkus - name: optaplanner-operator -spec: {} ---- -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - annotations: - app.openshift.io/vcs-url: <> - app.quarkus.io/commit-id: 9d9d867ae972619cd29012a4a8ffb5e5c4fdb368 - app.quarkus.io/build-timestamp: 2022-05-03 - 17:27:05 +0000 - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - app.openshift.io/runtime: quarkus - name: optaplanner-operator -spec: - output: - to: - kind: ImageStreamTag - name: optaplanner-operator:latest - source: - binary: {} - strategy: - sourceStrategy: - from: - kind: ImageStreamTag - name: openjdk-11:1.11 ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: josdk-crd-validating-cluster-role -rules: - - apiGroups: - - apiextensions.k8s.io - resources: - - customresourcedefinitions - verbs: - - get - - list ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: optaplanner-solver-cluster-role -rules: - - apiGroups: - - "" - resources: - - deployments - - services - - configmaps - - pods - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "apps" - resources: - - deployments - - services - - configmaps - - pods - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "org.optaplanner.solver" - resources: - - solvers - - solvers/status - - solvers/finalizers - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "broker.amq.io" - resources: - - activemqartemisaddresses - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "broker.amq.io" - resources: - - activemqartemisaddresses - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "keda.sh" - resources: - - scaledobjects - - scaledobjects/status - - triggerauthentications - verbs: - - get - - list - - watch - - create - - delete - - patch - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: optaplanner-solver-cluster-role-binding -roleRef: - kind: ClusterRole - apiGroup: rbac.authorization.k8s.io - name: optaplanner-solver-cluster-role -subjects: - - kind: ServiceAccount - name: optaplanner-operator - namespace: optaplanner-operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: optaplanner-solver-crd-validating-role-binding -roleRef: - kind: ClusterRole - apiGroup: rbac.authorization.k8s.io - name: josdk-crd-validating-cluster-role -subjects: - - kind: ServiceAccount - name: optaplanner-operator - namespace: optaplanner-operator ---- -apiVersion: apps.openshift.io/v1 -kind: DeploymentConfig -metadata: - annotations: - app.openshift.io/vcs-url: <> - app.quarkus.io/commit-id: 9d9d867ae972619cd29012a4a8ffb5e5c4fdb368 - app.quarkus.io/build-timestamp: 2022-05-03 - 17:27:05 +0000 - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - app.openshift.io/runtime: quarkus - name: optaplanner-operator -spec: - replicas: 1 - selector: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - template: - metadata: - annotations: - app.openshift.io/vcs-url: <> - app.quarkus.io/commit-id: 9d9d867ae972619cd29012a4a8ffb5e5c4fdb368 - app.quarkus.io/build-timestamp: 2022-05-03 - 17:27:05 +0000 - labels: - app.kubernetes.io/name: optaplanner-operator - app.kubernetes.io/version: latest - app.openshift.io/runtime: quarkus - spec: - containers: - - command: - - java - - -Dquarkus.http.host=0.0.0.0 - - -Djava.util.logging.manager=org.jboss.logmanager.LogManager - - -jar - - /deployments/quarkus-run.jar - env: - - name: KUBERNETES_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: JAVA_APP_JAR - value: /deployments/optaplanner-operator-1.0-SNAPSHOT-runner.jar - image: optaplanner-operator/optaplanner-operator:latest - imagePullPolicy: IfNotPresent - livenessProbe: - failureThreshold: 3 - httpGet: - path: /q/health/live - port: 8080 - scheme: HTTP - initialDelaySeconds: 0 - periodSeconds: 30 - successThreshold: 1 - timeoutSeconds: 10 - name: optaplanner-operator - ports: - - containerPort: 8080 - name: http - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /q/health/ready - port: 8080 - scheme: HTTP - initialDelaySeconds: 0 - periodSeconds: 30 - successThreshold: 1 - timeoutSeconds: 10 - serviceAccountName: optaplanner-operator - triggers: - - imageChangeParams: - automatic: true - containerNames: - - optaplanner-operator - from: - kind: ImageStreamTag - name: optaplanner-operator:latest - type: ImageChange diff --git a/optaplanner-operator/src/k8s/optaplanner-operator.yml b/optaplanner-operator/src/k8s/optaplanner-operator.yml deleted file mode 100644 index 6d1cd200bd8..00000000000 --- a/optaplanner-operator/src/k8s/optaplanner-operator.yml +++ /dev/null @@ -1,219 +0,0 @@ -# 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. ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - app: optaplanner-operator - name: optaplanner-operator ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: optaplanner-operator - name: optaplanner-operator -spec: - ports: - - name: http - port: 80 - targetPort: 8080 - selector: - app: optaplanner-operator - type: ClusterIP ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: optaplanner-operator-view -roleRef: - kind: ClusterRole - apiGroup: rbac.authorization.k8s.io - name: view -subjects: - - kind: ServiceAccount - name: optaplanner-operator - namespace: optaplanner-operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: josdk-crd-validating-cluster-role - namespace: optaplanner-operator -rules: - - apiGroups: - - apiextensions.k8s.io - resources: - - customresourcedefinitions - verbs: - - get - - list ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: optaplanner-solver-cluster-role -rules: - - apiGroups: - - "" - resources: - - deployments - - services - - configmaps - - pods - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "apps" - resources: - - deployments - - services - - configmaps - - pods - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "org.optaplanner.solver" - resources: - - solvers - - solvers/status - - solvers/finalizers - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "broker.amq.io" - resources: - - activemqartemisaddresses - verbs: - - get - - list - - watch - - create - - delete - - patch - - update - - apiGroups: - - "keda.sh" - resources: - - scaledobjects - - scaledobjects/status - - triggerauthentications - verbs: - - get - - list - - watch - - create - - delete - - patch - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: optaplanner-solver-cluster-role-binding -roleRef: - kind: ClusterRole - apiGroup: rbac.authorization.k8s.io - name: optaplanner-solver-cluster-role -subjects: - - kind: ServiceAccount - name: optaplanner-operator - namespace: optaplanner-operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: optaplanner-solver-crd-validating-role-binding -roleRef: - kind: ClusterRole - apiGroup: rbac.authorization.k8s.io - name: josdk-crd-validating-cluster-role -subjects: - - kind: ServiceAccount - name: optaplanner-operator - namespace: optaplanner-operator ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: optaplanner-operator - name: optaplanner-operator -spec: - replicas: 1 - selector: - matchLabels: - app: optaplanner-operator - template: - metadata: - labels: - app: optaplanner-operator - namespace: optaplanner-operator - spec: - containers: - - env: - - name: KUBERNETES_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - image: quay.io/optaplanner/optaplanner-operator:${project.version} - imagePullPolicy: Always - livenessProbe: - failureThreshold: 3 - httpGet: - path: /q/health/live - port: 8080 - scheme: HTTP - initialDelaySeconds: 0 - periodSeconds: 30 - successThreshold: 1 - timeoutSeconds: 10 - name: optaplanner-operator - ports: - - containerPort: 8080 - name: http - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /q/health/ready - port: 8080 - scheme: HTTP - initialDelaySeconds: 0 - periodSeconds: 30 - successThreshold: 1 - timeoutSeconds: 10 - serviceAccountName: optaplanner-operator diff --git a/optaplanner-operator/src/k8s/school-timetabling-solver.yml b/optaplanner-operator/src/k8s/school-timetabling-solver.yml deleted file mode 100644 index 8d58dff59de..00000000000 --- a/optaplanner-operator/src/k8s/school-timetabling-solver.yml +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -# Example solver resource; override as you see fit. -apiVersion: org.optaplanner.solver/v1alpha1 -kind: Solver -metadata: - name: school-timetabling -spec: - amqBroker: - host: ex-aao-amqp-0-svc.demo.svc.cluster.local - port: 5672 - managementHost: ex-aao-hdls-svc.demo.svc.cluster.local - usernameSecretRef: - key: AMQ_USER - name: ex-aao-credentials-secret - passwordSecretRef: - key: AMQ_PASSWORD - name: ex-aao-credentials-secret - template: - spec: - containers: - - name: school-timetabling - image: quay.io/example/school-timetabling:latest - scaling: - dynamic: true - replicas: 3 diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/OptaPlannerSolverReconciler.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/OptaPlannerSolverReconciler.java deleted file mode 100644 index d3946a4b250..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/OptaPlannerSolverReconciler.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver; - -import java.util.Map; -import java.util.Optional; - -import jakarta.inject.Inject; - -import org.optaplanner.operator.impl.solver.model.ConfigMapDependentResource; -import org.optaplanner.operator.impl.solver.model.DeploymentDependentResource; -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolver; -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolverStatus; -import org.optaplanner.operator.impl.solver.model.keda.ScaledObjectDependentResource; -import org.optaplanner.operator.impl.solver.model.keda.TriggerAuthenticationDependentResource; -import org.optaplanner.operator.impl.solver.model.messaging.ArtemisQueue; -import org.optaplanner.operator.impl.solver.model.messaging.ArtemisQueueDependentResource; -import org.optaplanner.operator.impl.solver.model.messaging.MessageAddress; - -import io.fabric8.kubernetes.client.KubernetesClient; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.api.reconciler.ControllerConfiguration; -import io.javaoperatorsdk.operator.api.reconciler.ErrorStatusHandler; -import io.javaoperatorsdk.operator.api.reconciler.ErrorStatusUpdateControl; -import io.javaoperatorsdk.operator.api.reconciler.EventSourceContext; -import io.javaoperatorsdk.operator.api.reconciler.EventSourceInitializer; -import io.javaoperatorsdk.operator.api.reconciler.Reconciler; -import io.javaoperatorsdk.operator.api.reconciler.ResourceIDMatcherDiscriminator; -import io.javaoperatorsdk.operator.api.reconciler.UpdateControl; -import io.javaoperatorsdk.operator.processing.event.ResourceID; -import io.javaoperatorsdk.operator.processing.event.source.EventSource; -import io.quarkiverse.operatorsdk.runtime.QuarkusConfigurationService; - -@ControllerConfiguration(name = "optaplanner-solver") -public final class OptaPlannerSolverReconciler implements Reconciler, ErrorStatusHandler, - EventSourceInitializer { - - private KubernetesClient kubernetesClient; - - private final DeploymentDependentResource deploymentDependentResource; - private final ArtemisQueueDependentResource inputQueueDependentResource; - private final ArtemisQueueDependentResource outputQueueDependentResource; - private final ConfigMapDependentResource configMapDependentResource; - private final TriggerAuthenticationDependentResource triggerAuthenticationDependentResource; - private final ScaledObjectDependentResource scaledObjectDependentResource; - - @Inject - QuarkusConfigurationService configurationService; - - @Inject - public OptaPlannerSolverReconciler() { - - deploymentDependentResource = new DeploymentDependentResource(); - inputQueueDependentResource = new ArtemisQueueDependentResource(MessageAddress.INPUT); - outputQueueDependentResource = new ArtemisQueueDependentResource(MessageAddress.OUTPUT); - configMapDependentResource = new ConfigMapDependentResource(); - triggerAuthenticationDependentResource = new TriggerAuthenticationDependentResource(); - scaledObjectDependentResource = new ScaledObjectDependentResource(); - - inputQueueDependentResource.setResourceDiscriminator(new ResourceIDMatcherDiscriminator<>( - optaPlannerSolver -> new ResourceID(optaPlannerSolver.getInputMessageAddressName(), - optaPlannerSolver.getMetadata().getNamespace()))); - outputQueueDependentResource.setResourceDiscriminator(new ResourceIDMatcherDiscriminator<>( - optaPlannerSolver -> new ResourceID(optaPlannerSolver.getOutputMessageAddressName(), - optaPlannerSolver.getMetadata().getNamespace()))); - } - - @Override - public Map prepareEventSources(EventSourceContext context) { - return EventSourceInitializer.nameEventSources(deploymentDependentResource.initEventSource(context), - inputQueueDependentResource.initEventSource(context), - outputQueueDependentResource.initEventSource(context), - configMapDependentResource.initEventSource(context), - triggerAuthenticationDependentResource.initEventSource(context), - scaledObjectDependentResource.initEventSource(context)); - } - - @Override - public UpdateControl reconcile(OptaPlannerSolver solver, Context context) { - boolean isReady = true; - deploymentDependentResource.reconcile(solver, context); - inputQueueDependentResource.reconcile(solver, context); - outputQueueDependentResource.reconcile(solver, context); - if (solver.getSpec().getScaling().isDynamic()) { - triggerAuthenticationDependentResource.reconcile(solver, context); - scaledObjectDependentResource.reconcile(solver, context); - - if (scaledObjectDependentResource.getSecondaryResource(solver, context).isEmpty() || - triggerAuthenticationDependentResource.getSecondaryResource(solver, context).isEmpty()) { - isReady = false; - } - } - - Optional inputQueue = inputQueueDependentResource.getSecondaryResource(solver, context); - Optional outputQueue = outputQueueDependentResource.getSecondaryResource(solver, context); - if (inputQueue.isEmpty() || outputQueue.isEmpty()) { - isReady = false; - } - - if (inputQueue.isPresent() && outputQueue.isPresent()) { - configMapDependentResource.reconcile(solver, context); - if (configMapDependentResource.getSecondaryResource(solver, context).isEmpty()) { - isReady = false; - } - } - - if (isReady) { - solver.setStatus(OptaPlannerSolverStatus.ready(solver.getMetadata().getGeneration())); - solver.getStatus().setInputMessageAddress(inputQueue.get().getSpec().getQueueName()); - solver.getStatus().setOutputMessageAddress(outputQueue.get().getSpec().getQueueName()); - } else { - solver.setStatus(OptaPlannerSolverStatus.unknown(solver.getMetadata().getGeneration())); - } - return UpdateControl.updateStatus(solver); - } - - @Override - public ErrorStatusUpdateControl updateErrorStatus(OptaPlannerSolver solver, - Context context, Exception e) { - solver.setStatus(OptaPlannerSolverStatus.error(solver.getMetadata().getGeneration(), e)); - return ErrorStatusUpdateControl.updateStatus(solver); - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/AmqBroker.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/AmqBroker.java deleted file mode 100644 index 168e220a665..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/AmqBroker.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import io.fabric8.kubernetes.api.model.SecretKeySelector; - -public final class AmqBroker { - - private static final int DEFAULT_PORT = 5672; - - private static final int DEFAULT_MANAGEMENT_PORT = 8161; - - // TODO: Try to detect. - private static final String DEFAULT_BROKER_NAME = "amq-broker"; - - private String host; - - private int port = DEFAULT_PORT; - - private String managementHost; - - private int managementPort = DEFAULT_MANAGEMENT_PORT; - - private String brokerName = DEFAULT_BROKER_NAME; - - private SecretKeySelector usernameSecretRef; - - private SecretKeySelector passwordSecretRef; - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public String getManagementHost() { - return managementHost; - } - - public void setManagementHost(String managementHost) { - this.managementHost = managementHost; - } - - public int getManagementPort() { - return managementPort; - } - - public void setManagementPort(int managementPort) { - this.managementPort = managementPort; - } - - public String getBrokerName() { - return brokerName; - } - - public void setBrokerName(String brokerName) { - this.brokerName = brokerName; - } - - public SecretKeySelector getUsernameSecretRef() { - return usernameSecretRef; - } - - public void setUsernameSecretRef(SecretKeySelector usernameSecretRef) { - this.usernameSecretRef = usernameSecretRef; - } - - public SecretKeySelector getPasswordSecretRef() { - return passwordSecretRef; - } - - public void setPasswordSecretRef(SecretKeySelector passwordSecretRef) { - this.passwordSecretRef = passwordSecretRef; - } - - @JsonIgnore - public String getManagementEndpoint() { - return String.format("%s:%s", managementHost, managementPort); - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/ConfigMapDependentResource.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/ConfigMapDependentResource.java deleted file mode 100644 index cb8ed095416..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/ConfigMapDependentResource.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import java.util.HashMap; -import java.util.Map; - -import io.fabric8.kubernetes.api.model.ConfigMap; -import io.fabric8.kubernetes.api.model.ConfigMapBuilder; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent; - -@KubernetesDependent -public final class ConfigMapDependentResource extends CRUDKubernetesDependentResource { - - public static final String SOLVER_MESSAGE_INPUT_KEY = "solver.message.input"; - public static final String SOLVER_MESSAGE_OUTPUT_KEY = "solver.message.output"; - public static final String SOLVER_MESSAGE_AMQ_HOST_KEY = "solver.amq.host"; - public static final String SOLVER_MESSAGE_AMQ_PORT_KEY = "solver.amq.port"; - - public ConfigMapDependentResource() { - super(ConfigMap.class); - } - - @Override - protected ConfigMap desired(OptaPlannerSolver solver, Context context) { - Map data = new HashMap<>(); - data.put(SOLVER_MESSAGE_INPUT_KEY, solver.getInputMessageAddressName()); - data.put(SOLVER_MESSAGE_OUTPUT_KEY, solver.getOutputMessageAddressName()); - data.put(SOLVER_MESSAGE_AMQ_HOST_KEY, solver.getSpec().getAmqBroker().getHost()); - data.put(SOLVER_MESSAGE_AMQ_PORT_KEY, String.valueOf(solver.getSpec().getAmqBroker().getPort())); - - return new ConfigMapBuilder() - .withNewMetadata() - .withName(solver.getConfigMapName()) - .withNamespace(solver.getNamespace()) - .endMetadata() - .withData(data) - .build(); - } - - @Override - public ConfigMap update(ConfigMap actual, ConfigMap target, OptaPlannerSolver solver, Context context) { - ConfigMap resultingConfigMap = super.update(actual, target, solver, context); - String namespace = actual.getMetadata().getNamespace(); - context.getClient() - .pods() - .inNamespace(namespace) - .withLabel("app", solver.getMetadata().getName()) - .delete(); - return resultingConfigMap; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/DeploymentDependentResource.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/DeploymentDependentResource.java deleted file mode 100644 index b78f4bffc04..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/DeploymentDependentResource.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import io.fabric8.kubernetes.api.model.Container; -import io.fabric8.kubernetes.api.model.EnvVar; -import io.fabric8.kubernetes.api.model.EnvVarBuilder; -import io.fabric8.kubernetes.api.model.PodTemplateSpec; -import io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder; -import io.fabric8.kubernetes.api.model.SecretKeySelector; -import io.fabric8.kubernetes.api.model.apps.Deployment; -import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder; -import io.fabric8.kubernetes.api.model.apps.DeploymentSpecBuilder; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent; - -@KubernetesDependent -public final class DeploymentDependentResource extends CRUDKubernetesDependentResource { - - private static final String ENV_SOLVER_MESSAGE_IN = "SOLVER_MESSAGE_INPUT"; - private static final String ENV_SOLVER_MESSAGE_OUT = "SOLVER_MESSAGE_OUTPUT"; - private static final String ENV_AMQ_HOST = "SOLVER_MESSAGE_AMQ_HOST"; - private static final String ENV_AMQ_PORT = "SOLVER_MESSAGE_AMQ_PORT"; - private static final String ENV_AMQ_USERNAME = "SOLVER_MESSAGE_AMQ_USERNAME"; - private static final String ENV_AMQ_PASSWORD = "SOLVER_MESSAGE_AMQ_PASSWORD"; - - public DeploymentDependentResource() { - super(Deployment.class); - } - - @Override - protected Deployment desired(OptaPlannerSolver solver, Context context) { - String deploymentName = solver.getDeploymentName(); - - DeploymentSpecBuilder deploymentSpecBuilder = new DeploymentSpecBuilder() - .withNewSelector().withMatchLabels(Map.of("app", deploymentName)) - .endSelector(); - if (!solver.getSpec().getScaling().isDynamic()) { - // Set deployment replicas only for static scaling, otherwise the operator would interfere with KEDA. - deploymentSpecBuilder.withReplicas(solver.getSpec().getScaling().getReplicas()); - } - - PodTemplateSpec podTemplateSpec = solver.getSpec().getTemplate(); - if (podTemplateSpec == null) { - throw new IllegalStateException("Solver (" + solver.getMetadata().getName() + ") pod template is missing." - + "\nMaybe check the related " + solver.getFullResourceName() + " resource."); - } - - PodTemplateSpec updatedPodTemplateSpec = addPodAppLabel(podTemplateSpec, deploymentName); - if (updatedPodTemplateSpec.getSpec() == null || updatedPodTemplateSpec.getSpec().getContainers() == null - || updatedPodTemplateSpec.getSpec().getContainers().isEmpty()) { - throw new IllegalStateException("Solver (" + solver.getMetadata().getName() - + ") pod template does not contain any container." - + "\nMaybe check the related " + solver.getFullResourceName() + " resource."); - } - List containers = updatedPodTemplateSpec.getSpec().getContainers(); - // There may be multiple containers; add the environment variables to all of them. - for (Container container : containers) { - if (container.getEnv() == null) { - container.setEnv(new ArrayList<>()); - } - container.getEnv().addAll(buildEnvironmentVariablesMapping(solver)); - } - - deploymentSpecBuilder.withTemplate(updatedPodTemplateSpec); - return new DeploymentBuilder() - .withNewMetadata() - .withName(deploymentName) - .withNamespace(solver.getNamespace()) - .endMetadata() - .withSpec(deploymentSpecBuilder.build()) - .build(); - } - - private PodTemplateSpec addPodAppLabel(PodTemplateSpec podTemplateSpec, String deploymentName) { - return new PodTemplateSpecBuilder(podTemplateSpec) - .editOrNewMetadata() - .addToLabels("app", deploymentName) - .endMetadata() - .build(); - } - - private List buildEnvironmentVariablesMapping(OptaPlannerSolver solver) { - String configMapName = solver.getConfigMapName(); - EnvVar envVarMessageInput = buildEnvVarFromConfigMap(ENV_SOLVER_MESSAGE_IN, configMapName, - ConfigMapDependentResource.SOLVER_MESSAGE_INPUT_KEY); - - EnvVar envVarMessageOutput = buildEnvVarFromConfigMap(ENV_SOLVER_MESSAGE_OUT, configMapName, - ConfigMapDependentResource.SOLVER_MESSAGE_OUTPUT_KEY); - - EnvVar envVarAmqHost = buildEnvVarFromConfigMap(ENV_AMQ_HOST, configMapName, - ConfigMapDependentResource.SOLVER_MESSAGE_AMQ_HOST_KEY); - - EnvVar envVarAmqPort = buildEnvVarFromConfigMap(ENV_AMQ_PORT, configMapName, - ConfigMapDependentResource.SOLVER_MESSAGE_AMQ_PORT_KEY); - - EnvVar envVarAmqUsername = buildEnvVarFromSecretKeySelector(ENV_AMQ_USERNAME, - solver.getSpec().getAmqBroker().getUsernameSecretRef()); - - EnvVar envVarAmqPassword = buildEnvVarFromSecretKeySelector(ENV_AMQ_PASSWORD, - solver.getSpec().getAmqBroker().getPasswordSecretRef()); - - return List.of(envVarMessageInput, envVarMessageOutput, envVarAmqHost, envVarAmqPort, envVarAmqUsername, - envVarAmqPassword); - } - - private EnvVar buildEnvVarFromConfigMap(String envVariable, String configMapName, String configMapKey) { - return new EnvVarBuilder() - .withName(envVariable) - .withNewValueFrom() - .withNewConfigMapKeyRef(configMapKey, configMapName, false) - .endValueFrom() - .build(); - } - - private EnvVar buildEnvVarFromSecretKeySelector(String envVariable, SecretKeySelector secretKeySelector) { - return new EnvVarBuilder() - .withName(envVariable) - .withNewValueFrom() - .withNewSecretKeyRef(secretKeySelector.getKey(), secretKeySelector.getName(), secretKeySelector.getOptional()) - .endValueFrom() - .build(); - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolver.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolver.java deleted file mode 100644 index 66b5dad0869..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolver.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import org.optaplanner.operator.impl.solver.model.messaging.MessageAddress; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -import io.fabric8.kubernetes.api.model.Namespaced; -import io.fabric8.kubernetes.client.CustomResource; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Kind; -import io.fabric8.kubernetes.model.annotation.Plural; -import io.fabric8.kubernetes.model.annotation.Singular; -import io.fabric8.kubernetes.model.annotation.Version; - -@Group(OptaPlannerSolver.GROUP) -@Plural(OptaPlannerSolver.PLURAL) -@Singular(OptaPlannerSolver.SINGULAR) -@Version(OptaPlannerSolver.API_VERSION) -@Kind(OptaPlannerSolver.KIND) -public final class OptaPlannerSolver extends CustomResource - implements Namespaced { - public static final String GROUP = "org.optaplanner.solver"; - public static final String PLURAL = "solvers"; - public static final String SINGULAR = "solver"; - public static final String API_VERSION = "v1alpha1"; - public static final String KIND = "Solver"; - - @Override - protected OptaPlannerSolverStatus initStatus() { - return new OptaPlannerSolverStatus(); - } - - // TODO: Move all the following methods away if this class ever becomes an API. - @JsonIgnore - public String getNamespace() { - return getMetadata().getNamespace(); - } - - @JsonIgnore - public String getConfigMapName() { - return getSolverName(); - } - - @JsonIgnore - public String getDeploymentName() { - return getSolverName(); - } - - @JsonIgnore - public String getInputMessageAddressName() { - return getMessageAddressName(MessageAddress.INPUT); - } - - @JsonIgnore - public String getOutputMessageAddressName() { - return getMessageAddressName(MessageAddress.OUTPUT); - } - - @JsonIgnore - public String getMessageAddressName(MessageAddress messageAddress) { - return String.format("%s-%s", getSolverName(), messageAddress.getName()); - } - - @JsonIgnore - public String getTriggerAuthenticationName() { - return getSolverName(); - } - - @JsonIgnore - public String getScaledObjectName() { - return getSolverName(); - } - - @JsonIgnore - public String getScaledObjectTriggerName() { - return getSolverName(); - } - - @JsonIgnore - private String getSolverName() { - return getMetadata().getName(); - } - -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolverSpec.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolverSpec.java deleted file mode 100644 index 4db8b00d70e..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolverSpec.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import io.fabric8.kubernetes.api.model.PodTemplateSpec; - -public final class OptaPlannerSolverSpec { - private AmqBroker amqBroker; - private Scaling scaling = new Scaling(); - private PodTemplateSpec template; - - public Scaling getScaling() { - return scaling; - } - - public void setScaling(Scaling scaling) { - this.scaling = scaling; - } - - public AmqBroker getAmqBroker() { - return amqBroker; - } - - public void setAmqBroker(AmqBroker amqBroker) { - this.amqBroker = amqBroker; - } - - public PodTemplateSpec getTemplate() { - return template; - } - - public void setTemplate(PodTemplateSpec template) { - this.template = template; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolverStatus.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolverStatus.java deleted file mode 100644 index 6898a29c68e..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/OptaPlannerSolverStatus.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -import io.fabric8.kubernetes.api.model.Condition; -import io.fabric8.kubernetes.api.model.ConditionBuilder; - -/* - For more details about the Status and Conditions, see - https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties - */ -public final class OptaPlannerSolverStatus { - - public static final String CONDITION_TYPE_READY = "Ready"; - private static final String CONDITION_REASON_IN_PROGRESS = "InProgress"; - - private static final String CONDITION_REASON_SOLVER_READY = "SolverReady"; - - /** - * @return the current timestamp in ISO 8601 format, e.g. "2022-09-02T12:36:10.571Z". - */ - private static String currentTimestamp() { - return ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT); - } - - public static OptaPlannerSolverStatus unknown(Long generation) { - OptaPlannerSolverStatus optaPlannerSolverStatus = new OptaPlannerSolverStatus(); - Condition condition = new ConditionBuilder() - .withLastTransitionTime(currentTimestamp()) - .withObservedGeneration(generation) - .withReason(CONDITION_REASON_IN_PROGRESS) - .withStatus(ConditionStatus.UNKNOWN.getName()) - .withType(CONDITION_TYPE_READY) - .build(); - optaPlannerSolverStatus.setConditions(List.of(condition)); - return optaPlannerSolverStatus; - } - - public static OptaPlannerSolverStatus ready(Long generation) { - OptaPlannerSolverStatus optaPlannerSolverStatus = new OptaPlannerSolverStatus(); - Condition condition = new ConditionBuilder() - .withLastTransitionTime(currentTimestamp()) - .withObservedGeneration(generation) - .withStatus(ConditionStatus.TRUE.getName()) - .withReason(CONDITION_REASON_SOLVER_READY) - .withType(CONDITION_TYPE_READY) - .build(); - optaPlannerSolverStatus.setConditions(List.of(condition)); - return optaPlannerSolverStatus; - } - - public static OptaPlannerSolverStatus error(Long generation, Throwable error) { - OptaPlannerSolverStatus optaPlannerSolverStatus = new OptaPlannerSolverStatus(); - Condition condition = new ConditionBuilder() - .withLastTransitionTime(currentTimestamp()) - .withObservedGeneration(generation) - .withStatus(ConditionStatus.FALSE.getName()) - .withType(CONDITION_TYPE_READY) - .withReason(error.getClass().getSimpleName()) - .withMessage(error.getMessage()) - .build(); - optaPlannerSolverStatus.setConditions(List.of(condition)); - return optaPlannerSolverStatus; - } - - public enum ConditionStatus { - UNKNOWN("Unknown"), - TRUE("True"), - FALSE("False"); - - private final String name; - - ConditionStatus(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - private List conditions; - - private String inputMessageAddress; - private String outputMessageAddress; - - public OptaPlannerSolverStatus() { - // required by Jackson - } - - public String getInputMessageAddress() { - return inputMessageAddress; - } - - public void setInputMessageAddress(String inputMessageAddress) { - this.inputMessageAddress = inputMessageAddress; - } - - public String getOutputMessageAddress() { - return outputMessageAddress; - } - - public void setOutputMessageAddress(String outputMessageAddress) { - this.outputMessageAddress = outputMessageAddress; - } - - public List getConditions() { - return conditions; - } - - public void setConditions(List conditions) { - this.conditions = conditions; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/Scaling.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/Scaling.java deleted file mode 100644 index 1a43d70dbd5..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/Scaling.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -public final class Scaling { - - private boolean dynamic = false; - - private int replicas = 1; - - public Scaling() { - // Required by Jackson - } - - public Scaling(boolean dynamic, int replicas) { - this.dynamic = dynamic; - this.replicas = replicas; - } - - public boolean isDynamic() { - return dynamic; - } - - public int getReplicas() { - return replicas; - } - - public void setDynamic(boolean dynamic) { - this.dynamic = dynamic; - } - - public void setReplicas(int replicas) { - this.replicas = replicas; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/common/ResourceNameReference.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/common/ResourceNameReference.java deleted file mode 100644 index 3a3fdb7e135..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/common/ResourceNameReference.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.common; - -public final class ResourceNameReference { - - private String name; - - public ResourceNameReference() { - // Required by Jackson. - } - - public ResourceNameReference(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/KedaConstants.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/KedaConstants.java deleted file mode 100644 index 89b0fda853f..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/KedaConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -final class KedaConstants { - - static final String GROUP = "keda.sh"; - - static final String API_VERSION = "v1alpha1"; - - private KedaConstants() { - throw new UnsupportedOperationException("This class should not be instantiated"); - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObject.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObject.java deleted file mode 100644 index 305b7101997..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObject.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import io.fabric8.kubernetes.api.model.Namespaced; -import io.fabric8.kubernetes.client.CustomResource; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Kind; -import io.fabric8.kubernetes.model.annotation.Version; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Group(KedaConstants.GROUP) -@Version(KedaConstants.API_VERSION) -@Kind(ScaledObject.KIND) -public final class ScaledObject extends CustomResource - implements Namespaced { - - public static final String KIND = "ScaledObject"; - - @JsonIgnoreProperties(ignoreUnknown = true) - static class ScaledObjectStatus { - // Not interested in the status of this resource. - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectDependentResource.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectDependentResource.java deleted file mode 100644 index d5b0f8f3966..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectDependentResource.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import org.optaplanner.operator.impl.solver.model.AmqBroker; -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolver; -import org.optaplanner.operator.impl.solver.model.common.ResourceNameReference; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent; - -/* -Example YAML: ------------------------------------------ -apiVersion: keda.sh/v1alpha1 -kind: ScaledObject -metadata: - name: school-timetabling-scaledobject - namespace: artemis -spec: - scaleTargetRef: - name: school-timetabling-activemq - triggers: - - type: artemis-queue - name: school-timetabling-trigger - metadata: - managementEndpoint: "ex-aao-hdls-svc.artemis.svc.cluster.local:8161" - queueName: "school-timetabling-problem" - queueLength: "1" - brokerName: "amq-broker" - brokerAddress: "school-timetabling-problem" - authenticationRef: - name: school-timetabling-scaledobject-auth - cooldownPeriod: 10 - maxReplicaCount: 3 - minReplicaCount: 0 - pollingInterval: 10 -*/ - -@KubernetesDependent -public final class ScaledObjectDependentResource extends CRUDKubernetesDependentResource { - - public static final String ARTEMIS_QUEUE_TRIGGER = "artemis-queue"; - - /** - * Required to scale down to zero pods. - */ - private static final int MIN_REPLICAS = 0; - private static final int POLLING_INTERVAL = 10; - private static final int COOLDOWN_PERIOD = 10; - - /** - * The scaler increases replicas if the queue message count is greater than this value per active replica. - */ - private static final int TARGET_QUEUE_LENGTH = 1; - - public ScaledObjectDependentResource() { - super(ScaledObject.class); - } - - @Override - protected ScaledObject desired(OptaPlannerSolver optaPlannerSolver, Context context) { - AmqBroker amqBroker = optaPlannerSolver.getSpec().getAmqBroker(); - - TriggerMetadata triggerMetadata = new TriggerMetadata(); - triggerMetadata.setBrokerAddress(optaPlannerSolver.getInputMessageAddressName()); - triggerMetadata.setQueueName(optaPlannerSolver.getInputMessageAddressName()); - triggerMetadata.setQueueLength(String.valueOf(TARGET_QUEUE_LENGTH)); - triggerMetadata.setBrokerName(amqBroker.getBrokerName()); - triggerMetadata.setManagementEndpoint(amqBroker.getManagementEndpoint()); - - Trigger trigger = new Trigger(); - trigger.setType(ARTEMIS_QUEUE_TRIGGER); - trigger.setMetadata(triggerMetadata); - trigger.setName(optaPlannerSolver.getScaledObjectTriggerName()); - trigger.setAuthenticationRef(new ResourceNameReference(optaPlannerSolver.getTriggerAuthenticationName())); - - ScaledObjectSpec spec = new ScaledObjectSpec(); - spec.withTrigger(trigger); - spec.setScaleTargetRef(new ResourceNameReference(optaPlannerSolver.getDeploymentName())); - spec.setMinReplicaCount(MIN_REPLICAS); - spec.setMaxReplicaCount(optaPlannerSolver.getSpec().getScaling().getReplicas()); - spec.setPollingInterval(POLLING_INTERVAL); - spec.setCooldownPeriod(COOLDOWN_PERIOD); - - ScaledObject scaledObject = new ScaledObject(); - scaledObject.setSpec(spec); - scaledObject.setMetadata(buildMetadata(optaPlannerSolver)); - scaledObject.setStatus(new ScaledObject.ScaledObjectStatus()); - - return scaledObject; - } - - private ObjectMeta buildMetadata(OptaPlannerSolver optaPlannerSolver) { - return new ObjectMetaBuilder() - .withName(optaPlannerSolver.getScaledObjectName()) - .withNamespace(optaPlannerSolver.getNamespace()) - .build(); - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectSpec.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectSpec.java deleted file mode 100644 index 55d064e1b01..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectSpec.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import java.util.ArrayList; -import java.util.List; - -import org.optaplanner.operator.impl.solver.model.common.ResourceNameReference; - -public final class ScaledObjectSpec { - - private ResourceNameReference scaleTargetRef; - - private List triggers = new ArrayList<>(); - - private int cooldownPeriod; - - private int pollingInterval; - - private int minReplicaCount; - - private int maxReplicaCount; - - public ScaledObjectSpec withTrigger(Trigger trigger) { - triggers.add(trigger); - return this; - } - - public ResourceNameReference getScaleTargetRef() { - return scaleTargetRef; - } - - public void setScaleTargetRef(ResourceNameReference scaleTargetRef) { - this.scaleTargetRef = scaleTargetRef; - } - - public List getTriggers() { - return triggers; - } - - public void setTriggers(List triggers) { - this.triggers = triggers; - } - - public int getCooldownPeriod() { - return cooldownPeriod; - } - - public void setCooldownPeriod(int cooldownPeriod) { - this.cooldownPeriod = cooldownPeriod; - } - - public int getPollingInterval() { - return pollingInterval; - } - - public void setPollingInterval(int pollingInterval) { - this.pollingInterval = pollingInterval; - } - - public int getMinReplicaCount() { - return minReplicaCount; - } - - public void setMinReplicaCount(int minReplicaCount) { - this.minReplicaCount = minReplicaCount; - } - - public int getMaxReplicaCount() { - return maxReplicaCount; - } - - public void setMaxReplicaCount(int maxReplicaCount) { - this.maxReplicaCount = maxReplicaCount; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/SecretTargetRef.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/SecretTargetRef.java deleted file mode 100644 index 366e8f14ba5..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/SecretTargetRef.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import io.fabric8.kubernetes.api.model.SecretKeySelector; - -public final class SecretTargetRef { - - public static SecretTargetRef fromSecretKeySelector(String parameter, SecretKeySelector secretKeySelector) { - return new SecretTargetRef(parameter, secretKeySelector.getName(), secretKeySelector.getKey()); - } - - private String parameter; - private String name; - private String key; - - public SecretTargetRef() { - // Required by Jackson. - } - - public SecretTargetRef(String parameter, String name, String key) { - this.parameter = parameter; - this.name = name; - this.key = key; - } - - public String getParameter() { - return parameter; - } - - public void setParameter(String parameter) { - this.parameter = parameter; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/Trigger.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/Trigger.java deleted file mode 100644 index a5ac2b76580..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/Trigger.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import org.optaplanner.operator.impl.solver.model.common.ResourceNameReference; - -public final class Trigger { - private String type; - private String name; - private TriggerMetadata metadata; - private ResourceNameReference authenticationRef; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public TriggerMetadata getMetadata() { - return metadata; - } - - public void setMetadata(TriggerMetadata metadata) { - this.metadata = metadata; - } - - public ResourceNameReference getAuthenticationRef() { - return authenticationRef; - } - - public void setAuthenticationRef(ResourceNameReference authenticationRef) { - this.authenticationRef = authenticationRef; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthentication.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthentication.java deleted file mode 100644 index 0aed3f5d161..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthentication.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import com.fasterxml.jackson.annotation.JsonInclude; - -import io.fabric8.kubernetes.api.model.Namespaced; -import io.fabric8.kubernetes.client.CustomResource; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Kind; -import io.fabric8.kubernetes.model.annotation.Version; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Group(KedaConstants.GROUP) -@Version(KedaConstants.API_VERSION) -@Kind(TriggerAuthentication.KIND) -public final class TriggerAuthentication - extends CustomResource implements Namespaced { - - public static final String KIND = "TriggerAuthentication"; -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationDependentResource.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationDependentResource.java deleted file mode 100644 index a788fe81ea2..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationDependentResource.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolver; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; -import io.fabric8.kubernetes.api.model.SecretKeySelector; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent; - -/* -Example YAML: ------------------------------------------ -apiVersion: keda.sh/v1alpha1 -kind: TriggerAuthentication -metadata: - name: school-timetabling-scaledobject-auth - namespace: artemis -spec: - secretTargetRef: - - parameter: username - name: activemq-secret - key: activemq-username - - parameter: password - name: activemq-secret - key: activemq-password -*/ - -@KubernetesDependent -public final class TriggerAuthenticationDependentResource - extends CRUDKubernetesDependentResource { - - public static final String PARAM_USERNAME = "username"; - public static final String PARAM_PASSWORD = "password"; - - public TriggerAuthenticationDependentResource() { - super(TriggerAuthentication.class); - } - - @Override - protected TriggerAuthentication desired(OptaPlannerSolver optaPlannerSolver, Context context) { - final SecretKeySelector amqUsernameSecretKeySelector = - optaPlannerSolver.getSpec().getAmqBroker().getUsernameSecretRef(); - final SecretKeySelector amqPasswordSecretKeySelector = - optaPlannerSolver.getSpec().getAmqBroker().getPasswordSecretRef(); - TriggerAuthenticationSpec spec = new TriggerAuthenticationSpec() - .withSecretTargetRef(SecretTargetRef.fromSecretKeySelector(PARAM_USERNAME, amqUsernameSecretKeySelector)) - .withSecretTargetRef(SecretTargetRef.fromSecretKeySelector(PARAM_PASSWORD, amqPasswordSecretKeySelector)); - - ObjectMeta metadata = new ObjectMetaBuilder() - .withName(optaPlannerSolver.getTriggerAuthenticationName()) - .withNamespace(optaPlannerSolver.getNamespace()) - .build(); - TriggerAuthentication triggerAuthentication = new TriggerAuthentication(); - triggerAuthentication.setMetadata(metadata); - triggerAuthentication.setSpec(spec); - - return triggerAuthentication; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationSpec.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationSpec.java deleted file mode 100644 index 23bca2903f4..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationSpec.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public final class TriggerAuthenticationSpec { - - @JsonProperty("secretTargetRef") - private List secretTargetRefs = new ArrayList<>(); - - public TriggerAuthenticationSpec withSecretTargetRef(SecretTargetRef secretTargetRef) { - secretTargetRefs.add(secretTargetRef); - return this; - } - - public List getSecretTargetRefs() { - return secretTargetRefs; - } - - public void setSecretTargetRefs(List secretTargetRefs) { - this.secretTargetRefs = secretTargetRefs; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerMetadata.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerMetadata.java deleted file mode 100644 index 8b7431f27d0..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/keda/TriggerMetadata.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -public final class TriggerMetadata { - private String managementEndpoint; - private String queueName; - private String queueLength; - private String brokerName; - private String brokerAddress; - - public String getManagementEndpoint() { - return managementEndpoint; - } - - public void setManagementEndpoint(String managementEndpoint) { - this.managementEndpoint = managementEndpoint; - } - - public String getQueueName() { - return queueName; - } - - public void setQueueName(String queueName) { - this.queueName = queueName; - } - - public String getQueueLength() { - return queueLength; - } - - public void setQueueLength(String queueLength) { - this.queueLength = queueLength; - } - - public String getBrokerName() { - return brokerName; - } - - public void setBrokerName(String brokerName) { - this.brokerName = brokerName; - } - - public String getBrokerAddress() { - return brokerAddress; - } - - public void setBrokerAddress(String brokerAddress) { - this.brokerAddress = brokerAddress; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueue.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueue.java deleted file mode 100644 index a65963c8ad7..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueue.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.messaging; - -import com.fasterxml.jackson.annotation.JsonInclude; - -import io.fabric8.kubernetes.api.model.Namespaced; -import io.fabric8.kubernetes.client.CustomResource; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Kind; -import io.fabric8.kubernetes.model.annotation.Plural; -import io.fabric8.kubernetes.model.annotation.Singular; -import io.fabric8.kubernetes.model.annotation.Version; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@Group(ArtemisQueue.GROUP) -@Plural(ArtemisQueue.PLURAL) -@Singular(ArtemisQueue.SINGULAR) -@Version(ArtemisQueue.API_VERSION) -@Kind(ArtemisQueue.KIND) -public final class ArtemisQueue extends CustomResource - implements Namespaced { - - public static final String GROUP = "broker.amq.io"; - public static final String PLURAL = "activemqartemisaddresses"; - public static final String SINGULAR = "activemqartemisaddress"; - public static final String API_VERSION = "v1beta1"; - public static final String KIND = "ActiveMQArtemisAddress"; - - static class ArtemisQueueStatus { - // Not interested in the status. - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueDependentResource.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueDependentResource.java deleted file mode 100644 index 0c5bf820025..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueDependentResource.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.messaging; - -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolver; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.fabric8.kubernetes.api.model.ObjectMetaBuilder; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource; -import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependent; - -@KubernetesDependent -public final class ArtemisQueueDependentResource extends CRUDKubernetesDependentResource { - - public ArtemisQueueDependentResource(MessageAddress messageAddress) { - super(ArtemisQueue.class); - this.messageAddress = messageAddress; - } - - private final MessageAddress messageAddress; - - @Override - protected ArtemisQueue desired(OptaPlannerSolver solver, Context context) { - final String queueName = solver.getMessageAddressName(messageAddress); - - ObjectMeta objectMeta = new ObjectMetaBuilder() - .withName(queueName) - .withNamespace(solver.getNamespace()) - .build(); - - ArtemisQueueSpec spec = new ArtemisQueueSpec(); - spec.setAddressName(queueName); - spec.setQueueName(queueName); - - ArtemisQueue artemisQueue = new ArtemisQueue(); - artemisQueue.setMetadata(objectMeta); - artemisQueue.setSpec(spec); - - return artemisQueue; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueSpec.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueSpec.java deleted file mode 100644 index 67aed73d2ea..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueSpec.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.messaging; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public final class ArtemisQueueSpec { - - private static final String ROUTING_TYPE_ANYCAST = "anycast"; - - private String addressName; - - private String queueName; - - @JsonProperty(access = JsonProperty.Access.READ_ONLY) - private final String routingType = ROUTING_TYPE_ANYCAST; - - public String getAddressName() { - return addressName; - } - - public String getQueueName() { - return queueName; - } - - public String getRoutingType() { - return routingType; - } - - public void setAddressName(String addressName) { - this.addressName = addressName; - } - - public void setQueueName(String queueName) { - this.queueName = queueName; - } -} diff --git a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/MessageAddress.java b/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/MessageAddress.java deleted file mode 100644 index 0eeb79f6fa6..00000000000 --- a/optaplanner-operator/src/main/java/org/optaplanner/operator/impl/solver/model/messaging/MessageAddress.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.messaging; - -public enum MessageAddress { - - INPUT("problem"), - OUTPUT("solution"); - - private final String name; - - MessageAddress(String name) { - this.name = name; - } - - public String getName() { - return name; - } -} diff --git a/optaplanner-operator/src/main/resources/application.properties b/optaplanner-operator/src/main/resources/application.properties deleted file mode 100644 index 8672871dc98..00000000000 --- a/optaplanner-operator/src/main/resources/application.properties +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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. -# - - -quarkus.operator-sdk.crd.apply=true - -# New version of the operator use SSA, a different algorithm for creating resources -# that needs some changes. In the meanwhile this feature flag reverts to the old behaviour -# See https://javaoperatorsdk.io/docs/dependent-resources#comparing-desired-and-actual-state-matching -# And https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L332-L358 -quarkus.operator-sdk.enable-ssa=false - -quarkus.log.category."io.quarkiverse.operatorsdk".level=ERROR - -######################## -# Building the image -######################## - -quarkus.container-image.name=optaplanner-operator -quarkus.container-image.tag=latest -quarkus.kubernetes.namespace=optaplanner-operator -quarkus.kubernetes.deployment-target=kubernetes,openshift -%openshift.quarkus.container-image.build=true - -%image.quarkus.container-image.build=true -# Intentionally left blank so that the image is not bound to any namespace. -%image.quarkus.container-image.group= -%image.quarkus.jib.base-jvm-image=registry.access.redhat.com/ubi8/openjdk-17-runtime:1.14 \ No newline at end of file diff --git a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/AbstractKubernetesTest.java b/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/AbstractKubernetesTest.java deleted file mode 100644 index b44efc670b9..00000000000 --- a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/AbstractKubernetesTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver; - -import io.fabric8.kubernetes.client.server.mock.KubernetesServer; -import io.quarkus.test.kubernetes.client.KubernetesTestServer; -import io.quarkus.test.kubernetes.client.WithKubernetesTestServer; - -@WithKubernetesTestServer -abstract public class AbstractKubernetesTest { - - @KubernetesTestServer - private KubernetesServer mockServer; - - protected KubernetesServer getMockServer() { - return mockServer; - } -} diff --git a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/OptaPlannerSolverReconcilerTest.java b/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/OptaPlannerSolverReconcilerTest.java deleted file mode 100644 index 83515d83768..00000000000 --- a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/OptaPlannerSolverReconcilerTest.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver; - -import static java.util.concurrent.TimeUnit.MINUTES; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import jakarta.enterprise.event.Observes; -import jakarta.inject.Inject; - -import org.assertj.core.api.SoftAssertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.optaplanner.operator.impl.solver.model.AmqBroker; -import org.optaplanner.operator.impl.solver.model.ConfigMapDependentResource; -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolver; -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolverSpec; -import org.optaplanner.operator.impl.solver.model.OptaPlannerSolverStatus; -import org.optaplanner.operator.impl.solver.model.Scaling; -import org.optaplanner.operator.impl.solver.model.keda.ScaledObject; -import org.optaplanner.operator.impl.solver.model.keda.ScaledObjectDependentResource; -import org.optaplanner.operator.impl.solver.model.keda.SecretTargetRef; -import org.optaplanner.operator.impl.solver.model.keda.Trigger; -import org.optaplanner.operator.impl.solver.model.keda.TriggerAuthentication; -import org.optaplanner.operator.impl.solver.model.keda.TriggerAuthenticationDependentResource; - -import io.fabric8.kubernetes.api.model.Condition; -import io.fabric8.kubernetes.api.model.ConfigMap; -import io.fabric8.kubernetes.api.model.ContainerBuilder; -import io.fabric8.kubernetes.api.model.EnvVar; -import io.fabric8.kubernetes.api.model.EnvVarBuilder; -import io.fabric8.kubernetes.api.model.PodTemplateSpec; -import io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder; -import io.fabric8.kubernetes.api.model.Quantity; -import io.fabric8.kubernetes.api.model.SecretKeySelector; -import io.fabric8.kubernetes.api.model.apps.Deployment; -import io.fabric8.kubernetes.client.KubernetesClient; -import io.javaoperatorsdk.operator.Operator; -import io.quarkus.runtime.StartupEvent; -import io.quarkus.test.junit.QuarkusTest; - -@QuarkusTest -public class OptaPlannerSolverReconcilerTest extends AbstractKubernetesTest { - - @Inject - private Operator operator; - - // TODO: Replace with @BeforeEach after https://github.com/quarkiverse/quarkus-operator-sdk/issues/388 is resolved. - public void onStart(@Observes StartupEvent startupEvent) { - operator.start(); - } - - private String namespace; - - @BeforeEach - public void createNamespace() { - namespace = "test-" + UUID.randomUUID(); - } - - @Test - void createMandatoryDependentResources() { - final OptaPlannerSolver solver = new OptaPlannerSolver(); - final String solverName = "test-solver"; - - AmqBroker amqBroker = createAmqBroker(); - - solver.getMetadata().setName(solverName); - solver.getMetadata().setNamespace(namespace); - solver.setSpec(new OptaPlannerSolverSpec()); - solver.getSpec().setTemplate(createPodTemplateSpec("solver-project-image")); - solver.getSpec().setAmqBroker(amqBroker); - solver.getSpec().setScaling(new Scaling()); - getClient().resources(OptaPlannerSolver.class).create(solver); - - final String expectedMessageAddressIn = solver.getInputMessageAddressName(); - final String expectedMessageAddressOut = solver.getOutputMessageAddressName(); - - await().ignoreException(NullPointerException.class).atMost(1, MINUTES).untilAsserted(() -> { - OptaPlannerSolver updatedSolver = getClient() - .resources(OptaPlannerSolver.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solver.getMetadata().getName()) - .get(); - assertThat(updatedSolver.getStatus()).isNotNull(); - assertThat(updatedSolver.getStatus().getConditions()).isNotEmpty(); - Condition condition = updatedSolver.getStatus().getConditions().get(0); - assertStatusCondition(condition, updatedSolver, OptaPlannerSolverStatus.ConditionStatus.TRUE); - - assertThat(updatedSolver.getStatus().getInputMessageAddress()) - .isEqualTo(expectedMessageAddressIn); - assertThat(updatedSolver.getStatus().getOutputMessageAddress()) - .isEqualTo(expectedMessageAddressOut); - }); - ConfigMap configMap = getClient() - .resources(ConfigMap.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solver.getConfigMapName()) - .get(); - Map configMapData = configMap.getData(); - assertThat(configMapData.get(ConfigMapDependentResource.SOLVER_MESSAGE_INPUT_KEY)) - .isEqualTo(expectedMessageAddressIn); - assertThat(configMapData.get(ConfigMapDependentResource.SOLVER_MESSAGE_OUTPUT_KEY)) - .isEqualTo(expectedMessageAddressOut); - - List deployments = getClient() - .resources(Deployment.class) - .inNamespace(solver.getMetadata().getNamespace()) - .list() - .getItems(); - assertThat(deployments).hasSize(1); - assertThat(deployments.get(0).getMetadata().getName()).isEqualTo("test-solver"); - } - - @Test - void dynamicScaling_configuresKeda() { - final String solverName = "test-solver"; - final AmqBroker amqBroker = createAmqBroker(); - final int maxReplicas = 5; - - final OptaPlannerSolver solver = new OptaPlannerSolver(); - solver.getMetadata().setName(solverName); - solver.getMetadata().setNamespace(namespace); - solver.setSpec(new OptaPlannerSolverSpec()); - solver.getSpec().setTemplate(createPodTemplateSpec("solver-project-image")); - solver.getSpec().setAmqBroker(amqBroker); - solver.getSpec().setScaling(new Scaling(true, maxReplicas)); - - getClient().resources(OptaPlannerSolver.class).create(solver); - await().ignoreException(NullPointerException.class).atMost(1, MINUTES).untilAsserted(() -> { - OptaPlannerSolver updatedSolver = getClient() - .resources(OptaPlannerSolver.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solver.getMetadata().getName()) - .get(); - assertThat(updatedSolver.getStatus().getConditions().get(0).getStatus()) - .isNotEqualTo(OptaPlannerSolverStatus.ConditionStatus.UNKNOWN.getName()); - }); - - ScaledObject scaledObject = getClient() - .resources(ScaledObject.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solverName) - .get(); - - TriggerAuthentication triggerAuthentication = getClient() - .resources(TriggerAuthentication.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solverName) - .get(); - - assertThat(scaledObject.getSpec().getScaleTargetRef().getName()).isEqualTo(solverName); - assertThat(scaledObject.getSpec().getTriggers()).hasSize(1); - Trigger trigger = scaledObject.getSpec().getTriggers().get(0); - assertThat(trigger.getType()).isEqualTo(ScaledObjectDependentResource.ARTEMIS_QUEUE_TRIGGER); - assertThat(trigger.getMetadata().getQueueName()).isEqualTo(solver.getInputMessageAddressName()); - assertThat(trigger.getAuthenticationRef().getName()).isEqualTo(triggerAuthentication.getMetadata().getName()); - - List secretTargetRefs = triggerAuthentication.getSpec().getSecretTargetRefs(); - assertThat(secretTargetRefs).hasSize(2); - assertThat(secretTargetRefs).allSatisfy(secretTargetRef -> { - if (TriggerAuthenticationDependentResource.PARAM_USERNAME.equals(secretTargetRef.getParameter())) { - assertSecretTargetRefFromSecretKeySelector(secretTargetRef, amqBroker.getUsernameSecretRef()); - } else { - assertSecretTargetRefFromSecretKeySelector(secretTargetRef, amqBroker.getPasswordSecretRef()); - } - }); - } - - @Test - void incorrectSolverResource_FailedCondition() { - final OptaPlannerSolver solver = new OptaPlannerSolver(); - final String solverName = "incorrect-solver"; - solver.getMetadata().setName(solverName); - solver.getMetadata().setNamespace(namespace); - solver.setSpec(new OptaPlannerSolverSpec()); // Empty spec. - getClient().resources(OptaPlannerSolver.class).create(solver); - - await().ignoreException(NullPointerException.class).atMost(1, MINUTES).untilAsserted(() -> { - OptaPlannerSolver updatedSolver = getClient() - .resources(OptaPlannerSolver.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solver.getMetadata().getName()) - .get(); - - assertThat(updatedSolver.getStatus().getConditions()).isNotEmpty(); - Condition condition = updatedSolver.getStatus().getConditions().get(0); - assertStatusCondition(condition, updatedSolver, OptaPlannerSolverStatus.ConditionStatus.FALSE); - }); - } - - @Test - void mergePodTemplate() { - final OptaPlannerSolver solver = new OptaPlannerSolver(); - final String solverName = "test-solver-merge-environment"; - - solver.getMetadata().setName(solverName); - solver.getMetadata().setNamespace(namespace); - solver.setSpec(new OptaPlannerSolverSpec()); - solver.getSpec().setAmqBroker(createAmqBroker()); - - EnvVar existingEnvVar = new EnvVarBuilder() - .withName("test-var") - .withValue("test-var-value") - .build(); - - PodTemplateSpec podTemplateSpec = new PodTemplateSpecBuilder() - .withNewMetadata() - .withName("test-pod-template") - .addToLabels("test-label", "test-label-value") - .endMetadata() - .withNewSpec() - .withContainers(new ContainerBuilder() - .withImage("solver-project-image") - .withEnv(existingEnvVar) - .withNewResources() - .addToRequests("cpu", Quantity.parse("1")) - .endResources() - .build()) - .endSpec() - .build(); - - solver.getSpec().setTemplate(podTemplateSpec); - - getClient().resources(OptaPlannerSolver.class).create(solver); - - await().ignoreException(NullPointerException.class).atMost(1, MINUTES).untilAsserted(() -> { - OptaPlannerSolver updatedSolver = getClient() - .resources(OptaPlannerSolver.class) - .inNamespace(solver.getMetadata().getNamespace()) - .withName(solver.getMetadata().getName()) - .get(); - assertThat(updatedSolver.getStatus().getConditions().get(0).getStatus()) - .isNotEqualTo(OptaPlannerSolverStatus.ConditionStatus.UNKNOWN.getName()); - }); - - List deployments = getClient() - .resources(Deployment.class) - .inNamespace(solver.getMetadata().getNamespace()) - .list() - .getItems(); - assertThat(deployments).hasSize(1); - PodTemplateSpec resolvedPodTemplateSpec = deployments.get(0).getSpec().getTemplate(); - assertThat(resolvedPodTemplateSpec.getMetadata().getName()).isEqualTo(podTemplateSpec.getMetadata().getName()); - assertThat(resolvedPodTemplateSpec.getMetadata().getLabels()).containsOnlyKeys("app", "test-label"); - assertThat(resolvedPodTemplateSpec.getSpec().getContainers()).hasSize(1); - assertThat(resolvedPodTemplateSpec.getSpec().getContainers().get(0).getEnv()) - .hasSizeGreaterThan(1) - .contains(existingEnvVar); - assertThat(resolvedPodTemplateSpec.getSpec().getContainers().get(0).getResources().getRequests()) - .containsOnlyKeys("cpu"); - } - - private KubernetesClient getClient() { - return getMockServer().getClient().inNamespace(namespace); - } - - private void assertSecretTargetRefFromSecretKeySelector(SecretTargetRef secretTargetRef, - SecretKeySelector secretKeySelector) { - SoftAssertions.assertSoftly(softly -> { - softly.assertThat(secretTargetRef.getName()).isEqualTo(secretKeySelector.getName()); - softly.assertThat(secretTargetRef.getKey()).isEqualTo(secretKeySelector.getKey()); - }); - } - - private void assertStatusCondition(Condition condition, OptaPlannerSolver optaPlannerSolver, - OptaPlannerSolverStatus.ConditionStatus expectedStatus) { - SoftAssertions.assertSoftly(softly -> { - softly.assertThat(condition.getType()).isEqualTo(OptaPlannerSolverStatus.CONDITION_TYPE_READY); - softly.assertThat(condition.getStatus()).isEqualTo(expectedStatus.getName()); - softly.assertThat(condition.getLastTransitionTime()).isNotEmpty(); - softly.assertThat(condition.getObservedGeneration()) - .isEqualTo(optaPlannerSolver.getMetadata().getGeneration()); - }); - } - - private AmqBroker createAmqBroker() { - AmqBroker amqBroker = new AmqBroker(); - amqBroker.setHost("amq-host"); - amqBroker.setPort(5678); - amqBroker.setUsernameSecretRef(new SecretKeySelector("amq-username", "my-secret", false)); - amqBroker.setPasswordSecretRef(new SecretKeySelector("amq-password", "my-secret", false)); - - return amqBroker; - } - - private PodTemplateSpec createPodTemplateSpec(String imageName) { - return new PodTemplateSpecBuilder() - .withNewSpec() - .withContainers(new ContainerBuilder() - .withImage(imageName) - .build()) - .endSpec() - .build(); - } -} diff --git a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/AbstractKubernetesCustomResourceTest.java b/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/AbstractKubernetesCustomResourceTest.java deleted file mode 100644 index 5d908003105..00000000000 --- a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/AbstractKubernetesCustomResourceTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.Test; -import org.optaplanner.operator.impl.solver.AbstractKubernetesTest; - -import io.fabric8.kubernetes.client.CustomResource; - -public abstract class AbstractKubernetesCustomResourceTest> - extends AbstractKubernetesTest { - - private final Class customResourceClass; - - public AbstractKubernetesCustomResourceTest(Class customResourceClass) { - this.customResourceClass = customResourceClass; - } - - @Test - void createAndVerifyCustomResource() { - CustomResourceType customResource = createCustomResource(); - CustomResourceType returned = getMockServer().getClient().resources(customResourceClass).create(customResource); - assertThat(returned).isNotSameAs(customResource); - assertThat(returned).usingRecursiveComparison().ignoringExpectedNullFields().isEqualTo(customResource); - } - - abstract protected CustomResourceType createCustomResource(); -} diff --git a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectTest.java b/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectTest.java deleted file mode 100644 index b579650ac09..00000000000 --- a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/keda/ScaledObjectTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import org.optaplanner.operator.impl.solver.model.AbstractKubernetesCustomResourceTest; -import org.optaplanner.operator.impl.solver.model.common.ResourceNameReference; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.quarkus.test.junit.QuarkusTest; - -@QuarkusTest -public class ScaledObjectTest extends AbstractKubernetesCustomResourceTest { - - public ScaledObjectTest() { - super(ScaledObject.class); - } - - @Override - protected ScaledObject createCustomResource() { - TriggerMetadata triggerMetadata = new TriggerMetadata(); - triggerMetadata.setBrokerAddress("test-messaging-address"); - triggerMetadata.setBrokerName("amq-broker"); - triggerMetadata.setQueueLength(String.valueOf(1)); - triggerMetadata.setQueueName("test-messaging-queue"); - triggerMetadata.setManagementEndpoint("test-host:8161"); - - Trigger trigger = new Trigger(); - trigger.setAuthenticationRef(new ResourceNameReference("test-trigger-auth")); - trigger.setMetadata(triggerMetadata); - trigger.setName("test-keda-trigger"); - trigger.setType("artemis-queue"); - - ScaledObjectSpec scaledObjectSpec = new ScaledObjectSpec(); - scaledObjectSpec.setCooldownPeriod(10); - scaledObjectSpec.setMaxReplicaCount(5); - scaledObjectSpec.setMinReplicaCount(0); - scaledObjectSpec.setPollingInterval(10); - scaledObjectSpec.setScaleTargetRef(new ResourceNameReference("test-deployment")); - scaledObjectSpec.withTrigger(trigger); - - ObjectMeta scaledObjectMeta = new ObjectMeta(); - scaledObjectMeta.setName("test-scaled-object"); - ScaledObject scaledObject = new ScaledObject(); - scaledObject.setMetadata(scaledObjectMeta); - scaledObject.setSpec(scaledObjectSpec); - - return scaledObject; - } -} diff --git a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationTest.java b/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationTest.java deleted file mode 100644 index f5bc54e6386..00000000000 --- a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/keda/TriggerAuthenticationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.keda; - -import org.optaplanner.operator.impl.solver.model.AbstractKubernetesCustomResourceTest; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.quarkus.test.junit.QuarkusTest; - -@QuarkusTest -public class TriggerAuthenticationTest extends AbstractKubernetesCustomResourceTest { - - public TriggerAuthenticationTest() { - super(TriggerAuthentication.class); - } - - @Override - protected TriggerAuthentication createCustomResource() { - TriggerAuthenticationSpec triggerAuthenticationSpec = new TriggerAuthenticationSpec(); - triggerAuthenticationSpec - .withSecretTargetRef(new SecretTargetRef("username", "activemq-secret", "activemq-username")) - .withSecretTargetRef(new SecretTargetRef("password", "activemq-secret", "activemq-password")); - - TriggerAuthentication triggerAuthentication = new TriggerAuthentication(); - ObjectMeta triggerAuthenticationMetadata = new ObjectMeta(); - triggerAuthenticationMetadata.setName("test-trigger-auth"); - triggerAuthentication.setMetadata(triggerAuthenticationMetadata); - triggerAuthentication.setSpec(triggerAuthenticationSpec); - - return triggerAuthentication; - } -} diff --git a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueTest.java b/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueTest.java deleted file mode 100644 index 85f610a3d73..00000000000 --- a/optaplanner-operator/src/test/java/org/optaplanner/operator/impl/solver/model/messaging/ArtemisQueueTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -package org.optaplanner.operator.impl.solver.model.messaging; - -import org.optaplanner.operator.impl.solver.model.AbstractKubernetesCustomResourceTest; - -import io.fabric8.kubernetes.api.model.ObjectMeta; -import io.quarkus.test.junit.QuarkusTest; - -@QuarkusTest -public class ArtemisQueueTest extends AbstractKubernetesCustomResourceTest { - - public ArtemisQueueTest() { - super(ArtemisQueue.class); - } - - @Override - protected ArtemisQueue createCustomResource() { - ArtemisQueueSpec artemisQueueSpec = new ArtemisQueueSpec(); - artemisQueueSpec.setQueueName("test-queue"); - artemisQueueSpec.setAddressName("test-queue-address"); - - ObjectMeta metadata = new ObjectMeta(); - metadata.setName("test-artemis-queue"); - - ArtemisQueue artemisQueue = new ArtemisQueue(); - artemisQueue.setMetadata(metadata); - artemisQueue.setSpec(artemisQueueSpec); - - return artemisQueue; - } -} diff --git a/pom.xml b/pom.xml index 368923dda16..471636e2f68 100644 --- a/pom.xml +++ b/pom.xml @@ -153,16 +153,5 @@ build/optaplanner-distribution-internal - - default - - - !productized - - - - optaplanner-operator - -