-
Notifications
You must be signed in to change notification settings - Fork 84
Add readiness and liveness probes to MySQL and TodoList deployments; create MySQL Minikube test configuration #2017
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
base: oadp-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -96,12 +96,40 @@ items: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumeMounts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: mysql-data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mountPath: /var/lib/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| readinessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 1s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $(MYSQL_DATABASE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 127.0.0.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -u$(MYSQL_USER) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -p$(MYSQL_PASSWORD) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - SELECT 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeoutSeconds: 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| failureThreshold: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+99
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Environment variables will not expand in exec probe command array. Same critical variable expansion issue as identified in Apply this fix: readinessProbe:
- exec:
- command:
- - /usr/bin/timeout
- - 1s
- - /usr/bin/mysql
- - $(MYSQL_DATABASE)
- - -h
- - 127.0.0.1
- - -u$(MYSQL_USER)
- - -p$(MYSQL_PASSWORD)
- - -e
- - SELECT 1
+ exec:
+ command:
+ - /bin/sh
+ - -c
+ - /usr/bin/timeout 1s /usr/bin/mysql $(MYSQL_DATABASE) -h 127.0.0.1 -u$(MYSQL_USER) -p$(MYSQL_PASSWORD) -e "SELECT 1"
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 3📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tcpSocket: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 1s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $(MYSQL_DATABASE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 127.0.0.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -u$(MYSQL_USER) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -p$(MYSQL_PASSWORD) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - SELECT 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeoutSeconds: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| failureThreshold: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| startupProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -174,6 +202,18 @@ items: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - containerPort: 8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protocol: TCP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| httpGet: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: 8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| readinessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| httpGet: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: 8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumeMounts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: applog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mountPath: /tmp/log/todoapp/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -117,12 +117,40 @@ items: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumeMounts: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: mysql-data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mountPath: /var/lib/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tcpSocket: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| readinessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 1s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $(MYSQL_DATABASE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 127.0.0.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -u$(MYSQL_USER) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -p$(MYSQL_PASSWORD) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - SELECT 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeoutSeconds: 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| failureThreshold: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+120
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Environment variables will not expand in exec probe command array. Same critical variable expansion issue identified across all three YAML files. The readinessProbe command array contains literal Apply this fix: readinessProbe:
- exec:
- command:
- - /usr/bin/timeout
- - 1s
- - /usr/bin/mysql
- - $(MYSQL_DATABASE)
- - -h
- - 127.0.0.1
- - -u$(MYSQL_USER)
- - -p$(MYSQL_PASSWORD)
- - -e
- - SELECT 1
+ exec:
+ command:
+ - /bin/sh
+ - -c
+ - /usr/bin/timeout 1s /usr/bin/mysql $(MYSQL_DATABASE) -h 127.0.0.1 -u$(MYSQL_USER) -p$(MYSQL_PASSWORD) -e "SELECT 1"
initialDelaySeconds: 10
- periodSeconds: 5
- timeoutSeconds: 2
- failureThreshold: 3
+ periodSeconds: 5
+ timeoutSeconds: 2
+ failureThreshold: 3📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 1s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /usr/bin/mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $(MYSQL_DATABASE) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -h | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 127.0.0.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -u$(MYSQL_USER) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -p$(MYSQL_PASSWORD) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - -e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - SELECT 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeoutSeconds: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| failureThreshold: 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| startupProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| command: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -196,6 +224,18 @@ items: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - containerPort: 8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| protocol: TCP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| livenessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| httpGet: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: 8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 30 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| readinessProbe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| httpGet: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| port: 8000 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initialDelaySeconds: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| periodSeconds: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| initContainers: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: init-myservice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Environment variables will not expand in exec probe command array.
Kubernetes exec probes execute commands directly without shell interpretation. The shell variables
$(MYSQL_DATABASE),$(MYSQL_USER), and$(MYSQL_PASSWORD)in the command array will be passed as literal strings to the mysql binary, causing the health check to fail. For example, the mysql command will receive the literal argument"$(MYSQL_DATABASE)"instead of the actual database name.The exec command must be wrapped in a shell to enable variable expansion. Apply this fix:
🤖 Prompt for AI Agents