-
Notifications
You must be signed in to change notification settings - Fork 86
fix: update container images to use quay.io for consistency and security #2069
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -71,7 +71,7 @@ items: | |||||||||
| # Used to format the block device (put filesystem on it). | ||||||||||
| # This allows Mongo to use the filesystem which lives on block device. | ||||||||||
| initContainers: | ||||||||||
| - image: docker.io/library/mongo:7.0 | ||||||||||
| - image: quay.io/migtools/mongo:7.0.28 | ||||||||||
| imagePullPolicy: IfNotPresent | ||||||||||
| securityContext: | ||||||||||
| privileged: true | ||||||||||
|
|
@@ -102,7 +102,7 @@ items: | |||||||||
| - name: block-volume-pv | ||||||||||
| devicePath: /dev/xvdx | ||||||||||
| containers: | ||||||||||
| - image: docker.io/library/mongo:7.0 | ||||||||||
| - image: quay.io/migtools/mongo:7.0.28 | ||||||||||
| name: mongo | ||||||||||
| securityContext: | ||||||||||
| privileged: true | ||||||||||
|
|
@@ -165,7 +165,7 @@ items: | |||||||||
| timeoutSeconds: 5 | ||||||||||
| successThreshold: 1 | ||||||||||
| failureThreshold: 12 # 12x10sec = 2min before restart pod | ||||||||||
| - image: docker.io/curlimages/curl:8.5.0 | ||||||||||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||
| name: curl-tool | ||||||||||
| command: ["/bin/sleep", "infinity"] | ||||||||||
| volumes: | ||||||||||
|
|
@@ -236,7 +236,7 @@ items: | |||||||||
| periodSeconds: 5 | ||||||||||
| initContainers: | ||||||||||
| - name: init-myservice | ||||||||||
| image: docker.io/curlimages/curl:8.5.0 | ||||||||||
| image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | ||||||||||
|
Comment on lines
+239
to
240
Contributor
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. Init container will fail: UBI8 base image does not include The Consider one of these alternatives:
🐛 Option 2: Replace curl with bash /dev/tcp initContainers:
- name: init-myservice
image: registry.access.redhat.com/ubi8/ubi:latest
- command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"']
+ command: ['bash', '-c', 'sleep 30; max_attempts=180; attempt=0; until timeout 2 bash -c "</dev/tcp/mongo/27017" 2>/dev/null || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"']📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| - apiVersion: v1 | ||||||||||
| kind: Service | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -67,7 +67,7 @@ items: | |||||||||||||
| spec: | ||||||||||||||
| serviceAccountName: mongo-persistent-sa | ||||||||||||||
| containers: | ||||||||||||||
| - image: docker.io/library/mongo:7.0 | ||||||||||||||
| - image: quay.io/migtools/mongo:7.0.28 | ||||||||||||||
| imagePullPolicy: IfNotPresent | ||||||||||||||
| name: mongo | ||||||||||||||
| securityContext: | ||||||||||||||
|
|
@@ -122,7 +122,7 @@ items: | |||||||||||||
| timeoutSeconds: 5 | ||||||||||||||
| successThreshold: 1 | ||||||||||||||
| failureThreshold: 12 # 12x10sec = 2min before restart pod | ||||||||||||||
| - image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||
| name: curl-tool | ||||||||||||||
| command: ["/bin/sleep", "infinity"] | ||||||||||||||
| volumes: | ||||||||||||||
|
|
@@ -193,7 +193,7 @@ items: | |||||||||||||
| periodSeconds: 5 | ||||||||||||||
| initContainers: | ||||||||||||||
| - name: init-myservice | ||||||||||||||
| image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||
| image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | ||||||||||||||
|
||||||||||||||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | |
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w2 mongo 27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] |
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.
curl is not available in the ubi8/ubi base image.
The init container command uses curl to check MongoDB connectivity, but registry.access.redhat.com/ubi8/ubi:latest does not include curl by default. This will cause the init container to fail with a "command not found" error.
Consider one of these alternatives:
- Use
registry.access.redhat.com/ubi8/ubi-minimaland install curl, or - Use a different connectivity check that doesn't require curl (e.g., bash's
/dev/tcp), or - Use an image that includes curl
🐛 Proposed fix using bash /dev/tcp instead of curl
- name: init-myservice
image: registry.access.redhat.com/ubi8/ubi:latest
- command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"']
+ command: ['bash', '-c', 'sleep 30; max_attempts=180; attempt=0; until timeout 2 bash -c "cat < /dev/null > /dev/tcp/mongo/27017" 2>/dev/null || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"']📝 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.
| image: registry.access.redhat.com/ubi8/ubi:latest | |
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | |
| image: registry.access.redhat.com/ubi8/ubi:latest | |
| command: ['bash', '-c', 'sleep 30; max_attempts=180; attempt=0; until timeout 2 bash -c "cat < /dev/null > /dev/tcp/mongo/27017" 2>/dev/null || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] |
🤖 Prompt for AI Agents
In `@tests/e2e/sample-applications/mongo-persistent/mongo-persistent-csi.yaml`
around lines 196 - 197, The init container uses curl in the command string while
the base image "registry.access.redhat.com/ubi8/ubi:latest" does not include
curl, causing a "command not found" failure; fix by either switching the image
to one that contains curl (or installing curl into the image), or replace the
curl check in the command (the long command starting with 'sleep 30;
max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 ...')
with a shell-native connectivity test such as bash /dev/tcp (or nc) so the
readiness loop works without curl. Ensure the chosen approach updates the image
line ("image: registry.access.redhat.com/ubi8/ubi:latest") or modifies the
command string accordingly.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -80,7 +80,7 @@ items: | |||||||||||||
| spec: | ||||||||||||||
| serviceAccountName: mongo-persistent-sa | ||||||||||||||
| containers: | ||||||||||||||
| - image: docker.io/library/mongo:7.0 | ||||||||||||||
| - image: quay.io/migtools/mongo:7.0.28 | ||||||||||||||
| imagePullPolicy: IfNotPresent | ||||||||||||||
| name: mongo | ||||||||||||||
| securityContext: | ||||||||||||||
|
|
@@ -135,7 +135,7 @@ items: | |||||||||||||
| timeoutSeconds: 5 | ||||||||||||||
| successThreshold: 1 | ||||||||||||||
| failureThreshold: 12 # 12x10sec = 2min before restart pod | ||||||||||||||
| - image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||
| name: curl-tool | ||||||||||||||
| command: ["/bin/sleep", "infinity"] | ||||||||||||||
| volumes: | ||||||||||||||
|
|
@@ -206,7 +206,7 @@ items: | |||||||||||||
| periodSeconds: 5 | ||||||||||||||
| initContainers: | ||||||||||||||
| - name: init-myservice | ||||||||||||||
| image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||
| image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | ||||||||||||||
|
||||||||||||||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | |
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w2 mongo 27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] |
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.
curl is not available in the ubi8/ubi base image.
Same issue as in mongo-persistent-csi.yaml — the init container command relies on curl, which is not installed in the base UBI image. This will break the init container.
🐛 Proposed fix using bash /dev/tcp instead of curl
- name: init-myservice
image: registry.access.redhat.com/ubi8/ubi:latest
- command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"']
+ command: ['bash', '-c', 'sleep 30; max_attempts=180; attempt=0; until timeout 2 bash -c "cat < /dev/null > /dev/tcp/mongo/27017" 2>/dev/null || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"']📝 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.
| image: registry.access.redhat.com/ubi8/ubi:latest | |
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until curl -s --connect-timeout 2 mongo:27017 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] | |
| image: registry.access.redhat.com/ubi8/ubi:latest | |
| command: ['bash', '-c', 'sleep 30; max_attempts=180; attempt=0; until timeout 2 bash -c "cat < /dev/null > /dev/tcp/mongo/27017" 2>/dev/null || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mongo DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mongo after $max_attempts attempts"; exit 1; fi; echo "mongo DB port reachable"'] |
🤖 Prompt for AI Agents
In `@tests/e2e/sample-applications/mongo-persistent/mongo-persistent.yaml` around
lines 209 - 210, The init container command uses curl but the image
registry.access.redhat.com/ubi8/ubi:latest does not include curl; update the
init container command (the command field in this manifest) to either install
curl (e.g., use microdnf to install curl before running the loop) or,
preferably, replace the curl check with a POSIX/bash TCP check using /dev/tcp
(e.g., use sh -c with a loop that tests </dev/tcp/host/port> or uses bash -c
'>/dev/tcp/mongo/27017' and checks the exit status) so the readiness loop in the
command string works without adding packages. Ensure you modify the command
string referenced in the diff accordingly (the command array that starts with
'sh', '-c', 'sleep 30; ...').
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -155,7 +155,7 @@ items: | |||||||||||||||||||||
| timeoutSeconds: 2 | ||||||||||||||||||||||
| successThreshold: 1 | ||||||||||||||||||||||
| failureThreshold: 40 # 40x30sec before restart pod | ||||||||||||||||||||||
| - image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||||||||||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||||||||||
| name: curl-tool | ||||||||||||||||||||||
| command: ["/bin/sleep", "infinity"] | ||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||
|
|
@@ -226,7 +226,7 @@ items: | |||||||||||||||||||||
| periodSeconds: 5 | ||||||||||||||||||||||
| initContainers: | ||||||||||||||||||||||
| - name: init-myservice | ||||||||||||||||||||||
| image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||||||||||
| image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||||||||||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"'] | ||||||||||||||||||||||
|
Comment on lines
228
to
230
Contributor
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. 🧩 Analysis chain🏁 Script executed: find . -type f -name "*mysql-persistent-csi.yaml" | head -20Repository: openshift/oadp-operator Length of output: 141 🏁 Script executed: cd tests/e2e/sample-applications/mysql-persistent 2>/dev/null && wc -l mysql-persistent-csi.yamlRepository: openshift/oadp-operator Length of output: 96 🏁 Script executed: sed -n '225,235p' tests/e2e/sample-applications/mysql-persistent/mysql-persistent-csi.yamlRepository: openshift/oadp-operator Length of output: 804 🌐 Web query:
💡 Result: Short answer: UBI 8 images do NOT include the ncat/nc binary by default. You must install the nmap-ncat package from the UBI/RHEL repositories (using dnf in the standard UBI image or microdnf in UBI‑minimal) to get ncat/nc. [1][2] Example (in ubi8/ubi-minimal):
Sources:
Init container will fail: The command on line 230 uses Example fix (install nmap-ncat at startup) initContainers:
- name: init-myservice
image: registry.access.redhat.com/ubi8/ubi:latest
+ securityContext:
+ runAsUser: 0
+ runAsGroup: 0
command:
- ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"']
+ ['bash', '-c', 'microdnf -y install nmap-ncat && sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"']📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| - apiVersion: route.openshift.io/v1 | ||||||||||||||||||||||
| kind: Route | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,7 +147,7 @@ items: | |
| timeoutSeconds: 2 | ||
| successThreshold: 1 | ||
| failureThreshold: 40 # 40x30sec before restart pod | ||
| - image: docker.io/curlimages/curl:8.5.0 | ||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||
| name: curl-tool | ||
| command: ["/bin/sleep", "infinity"] | ||
|
Comment on lines
+150
to
152
Contributor
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. 🧩 Analysis chain🏁 Script executed: cat -n tests/e2e/sample-applications/mysql-persistent/mysql-persistent-twovol-csi.yaml | head -160Repository: openshift/oadp-operator Length of output: 5495 🏁 Script executed: cat -n tests/e2e/sample-applications/mysql-persistent/mysql-persistent-twovol-csi.yaml | sed -n '140,240p'Repository: openshift/oadp-operator Length of output: 3761 🌐 Web query:
💡 Result: Short answer: The official UBI 8 "ubi" (standard) image does not include curl or netcat (nmap-ncat) by default, but both packages are available from the UBI 8 repositories and can be installed into the image (yum/dnf in the standard image; minimal/micro images may use microdnf or require enabling repos). [1][2][3] How to verify / install:
Sources:
🏁 Script executed: cat -n tests/e2e/sample-applications/mysql-persistent/mysql-persistent-twovol-csi.yaml | sed -n '226,228p'Repository: openshift/oadp-operator Length of output: 601 UBI 8 image lacks required tooling; netcat absence will prevent pod startup. Both containers use 🤖 Prompt for AI Agents |
||
| volumes: | ||
|
|
@@ -224,7 +224,7 @@ items: | |
| claimName: applog | ||
| initContainers: | ||
| - name: init-myservice | ||
| image: docker.io/curlimages/curl:8.5.0 | ||
| image: registry.access.redhat.com/ubi8/ubi:latest | ||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"'] | ||
|
Comment on lines
226
to
228
Contributor
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. 🧩 Analysis chain🌐 Web query:
💡 Result: Short answer: UBI8 images do not include /usr/bin/nc by default. You can add netcat using the RHEL packages (e.g., install nmap-ncat from AppStream) or the netcat package from EPEL — both provide an nc binary. Example install: dnf install -y nmap-ncat (or enable EPEL and install netcat). [1][2][3] Sources:
🏁 Script executed: rg '/usr/bin/nc|nc -z' tests/Repository: openshift/oadp-operator Length of output: 2169 🏁 Script executed: # Check if any of these files have dnf install or netcat installation commands
rg -A 5 -B 5 'init-myservice|dnf install|nmap-ncat|apt-get.*netcat' tests/e2e/sample-applications/mysql-persistent/Repository: openshift/oadp-operator Length of output: 4689 🏁 Script executed: # Check if there's a custom image or Dockerfile that might install netcat
fd -e Dockerfile -e dockerfile tests/e2e/sample-applications/mysql-persistent/Repository: openshift/oadp-operator Length of output: 560 🏁 Script executed: fd --full-path 'tests/e2e/sample-applications/mysql-persistent/.*Dockerfile'Repository: openshift/oadp-operator Length of output: 49 🏁 Script executed: # Check for any installation of netcat in the init commands more carefully
rg 'dnf install|yum install|apt-get' tests/e2e/sample-applications/Repository: openshift/oadp-operator Length of output: 180 Install netcat or use an alternative approach to verify MySQL connectivity. The Either install netcat in the init container command (e.g., 🤖 Prompt for AI Agents |
||
| - apiVersion: route.openshift.io/v1 | ||
| kind: Route | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,7 +168,7 @@ items: | |
| timeoutSeconds: 2 | ||
| successThreshold: 1 | ||
| failureThreshold: 40 # 40x30sec before restart pod | ||
| - image: docker.io/curlimages/curl:8.5.0 | ||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||
| name: curl-tool | ||
| command: ["/bin/sleep", "infinity"] | ||
| volumes: | ||
|
|
@@ -239,7 +239,7 @@ items: | |
| periodSeconds: 5 | ||
| initContainers: | ||
| - name: init-myservice | ||
| image: docker.io/curlimages/curl:8.5.0 | ||
| image: registry.access.redhat.com/ubi8/ubi:latest | ||
| command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"'] | ||
|
Comment on lines
240
to
243
Contributor
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. 🧩 Analysis chain🌐 Web query:
💡 Result: Short answer: UBI8 images do not include netcat (nc) / nmap-ncat by default. The UBI images ship a minimal set of packages (ubi, ubi-minimal, etc.) and provide Red Hat UBI BaseOS/AppStream repositories so you can install nmap-ncat (provided as the nmap-ncat package) with yum or microdnf. [1][2][3] References
🏁 Script executed: # First, let's examine the actual file to understand the context better
cat -n tests/e2e/sample-applications/mysql-persistent/mysql-persistent.yaml | head -250 | tail -20Repository: openshift/oadp-operator Length of output: 1169 🌐 Web query:
💡 Result: Short answer: The UBI8 "ubi:latest" (standard) image is a small, supported subset of RHEL‑8 userland that includes a curated set of core GNU/Linux and system utilities (tar, gzip, vi, coreutils, glibc, openssl, yum/dnf tooling, etc.) and is preconfigured to use the UBI 8 BaseOS and AppStream repositories. The exact package list varies by image build/tag (Red Hat rebuilds periodically), so to get the authoritative list for the specific ubi:latest you pull, run rpm -qa inside the image or inspect the image manifest. [1][2][3] How to see the exact packages yourself
Why the list can change
References
Sources 🏁 Script executed: # Let's also check if there are any other test files or scripts that might shed light on this
find tests -name "*.yaml" -o -name "*.yml" | head -10Repository: openshift/oadp-operator Length of output: 887 Remove The init-myservice container uses Replace with a bash-native TCP check: 🤖 Prompt for AI Agents |
||
| - apiVersion: route.openshift.io/v1 | ||
| kind: Route | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -140,7 +140,7 @@ items: | |||||||||||||||||||||
| timeoutSeconds: 2 | ||||||||||||||||||||||
| successThreshold: 1 | ||||||||||||||||||||||
| failureThreshold: 40 # 40x30sec before restart pod | ||||||||||||||||||||||
| - image: docker.io/curlimages/curl:8.5.0 | ||||||||||||||||||||||
| - image: registry.access.redhat.com/ubi8/ubi:latest | ||||||||||||||||||||||
|
Contributor
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. 🧩 Analysis chain🏁 Script executed: cat -n tests/e2e/sample-applications/virtual-machines/fedora-todolist/fedora-todolist.yaml | sed -n '140,210p'Repository: openshift/oadp-operator Length of output: 2780 🌐 Web query:
💡 Result: Short answer — the UBI8 "ubi" (standard) image is a small RHEL-based userland that includes package-management and common OS utilities. Notable tools shipped in the standard ubi8 image include:
Notes: the exact package list can change between image releases; for the authoritative, up‑to‑date contents check the Red Hat Ecosystem Catalog entry for ubi8 or inspect a pulled image (e.g., podman run --rm registry.access.redhat.com/ubi8/ubi rpm -qa). [2][3] Sources: Red Hat container docs and UBI catalog. [1][2][3] 🌐 Web query:
💡 Result: Short answer: No—UBI8 images do not reliably include netcat (nc) by default, and whether curl is present depends on the variant.
If you want, tell me which UBI8 tag (ubi, ubi-minimal, ubi-micro, or exact image:tag) and I’ll check that tag specifically. Citations:
🌐 Web query:
💡 Result: Short answer — difference and what’s included
Sources: Red Hat/UBI docs and Red Hat Developer articles describing "ubi" vs "ubi-minimal" (package counts, size and included tooling). [1][2][3][4] References The UBI8 base image does not include The Suggested remediation- - image: registry.access.redhat.com/ubi8/ubi:latest
+ - image: registry.access.redhat.com/ubi8/ubi:latest
name: curl-tool
- command: ["/bin/sleep", "infinity"]
+ command: ['sh', '-c', 'microdnf install -y curl nmap-ncat && sleep infinity']
...
- - name: init-myservice
- image: registry.access.redhat.com/ubi8/ubi:latest
- command: ['sh', '-c', 'sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"']
+ - name: init-myservice
+ image: registry.access.redhat.com/ubi8/ubi:latest
+ command: ['sh', '-c', 'microdnf install -y nmap-ncat && sleep 30; max_attempts=180; attempt=0; until /usr/bin/nc -z -w 1 mysql 3306 || [ $attempt -ge $max_attempts ]; do attempt=$((attempt+1)); echo "Attempt $attempt/$max_attempts: Trying to connect to mysql DB port"; sleep 5; done; if [ $attempt -ge $max_attempts ]; then echo "ERROR: Failed to connect to mysql after $max_attempts attempts"; exit 1; fi; echo "mysql DB port reachable"']Also applies to: 202-203 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| name: curl-tool | ||||||||||||||||||||||
| command: ["/bin/sleep", "infinity"] | ||||||||||||||||||||||
|
||||||||||||||||||||||
| command: ["/bin/sleep", "infinity"] | |
| command: | |
| - /bin/sh | |
| - -c | |
| - | | |
| set -e | |
| if ! command -v curl >/dev/null 2>&1; then | |
| microdnf install -y curl && microdnf clean all | |
| fi | |
| exec /bin/sleep infinity |
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.
The init container command uses
curlbut the UBI8 base image does not include curl by default. This will cause the init container to fail. Either install curl in the init container or use a different connectivity check method like/usr/bin/nc(which is available in UBI8) instead of curl.