Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,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 +107 to +123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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:

            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
🤖 Prompt for AI Agents
In tests/e2e/sample-applications/mysql-persistent/mysql-persistent-csi.yaml
around lines 107 to 123, the exec readinessProbe uses literal array entries like
$(MYSQL_DATABASE) which will not be expanded; wrap the whole command in a shell
so environment variables are expanded by replacing the array with a shell
invocation (e.g. /bin/sh -c) and pass the full timeout + mysql invocation as a
single string so the shell expands MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD
at runtime; ensure proper quoting of the SELECT statement and timeout invocation
within that single string.

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:
Expand Down Expand Up @@ -183,6 +211,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Environment variables will not expand in exec probe command array.

Same critical variable expansion issue as identified in mysql-persistent-csi.yaml. The readinessProbe shell variables must be wrapped in /bin/sh -c for expansion to occur.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
readinessProbe:
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
🤖 Prompt for AI Agents
In
tests/e2e/sample-applications/mysql-persistent/mysql-persistent-twovol-csi.yaml
around lines 99 to 115, the readinessProbe uses an exec command array containing
shell variables (e.g. $(MYSQL_DATABASE), $(MYSQL_USER), $(MYSQL_PASSWORD)) which
will not be expanded; change the exec to run a shell so variables expand by
replacing the command array with a single shell invocation like /bin/sh -c and
pass the full command as one string (e.g. use /usr/bin/timeout 1s /usr/bin/mysql
"$(MYSQL_DATABASE)" -h 127.0.0.1 -u"$(MYSQL_USER)" -p"$(MYSQL_PASSWORD)" -e
'SELECT 1'), keeping the existing probe timings intact.

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:
Expand Down Expand Up @@ -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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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 $(MYSQL_DATABASE), $(MYSQL_USER), and $(MYSQL_PASSWORD) strings that Kubernetes will not expand. These must be wrapped in a shell for variable substitution.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
readinessProbe:
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
🤖 Prompt for AI Agents
In tests/e2e/sample-applications/mysql-persistent/mysql-persistent.yaml around
lines 120-136, the readinessProbe exec command uses literal $(MYSQL_...) tokens
which Kubernetes will not expand; change the command to run a shell so
environment variables are expanded (e.g. replace the command array with a shell
invocation like /bin/sh -c and provide a single string that runs timeout and
mysql using $MYSQL_DATABASE, $MYSQL_USER and $MYSQL_PASSWORD with proper
quoting), and apply the same change to the other two YAML files that share this
probe.

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:
Expand Down Expand Up @@ -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
Expand Down