Skip to content

Commit

Permalink
Update the error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Veronika Fisarova <[email protected]>
  • Loading branch information
Deydra71 committed Sep 13, 2023
1 parent 3303453 commit 894b06d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/common/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ func EnsureOrCreateSecret(clientset *kubernetes.Clientset, namespace, secretName
Name: secretName,
Namespace: namespace,
},
Data: data, // The data to store in the secret, the actual data provided by cert-manager
Data: data, // The data to store in the secret - the actual data provided by cert-manager formatted as "tls.crt": []byte("..."), "tls.key": []byte("..."),
}
_, err := clientset.CoreV1().Secrets(namespace).Create(context.TODO(), secret, metav1.CreateOptions{})
if err != nil {
return fmt.Errorf("error creating secret %s: %v", secretName, err)
return fmt.Errorf("Error creating secret %s: %w", secretName, err)
}
} else {
return fmt.Errorf("error checking secret %s: %v", secretName, err)
return fmt.Errorf("Error validationg secret %s: %w", secretName, err)
}
}
return nil
Expand Down Expand Up @@ -162,7 +162,7 @@ func CreateVolumes(tls *TLS) []corev1.Volume {
Items: []corev1.KeyToPath{
{
Key: "ca.crt",
Path: fmt.Sprintf("ca.crt"),
Path: "ca.crt",
},
},
},
Expand Down

0 comments on commit 894b06d

Please sign in to comment.