Skip to content
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

windows port #264

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

windows port #264

wants to merge 1 commit into from

Conversation

maxsivkov
Copy link

This PR represent fluentd windows port

in order to run operator in heterogenous cluster (linux and windows nodes) one have to run two operator instances. One for linux and another for windows nodes.

Instructions

The easiest way to build linux and windows images is to have windows desktop (win 10) PC
Of course you'll need Docker Desktop installed https://docs.docker.com/desktop/windows/install/.
Docker Desktop should be running in WSL2 mode https://docs.docker.com/desktop/windows/wsl/
to be able to build linxu and windows images you need to install

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
  • Open cmd.exe in elevated prompt, install git (we will use bash from git package), make, jq
choco install git make jq -y
  • Open cmd.exe, cd to the project root. Execute
"%ProgramFiles%\Git\git-bash.exe" --cd=.
  • Open Docker Desktop, check if it is running in "Linux containers" mode. Build linux base image and reloader images with following command:
make build-image
  • Push linux image with make push-image

  • Switch Docker Desktop to "Windows containers" mode. Build windows images (for each windows platform you want to support https://hub.docker.com/_/microsoft-windows-servercore)
    NOTE: you need to change WIN_TAG for each iteration. For example: WIN_TAG := {ltsc2019, 1909, 2004, 20H2, ltsc2022}

    • Build base image for windows container with following command

      make build-windows-image IMG_OS=windows WIN_TAG=ltsc2019
      

      NOTE: you need to build as many base images as many windows versions you want to support (changing WIN_TAG parameter. Possible values https://hub.docker.com/_/microsoft-windows-servercore)

    • Build operator image

      make build-windows-image IMG_ARCH=amd64 IMG_OS=windows WIN_TAG=ltsc2019
      

      NOTE: you need to build as many base images as many windows versions you want to support (changing WIN_TAG parameter. Possible values https://hub.docker.com/_/microsoft-windows-servercore)

    • Push each windows image with make push-windows-image IMG_ARCH=amd64 IMG_OS=windows WIN_TAG=ltsc2019

  • After all use make pushed-images to view all pushed images for the current release version

  • Prepare multi-arch manifest

    • Execute make docker-manifest to create docker manifest and include all images for current release
    • Annotate each image with arch and os tags. I don't know how to automate this. For example
      IMAGE=vmware/kube-fluentd-operator
      VERSION=$(git describe --tags --always --dirty)
      
      # Annotate linux version
      docker manifest annotate $IMAGE:$VERSION $IMAGE:amd64-linux-$VERSION --arch amd64 --os linux
      # Annotate windows version
      docker manifest annotate $IMAGE:$VERSION $IMAGE:amd64-windows-ltsc2019-$VERSION --arch amd64 --os windows --os-version 10.0.17763.2114
      
    • Push manifest to the registry
      docker manifest push -p $IMAGE:$VERSION
      
  • The same needs to be done in order to support 'latest' tag:

make docker-latest-manifest
IMAGE=vmware/kube-fluentd-operator
VERSION=$(git describe --tags --always --dirty)
# Annotate linux version
docker manifest annotate $IMAGE:latest $IMAGE:amd64-linux-$VERSION --arch amd64 --os linux
# Annotate windows version
docker manifest annotate $IMAGE:latest $IMAGE:amd64-windows-ltsc2019-$VERSION --arch amd64 --os windows --os-version 10.0.17763.2114
docker manifest push -p $IMAGE:latest

You may check if all images are combined under single manifest on dockerhub.com site.
As an example: https://hub.docker.com/layers/168658076/maxsivkov/kube-fluentd-operator/latest/images/sha256-3da050dc7b041e9415a472e3e6c06c5835b65186aca8ac45d6b6952e2f12ad6a?context=repo

@vmwclabot
Copy link
Member

@maxsivkov, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <john.doe@email.org> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link
Member

@maxsivkov, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <john.doe@email.org> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

Signed-off-by: Max Sivkov <maxsivkov@gmail.com>
@Cryptophobia
Copy link
Contributor

Hi @maxsivkov , thank you for the contributions! Looks good but I need to do a deeper review and test.

I will merge this in at some point after we make a new release and fix some of the config-reloader issues. I don't want to merge and create a regression in charts that we may need to chase later until we stabilize after the bug fixes.

@maxsivkov
Copy link
Author

Hi @maxsivkov , thank you for the contributions! Looks good but I need to do a deeper review and test.

I will merge this in at some point after we make a new release and fix some of the config-reloader issues. I don't want to merge and create a regression in charts that we may need to chase later until we stabilize after the bug fixes.

Thanks.
Please drop me a message when you'll be ready to process with my PR. I will update conflicting files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants