Skip to content
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

RHOAIENG-14041: Add readiness probes #312

Merged
Merged
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
1 change: 0 additions & 1 deletion controllers/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// checkDatabaseAccessible checks if the TrustyAI service pod failed with database issues.
func (r *TrustyAIServiceReconciler) checkDatabaseAccessible(ctx context.Context, instance *trustyaiopendatahubiov1alpha1.TrustyAIService) (bool, error) {
deployment := &appsv1.Deployment{}
err := r.Get(ctx, types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace}, deployment)
Expand Down
7 changes: 6 additions & 1 deletion controllers/statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ func (r *TrustyAIServiceReconciler) reconcileStatuses(ctx context.Context, insta
UpdateRouteAvailable(saved)

if instance.Spec.Storage.IsStorageDatabase() || instance.IsMigration() {
UpdateDBAvailable(saved)
if status.DBReady {
UpdateDBAvailable(saved)
} else {
UpdateDBConnectionError(saved)
return
}
}

UpdateTrustyAIServiceAvailable(saved)
Expand Down
14 changes: 14 additions & 0 deletions controllers/templates/service/deployment.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ spec:
- name: STORAGE_MIGRATION_CONFIG_FROM_FILENAME
value: {{ .Instance.Spec.Data.Filename }}
{{ end }}
readinessProbe:
httpGet:
path: /q/health/ready
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
livenessProbe:
httpGet:
path: /q/health/live
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
volumeMounts:
- name: {{ .Instance.Name }}-internal
readOnly: false
Expand Down
Loading