You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config/v1alpha1/types_image_policy.go
+51-1Lines changed: 51 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -73,10 +73,12 @@ type Policy struct {
73
73
// +union
74
74
// +kubebuilder:validation:XValidation:rule="has(self.policyType) && self.policyType == 'PublicKey' ? has(self.publicKey) : !has(self.publicKey)",message="publicKey is required when policyType is PublicKey, and forbidden otherwise"
75
75
// +kubebuilder:validation:XValidation:rule="has(self.policyType) && self.policyType == 'FulcioCAWithRekor' ? has(self.fulcioCAWithRekor) : !has(self.fulcioCAWithRekor)",message="fulcioCAWithRekor is required when policyType is FulcioCAWithRekor, and forbidden otherwise"
76
+
// +openshift:validation:FeatureGateAwareXValidation:featureGate=SigstoreImageVerificationPKI,rule="has(self.policyType) && self.policyType == 'PKI' ? has(self.pki) : !has(self.pki)",message="pki is required when policyType is PKI, and forbidden otherwise"
76
77
typePolicyRootOfTruststruct {
77
78
// policyType serves as the union's discriminator. Users are required to assign a value to this field, choosing one of the policy types that define the root of trust.
78
79
// "PublicKey" indicates that the policy relies on a sigstore publicKey and may optionally use a Rekor verification.
79
80
// "FulcioCAWithRekor" indicates that the policy is based on the Fulcio certification and incorporates a Rekor verification.
81
+
// "PKI" is a DevPreview feature that indicates that the policy is based on the certificates from Bring Your Own Public Key Infrastructure (BYOPKI). This value is enabled by turning on the SigstoreImageVerificationPKI feature gate.
80
82
// +unionDiscriminator
81
83
// +required
82
84
PolicyTypePolicyType`json:"policyType"`
@@ -88,14 +90,20 @@ type PolicyRootOfTrust struct {
88
90
// https://github.com/sigstore/fulcio and https://github.com/sigstore/rekor
// PublicKey defines the root of trust based on a sigstore public key.
@@ -143,6 +151,48 @@ type PolicyFulcioSubject struct {
143
151
SignedEmailstring`json:"signedEmail"`
144
152
}
145
153
154
+
// PKI defines the root of trust based on Root CA(s) and corresponding intermediate certificates.
155
+
typePKIstruct {
156
+
// caRootsData contains base64-encoded data of a certificate bundle PEM file, which contains one or more CA roots in the PEM format. The total length of the data must not exceed 8192 characters.
157
+
// +required
158
+
// +kubebuilder:validation:MaxLength=8192
159
+
// +kubebuilder:validation:XValidation:rule="string(self).startsWith('-----BEGIN CERTIFICATE-----')",message="the caRootsData must start with base64 encoding of '-----BEGIN CERTIFICATE-----'."
160
+
// +kubebuilder:validation:XValidation:rule="string(self).endsWith('-----END CERTIFICATE-----\\n') || string(self).endsWith('-----END CERTIFICATE-----')",message="the caRootsData must end with base64 encoding of '-----END CERTIFICATE-----'."
161
+
// +kubebuilder:validation:XValidation:rule="string(self).findAll('-----BEGIN CERTIFICATE-----').size() == string(self).findAll('-----END CERTIFICATE-----').size()",message="caRootsData must be base64 encoding of valid PEM format data contain the same number of '-----BEGIN CERTIFICATE-----' and '-----END CERTIFICATE-----' markers."
// caIntermediatesData contains base64-encoded data of a certificate bundle PEM file, which contains one or more intermediate certificates in the PEM format. The total length of the data must not exceed 8192 characters.
164
+
// caIntermediatesData requires caRootsData to be set.
165
+
// +optional
166
+
// +kubebuilder:validation:XValidation:rule="string(self).startsWith('-----BEGIN CERTIFICATE-----')",message="the caIntermediatesData must start with base64 encoding of '-----BEGIN CERTIFICATE-----'."
167
+
// +kubebuilder:validation:XValidation:rule="string(self).endsWith('-----END CERTIFICATE-----\\n') || string(self).endsWith('-----END CERTIFICATE-----')",message="the caIntermediatesData must end with base64 encoding of '-----END CERTIFICATE-----'."
168
+
// +kubebuilder:validation:XValidation:rule="string(self).findAll('-----BEGIN CERTIFICATE-----').size() == string(self).findAll('-----END CERTIFICATE-----').size()",message="caIntermediatesData must be base64 encoding of valid PEM format data contain the same number of '-----BEGIN CERTIFICATE-----' and '-----END CERTIFICATE-----' markers."
// PKICertificateSubject defines the requirements imposed on the subject to which the certificate was issued.
178
+
// +kubebuilder:validation:XValidation:rule="has(self.email) || has(self.hostname)", message="at least one of email or hostname must be set in pkiCertificateSubject"
// email specifies the expected email address imposed on the subject to which the certificate was issued, and must match the email address listed in the Subject Alternative Name (SAN) field of the certificate.
182
+
// The email should be a valid email address and at most 320 characters in length.
183
+
// +optional
184
+
// +kubebuilder:validation:MaxLength:=320
185
+
// +kubebuilder:validation:XValidation:rule=`self.matches('^\\S+@\\S+$')`,message="invalid email address in pkiCertificateSubject"
186
+
Emailstring`json:"email,omitempty"`
187
+
// hostname specifies the expected hostname imposed on the subject to which the certificate was issued, and it must match the hostname listed in the Subject Alternative Name (SAN) DNS field of the certificate.
188
+
// The hostname should be a valid dns 1123 subdomain name, optionally prefixed by '*.', and at most 253 characters in length.
189
+
// It should consist only of lowercase alphanumeric characters, hyphens, periods and the optional preceding asterisk.
190
+
// +optional
191
+
// +kubebuilder:validation:MaxLength:=253
192
+
// +kubebuilder:validation:XValidation:rule="self.startsWith('*.') ? !format.dns1123Subdomain().validate(self.replace('*.', '', 1)).hasValue() : !format.dns1123Subdomain().validate(self).hasValue()",message="hostname should be a valid dns 1123 subdomain name, optionally prefixed by '*.'. It should consist only of lowercase alphanumeric characters, hyphens, periods and the optional preceding asterisk."
193
+
Hostnamestring`json:"hostname,omitempty"`
194
+
}
195
+
146
196
// PolicyIdentity defines image identity the signature claims about the image. When omitted, the default matchPolicy is "MatchRepoDigestOrExact".
147
197
// +kubebuilder:validation:XValidation:rule="(has(self.matchPolicy) && self.matchPolicy == 'ExactRepository') ? has(self.exactRepository) : !has(self.exactRepository)",message="exactRepository is required when matchPolicy is ExactRepository, and forbidden otherwise"
148
198
// +kubebuilder:validation:XValidation:rule="(has(self.matchPolicy) && self.matchPolicy == 'RemapIdentity') ? has(self.remapIdentity) : !has(self.remapIdentity)",message="remapIdentity is required when matchPolicy is RemapIdentity, and forbidden otherwise"
Copy file name to clipboardExpand all lines: config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_clusterimagepolicies-CustomNoUpgrade.crd.yaml
+91Lines changed: 91 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -102,14 +102,101 @@ spec:
102
102
- fulcioSubject
103
103
- rekorKeyData
104
104
type: object
105
+
pki:
106
+
description: pki defines the root of trust based on Bring
107
+
Your Own Public Key Infrastructure (BYOPKI) Root CA(s) and
108
+
corresponding intermediate certificates.
109
+
properties:
110
+
caIntermediatesData:
111
+
description: |-
112
+
caIntermediatesData contains base64-encoded data of a certificate bundle PEM file, which contains one or more intermediate certificates in the PEM format. The total length of the data must not exceed 8192 characters.
113
+
caIntermediatesData requires caRootsData to be set.
114
+
format: byte
115
+
maxLength: 8192
116
+
type: string
117
+
x-kubernetes-validations:
118
+
- message: the caIntermediatesData must start with base64
description: pkiCertificateSubject defines the requirements
155
+
imposed on the subject to which the certificate was
156
+
issued.
157
+
properties:
158
+
email:
159
+
description: |-
160
+
email specifies the expected email address imposed on the subject to which the certificate was issued, and must match the email address listed in the Subject Alternative Name (SAN) field of the certificate.
161
+
The email should be a valid email address and at most 320 characters in length.
162
+
maxLength: 320
163
+
type: string
164
+
x-kubernetes-validations:
165
+
- message: invalid email address in pkiCertificateSubject
166
+
rule: self.matches('^\\S+@\\S+$')
167
+
hostname:
168
+
description: |-
169
+
hostname specifies the expected hostname imposed on the subject to which the certificate was issued, and it must match the hostname listed in the Subject Alternative Name (SAN) DNS field of the certificate.
170
+
The hostname should be a valid dns 1123 subdomain name, optionally prefixed by '*.', and at most 253 characters in length.
171
+
It should consist only of lowercase alphanumeric characters, hyphens, periods and the optional preceding asterisk.
172
+
maxLength: 253
173
+
type: string
174
+
x-kubernetes-validations:
175
+
- message: hostname should be a valid dns 1123 subdomain
176
+
name, optionally prefixed by '*.'. It should consist
177
+
only of lowercase alphanumeric characters, hyphens,
- message: at least one of email or hostname must be set
184
+
in pkiCertificateSubject
185
+
rule: has(self.email) || has(self.hostname)
186
+
required:
187
+
- caRootsData
188
+
- pkiCertificateSubject
189
+
type: object
105
190
policyType:
106
191
description: |-
107
192
policyType serves as the union's discriminator. Users are required to assign a value to this field, choosing one of the policy types that define the root of trust.
108
193
"PublicKey" indicates that the policy relies on a sigstore publicKey and may optionally use a Rekor verification.
109
194
"FulcioCAWithRekor" indicates that the policy is based on the Fulcio certification and incorporates a Rekor verification.
195
+
"PKI" is a DevPreview feature that indicates that the policy is based on the certificates from Bring Your Own Public Key Infrastructure (BYOPKI). This value is enabled by turning on the SigstoreImageVerificationPKI feature gate.
110
196
enum:
111
197
- PublicKey
112
198
- FulcioCAWithRekor
199
+
- PKI
113
200
type: string
114
201
publicKey:
115
202
description: publicKey defines the root of trust based on
@@ -136,6 +223,10 @@ spec:
136
223
- policyType
137
224
type: object
138
225
x-kubernetes-validations:
226
+
- message: pki is required when policyType is PKI, and forbidden
0 commit comments