Skip to content

Commit 5fde12e

Browse files
authored
Merge pull request #71323 from mburke5678/winc-runtime-class
WINC-511: Use RuntimeClass in e2e tests
2 parents 678e1c5 + 86d44f4 commit 5fde12e

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

modules/creating-runtimeclass.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,27 @@ Using a `RuntimeClass` object simplifies the use of scheduling mechanisms like t
1717
apiVersion: node.k8s.io/v1
1818
kind: RuntimeClass
1919
metadata:
20-
name: <runtime_class_name> <1>
20+
name: windows2019 <1>
2121
handler: 'runhcs-wcow-process'
2222
scheduling:
2323
nodeSelector: <2>
2424
kubernetes.io/os: 'windows'
2525
kubernetes.io/arch: 'amd64'
2626
node.kubernetes.io/windows-build: '10.0.17763'
2727
tolerations: <3>
28+
- effect: NoSchedule
29+
key: os
30+
operator: Equal
31+
value: "windows"
2832
- effect: NoSchedule
2933
key: os
3034
operator: Equal
3135
value: "Windows"
3236
----
3337
<1> Specify the `RuntimeClass` object name, which is defined in the pods you want to be managed by this runtime class.
3438
<2> Specify labels that must be present on nodes that support this runtime class. Pods using this runtime class can only be scheduled to a node matched by this selector. The node selector of the runtime class is merged with the existing node selector of the pod. Any conflicts prevent the pod from being scheduled to the node.
39+
* For Windows 2019, specify the `node.kubernetes.io/windows-build: '10.0.17763'` label.
40+
* For Windows 2022, specify the `node.kubernetes.io/windows-build: '10.0.20348'` label.
3541
<3> Specify tolerations to append to pods, excluding duplicates, running with this runtime class during admission. This combines the set of nodes tolerated by the pod and the runtime class.
3642

3743
. Create the `RuntimeClass` object:
@@ -57,7 +63,7 @@ kind: Pod
5763
metadata:
5864
name: my-windows-pod
5965
spec:
60-
runtimeClassName: <runtime_class_name> <1>
61-
...
66+
runtimeClassName: windows2019 <1>
67+
# ...
6268
----
6369
<1> Specify the runtime class to manage the scheduling of your pod.

modules/sample-windows-workload-deployment.adoc

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,26 @@ spec:
5151
app: win-webserver
5252
name: win-webserver
5353
spec:
54-
tolerations:
55-
- key: "os"
56-
value: "Windows"
57-
Effect: "NoSchedule"
5854
containers:
5955
- name: windowswebserver
60-
image: mcr.microsoft.com/windows/servercore:ltsc2019
56+
image: mcr.microsoft.com/windows/servercore:ltsc2019 <1>
6157
imagePullPolicy: IfNotPresent
6258
command:
63-
- powershell.exe
59+
- powershell.exe <2>
6460
- -command
6561
- $listener = New-Object System.Net.HttpListener; $listener.Prefixes.Add('http://*:80/'); $listener.Start();Write-Host('Listening at http://*:80/'); while ($listener.IsListening) { $context = $listener.GetContext(); $response = $context.Response; $content='<html><body><H1>Red Hat OpenShift + Windows Container Workloads</H1></body></html>'; $buffer = [System.Text.Encoding]::UTF8.GetBytes($content); $response.ContentLength64 = $buffer.Length; $response.OutputStream.Write($buffer, 0, $buffer.Length); $response.Close(); };
6662
securityContext:
6763
runAsNonRoot: false
6864
windowsOptions:
6965
runAsUserName: "ContainerAdministrator"
70-
nodeSelector:
71-
kubernetes.io/os: windows
7266
os:
73-
name: windows
67+
name: "windows"
68+
runtimeClassName: windows2019 <3>
7469
----
75-
76-
[NOTE]
77-
====
78-
When using the `mcr.microsoft.com/powershell:<tag>` container image, you must define the command as `pwsh.exe`. If you are using the `mcr.microsoft.com/windows/servercore:<tag>` container image, you must define the command as `powershell.exe`. For more information, see Microsoft's documentation.
79-
====
70+
<1> Specify the container image to use: `mcr.microsoft.com/powershell:<tag>` or `mcr.microsoft.com/windows/servercore:<tag>`. The container image must match the Windows version running on the node.
71+
* For Windows 2019, use the `ltsc2019` tag.
72+
* For Windows 2022, use the `ltsc2022` tag.
73+
<2> Specify the commands to execute on the container.
74+
* For the `mcr.microsoft.com/powershell:<tag>` container image, you must define the command as `pwsh.exe`.
75+
* For the `mcr.microsoft.com/windows/servercore:<tag>` container image, you must define the command as `powershell.exe`.
76+
<3> Specify the runtime class you created for the Windows operating system variant on your cluster.

0 commit comments

Comments
 (0)