Skip to content

Commit cedcd38

Browse files
committed
fix golangci reported issues
Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent a7ef130 commit cedcd38

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

controllers/placementapi_controller.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package controllers contains the Kubernetes controllers for managing Placement API components
1718
package controllers
1819

1920
import (
@@ -71,6 +72,7 @@ type conditionUpdater interface {
7172
MarkTrue(t condition.Type, messageFormat string, messageArgs ...interface{})
7273
}
7374

75+
// GetSecret interface defines methods for objects that can provide secret names
7476
type GetSecret interface {
7577
GetSecret() string
7678
client.Object
@@ -93,7 +95,7 @@ func ensureSecret(
9395
condition.InputReadyCondition,
9496
condition.RequestedReason,
9597
condition.SeverityInfo,
96-
fmt.Sprintf("Input data resources missing: %s", "secret/"+secretName.Name)))
98+
"%s", fmt.Sprintf("Input data resources missing: %s", "secret/"+secretName.Name)))
9799
return "",
98100
ctrl.Result{},
99101
*secret,
@@ -141,7 +143,7 @@ func ensureSecret(
141143
return hash, ctrl.Result{}, *secret, nil
142144
}
143145

144-
// GetLog returns a logger object with a prefix of "controller.name" and additional controller context fields
146+
// GetLogger returns a logger object with a prefix of "controller.name" and additional controller context fields
145147
func (r *PlacementAPIReconciler) GetLogger(ctx context.Context) logr.Logger {
146148
return log.FromContext(ctx).WithName("Controllers").WithName("PlacementAPI")
147149
}
@@ -186,7 +188,7 @@ func (r *PlacementAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request
186188

187189
// Fetch the PlacementAPI instance
188190
instance := &placementv1.PlacementAPI{}
189-
err := r.Client.Get(ctx, req.NamespacedName, instance)
191+
err := r.Get(ctx, req.NamespacedName, instance)
190192
if err != nil {
191193
if k8s_errors.IsNotFound(err) {
192194
// Request object not found, could have been deleted after reconcile request.
@@ -386,7 +388,7 @@ func (r *PlacementAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request
386388
condition.TLSInputReadyCondition,
387389
condition.RequestedReason,
388390
condition.SeverityInfo,
389-
fmt.Sprintf(condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName)))
391+
condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))
390392
return ctrl.Result{}, nil
391393
}
392394
instance.Status.Conditions.Set(condition.FalseCondition(
@@ -411,7 +413,7 @@ func (r *PlacementAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request
411413
condition.TLSInputReadyCondition,
412414
condition.RequestedReason,
413415
condition.SeverityInfo,
414-
fmt.Sprintf(condition.TLSInputReadyWaitingMessage, err.Error())))
416+
condition.TLSInputReadyWaitingMessage, err.Error()))
415417
return ctrl.Result{}, nil
416418
}
417419
instance.Status.Conditions.Set(condition.FalseCondition(
@@ -980,7 +982,7 @@ func (r *PlacementAPIReconciler) findObjectForSrc(ctx context.Context, src clien
980982
listOps := &client.ListOptions{
981983
Namespace: src.GetNamespace(),
982984
}
983-
err := r.Client.List(ctx, crList, listOps)
985+
err := r.List(ctx, crList, listOps)
984986
if err != nil {
985987
Log.Error(err, fmt.Sprintf("listing %s for namespace: %s", crList.GroupVersionKind().Kind, src.GetNamespace()))
986988
return requests
@@ -1322,7 +1324,7 @@ func (r *PlacementAPIReconciler) generateServiceConfigMaps(
13221324
cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(placement.ServiceName), map[string]string{})
13231325

13241326
var tlsCfg *tls.Service
1325-
if instance.Spec.TLS.Ca.CaBundleSecretName != "" {
1327+
if instance.Spec.TLS.CaBundleSecretName != "" {
13261328
tlsCfg = &tls.Service{}
13271329
}
13281330

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
// Package main is the entry point for the Placement operator
1718
package main
1819

1920
import (

pkg/placement/const.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
*/
1515

16+
// Package placement provides constants and utilities for managing OpenStack Placement service
1617
package placement
1718

1819
const (
@@ -21,14 +22,15 @@ const (
2122
// DatabaseName -
2223
DatabaseName = "placement"
2324

24-
//config secret name
25+
// ConfigSecretName is the name of the secret containing placement configuration
2526
ConfigSecretName = "placement-config-data"
2627

2728
// PlacementPublicPort -
2829
PlacementPublicPort int32 = 8778
2930
// PlacementInternalPort -
3031
PlacementInternalPort int32 = 8778
3132

33+
// KollaServiceCommand is the command used to start the placement service in Kolla containers
3234
KollaServiceCommand = "/usr/local/bin/kolla_start"
3335

3436
// PlacementUserID is the linux user ID used by Kolla for the placement

tests/functional/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ var _ = BeforeSuite(func() {
209209
if err != nil {
210210
return err
211211
}
212-
conn.Close()
212+
_ = conn.Close() // Ignore close error in tests
213213
return nil
214214
}).Should(Succeed())
215215
})

0 commit comments

Comments
 (0)