Skip to content

Commit

Permalink
chore(deps): resolve linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbaehler committed Feb 19, 2024
1 parent 3a1d956 commit 385bb9c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ linters-settings:
nakedret:
# Make an issue if func has more lines of code than this setting, and it has naked returns.
max-func-lines: 50

linters:
enable-all: true
disable:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ golangci-lint: ## Download golangci-lint locally if necessary.
# Linting code as PR is expecting
.PHONY: golint
golint: golangci-lint
$(GOLANGCI_LINT) run --fix -c .golangci.yml
$(GOLANGCI_LINT) run -c .golangci.yml

# Running e2e tests in a KinD instance
.PHONY: e2e
Expand Down
1 change: 1 addition & 0 deletions controllers/rbac/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (r *Manager) SetupWithManager(_ context.Context, mgr ctrl.Manager, configur
crbErr := ctrl.NewControllerManagedBy(mgr).
For(&rbacv1.ClusterRoleBinding{}, namesPredicate).
Watches(&capsulev1beta2.CapsuleConfiguration{}, handler.Funcs{
//nolint:revive
UpdateFunc: func(ctx context.Context, updateEvent event.UpdateEvent, limitingInterface workqueue.RateLimitingInterface) {
if updateEvent.ObjectNew.GetName() == configurationName {
if crbErr := r.EnsureClusterRoleBindings(ctx); crbErr != nil {
Expand Down
1 change: 1 addition & 0 deletions controllers/tenant/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func (r *Manager) collectNamespaces(ctx context.Context, tenant *capsulev1beta2.
err = r.Client.List(ctx, list, client.MatchingFieldsSelector{
Selector: fields.OneTermEqualSelector(".metadata.ownerReferences[*].capsule", tenant.GetName()),
})

if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions controllers/tls/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ func (r Reconciler) updateValidatingWebhookConfiguration(ctx context.Context, ca
return retry.RetryOnConflict(retry.DefaultBackoff, func() (err error) {
vw := &admissionregistrationv1.ValidatingWebhookConfiguration{}
err = r.Get(ctx, types.NamespacedName{Name: r.Configuration.ValidatingWebhookConfigurationName()}, vw)

if err != nil {
r.Log.Error(err, "cannot retrieve ValidatingWebhookConfiguration")

Expand All @@ -277,6 +278,7 @@ func (r Reconciler) updateValidatingWebhookConfiguration(ctx context.Context, ca
func (r Reconciler) updateMutatingWebhookConfiguration(ctx context.Context, caBundle []byte) error {
return retry.RetryOnConflict(retry.DefaultBackoff, func() (err error) {
mw := &admissionregistrationv1.MutatingWebhookConfiguration{}

err = r.Get(ctx, types.NamespacedName{Name: r.Configuration.MutatingWebhookConfigurationName()}, mw)
if err != nil {
r.Log.Error(err, "cannot retrieve MutatingWebhookConfiguration")
Expand Down
4 changes: 4 additions & 0 deletions pkg/cert/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type CapsuleCA struct {

func (c CapsuleCA) CACertificatePem() (b *bytes.Buffer, err error) {
var crtBytes []byte

crtBytes, err = x509.CreateCertificate(rand.Reader, c.certificate, c.certificate, &c.key.PublicKey, c.key)
if err != nil {
return
Expand Down Expand Up @@ -146,6 +147,7 @@ func NewCertificateAuthorityFromBytes(certBytes, keyBytes []byte) (*CapsuleCA, e
//nolint:nakedret
func (c *CapsuleCA) GenerateCertificate(opts CertificateOptions) (certificatePem *bytes.Buffer, certificateKey *bytes.Buffer, err error) {
var certPrivKey *rsa.PrivateKey

certPrivKey, err = rsa.GenerateKey(rand.Reader, 4096)
if err != nil {
return nil, nil, err
Expand All @@ -170,6 +172,7 @@ func (c *CapsuleCA) GenerateCertificate(opts CertificateOptions) (certificatePem
}

var certBytes []byte

certBytes, err = x509.CreateCertificate(rand.Reader, cert, c.certificate, &certPrivKey.PublicKey, c.key)
if err != nil {
return nil, nil, err
Expand All @@ -180,6 +183,7 @@ func (c *CapsuleCA) GenerateCertificate(opts CertificateOptions) (certificatePem
Type: "CERTIFICATE",
Bytes: certBytes,
})

if err != nil {
return
}
Expand Down

0 comments on commit 385bb9c

Please sign in to comment.