Created
July 2, 2024 12:33
-
-
Save dmc5179/977276deba683e38433fd2f7fbe7f09e to your computer and use it in GitHub Desktop.
Script to fix an operator index container image created by oc-mirror with an improperly set umask
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
#!/bin/bash -xe | |
# This script is indexed to "fix" an operator index image created by the oc-mirror tool where | |
# the /configs and files under /configs are created with root only read permissions. | |
# When /configs and the files under that directory can only be read by root, the operator index container | |
# will crash when running on OpenShift as the non-root users that the index runs as will be unable | |
# to read the operator index configuration data under /configs | |
# Change INDEX to the index container image that needs to be fixed | |
INDEX="ip-10-0-185-96.us-east-2.compute.internal:8443/redhat/redhat-operator-index:v4.15" | |
#INDEX="ip-10-0-185-96.us-east-2.compute.internal:8443/redhat/certified-operator-index:v4.15" | |
#INDEX="ip-10-0-185-96.us-east-2.compute.internal:8443/redhat/community-operator-index:v4.15" | |
# Stop and cleanup previous runs | |
podman stop index || true | |
podman rm index || true | |
podman run -d --rm --name index --entrypoint '["/bin/bash","-c","sleep 9999"]' "${INDEX}" | |
podman exec -ti --user root index /bin/bash -c "chmod -R 0755 /configs" | |
podman commit index modified-operator-index:v4.15 | |
podman stop index || true | |
podman rm index || true | |
podman rmi "${INDEX}" | |
podman tag localhost/modified-operator-index:v4.15 "${INDEX}" | |
podman push "${INDEX}" | |
podman rmi localhost/modified-operator-index:v4.15 | |
podman rmi "${INDEX}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment