-
Notifications
You must be signed in to change notification settings - Fork 290
OCPBUGS-83863: Remove version-specific CNI binary copy logic #2967
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
Merged
openshift-merge-bot
merged 2 commits into
openshift:master
from
sdodson:OCPBUGS-83863-remove-rhel8-fallback
May 23, 2026
+14
−148
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,8 @@ data: | |
| DESTINATION_DIRECTORY=/host/opt/cni/bin/ | ||
|
|
||
| # Perform validation of usage | ||
| if [ -z "$RHEL8_SOURCE_DIRECTORY" ] || | ||
| [ -z "$RHEL9_SOURCE_DIRECTORY" ] || | ||
| [ -z "$DEFAULT_SOURCE_DIRECTORY" ]; then | ||
| log "FATAL ERROR: You must set env variables: RHEL8_SOURCE_DIRECTORY, RHEL9_SOURCE_DIRECTORY, DEFAULT_SOURCE_DIRECTORY" | ||
| if [ -z "$SOURCE_DIRECTORY" ]; then | ||
| log "FATAL ERROR: You must set the SOURCE_DIRECTORY env variable" | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
@@ -33,62 +31,15 @@ data: | |
| exit 1 | ||
| fi | ||
|
|
||
| # Collect host OS information | ||
| . /host/etc/os-release | ||
| rhelmajor= | ||
| # detect which version we're using in order to copy the proper binaries | ||
| case "${ID}" in | ||
| rhcos|scos) | ||
| RHEL_VERSION=$(echo "${CPE_NAME}" | cut -f 5 -d :) | ||
| rhelmajor=$(echo $RHEL_VERSION | sed -E 's/([0-9]+)\.{1}[0-9]+(\.[0-9]+)?/\1/') | ||
| ;; | ||
| rhel|centos) rhelmajor=$(echo "${VERSION_ID}" | cut -f 1 -d .) | ||
| ;; | ||
| fedora) | ||
| if [ "${VARIANT_ID}" == "coreos" ]; then | ||
| rhelmajor=8 | ||
| else | ||
| log "FATAL ERROR: Unsupported Fedora variant=${VARIANT_ID}" | ||
| exit 1 | ||
| fi | ||
| ;; | ||
| *) log "FATAL ERROR: Unsupported OS ID=${ID}"; exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| # Set which directory we'll copy from, detect if it exists | ||
| sourcedir= | ||
| founddir=false | ||
| case "${rhelmajor}" in | ||
| 8) | ||
| if [ -d "${RHEL8_SOURCE_DIRECTORY}" ]; then | ||
| sourcedir=${RHEL8_SOURCE_DIRECTORY} | ||
| founddir=true | ||
| fi | ||
| ;; | ||
| 9) | ||
| if [ -d "${RHEL9_SOURCE_DIRECTORY}" ]; then | ||
| sourcedir=${RHEL9_SOURCE_DIRECTORY} | ||
| founddir=true | ||
| fi | ||
| ;; | ||
| *) | ||
| log "ERROR: RHEL Major Version Unsupported, rhelmajor=${rhelmajor}" | ||
| ;; | ||
| esac | ||
|
|
||
| # When it doesn't exist, fall back to the original directory. | ||
| if [ "$founddir" == false ]; then | ||
| log "Source directory unavailable for OS version: ${rhelmajor}" | ||
| sourcedir=$DEFAULT_SOURCE_DIRECTORY | ||
| fi | ||
| sourcedir="${SOURCE_DIRECTORY}" | ||
| log "Copying binaries from ${sourcedir}" | ||
|
|
||
| # Use a subdirectory called "upgrade" so we can atomically move fully copied files. | ||
| # We now use --remove-destination after running into an issue with -f not working over symlinks | ||
| UPGRADE_DIRECTORY=${DESTINATION_DIRECTORY}upgrade_$(uuidgen) | ||
| rm -Rf $UPGRADE_DIRECTORY | ||
| mkdir -p $UPGRADE_DIRECTORY | ||
| cp -r --remove-destination ${sourcedir}* $UPGRADE_DIRECTORY | ||
| find "${sourcedir}" -maxdepth 1 -mindepth 1 ! -type d -exec cp --remove-destination {} "${UPGRADE_DIRECTORY}/" \; | ||
| if [ $? -eq 0 ]; then | ||
| log "Successfully copied files in ${sourcedir} to $UPGRADE_DIRECTORY" | ||
| else | ||
|
|
@@ -221,8 +172,6 @@ spec: | |
| volumeMounts: | ||
| - mountPath: /entrypoint | ||
| name: cni-binary-copy | ||
| - mountPath: /host/etc/os-release | ||
| name: os-release | ||
| - name: system-cni-dir | ||
| mountPath: /host/etc/cni/net.d | ||
| - name: multus-cni-dir | ||
|
|
@@ -260,11 +209,7 @@ spec: | |
| - name: etc-kubernetes | ||
| mountPath: /etc/kubernetes | ||
| env: | ||
| - name: RHEL8_SOURCE_DIRECTORY | ||
| value: "/usr/src/multus-cni/rhel8/bin/" | ||
| - name: RHEL9_SOURCE_DIRECTORY | ||
| value: "/usr/src/multus-cni/rhel9/bin/" | ||
| - name: DEFAULT_SOURCE_DIRECTORY | ||
| - name: SOURCE_DIRECTORY | ||
| value: "/usr/src/multus-cni/bin/" | ||
| - name: KUBERNETES_SERVICE_PORT | ||
| value: "{{.KUBERNETES_SERVICE_PORT}}" | ||
|
|
@@ -304,10 +249,6 @@ spec: | |
| hostPath: | ||
| path: {{ .CNIBinDir }} | ||
| type: Directory | ||
| - name: os-release | ||
| hostPath: | ||
| path: /etc/os-release | ||
| type: File | ||
| - name: cni-binary-copy | ||
| configMap: | ||
| name: cni-copy-resources | ||
|
|
@@ -399,15 +340,8 @@ spec: | |
| name: cni-binary-copy | ||
| - mountPath: /host/opt/cni/bin | ||
| name: cnibin | ||
| - mountPath: /host/etc/os-release | ||
| name: os-release | ||
| readOnly: true | ||
| env: | ||
| - name: RHEL8_SOURCE_DIRECTORY | ||
| value: "/usr/src/egress-router-cni/rhel8/bin/" | ||
| - name: RHEL9_SOURCE_DIRECTORY | ||
| value: "/usr/src/egress-router-cni/rhel9/bin/" | ||
| - name: DEFAULT_SOURCE_DIRECTORY | ||
| - name: SOURCE_DIRECTORY | ||
| value: "/usr/src/egress-router-cni/bin/" | ||
| - name: cni-plugins | ||
| image: {{.CNIPluginsImage}} | ||
|
|
@@ -418,20 +352,13 @@ spec: | |
| name: cni-binary-copy | ||
| - mountPath: /host/opt/cni/bin | ||
| name: cnibin | ||
| - mountPath: /host/etc/os-release | ||
| name: os-release | ||
| readOnly: true | ||
| - mountPath: /host/etc/cni/tuning/ | ||
| name: tuning-conf-dir | ||
| readOnly: false | ||
| - mountPath: /sysctls | ||
| name: cni-sysctl-allowlist | ||
| env: | ||
| - name: RHEL8_SOURCE_DIRECTORY | ||
| value: "/usr/src/plugins/rhel8/bin/" | ||
| - name: RHEL9_SOURCE_DIRECTORY | ||
| value: "/usr/src/plugins/rhel9/bin/" | ||
| - name: DEFAULT_SOURCE_DIRECTORY | ||
| - name: SOURCE_DIRECTORY | ||
| value: "/usr/src/plugins/bin/" | ||
| - name: bond-cni-plugin | ||
| image: {{.BondCNIPluginImage}} | ||
|
|
@@ -442,16 +369,9 @@ spec: | |
| name: cni-binary-copy | ||
| - mountPath: /host/opt/cni/bin | ||
| name: cnibin | ||
| - mountPath: /host/etc/os-release | ||
| name: os-release | ||
| readOnly: true | ||
| env: | ||
| - name: RHEL8_SOURCE_DIRECTORY | ||
| value: "/bondcni/rhel8/" | ||
| - name: RHEL9_SOURCE_DIRECTORY | ||
| value: "/bondcni/rhel9/" | ||
| - name: DEFAULT_SOURCE_DIRECTORY | ||
| value: "/bondcni/rhel9/" | ||
| - name: SOURCE_DIRECTORY | ||
| value: "/bondcni/" | ||
|
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. right, ok, although we weren't using it before, the bond-cni image does include a "default" build at the top level |
||
| - name: routeoverride-cni | ||
| image: {{.RouteOverrideImage}} | ||
| command: ["/entrypoint/cnibincopy.sh"] | ||
|
|
@@ -461,15 +381,8 @@ spec: | |
| name: cni-binary-copy | ||
| - mountPath: /host/opt/cni/bin | ||
| name: cnibin | ||
| - mountPath: /host/etc/os-release | ||
| name: os-release | ||
| readOnly: true | ||
| env: | ||
| - name: RHEL8_SOURCE_DIRECTORY | ||
| value: "/usr/src/route-override/rhel8/bin/" | ||
| - name: RHEL9_SOURCE_DIRECTORY | ||
| value: "/usr/src/route-override/rhel9/bin/" | ||
| - name: DEFAULT_SOURCE_DIRECTORY | ||
| - name: SOURCE_DIRECTORY | ||
| value: "/usr/src/route-override/bin/" | ||
| - name: whereabouts-cni-bincopy | ||
| image: {{.WhereaboutsImage}} | ||
|
|
@@ -484,15 +397,8 @@ spec: | |
| name: cni-binary-copy | ||
| - mountPath: /host/opt/cni/bin | ||
| name: cnibin | ||
| - mountPath: /host/etc/os-release | ||
| name: os-release | ||
| readOnly: true | ||
| env: | ||
| - name: RHEL8_SOURCE_DIRECTORY | ||
| value: "/usr/src/whereabouts/rhel8/bin/" | ||
| - name: RHEL9_SOURCE_DIRECTORY | ||
| value: "/usr/src/whereabouts/rhel9/bin/" | ||
| - name: DEFAULT_SOURCE_DIRECTORY | ||
| - name: SOURCE_DIRECTORY | ||
| value: "/usr/src/whereabouts/bin/" | ||
| - name: whereabouts-cni | ||
| image: {{.WhereaboutsImage}} | ||
|
|
@@ -697,10 +603,6 @@ spec: | |
| - name: cnibin | ||
| hostPath: | ||
| path: {{ .CNIBinDir }} | ||
| - name: os-release | ||
| hostPath: | ||
| path: /etc/os-release | ||
| type: File | ||
| - name: cni-binary-copy | ||
| configMap: | ||
| name: cni-copy-resources | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This command is pretty non-obvious, and also very specific to right now, where we know that
${sourcedir}contains subdirectories that we don't care about. Once we update the other modules to stop building the versioned binaries, this fix will be unnecessary. Can we just leave it out?