|
| 1 | +apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this |
| 2 | +name: "KubeletConfig" |
| 3 | +crdName: kubeletconfigs.machineconfiguration.openshift.io |
| 4 | +tests: |
| 5 | + onCreate: |
| 6 | + # LogLevel Boundary Tests |
| 7 | + - name: Should be able to set logLevel to 0 (minimum) |
| 8 | + initial: | |
| 9 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 10 | + kind: KubeletConfig |
| 11 | + spec: |
| 12 | + logLevel: 0 |
| 13 | + expected: | |
| 14 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 15 | + kind: KubeletConfig |
| 16 | + spec: |
| 17 | + logLevel: 0 |
| 18 | + - name: Should be able to set logLevel to 10 (maximum) |
| 19 | + initial: | |
| 20 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 21 | + kind: KubeletConfig |
| 22 | + spec: |
| 23 | + logLevel: 10 |
| 24 | + expected: | |
| 25 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 26 | + kind: KubeletConfig |
| 27 | + spec: |
| 28 | + logLevel: 10 |
| 29 | + - name: Should reject logLevel less than 0 |
| 30 | + initial: | |
| 31 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 32 | + kind: KubeletConfig |
| 33 | + spec: |
| 34 | + logLevel: -1 |
| 35 | + expectedError: "Invalid value" |
| 36 | + - name: Should reject logLevel greater than 10 |
| 37 | + initial: | |
| 38 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 39 | + kind: KubeletConfig |
| 40 | + spec: |
| 41 | + logLevel: 11 |
| 42 | + expectedError: "Invalid value" |
| 43 | + |
| 44 | + # TLSSecurityProfile CEL Validation tests |
| 45 | + - name: Should allow tlsSecurityProfile with Old type |
| 46 | + initial: | |
| 47 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 48 | + kind: KubeletConfig |
| 49 | + spec: |
| 50 | + tlsSecurityProfile: |
| 51 | + type: Old |
| 52 | + expected: | |
| 53 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 54 | + kind: KubeletConfig |
| 55 | + spec: |
| 56 | + tlsSecurityProfile: |
| 57 | + type: Old |
| 58 | + - name: Should allow tlsSecurityProfile with Intermediate type |
| 59 | + initial: | |
| 60 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 61 | + kind: KubeletConfig |
| 62 | + spec: |
| 63 | + tlsSecurityProfile: |
| 64 | + type: Intermediate |
| 65 | + expected: | |
| 66 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 67 | + kind: KubeletConfig |
| 68 | + spec: |
| 69 | + tlsSecurityProfile: |
| 70 | + type: Intermediate |
| 71 | + - name: Should reject tlsSecurityProfile with Modern type |
| 72 | + initial: | |
| 73 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 74 | + kind: KubeletConfig |
| 75 | + spec: |
| 76 | + tlsSecurityProfile: |
| 77 | + type: Modern |
| 78 | + expectedError: "only Old and Intermediate TLS profiles are supported for kubelet" |
| 79 | + - name: Should reject tlsSecurityProfile with Custom type |
| 80 | + initial: | |
| 81 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 82 | + kind: KubeletConfig |
| 83 | + spec: |
| 84 | + tlsSecurityProfile: |
| 85 | + type: Custom |
| 86 | + custom: |
| 87 | + ciphers: |
| 88 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 89 | + minTLSVersion: VersionTLS12 |
| 90 | + expectedError: "only Old and Intermediate TLS profiles are supported for kubelet" |
| 91 | + - name: Should allow tlsSecurityProfile without type field for backward compatibility |
| 92 | + initial: | |
| 93 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 94 | + kind: KubeletConfig |
| 95 | + spec: |
| 96 | + tlsSecurityProfile: |
| 97 | + custom: |
| 98 | + ciphers: |
| 99 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 100 | + minTLSVersion: VersionTLS12 |
| 101 | + expected: | |
| 102 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 103 | + kind: KubeletConfig |
| 104 | + spec: |
| 105 | + tlsSecurityProfile: |
| 106 | + custom: |
| 107 | + ciphers: |
| 108 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 109 | + minTLSVersion: VersionTLS12 |
| 110 | +
|
| 111 | + onUpdate: |
| 112 | + # Ratcheting tests - ensure existing objects with previously valid values can be updated |
| 113 | + - name: Should allow updating other fields with a previously valid Custom TLS profile persisted |
| 114 | + initialCRDPatches: |
| 115 | + - op: remove |
| 116 | + path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/tlsSecurityProfile/x-kubernetes-validations |
| 117 | + initial: | |
| 118 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 119 | + kind: KubeletConfig |
| 120 | + spec: |
| 121 | + tlsSecurityProfile: |
| 122 | + type: Custom |
| 123 | + custom: |
| 124 | + ciphers: |
| 125 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 126 | + minTLSVersion: VersionTLS12 |
| 127 | + updated: | |
| 128 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 129 | + kind: KubeletConfig |
| 130 | + spec: |
| 131 | + logLevel: 5 |
| 132 | + tlsSecurityProfile: |
| 133 | + type: Custom |
| 134 | + custom: |
| 135 | + ciphers: |
| 136 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 137 | + minTLSVersion: VersionTLS12 |
| 138 | + expected: | |
| 139 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 140 | + kind: KubeletConfig |
| 141 | + spec: |
| 142 | + logLevel: 5 |
| 143 | + tlsSecurityProfile: |
| 144 | + type: Custom |
| 145 | + custom: |
| 146 | + ciphers: |
| 147 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 148 | + minTLSVersion: VersionTLS12 |
| 149 | + - name: Should allow updating other fields with a previously valid Modern TLS profile persisted |
| 150 | + initialCRDPatches: |
| 151 | + - op: remove |
| 152 | + path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/tlsSecurityProfile/x-kubernetes-validations |
| 153 | + initial: | |
| 154 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 155 | + kind: KubeletConfig |
| 156 | + spec: |
| 157 | + tlsSecurityProfile: |
| 158 | + type: Modern |
| 159 | + updated: | |
| 160 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 161 | + kind: KubeletConfig |
| 162 | + spec: |
| 163 | + logLevel: 3 |
| 164 | + tlsSecurityProfile: |
| 165 | + type: Modern |
| 166 | + expected: | |
| 167 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 168 | + kind: KubeletConfig |
| 169 | + spec: |
| 170 | + logLevel: 3 |
| 171 | + tlsSecurityProfile: |
| 172 | + type: Modern |
| 173 | + - name: Should allow updating other fields with a previously valid logLevel outside current range |
| 174 | + initialCRDPatches: |
| 175 | + - op: remove |
| 176 | + path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/logLevel/maximum |
| 177 | + - op: remove |
| 178 | + path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/logLevel/minimum |
| 179 | + initial: | |
| 180 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 181 | + kind: KubeletConfig |
| 182 | + spec: |
| 183 | + logLevel: 15 |
| 184 | + updated: | |
| 185 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 186 | + kind: KubeletConfig |
| 187 | + spec: |
| 188 | + logLevel: 15 |
| 189 | + autoSizingReserved: true |
| 190 | + expected: | |
| 191 | + apiVersion: machineconfiguration.openshift.io/v1 |
| 192 | + kind: KubeletConfig |
| 193 | + spec: |
| 194 | + logLevel: 15 |
| 195 | + autoSizingReserved: true |
0 commit comments