@@ -49,6 +49,11 @@ type WebhookInstallOptions struct {
49
49
// ValidatingWebhooks is a list of ValidatingWebhookConfigurations to install
50
50
ValidatingWebhooks []* admissionv1.ValidatingWebhookConfiguration
51
51
52
+ // IgnoreSchemeConvertible, will modify any CRD conversion webhook to use the local serving host and port,
53
+ // bypassing the need to have the types registered in the Scheme. This is useful for testing CRD conversion webhooks
54
+ // with unregistered or unstructured types.
55
+ IgnoreSchemeConvertible bool
56
+
52
57
// IgnoreErrorIfPathMissing will ignore an error if a DirectoryPath does not exist when set to true
53
58
IgnoreErrorIfPathMissing bool
54
59
@@ -184,7 +189,8 @@ func defaultWebhookOptions(o *WebhookInstallOptions) {
184
189
func WaitForWebhooks (config * rest.Config ,
185
190
mutatingWebhooks []* admissionv1.MutatingWebhookConfiguration ,
186
191
validatingWebhooks []* admissionv1.ValidatingWebhookConfiguration ,
187
- options WebhookInstallOptions ) error {
192
+ options WebhookInstallOptions ,
193
+ ) error {
188
194
waitingFor := map [schema.GroupVersionKind ]* sets.Set [string ]{}
189
195
190
196
for _ , hook := range mutatingWebhooks {
@@ -242,7 +248,7 @@ func (p *webhookPoller) poll(ctx context.Context) (done bool, err error) {
242
248
continue
243
249
}
244
250
for _ , name := range names .UnsortedList () {
245
- var obj = & unstructured.Unstructured {}
251
+ obj : = & unstructured.Unstructured {}
246
252
obj .SetGroupVersionKind (gvk )
247
253
err := c .Get (context .Background (), client.ObjectKey {
248
254
Namespace : "" ,
@@ -288,10 +294,10 @@ func (o *WebhookInstallOptions) setupCA() error {
288
294
return fmt .Errorf ("unable to marshal webhook serving certs: %w" , err )
289
295
}
290
296
291
- if err := os .WriteFile (filepath .Join (localServingCertsDir , "tls.crt" ), certData , 0640 ); err != nil { //nolint:gosec
297
+ if err := os .WriteFile (filepath .Join (localServingCertsDir , "tls.crt" ), certData , 0o640 ); err != nil { //nolint:gosec
292
298
return fmt .Errorf ("unable to write webhook serving cert to disk: %w" , err )
293
299
}
294
- if err := os .WriteFile (filepath .Join (localServingCertsDir , "tls.key" ), keyData , 0640 ); err != nil { //nolint:gosec
300
+ if err := os .WriteFile (filepath .Join (localServingCertsDir , "tls.key" ), keyData , 0o640 ); err != nil { //nolint:gosec
295
301
return fmt .Errorf ("unable to write webhook serving key to disk: %w" , err )
296
302
}
297
303
0 commit comments