Skip to content

Commit

Permalink
Include Elasticsearch service in the OpenShift deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Oct 11, 2023
1 parent fcccaf6 commit 4035e9e
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/main/kubernetes/openshift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
labels:
app: elasticsearch
app.kubernetes.io/name: elasticsearch
app.kubernetes.io/component: datastore
app.kubernetes.io/part-of: search-quarkus-io
app.kubernetes.io/managed-by: quarkus
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 9200
selector:
app.kubernetes.io/name: elasticsearch
type: ClusterIP
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: elasticsearch
labels:
app: elasticsearch
app.kubernetes.io/name: elasticsearch
app.kubernetes.io/component: datastore
app.kubernetes.io/part-of: search-quarkus-io
app.kubernetes.io/managed-by: quarkus
spec:
replicas: 3
selector:
app.kubernetes.io/name: elasticsearch
template:
metadata:
labels:
app: elasticsearch
app.kubernetes.io/name: elasticsearch
app.kubernetes.io/component: datastore
app.kubernetes.io/part-of: search-quarkus-io
app.kubernetes.io/managed-by: quarkus
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
imagePullPolicy: Always
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 250m
memory: 500Mi
env:
- name: cluster.name
value: search-quarkus-io
# Not exposed to the internet, no sensitive data
# => We don't bother with HTTPS and pesky self-signed certificates
- name: xpack.security.enabled
value: false
envFrom:
- configMapRef:
name: elasticsearch-config
- secretRef:
name: elasticsearch-secrets
ports:
- containerPort: 9200
name: http
protocol: TCP
8 changes: 8 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ quarkus.swagger-ui.always-include=true
quarkus.swagger-ui.title=Quarkus Search API

# Production
## This should match the Elasticsearch service defined in src/main/kubernetes
## We assume the cluster DNS will resolve the service name to the service IP automatically
%prod.quarkus.hibernate-search-orm.elasticsearch.hosts=elasticsearch:80
%prod.quarkus.hibernate-search-orm.elasticsearch.protocol=http
## We don't expect Elasticsearch to be reachable when the application starts
%prod.quarkus.hibernate-search-orm.elasticsearch.version-check.enabled=false
## ... and the application automatically creates indexes upon first indexing anyway.
%prod.quarkus.hibernate-search-orm.schema-management.strategy=none

# Deployment to OpenShift
%prod.quarkus.openshift.labels."app"=search.quarkus.io
Expand Down

0 comments on commit 4035e9e

Please sign in to comment.