Skip to content

Commit 47fcf16

Browse files
Merge pull request #773 from gibizer/full-golangci-lint
Ensure golangci-lint runs on all files
2 parents 9da6fd9 + 51325fa commit 47fcf16

17 files changed

Lines changed: 65 additions & 54 deletions

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ repos:
5858
- repo: https://github.com/golangci/golangci-lint
5959
rev: v1.55.2
6060
hooks:
61-
- id: golangci-lint
61+
- id: golangci-lint-full
6262
args: ["-v"]

‎controllers/client/openstackclient_controller.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
314314
op, err := controllerutil.CreateOrPatch(ctx, r.Client, osclient, func() error {
315315
isPodUpdate := !osclient.ObjectMeta.CreationTimestamp.IsZero()
316316
if !isPodUpdate {
317-
osclient.Spec = openstackclient.ClientPodSpec(ctx, instance, helper, clientLabels, configVarsHash)
317+
osclient.Spec = openstackclient.ClientPodSpec(ctx, instance, helper, configVarsHash)
318318
} else {
319319
hashupdate := false
320320

@@ -544,7 +544,7 @@ func (r *OpenStackClientReconciler) findObjectsForSrc(ctx context.Context, src c
544544
FieldSelector: fields.OneTermEqualSelector(field, src.GetName()),
545545
Namespace: src.GetNamespace(),
546546
}
547-
err := r.List(context.TODO(), crList, listOps)
547+
err := r.List(ctx, crList, listOps)
548548
if err != nil {
549549
return []reconcile.Request{}
550550
}

‎controllers/core/openstackcontrolplane_controller.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (r *OpenStackControlPlaneReconciler) Reconcile(ctx context.Context, req ctr
198198
return ctrlResult, nil
199199
}
200200

201-
if instance.Status.DeployedVersion == nil || version.Spec.TargetVersion == *instance.Status.DeployedVersion {
201+
if instance.Status.DeployedVersion == nil || version.Spec.TargetVersion == *instance.Status.DeployedVersion { //revive:disable:indent-error-flow
202202
// green field deployment or no minor update in progress
203203
ctrlResult, err := r.reconcileNormal(ctx, instance, version, helper)
204204
if err != nil {

‎controllers/core/openstackversion_controller.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
191191
Log.Info("Target version not found in defaults", "targetVersion", instance.Spec.TargetVersion)
192192
return ctrl.Result{}, nil
193193
}
194-
instance.Status.ContainerImages = openstack.GetContainerImages(ctx, val, *instance)
194+
instance.Status.ContainerImages = openstack.GetContainerImages(val, *instance)
195195

196196
instance.Status.Conditions.MarkTrue(
197197
corev1beta1.OpenStackVersionInitialized,
@@ -209,9 +209,8 @@ func (r *OpenStackVersionReconciler) Reconcile(ctx context.Context, req ctrl.Req
209209
if k8s_errors.IsNotFound(err) {
210210
Log.Info("No controlplane found.")
211211
return ctrl.Result{}, nil
212-
} else {
213-
return ctrl.Result{}, err
214212
}
213+
return ctrl.Result{}, err
215214
}
216215

217216
// greenfield deployment //FIXME check dataplane here too

‎pkg/openstack/ca.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ func ReconcileCAs(ctx context.Context, instance *corev1.OpenStackControlPlane, h
136136
bundle,
137137
caOnlyBundle,
138138
)
139+
if err != nil {
140+
return ctrl.Result{}, err
141+
} else if (ctrlResult != ctrl.Result{}) {
142+
return ctrlResult, nil
143+
}
139144
}
140145

141146
// create CA for internal podLevel termination
@@ -178,6 +183,12 @@ func ReconcileCAs(ctx context.Context, instance *corev1.OpenStackControlPlane, h
178183
bundle,
179184
caOnlyBundle,
180185
)
186+
if err != nil {
187+
return ctrl.Result{}, err
188+
} else if (ctrlResult != ctrl.Result{}) {
189+
return ctrlResult, nil
190+
}
191+
181192
}
182193

183194
// create CA for ovn
@@ -219,6 +230,12 @@ func ReconcileCAs(ctx context.Context, instance *corev1.OpenStackControlPlane, h
219230
bundle,
220231
caOnlyBundle,
221232
)
233+
if err != nil {
234+
return ctrl.Result{}, err
235+
} else if (ctrlResult != ctrl.Result{}) {
236+
return ctrlResult, nil
237+
}
238+
222239
}
223240

224241
instance.Status.Conditions.MarkTrue(corev1.OpenStackControlPlaneCAReadyCondition, corev1.OpenStackControlPlaneCAReadyMessage)

‎pkg/openstack/galera.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func ReconcileGaleras(
3838
return ctrl.Result{}, nil
3939
}
4040

41-
var failures []string = []string{}
42-
var inprogress []string = []string{}
41+
var failures = []string{}
42+
var inprogress = []string{}
4343

4444
for name, spec := range instance.Spec.Galera.Templates {
4545
hostname := fmt.Sprintf("%s.%s.svc", name, instance.Namespace)

‎pkg/openstack/memcached.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func ReconcileMemcacheds(
3535
version *corev1beta1.OpenStackVersion,
3636
helper *helper.Helper,
3737
) (ctrl.Result, error) {
38-
var failures []string = []string{}
39-
var inprogress []string = []string{}
38+
var failures = []string{}
39+
var inprogress = []string{}
4040

4141
// We first remove memcacheds no longer owned
4242
memcacheds := &memcachedv1.MemcachedList{}

‎pkg/openstack/nova.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ func cellMetadataLabelMap(name string, cell string) map[string]string {
352352
}
353353

354354
func metadataEnabled(metadata novav1.NovaMetadataTemplate) bool {
355-
return metadata.Enabled != nil && *metadata.Enabled == true
355+
return metadata.Enabled != nil && *metadata.Enabled
356356
}
357357

358358
func noVNCProxyEnabled(vncproxy novav1.NovaNoVNCProxyTemplate) bool {
359-
return vncproxy.Enabled != nil && *vncproxy.Enabled == true
359+
return vncproxy.Enabled != nil && *vncproxy.Enabled
360360
}

‎pkg/openstack/ovn.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func ReconcileOVNNorthd(ctx context.Context, instance *corev1beta1.OpenStackCont
270270
Log.Info(fmt.Sprintf("OVNNorthd %s - %s", OVNNorthd.Name, op))
271271
}
272272

273-
if OVNNorthd.Status.ObservedGeneration == OVNNorthd.Generation && OVNNorthd.IsReady() {
273+
if OVNNorthd.Status.ObservedGeneration == OVNNorthd.Generation && OVNNorthd.IsReady() { //revive:disable:indent-error-flow
274274
instance.Status.ContainerImages.OvnNorthdImage = version.Status.ContainerImages.OvnNorthdImage
275275
return true, nil
276276
} else {

‎pkg/openstack/rabbitmq.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ func ReconcileRabbitMQs(
4141
version *corev1beta1.OpenStackVersion,
4242
helper *helper.Helper,
4343
) (ctrl.Result, error) {
44-
var failures []string = []string{}
45-
var inprogress []string = []string{}
44+
var failures = []string{}
45+
var inprogress = []string{}
4646
var ctrlResult ctrl.Result
4747
var err error
4848
var status mqStatus

0 commit comments

Comments
 (0)