Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 64c59c6

Browse files
authored
RLP controller: Fix gateway not found (#195)
* go lint issues * fix rlp finalizer: when gateway not found error
1 parent 1566910 commit 64c59c6

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

apis/apim/v1alpha1/authpolicy_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ type AuthPolicyStatus struct {
4040
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
4141
}
4242

43-
//+kubebuilder:object:root=true
44-
//+kubebuilder:subresource:status
43+
// +kubebuilder:object:root=true
44+
// +kubebuilder:subresource:status
4545
type AuthPolicy struct {
4646
metav1.TypeMeta `json:",inline"`
4747
metav1.ObjectMeta `json:"metadata,omitempty"`

apis/apim/v1alpha1/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
// Interface to be implemented by Policy's status struct
11-
//+kubebuilder:object:generate=false
11+
// +kubebuilder:object:generate=false
1212
type PolicyStatus interface {
1313
GetObservedGeneration() int64
1414
GetConditions() []metav1.Condition

apis/apim/v1alpha1/groupversion_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ limitations under the License.
1515
*/
1616

1717
// Package v1alpha1 contains API Schema definitions for the apim v1alpha1 API group
18-
//+kubebuilder:object:generate=true
19-
//+groupName=apim.kuadrant.io
18+
// +kubebuilder:object:generate=true
19+
// +groupName=apim.kuadrant.io
2020
package v1alpha1
2121

2222
import (

controllers/apim/ratelimitpolicy_finalizers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ func (r *RateLimitPolicyReconciler) computeFinalizeGatewayDiff(ctx context.Conte
7575
err := r.Client().Get(ctx, gwKey, gw)
7676
logger.V(1).Info("finalizeRLP", "fetch gateway", gwKey, "err", err)
7777
if err != nil {
78+
if apierrors.IsNotFound(err) {
79+
continue
80+
}
7881
return nil, err
7982
}
8083
gwDiff.LeftGateways = append(gwDiff.LeftGateways, rlptools.GatewayWrapper{Gateway: gw})

pkg/common/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"sigs.k8s.io/controller-runtime/pkg/client"
2626
)
2727

28-
//TODO: move the const to a proper place, or get it from config
28+
// TODO: move the const to a proper place, or get it from config
2929
const (
3030
KuadrantNamespace = "kuadrant-system"
3131
KuadrantAuthorizationProvider = "kuadrant-authorization"

pkg/reconcilers/base_reconciler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ func (b *BaseReconciler) EventRecorder() record.EventRecorder {
9797
// with the existing state inside the passed in callback MutateFn.
9898
//
9999
// obj: Object of the same type as the 'desired' object.
100-
// Used to read the resource from the kubernetes cluster.
101-
// Could be zero-valued initialized object.
100+
//
101+
// Used to read the resource from the kubernetes cluster.
102+
// Could be zero-valued initialized object.
103+
//
102104
// desired: Object representing the desired state
103105
//
104106
// It returns an error.
@@ -166,7 +168,7 @@ func (b *BaseReconciler) UpdateResourceStatus(ctx context.Context, obj client.Ob
166168
return b.Client().Status().Update(ctx, obj)
167169
}
168170

169-
//SetOwnerReference sets owner as a Controller OwnerReference on owned
171+
// SetOwnerReference sets owner as a Controller OwnerReference on owned
170172
func (b *BaseReconciler) SetOwnerReference(owner, obj client.Object) error {
171173
err := controllerutil.SetControllerReference(owner, obj, b.Scheme())
172174
if err != nil {
@@ -179,7 +181,7 @@ func (b *BaseReconciler) SetOwnerReference(owner, obj client.Object) error {
179181
return err
180182
}
181183

182-
//EnsureOwnerReference sets owner as a Controller OwnerReference on owned
184+
// EnsureOwnerReference sets owner as a Controller OwnerReference on owned
183185
// returns boolean to notify when the object has been updated
184186
func (b *BaseReconciler) EnsureOwnerReference(owner, obj client.Object) (bool, error) {
185187
changed := false

pkg/rlptools/limitador_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"github.com/kuadrant/kuadrant-controller/pkg/common"
55
)
66

7-
//TODO: we might want to have every single ENV in the same file
7+
// TODO: we might want to have every single ENV in the same file
88
var (
99
LimitadorNamespace = common.FetchEnv("LIMITADOR_NAMESPACE", common.KuadrantNamespace)
1010
LimitadorName = common.FetchEnv("LIMITADOR_NAME", "limitador")

0 commit comments

Comments
 (0)