Skip to content

Commit 07574ba

Browse files
OCPNODE-3372: Readd omitempty for defaultRuntime as its handled in MCO with additional test cases
1 parent 989d3cc commit 07574ba

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

machineconfiguration/v1/tests/containerruntimeconfigs.machineconfiguration.openshift.io/DefaultRuntimeConfig.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,14 @@ name: "ContainerRuntimeConfig"
33
crdName: containerruntimeconfigs.machineconfiguration.openshift.io
44
tests:
55
onCreate:
6-
- name: Should not fail if set to empty string
6+
- name: Should fail if set to empty string
77
initial: |
88
apiVersion: machineconfiguration.openshift.io/v1
99
kind: ContainerRuntimeConfig
1010
spec:
1111
containerRuntimeConfig:
1212
defaultRuntime: ""
13-
expected: |
14-
apiVersion: machineconfiguration.openshift.io/v1
15-
kind: ContainerRuntimeConfig
16-
spec:
17-
containerRuntimeConfig:
18-
defaultRuntime: ""
13+
expectedError: "spec.containerRuntimeConfig.defaultRuntime: Unsupported value: \"\": supported values: \"crun\", \"runc\""
1914
- name: Should not fail if not set and other fields set
2015
initial: |
2116
apiVersion: machineconfiguration.openshift.io/v1
@@ -28,7 +23,6 @@ tests:
2823
kind: ContainerRuntimeConfig
2924
spec:
3025
containerRuntimeConfig:
31-
defaultRuntime: ""
3226
logLevel: info
3327
- name: Should fail if set to a number
3428
initial: |
@@ -37,23 +31,23 @@ tests:
3731
spec:
3832
containerRuntimeConfig:
3933
defaultRuntime: 1234
40-
expectedError: "spec.containerRuntimeConfig.defaultRuntime: Invalid value: \"integer\": spec.containerRuntimeConfig.defaultRuntime in body must be of type string: \"integer\", spec.containerRuntimeConfig.defaultRuntime: Unsupported value: 1234: supported values: \"crun\", \"runc\", \"\""
34+
expectedError: "spec.containerRuntimeConfig.defaultRuntime: Invalid value: \"integer\": spec.containerRuntimeConfig.defaultRuntime in body must be of type string: \"integer\", spec.containerRuntimeConfig.defaultRuntime: Unsupported value: 1234: supported values: \"crun\", \"runc\""
4135
- name: Should fail if set to a blank string
4236
initial: |
4337
apiVersion: machineconfiguration.openshift.io/v1
4438
kind: ContainerRuntimeConfig
4539
spec:
4640
containerRuntimeConfig:
4741
defaultRuntime: " "
48-
expectedError: "Unsupported value: \" \": supported values: \"crun\", \"runc\", \"\""
42+
expectedError: "Unsupported value: \" \": supported values: \"crun\", \"runc\""
4943
- name: Should fail if invalid ContainerRuntimeConfig is provided
5044
initial: |
5145
apiVersion: machineconfiguration.openshift.io/v1
5246
kind: ContainerRuntimeConfig
5347
spec:
5448
containerRuntimeConfig:
5549
defaultRuntime: docker
56-
expectedError: "Unsupported value: \"docker\": supported values: \"crun\", \"runc\", \"\""
50+
expectedError: "Unsupported value: \"docker\": supported values: \"crun\", \"runc\""
5751
- name: Should be able to set crun in ContainerRuntimeConfig
5852
initial: |
5953
apiVersion: machineconfiguration.openshift.io/v1
@@ -92,7 +86,7 @@ tests:
9286
kind: ContainerRuntimeConfig
9387
spec:
9488
containerRuntimeConfig:
95-
defaultRuntime: ""
89+
defaultRuntime: crun
9690
logLevel: fatal
9791
updated: |
9892
apiVersion: machineconfiguration.openshift.io/v1
@@ -101,7 +95,7 @@ tests:
10195
containerRuntimeConfig:
10296
defaultRuntime: docker
10397
logLevel: info
104-
expectedError: "Unsupported value: \"docker\": supported values: \"crun\", \"runc\", \"\""
98+
expectedError: "Unsupported value: \"docker\": supported values: \"crun\", \"runc\""
10599
- name: Should be able to update from not set to default when other params are set
106100
initial: |
107101
apiVersion: machineconfiguration.openshift.io/v1
@@ -119,7 +113,6 @@ tests:
119113
kind: ContainerRuntimeConfig
120114
spec:
121115
containerRuntimeConfig:
122-
defaultRuntime: ""
123116
logLevel: info
124117
- name: Should be able to update from runc to crun with other parameters
125118
initialCRDPatches:

machineconfiguration/v1/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ type ContainerRuntimeConfiguration struct {
850850
// When set to `crun`, OpenShift will use crun to execute the container
851851
// When omitted, this means no opinion and the platform is left to choose a reasonable default,
852852
// which is subject to change over time. Currently, the default is `crun`.
853-
// +kubebuilder:validation:Enum=crun;runc;""
853+
// +kubebuilder:validation:Enum=crun;runc
854854
// +optional
855855
DefaultRuntime ContainerRuntimeDefaultRuntime `json:"defaultRuntime,omitempty"`
856856
}

machineconfiguration/v1/zz_generated.crd-manifests/0000_80_machine-config_01_containerruntimeconfigs.crd.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,16 @@ spec:
5353
runtime.
5454
properties:
5555
defaultRuntime:
56-
default: ""
5756
description: |-
5857
defaultRuntime is the name of the OCI runtime to be used as the default for containers.
59-
Allowed values are `runc`, `crun`, and omitted (`""`).
58+
Allowed values are `runc` and `crun`.
6059
When set to `runc`, OpenShift will use runc to execute the container
6160
When set to `crun`, OpenShift will use crun to execute the container
6261
When omitted, this means no opinion and the platform is left to choose a reasonable default,
6362
which is subject to change over time. Currently, the default is `crun`.
6463
enum:
6564
- crun
6665
- runc
67-
- ""
6866
type: string
6967
logLevel:
7068
description: |-

machineconfiguration/v1/zz_generated.featuregated-crd-manifests/containerruntimeconfigs.machineconfiguration.openshift.io/AAA_ungated.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,16 @@ spec:
5454
runtime.
5555
properties:
5656
defaultRuntime:
57-
default: ""
5857
description: |-
5958
defaultRuntime is the name of the OCI runtime to be used as the default for containers.
60-
Allowed values are `runc`, `crun`, and omitted (`""`).
59+
Allowed values are `runc` and `crun`.
6160
When set to `runc`, OpenShift will use runc to execute the container
6261
When set to `crun`, OpenShift will use crun to execute the container
6362
When omitted, this means no opinion and the platform is left to choose a reasonable default,
6463
which is subject to change over time. Currently, the default is `crun`.
6564
enum:
6665
- crun
6766
- runc
68-
- ""
6967
type: string
7068
logLevel:
7169
description: |-

0 commit comments

Comments
 (0)