Skip to content

Commit

Permalink
Prevent nil pointer access in otterize crds (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
otterobert authored Dec 15, 2024
1 parent 9c071df commit d3f0997
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (r *CustomResourceDefinitionsReconciler) Reconcile(ctx context.Context, req
}
resourceCopy := crd.DeepCopy()
resourceCopy.Spec = baseCRD.Spec
if resourceCopy.Spec.Conversion == nil || resourceCopy.Spec.Conversion.Webhook == nil || resourceCopy.Spec.Conversion.Webhook.ClientConfig == nil {
if resourceCopy.Spec.Conversion == nil || resourceCopy.Spec.Conversion.Webhook == nil || resourceCopy.Spec.Conversion.Webhook.ClientConfig == nil || resourceCopy.Spec.Conversion.Webhook.ClientConfig.Service == nil {
return ctrl.Result{}, errors.Errorf("CRD does not contain a proper conversion webhook definition")
}
if bytes.Equal(crd.Spec.Conversion.Webhook.ClientConfig.CABundle, r.certPem) && crd.Spec.Conversion.Webhook.ClientConfig.Service.Namespace == r.namespace {
Expand Down

0 comments on commit d3f0997

Please sign in to comment.