sigs.k8s.io/cluster-api-provider-azure@v1.14.3/templates/test/dev/custom-builds/patches/kubeadm-bootstrap-windows-k8s-pr-binaries.yaml (about)

     1  - op: add
     2    path: /spec/template/spec/files/-
     3    value:
     4      content: |
     5        Write-Host "Installing Azure CLI"
     6        $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://azcliprod.blob.core.windows.net/msi/azure-cli-2.53.0.msi -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi
     7        # Need to add manually AZ to PATH as it is not added without a reset
     8        Write-Host "Adding AZ to path:"
     9        $env:PATH +=";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
    10        Write-Host "Version Azure CLI:"
    11        az version
    12      path: C:/install-az-cli.ps1
    13      permissions: "0744"
    14  - op: add
    15    path: /spec/template/spec/files/-
    16    value:
    17      content: |
    18        $ErrorActionPreference = 'Stop'
    19  
    20        Stop-Service kubelet -Force
    21  
    22        $$KUBE_GIT_VERSION="${KUBE_GIT_VERSION}"
    23        if($$KUBE_GIT_VERSION -ne "")
    24        {
    25          # Need to add manually AZ to PATH as it is not added without a reset
    26          Write-Host "Adding AZ to path:"
    27          $env:PATH +=";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
    28          # Install Binaries
    29          $$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy")
    30          $$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_BLOB_CONTAINER_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64"
    31          echo "running az login via identity"
    32          az login --identity
    33          foreach ( $$binary in $$binaries )
    34          {
    35            echo "downloading binary: $$ci_url/$$binary.exe"
    36            az storage blob download --blob-url "$$ci_url/$$binary.exe" --file "c:/k/$$binary.exe" --auth-mode login
    37          }
    38        }
    39  
    40        # Tag it to the ci version.  The image knows how to use the copy locally with the configmap
    41        # that is applied at at this stage (windows-kubeproxy-ci.yaml)
    42        ctr.exe -n k8s.io images pull docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess
    43        ctr.exe -n k8s.io images tag docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess "docker.io/sigwindowstools/kube-proxy:${CI_VERSION/+/_}-calico-hostprocess"
    44  
    45        kubeadm.exe version -o=short
    46        kubectl.exe version --client=true
    47        kubelet.exe --version
    48        kube-proxy.exe --version
    49      path: C:/replace-pr-binaries.ps1
    50      permissions: "0744"
    51  - op: add
    52    path: /spec/template/spec/preKubeadmCommands/-
    53    value:
    54      powershell C:/install-az-cli.ps1
    55  - op: add
    56    path: /spec/template/spec/preKubeadmCommands/-
    57    value:
    58      powershell C:/replace-pr-binaries.ps1