Skip to content

Commit

Permalink
Revert "fix: misc bug fixes for EnvoyPatchPolicy"
Browse files Browse the repository at this point in the history
This reverts commit 315c19f.

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Aug 1, 2023
1 parent 8dcf425 commit 5f32074
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/envoypatchpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type EnvoyPatchPolicySpec struct {
// the priority i.e. int32.min has the highest priority and
// int32.max has the lowest priority.
// Defaults to 0.
Priority int32 `json:"priority,omitempty"`
Priority int32 `json:"priority"`
}

// EnvoyPatchType specifies the types of Envoy patching mechanisms.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ spec:
- JSONPatch
type: string
required:
- priority
- targetRef
- type
type: object
Expand Down
23 changes: 10 additions & 13 deletions internal/provider/kubernetes/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,16 @@ func (r *gatewayAPIReconciler) Reconcile(ctx context.Context, request reconcile.
}

// Add all EnvoyPatchPolicies
if r.envoyGateway.ExtensionAPIs != nil && r.envoyGateway.ExtensionAPIs.EnableEnvoyPatchPolicy {
envoyPatchPolicies := egv1a1.EnvoyPatchPolicyList{}
if err := r.client.List(ctx, &envoyPatchPolicies); err != nil {
return reconcile.Result{}, fmt.Errorf("error listing envoypatchpolicies: %v", err)
}

for _, policy := range envoyPatchPolicies.Items {
policy := policy
// Discard Status to reduce memory consumption in watchable
// It will be recomputed by the gateway-api layer
policy.Status = egv1a1.EnvoyPatchPolicyStatus{}
resourceTree.EnvoyPatchPolicies = append(resourceTree.EnvoyPatchPolicies, &policy)
}
envoyPatchPolicies := egv1a1.EnvoyPatchPolicyList{}
if err := r.client.List(ctx, &envoyPatchPolicies); err != nil {
return reconcile.Result{}, fmt.Errorf("error listing envoypatchpolicies: %v", err)
}
for _, policy := range envoyPatchPolicies.Items {
policy := policy
// Discard Status to reduce memory consumption in watchable
// It will be recomputed by the gateway-api layer
policy.Status = egv1a1.EnvoyPatchPolicyStatus{}
resourceTree.EnvoyPatchPolicies = append(resourceTree.EnvoyPatchPolicies, &policy)
}

// For this particular Gateway, and all associated objects, check whether the
Expand Down

0 comments on commit 5f32074

Please sign in to comment.