Skip to content

Commit 2cadf68

Browse files
Merge pull request #282 from npurdy-tyro/main
Fix PKI secret engine role enum validation for string arrays
2 parents 32d514d + 3826344 commit 2cadf68

File tree

3 files changed

+43
-30
lines changed

3 files changed

+43
-30
lines changed

api/v1alpha1/pkisecretenginerole_types.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,15 @@ type PKIRole struct {
184184

185185
// Specifies the allowed key usage constraint on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#KeyUsage - simply drop the KeyUsage part of the value. Values are not case-sensitive. To specify no key usage constraints, set this to an empty list.
186186
// +kubebuilder:validation:Optional
187-
// +kubebuilder:validation:Enum:=DigitalSignature;KeyAgreement;KeyEncipherment;ContentCommitment;DataEncipherment;CertSign;CRLSign;EncipherOnly;DecipherOnly
188187
// +listType=set
189188
// kubebuilder:validation:UniqueItems=true
190-
KeyUsage []string `json:"keyUsage,omitempty"`
189+
KeyUsage []KeyUsage `json:"keyUsage,omitempty"`
191190

192191
// Specifies the allowed extended key usage constraint on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#ExtKeyUsage - simply drop the ExtKeyUsage part of the value. Values are not case-sensitive. To specify no key usage constraints, set this to an empty list.
193192
// +kubebuilder:validation:Optional
194-
// +kubebuilder:validation:Enum:=ServerAuth;ClientAuth;CodeSigning;EmailProtection;IPSECEndSystem;IPSECTunnel;IPSECUser;TimeStamping;OCSPSigning;MicrosoftServerGatedCrypto;NetscapeServerGatedCrypto;MicrosoftCommercialCodeSigning;MicrosoftKernelCodeSigning
195193
// +listType=set
196194
// kubebuilder:validation:UniqueItems=true
197-
ExtKeyUsage []string `json:"extKeyUsage,omitempty"`
195+
ExtKeyUsage []ExtKeyUsage `json:"extKeyUsage,omitempty"`
198196

199197
// A comma-separated string or list of extended key usage oids.
200198
// +kubebuilder:validation:Optional
@@ -272,6 +270,14 @@ type PKIRole struct {
272270
NotBeforeDuration metav1.Duration `json:"notBeforeDuration,omitempty"`
273271
}
274272

273+
// KeyUsage specifies the allowed key usage constraint on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#KeyUsage - simply drop the KeyUsage part of the value.
274+
// +kubebuilder:validation:Enum:=DigitalSignature;KeyAgreement;KeyEncipherment;ContentCommitment;DataEncipherment;CertSign;CRLSign;EncipherOnly;DecipherOnly
275+
type KeyUsage string
276+
277+
// ExtKeyUsage specifies the allowed extended key usage constraint on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#ExtKeyUsage - simply drop the ExtKeyUsage part of the value.
278+
// +kubebuilder:validation:Enum:=ServerAuth;ClientAuth;CodeSigning;EmailProtection;IPSECEndSystem;IPSECTunnel;IPSECUser;TimeStamping;OCSPSigning;MicrosoftServerGatedCrypto;NetscapeServerGatedCrypto;MicrosoftCommercialCodeSigning;MicrosoftKernelCodeSigning
279+
type ExtKeyUsage string
280+
275281
// PKISecretEngineRoleStatus defines the observed state of PKISecretEngineRole
276282
type PKISecretEngineRoleStatus struct {
277283
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/redhatcop.redhat.io_pkisecretengineroles.yaml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -222,21 +222,25 @@ spec:
222222
description: |-
223223
Specifies the allowed extended key usage constraint on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#ExtKeyUsage - simply drop the ExtKeyUsage part of the value. Values are not case-sensitive. To specify no key usage constraints, set this to an empty list.
224224
kubebuilder:validation:UniqueItems=true
225-
enum:
226-
- ServerAuth
227-
- ClientAuth
228-
- CodeSigning
229-
- EmailProtection
230-
- IPSECEndSystem
231-
- IPSECTunnel
232-
- IPSECUser
233-
- TimeStamping
234-
- OCSPSigning
235-
- MicrosoftServerGatedCrypto
236-
- NetscapeServerGatedCrypto
237-
- MicrosoftCommercialCodeSigning
238-
- MicrosoftKernelCodeSigning
239225
items:
226+
description: ExtKeyUsage specifies the allowed extended key usage
227+
constraint on issued certificates. Valid values can be found at
228+
https://golang.org/pkg/crypto/x509/#ExtKeyUsage - simply drop
229+
the ExtKeyUsage part of the value.
230+
enum:
231+
- ServerAuth
232+
- ClientAuth
233+
- CodeSigning
234+
- EmailProtection
235+
- IPSECEndSystem
236+
- IPSECTunnel
237+
- IPSECUser
238+
- TimeStamping
239+
- OCSPSigning
240+
- MicrosoftServerGatedCrypto
241+
- NetscapeServerGatedCrypto
242+
- MicrosoftCommercialCodeSigning
243+
- MicrosoftKernelCodeSigning
240244
type: string
241245
type: array
242246
x-kubernetes-list-type: set
@@ -277,17 +281,20 @@ spec:
277281
description: |-
278282
Specifies the allowed key usage constraint on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#KeyUsage - simply drop the KeyUsage part of the value. Values are not case-sensitive. To specify no key usage constraints, set this to an empty list.
279283
kubebuilder:validation:UniqueItems=true
280-
enum:
281-
- DigitalSignature
282-
- KeyAgreement
283-
- KeyEncipherment
284-
- ContentCommitment
285-
- DataEncipherment
286-
- CertSign
287-
- CRLSign
288-
- EncipherOnly
289-
- DecipherOnly
290284
items:
285+
description: KeyUsage specifies the allowed key usage constraint
286+
on issued certificates. Valid values can be found at https://golang.org/pkg/crypto/x509/#KeyUsage
287+
- simply drop the KeyUsage part of the value.
288+
enum:
289+
- DigitalSignature
290+
- KeyAgreement
291+
- KeyEncipherment
292+
- ContentCommitment
293+
- DataEncipherment
294+
- CertSign
295+
- CRLSign
296+
- EncipherOnly
297+
- DecipherOnly
291298
type: string
292299
type: array
293300
x-kubernetes-list-type: set

0 commit comments

Comments
 (0)