Skip to content

Commit

Permalink
fix: linting code
Browse files Browse the repository at this point in the history
  • Loading branch information
gchiesa committed Nov 23, 2023
1 parent 001492b commit 76d0a9d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
11 changes: 8 additions & 3 deletions controllers/podlabels/abstract.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// Copyright 2020-2023 Project Capsule Authors.
// SPDX-License-Identifier: Apache-2.0

package podlabels

import (
"context"
"fmt"

"github.com/go-logr/logr"
"github.com/projectcapsule/capsule/pkg/utils"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierr "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/fields"
Expand All @@ -16,8 +20,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/pkg/errors"
capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
"github.com/projectcapsule/capsule/pkg/utils"
)

type podLabelsReconciler struct {
Expand Down Expand Up @@ -54,6 +58,7 @@ func (r *podLabelsReconciler) Reconcile(ctx context.Context, request ctrl.Reques
_, err = controllerutil.CreateOrUpdate(ctx, r.client, r.obj, func() (err error) {
r.obj.SetLabels(r.sync(r.obj.GetLabels(), tenant.Spec.PodOptions.AdditionalMetadata.Labels))
r.obj.SetAnnotations(r.sync(r.obj.GetAnnotations(), tenant.Spec.PodOptions.AdditionalMetadata.Annotations))

return nil
})
return reconcile.Result{}, err
Expand Down Expand Up @@ -86,7 +91,7 @@ func (r *podLabelsReconciler) getTenant(ctx context.Context, namespacedName type
func (r *podLabelsReconciler) sync(available map[string]string, tenantSpec map[string]string) map[string]string {
if tenantSpec != nil {
if available == nil {
available = tenantSpec
return tenantSpec
} else {
for key, value := range tenantSpec {
if available[key] != value {
Expand Down
3 changes: 3 additions & 0 deletions controllers/podlabels/errors.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2020-2023 Project Capsule Authors.
// SPDX-License-Identifier: Apache-2.0

package podlabels

import "fmt"
Expand Down
4 changes: 4 additions & 0 deletions controllers/podlabels/pod.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright 2020-2023 Project Capsule Authors.
// SPDX-License-Identifier: Apache-2.0

package podlabels

import (
"context"

"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down
8 changes: 4 additions & 4 deletions docs/content/general/crds-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -2967,7 +2967,7 @@ TenantSpec defines the desired state of Tenant.
<td><b><a href="#tenantspecpodoptions">podOptions</a></b></td>
<td>object</td>
<td>
Specifies options for the Pods, such additional metadata to enforce on each pod part of the tenant<br/>
Specifies options for the Pods deployed in the Tenant namespaces, such as additional metadata.<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -4408,7 +4408,7 @@ NetworkPolicyPort describes a port to allow traffic on



Specifies options for the Pods, such additional metadata to enforce on each pod part of the tenant
Specifies options for the Pods deployed in the Tenant namespaces, such as additional metadata.

<table>
<thead>
Expand All @@ -4423,7 +4423,7 @@ Specifies options for the Pods, such additional metadata to enforce on each pod
<td><b><a href="#tenantspecpodoptionsadditionalmetadata">additionalMetadata</a></b></td>
<td>object</td>
<td>
Specifies additional labels and annotations the Capsule operator places on any Service resource in the Tenant. Optional.<br/>
Specifies additional labels and annotations the Capsule operator places on any Pod resource in the Tenant. Optional.<br/>
</td>
<td>false</td>
</tr></tbody>
Expand All @@ -4434,7 +4434,7 @@ Specifies options for the Pods, such additional metadata to enforce on each pod



Specifies additional labels and annotations the Capsule operator places on any Service resource in the Tenant. Optional.
Specifies additional labels and annotations the Capsule operator places on any Pod resource in the Tenant. Optional.

<table>
<thead>
Expand Down

0 comments on commit 76d0a9d

Please sign in to comment.