angelnu / containers

Kubernetes tailored container images for various applications
Apache License 2.0
1 stars 2 forks source link

cni-plugin container for ARM64 appears to have the AMD64 binaries #96

Open hagak opened 1 month ago

hagak commented 1 month ago

I am trying to deploy multus to an ARM64 env and using your cni-plugins image the init container runs successfully but the /opt/cni/bin binaries it deploys appear to be for amd64.

I then created a pod with the ghcr.io/angelnu/cni-plugins:1.5.0 image but change the entry point to be a continous loop so I could inspect the image. I tried running the /plugins/macvlan within the container and it return the "exec format error". I then from inside the container did a wget https://github.com/containernetworking/plugins/releases/download/v1.5.0/cni-plugins-linux-arm64-v1.5.0.tgz and extracted the binaries to /plugins and performed the test again and was presented with the version info as expected.

angelnu commented 1 month ago

Thanks for reporting. The github action at https://github.com/angelnu/containers/blob/main/.github/workflows/action-image-build.yaml seems to only be building amd64...

Will need to find out why as the cni-plugins also include arm64 as target platform

hagak commented 1 month ago

So the image that is built is an arm64 image just the binaries for cni-plugins are not. I suspect whatever is defining TargetArch is the issue. Targetplatform seems correct. Sorry responding on my phone so going off memory here.

angelnu commented 1 month ago

The location is here. TARGETARCH should be set automatically by buildah - https://github.com/containers/buildah/issues/1368

So we need to find why it is not working if platform is right according to your comment. A focker inspect of the image would help to see the link that was downloaded.

hagak commented 1 month ago

Docker inspect:

[
    {
        "Id": "sha256:5f53e25d4a1383c5177036cc4034725db9def9d1e10453a38cfe96135e347cde",
        "RepoTags": [],
        "RepoDigests": [
            "ghcr.io/angelnu/cni-plugins@sha256:234e683049208d29203880bc149afb4ba6b4ac4bb8de5bab7e2621c9dc6d25b4"
        ],
        "Parent": "",
        "Comment": "FROM ghcr.io/onedr0p/alpine@sha256:3fbc581cb0fe29830376161ae026e2a765dcc11e1747477fe9ebf155720b8638",
        "Created": "2024-05-20T09:07:39.766124124Z",
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "a7e98563925e",
            "Domainname": "",
            "User": "root",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "TARGETPLATFORM=linux/arm64",
                "UMASK=0002",
                "TZ=Etc/UTC"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "cp /plugins/* /host/opt/cni/bin"
            ],
            "Image": "",
            "Volumes": {
                "/config": {}
            },
            "WorkingDir": "/app",
            "Entrypoint": [
                "/usr/bin/catatonit",
                "--"
            ],
            "OnBuild": [],
            "Labels": {
                "io.buildah.version": "1.23.1",
                "org.opencontainers.image.authors": "\"Angel Nunez Mencias <git@angelnu.com>\"",
                "org.opencontainers.image.build.url": "\"https://github.com/angelnu/actions/runs/9156299008\"",
                "org.opencontainers.image.created": "\"2024-05-20 09:07:19+00:00\"",
                "org.opencontainers.image.documentation": "\"https://github.com/angelnu/apps/cni-plugins/README.md\"",
                "org.opencontainers.image.revision": "\"c74731b90adbc2fdb723fcd5d67a7710a11111db\"",
                "org.opencontainers.image.source https://github.com/OWNER/REPO": "",
                "org.opencontainers.image.title": "\"cni-plugins (stable)\"",
                "org.opencontainers.image.url": "\"https://github.com/angelnu/apps/cni-plugins\"",
                "org.opencontainers.image.vendor": "onedr0p",
                "org.opencontainers.image.version": "\"1.5.0\""
            }
        },
        "Architecture": "arm64",
        "Os": "linux",
        "Size": 168992741,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/5fda3ac34268c115717846d6cc44fa90d77b67f84bbf1801cdaa54155540e5d6/diff:/var/lib/docker/overlay2/1ff818798302b1e660888858d744ffe9ea96d493725ae356b29bcf83900cfbeb/diff:/var/lib/docker/overlay2/e8bf9f245aa1f91e9831159310aff4bdfa5a1bb09a84829afdbb91a36a30aed1/diff:/var/lib/docker/overlay2/dffa5476e552d7561572438733dcbf9ddb7a5001df4fbe594a38620080ec0863/diff:/var/lib/docker/overlay2/dffa42727283a74d30b8173120ceed3f703f7830888198a2a04c858be7bf3abe/diff:/var/lib/docker/overlay2/3196ec206b6817a018876fec33681e5c7909a5f399513acfe4242c4466b8a9bd/diff",
                "MergedDir": "/var/lib/docker/overlay2/8c2d558913e3740178e546d4ba8c1a81ce0f2dba54a270587614bbde606e0b12/merged",
                "UpperDir": "/var/lib/docker/overlay2/8c2d558913e3740178e546d4ba8c1a81ce0f2dba54a270587614bbde606e0b12/diff",
                "WorkDir": "/var/lib/docker/overlay2/8c2d558913e3740178e546d4ba8c1a81ce0f2dba54a270587614bbde606e0b12/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:b09314aec293bcd9a8ee5e643539437b3846f9e5e55f79e282e5f67e3026de5e",
                "sha256:07bfe0dc4fbe0cc62cd3308f09edaee0b7d3f27b81100f2e87aabfe9b9acba4b",
                "sha256:839d79aa6c32456418d5af05f49fe0488d943e406f767cc8afc106dff0af823d",
                "sha256:c6f6f661edd3003daeece6b500f6c881f93171ce6dfc551ae41b5a886cd306a8",
                "sha256:3cf032e29e4c8e4c4cdf808d8b243050ecbb97abea31ae07477e3c1078f72dd6",
                "sha256:cfbeb859fbad78db42de052e1a5c11bb9e5eb8a56a21b2239c502713842ddccf",
                "sha256:39b57c0c8dec86b0ca7b0da762a839398b589d6c13355721f8bf91b1d0af3df1"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
angelnu commented 1 month ago

We would need the commands used to build the layers to see how the variables in tje download url were expanded. See https://github.com/containers/buildah/issues/1368#issuecomment-818385728

hagak commented 1 month ago

Not sure how i can help with that, I am not familiar with the build process you have.