Skip to content

Commit

Permalink
Add aws-iam-authenticator to windows image to allow aws aks auth (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-Walsh authored Sep 15, 2021
1 parent 13a3f42 commit e4eb6e0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
10 changes: 7 additions & 3 deletions ubuntu.18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM ubuntu:18.04

ARG Aws_Cli_Version=2.0.60
ARG Aws_Iam_Authenticator_Version=0.5.1
ARG Aws_Iam_Authenticator_Version=0.5.3
ARG Aws_Powershell_Version=4.1.2
ARG Azure_Cli_Version=2.14.0\*
ARG Azure_Powershell_Version=4.5.0
ARG Dotnet_Sdk_Version=3.1.401-1
Expand All @@ -13,7 +14,6 @@ ARG Java_Jdk_Version=11.0.11+9-0ubuntu2~18.04
ARG Kubectl_Version=1.18.8-00
ARG Octopus_Cli_Version=7.4.1
ARG Octopus_Client_Version=8.8.3
ARG Node_Version=14.17.2\*
ARG Powershell_Version=7.0.6\*
ARG Terraform_Version=1.0.0
ARG Umoci_Version=0.4.6
Expand Down Expand Up @@ -45,6 +45,10 @@ RUN pwsh -c 'Install-Package -Force Octopus.Client -MaximumVersion "'${Octopus_C
octopusClientPackagePath=$(pwsh -c '(Get-Item ((Get-Package Octopus.Client).source)).Directory.FullName') && \
cp -r $octopusClientPackagePath/lib/netstandard2.0/* .

# Get AWS Powershell core modules
# https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-linux-mac.html
RUN pwsh -c 'Install-Module -Force -Name AWSPowerShell.NetCore -AllowClobber -Scope AllUsers -MaximumVersion "'${Aws_Powershell_Version}'"'

# Get AZ Powershell core modules
# https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1
RUN pwsh -c 'Install-Module -Force -Name Az -AllowClobber -Scope AllUsers -MaximumVersion "'${Azure_Powershell_Version}'"'
Expand Down Expand Up @@ -77,7 +81,7 @@ RUN wget --quiet -O - https://packages.microsoft.com/keys/microsoft.asc | gpg --
# Get NodeJS
# https://websiteforstudents.com/how-to-install-node-js-10-11-12-on-ubuntu-16-04-18-04-via-apt-and-snap/\
RUN wget --quiet -O - https://deb.nodesource.com/setup_14.x | bash && \
apt-get install -y nodejs=${Node_Version}
apt-get install -y nodejs

# Get Kubectl
# https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-using-native-package-management
Expand Down
10 changes: 7 additions & 3 deletions ubuntu.18.04/spec/ubuntu.18.04.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ Describe 'installed dependencies' {
$LASTEXITCODE | Should -be 0
}

It 'has aws powershell module installed' {
(Get-Module AWSPowerShell.NetCore -ListAvailable).Version.ToString() | should -be '4.1.2.0'
}

It 'has az installed' {
$output = (& az version) | convertfrom-json
$output.'azure-cli' | Should -be '2.14.0'
$LASTEXITCODE | Should -be 0
}

it 'has az powershell module installed' {
It 'has az powershell module installed' {
(Get-Module Az -ListAvailable).Version.ToString() | should -be '4.5.0'
}

Expand All @@ -37,7 +41,7 @@ Describe 'installed dependencies' {
}

It 'has node installed' {
node --version | Should -match '14.17.2'
node --version | Should -match '14.\d+.\d+'
$LASTEXITCODE | Should -be 0
}

Expand Down Expand Up @@ -98,7 +102,7 @@ Describe 'installed dependencies' {
}

It 'has aws-iam-authenticator installed' {
aws-iam-authenticator version | Should -match '0.5.1'
aws-iam-authenticator version | out-null
$LASTEXITCODE | Should -be 0
}

Expand Down
4 changes: 4 additions & 0 deletions windows.ltsc2019/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command"]

ARG Aws_Cli_Version=2.0.60
ARG Aws_Iam_Authenticator_Version=0.5.3
ARG Aws_Powershell_Version=4.1.2
ARG Azure_Cli_Version=2.14.0
ARG Eks_Cli_Version=0.25.0
Expand Down Expand Up @@ -41,6 +42,9 @@ RUN choco install azure-cli -y --version $Env:Azure_Cli_Version --no-progress
# Install the AWS CLI
RUN choco install awscli -y --version $Env:Aws_Cli_Version --no-progress

# Install the AWS IAM Authenticator
RUN choco install aws-iam-authenticator -y --version $Env:Aws_Iam_Authenticator_Version --no-progress

# # Install AWS PowerShell module
# # https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-windows.html#ps-installing-awspowershellnetcore
RUN Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; `
Expand Down
5 changes: 5 additions & 0 deletions windows.ltsc2019/spec/windows.ltsc2019.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Describe 'installed dependencies' {
Import-Module AWSPowerShell.NetCore
Get-AWSPowerShellVersion | Should -Match '4.1.2'
}

# There is no version command for aws-iam-authenticator, so we just check for the installed version.
It 'has aws-iam-authenticator installed' {
Test-Path 'C:\ProgramData\chocolatey\bin\aws-iam-authenticator.exe' | should -be $true
}

It 'has node installed' {
node --version | Should -Match '14.17.2'
Expand Down

0 comments on commit e4eb6e0

Please sign in to comment.