Developing MinIO Operator with Podman - cesnietor/dev-docs GitHub Wiki

Overview

Developing for MinIO Operator requires to have a Kubernetes environment due to the nature of the product itself.

Podman is an alternative to Docker Desktop (requires subscription) and with few tweaks and considerations it can be a good replacement.

You can download the binaries but for Mac you still require a dockerd daemon and Virtual machine as per Docker docs:

"The macOS binary includes the Docker client only. It does not include the dockerd daemon which is required to run containers."

Note: This assumes you are using Mac M2 Pro.

See also:

Prerequirements:

Installing Podman

If you want the desktop UI experience, install Podman Desktop for Mac.
TL;DR:

brew install podman-desktop

No CLI: docs
TL;DR:

brew install podman
podman machine init
podman machine start
podman info

See podman machine command docs for more custom configuration like memory, cpu, etc.

For Podman Desktop

  1. Set your Podman machine configuration by creating a new one and start it.
    Screenshot 2023-04-21 at 10 57 56 AM
    Refer to Podman Desktop docs for more info.
  2. Disable Kubernetes since we'll be using Kind.
  3. Disable rootless default config for podman (needed for Kind to work).
podman system connection ls
podman system connection default podman-machine-default-root
  1. Create a symlink (alias is not enough)
ln -s  /opt/podman/bin/podman /usr/bin/docker

If not set, the make docker command in /operator will fail.

Verify Podman works

List images:

√ ~ % docker images
REPOSITORY                         TAG                    IMAGE ID       CREATED         SIZE
minio/k8s-operator                 latest                 8a6672234bde   14 hours ago    204MB
kindest/node                       <none>                 0dc0bbd0350c   3 weeks ago     858MB

Using docker since we already created a symlink.

Uploading your image to Kind registry

  1. Start your Kind cluster. See docs.
  2. Build image in your /operator folder like:
make build TAG="minio/operator:<YOUR_TAG>"
  1. Kind load docker-images is strictly for docker so use podman save and image-archive instead. This will store your images in a .tar file so that Kind can upload them without issues. See discussion.
podman save --output images.tar localhost/minio/operator:<YOUR_TAG>
kind load image-archive images.tar 

Considerations

  • Podman adds a localhost/ to the image name when creating a new image e.g. localhost/<IMAGE_NAME>. See discussion.
  • You will now have to deal with the new .tar file created for your images. (add it to your .gitignore)
⚠️ **GitHub.com Fallback** ⚠️