Skip to content

Instantly share code, notes, and snippets.

@benmoss
Created March 6, 2019 17:09
Show Gist options
  • Save benmoss/a56ebed1653081bff0cb531bc0e201f6 to your computer and use it in GitHub Desktop.
Save benmoss/a56ebed1653081bff0cb531bc0e201f6 to your computer and use it in GitHub Desktop.
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: win-webserver
name: win-webserver
spec:
replicas: 1
template:
metadata:
labels:
app: win-webserver
name: win-webserver
spec:
containers:
- name: windowswebserver
image: e2eteam/busybox:1.29
imagePullPolicy: Never
command:
- powershell.exe
- -command
- "<#code used from https://gist.github.com/wagnerandrade/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callCount = 0; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ; $$content='Windows Container Web Server\nHello world!\n'; Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus) } ; "
volumeMounts:
- mountPath: /cache
name: cache-volume
nodeSelector:
beta.kubernetes.io/os: windows
tolerations:
- key: "windows"
operator: "Equal"
value: "1803"
effect: "NoSchedule"
volumes:
- name: cache-volume
emptyDir: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment