Skip to content

Commit

Permalink
webhook: adjust return consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sebrandon1 committed Jan 6, 2025
1 parent 4567284 commit 5d41fc4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/webhook/mutatingwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type MutatingConfigurationBuilder struct {
func PullMutatingConfiguration(apiClient *clients.Settings, name string) (*MutatingConfigurationBuilder, error) {
glog.V(100).Infof("Pulling existing MutatingWebhookConfiguration name %s from cluster", name)

builder := MutatingConfigurationBuilder{
builder := &MutatingConfigurationBuilder{
apiClient: apiClient,
Definition: &admregv1.MutatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -43,7 +43,7 @@ func PullMutatingConfiguration(apiClient *clients.Settings, name string) (*Mutat
if name == "" {
glog.V(100).Infof("The name of the MutatingWebhookConfiguration is empty")

builder.errorMsg = "MutatingWebhookConfiguration 'name' cannot be empty"
return builder, fmt.Errorf("MutatingWebhookConfiguration 'name' cannot be empty")
}

if !builder.Exists() {
Expand All @@ -52,7 +52,7 @@ func PullMutatingConfiguration(apiClient *clients.Settings, name string) (*Mutat

builder.Definition = builder.Object

return &builder, nil
return builder, nil
}

// Exists checks whether the given MutatingWebhookConfiguration object exists in the cluster.
Expand Down Expand Up @@ -146,7 +146,7 @@ func (builder *MutatingConfigurationBuilder) validate() (bool, error) {
if builder.apiClient == nil {
glog.V(100).Infof("The %s builder apiclient is nil", resourceCRD)

builder.errorMsg = fmt.Sprintf("%s builder cannot have nil apiClient", resourceCRD)
return false, fmt.Errorf("%s builder cannot have nil apiClient", resourceCRD)
}

if builder.errorMsg != "" {
Expand Down

0 comments on commit 5d41fc4

Please sign in to comment.