Skip to content

test(samples): add liveness/readiness probes to sample apps #1098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ undeploy_sample_app_agent_injected: ## Undeploy sample app with Cryostat Agent d
.PHONY: sample_app_agent_injected
sample_app_agent_injected: undeploy_sample_app_agent_injected ## Deploy sample app with Cryostat Agent deployed by Operator injection.
$(CLUSTER_CLIENT) apply $(SAMPLE_APP_FLAGS) -f config/samples/sample-app-agent-injected.yaml
$(CLUSTER_CLIENT) patch --type=merge -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"cryostat.io/namespace\":\"${DEPLOY_NAMESPACE}\"}}}}}" deployment/quarkus-cryostat-agent
$(CLUSTER_CLIENT) patch --type=merge -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"cryostat.io/namespace\":\"${DEPLOY_NAMESPACE}\"}}}}}" deployment/quarkus-cryostat-agent-injected

.PHONY: cert_manager
cert_manager: remove_cert_manager ## Install cert manager.
Expand Down
27 changes: 19 additions & 8 deletions config/samples/sample-app-agent-injected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: quarkus-cryostat-agent
name: quarkus-cryostat-agent
app: quarkus-cryostat-agent-injected
name: quarkus-cryostat-agent-injected
spec:
replicas: 1
selector:
matchLabels:
app: quarkus-cryostat-agent
app: quarkus-cryostat-agent-injected
template:
metadata:
labels:
app: quarkus-cryostat-agent
app: quarkus-cryostat-agent-injected
cryostat.io/name: cryostat-sample
cryostat.io/namespace: cryostat-operator-system
spec:
Expand All @@ -26,14 +26,25 @@ spec:
-Dio.cryostat.agent.shaded.org.slf4j.simpleLogger.defaultLogLevel=debug
image: quay.io/redhat-java-monitoring/quarkus-cryostat-agent:latest
imagePullPolicy: Always
name: quarkus-cryostat-agent
name: quarkus-cryostat-agent-injected
ports:
- containerPort: 10010
protocol: TCP
name: app-http
resources:
limits:
cpu: 500m
memory: 256Mi
livenessProbe:
httpGet:
path: /hello-resteasy
port: app-http
initialDelaySeconds: 3
readinessProbe:
httpGet:
path: /hello-resteasy
port: app-http
initialDelaySeconds: 3
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand All @@ -47,11 +58,11 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: quarkus-cryostat-agent
name: quarkus-cryostat-agent
app: quarkus-cryostat-agent-injected
name: quarkus-cryostat-agent-injected
spec:
selector:
app: quarkus-cryostat-agent
app: quarkus-cryostat-agent-injected
ports:
- name: app-http
port: 10010
Expand Down
12 changes: 12 additions & 0 deletions config/samples/sample-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ spec:
ports:
- containerPort: 10010
protocol: TCP
name: app-http
- containerPort: 9097
protocol: TCP
name: jfr-jmx
resources:
requests:
cpu: 200m
Expand All @@ -36,6 +38,16 @@ spec:
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /hello-resteasy
port: app-http
initialDelaySeconds: 3
readinessProbe:
httpGet:
path: /hello-resteasy
port: app-http
initialDelaySeconds: 3
restartPolicy: Always
securityContext:
runAsNonRoot: true
Expand Down