Skip to content

Windows containers: Affinity assistant doesn't work as there's no Windows nop image #4471

@lippertmarkus

Description

@lippertmarkus

Expected Behavior

Affinity assistant should work when using tasks running on Windows with workspaces.

Actual Behavior

Affinity assistant doesn't work when using tasks running on Windows with workspaces as there's no Windows image for gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop (not for 0.31, 0.30 and 0.29).

Steps to Reproduce the Problem

  1. Deploy the following pipeline
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: hello-world
spec:
  pipelineSpec:
    workspaces:
      - name: workdir
    tasks:
      - name: task-win
        workspaces:
          - name: workdir
            workspace: workdir
        taskSpec:
          workspaces:
            - name: workdir
              mountPath: /workdir
          steps:
            - name: hello-windows
              image: mcr.microsoft.com/windows/nanoserver:1809
              command: ["cmd", "/c"]
              args: ["echo", "Hello from Windows Container!", ">", "C:\\workdir\\test.txt"]
      - name: task-lin
        runAfter:
          - task-win
        workspaces:
          - name: workdir
            workspace: workdir
        taskSpec:
          workspaces:
            - name: workdir
              mountPath: /workdir
          steps:
            - name: hello-linux
              image: alpine
              command: ["cat"]
              args: ["/workdir/test.txt"]    
  
  workspaces:
    - name: workdir
      volumeClaimTemplate:
        spec:
          accessModes: [ "ReadWriteMany" ]
          storageClassName: azurefile-csi
          resources:
            requests:
              storage: 1Gi
  
  taskRunSpecs:
    - pipelineTaskName: task-win
      taskPodTemplate:
        nodeSelector:
          kubernetes.io/os: windows  # runs on Windows
        securityContext:
          windowsOptions:
            runAsUserName: "ContainerAdministrator"
    - pipelineTaskName: task-lin
      taskPodTemplate:
        nodeSelector:
          kubernetes.io/os: linux  # runs on Linux
  1. Check the event of the affinity assistant pod created on the Windows node:
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  2m52s                default-scheduler  0/2 nodes are available: 2 pod has unbound immediate PersistentVolumeClaims.
  Normal   Scheduled         2m50s                default-scheduler  Successfully assigned default/affinity-assistant-4c53d012cf-0 to akswin1000000
  Normal   Pulling           89s (x4 over 2m49s)  kubelet            Pulling image "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.30.0@sha256:89cb4d5572372c7ade6b20b59bf35dc9dcd5e4cde2fa77f14888d4f7059cd767"
  Warning  Failed            89s (x4 over 2m49s)  kubelet            Error: ErrImagePull
  Normal   BackOff           53s (x7 over 2m48s)  kubelet            Back-off pulling image "gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/nop:v0.30.0@sha256:89cb4d5572372c7ade6b20b59bf35dc9dcd5e4cde2fa77f14888d4f7059cd767"                                                                    

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:41:01Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-18T19:30:35Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}
  • Tekton Pipeline version: v0.30.0

According to #3996 the nop image should be built for Windows as well.
My workaround currently is to disable the affinity assistant:

kubectl patch cm feature-flags -n tekton-pipelines -p '{\"data\": {\"disable-affinity-assistant\": \"true\"}}'

cc @imjasonh @aiden-deloryn who worked on that :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions